Blurring An Image
Blurring An Image
ORIGINAL IMAGE
BLURRED IMAGE
Definition:-In image terms blurring means that each pixel in the source image gets spread over and mixed into surrounding pixels. Another way to look at this is that each pixel in the destination image is made up out of a mixture of surrounding pixels from the source image.
sum += (r+g+b)/3; //We are calculating the Average of RGB using grayscale formula.
} } // average of 8 surrounding pixels and center r = g = b = sum / 9; outPixels[y][x] = (b | (g<<8) | (r<<16)); // Storing the calculated values to the output array } }
sumR += r; // We are calculating sum of R Separately. sumG += g; // We are calculating sum of G Separately. sumB += b; // We are calculating sum of B Separately.
} } // average of 8 surrounding pixels and center r = sumR / 9; g = sumG / 9; b = sumB / 9; outPixels[y][x] = (b | (g<<8) | (r<<16)); // Storing the calculated values to the output array } }
In the above example we are doing blur by calculating the average of surrounding 8 pixel that is 3*3 window. To increase the blur effect we can scan surrounding 5 pixel that is 5*5 window.
ORIGINAL IMAGE.