Java blur Image

后端 未结 7 1806
臣服心动
臣服心动 2021-01-11 17:48

I am trying to blur the image

   int radius = 11;
    int size = radius * 2 + 1;
    float weight = 1.0f / (size * size);
    float[] data = new float[size *         


        
7条回答
  •  独厮守ぢ
    2021-01-11 18:31

    You can't blur one pixel. This sounds obvious, but when you think about it, what is the minimum? To blur a pixel, you need neighboring pixels.

    The problem here is that at the edges and corners, the pixels have too few neighbours – the blur algorith has too few pixels to use. It has no pixels "outside" the image with which to blur, so it will just leave those as-is.

    The solution is either to extend the picture somehow (do you have a larger source image available?), or to cut off the non-blurred bits when you are done. Both are essentially the same.

提交回复
热议问题