Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-04-2011, 03:14 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 3
g00se is on a distinguished road
Default Gaussian filter

I'm writing a code for Gaussian filter. It works kinda strange. It only changes brightness of an image, but do not blur image. Here is my code:

Code:
     // Count mask 3x3
     if (size == 1) {
         for (row=-1; row<=1; row++) {
             for (col=-1; col<=1; col++) {
                 midCalkulation = -((pow(col, 2) + pow(row, 2))/(2*pow(sigma, 2)));
                 kernel3x3[row+1][col+1] = (1/(2*M_PI*pow(sigma, 2)))*exp(midCalkulation);
                 
             }
         }
     }

     // Image convolution with filter mask
     if (size == 1) {
         for(row=1; row<height-1; row++) {
             for(col=1; col<width-1; col++) {
                 midSum=0;
                 for(int i=-1; i<=1; i++) {
                     for(int j=-1; j<=1; j++) {
                         midSum += pixels[(row+i)*width + (col+j)]*kernel3x3[i+1][j+1];
                     }
                 }
                 filteredPixels[row*width + col] = midSum;
             }
         }
     }
I can't see where I'm making a mistake. Little help needed, please. Thank in advance.
g00se is offline   Reply With Quote
Reply

Bookmarks

Tags
blur, convolution, filter, gaussian

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
17 members and 374 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, iOS.Lover, jarv, LunarMoon, n00b, pbart, Pudding, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:20 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0