Gaussian blur
Second filter is Gaussian blur. It works kinda strange. It only changes brightness of an image, but do not blur image. Here is my code:
I can't see where I'm making a mistake. Little help needed, please. Thank in advance.
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.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Gaussian blur, software fallback on GMA950 | Fenris | 11 | 6,369 |
Jul 28, 2007 05:00 PM Last Post: OneSadCookie |
|
| Tell me about separable gaussian convolutions... | TomorrowPlusX | 11 | 5,284 |
Jul 17, 2006 03:48 PM Last Post: Jones |
|
| openGL blur | kelvin | 7 | 6,338 |
Mar 10, 2003 06:34 PM Last Post: Tycho |
|

