I am doing image processing in android such as blur effect and circle over image.
I aim to blur image at specific point and around that. I can do blur effect to whole image by using Gaussian Blur and ConvolutionMatrix.
public static Bitmap applyGaussianBlur(Bitmap src) {
double[][] GaussianBlurConfig = new double[][] { { 1, 2, 1 }, { 2, 4, 2 }, { 1, 2, 1 } };
ConvolutionMatrix convMatrix = new ConvolutionMatrix(3);
convMatrix.applyConfig(GaussianBlurConfig);
convMatrix.Factor = 16;
convMatrix.Offset = 0;
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
}
Can anyone give me a idea to do a blur effect at a specific point in image?
I actually just answered something similar to this.
Try doing the inverse of this.
I think what you want to do is to create two copies of the original image. One that is clear, and one that is blurred (using whatever filter you want). Then, for all pixels in the region you want blurred, copy their value from the blurred image to the clear image.
Doing a blur fitler seperately on all the pixels will likely be a waste of your time. Unless you are trying to do something fancy (like in the link), do it once and use it as a sort of lookup table.
However, since you are doing this on mobile, you may need to do some special memory management. In that case, get a cropped version of the original image (of size slightly larger than the blurred region) and blur only that sub image. Then keep track of which pixels in the sub image correspond to which pixels in the original, and copy those values over, or whatever works for your project.