在Android的图像处理(模糊效果)图像处理、模糊、效果、Android

2023-09-06 01:06:45 作者:给朕跪下唱征服

我在做图像处理机器人,如模糊效果,并圈上的形象。

I am doing image processing in android such as blur effect and circle over image.

我的目标是模糊的图像在特定的点,并解决这一问题。我可以通过使用高斯模糊,ConvolutionMatrix做模糊效果,以整体形象。

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做这个的倒数。

我想你想要做的是创建原始图像的两个副本。一说是清楚的,一个是模糊(使用任何过滤器,你想要的)。然后,在你想模糊的区域中的所有像素,从模糊图像复制其价值到清晰的图像。

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.

上的所有像素做模糊fitler单独将可能是在浪费你的时间。除非你试图做一些花哨的(如在的链接),做一次,并用它作为一种查找表的。

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.