Java blur Image

后端 未结 7 1713
臣服心动
臣服心动 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:28

    That is because you are using ConvolveOp.EDGE_NO_OP in this line:

    ConvolveOp op = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null);
    

    The API documentation says:

    Pixels at the edge of the source image are copied to the corresponding pixels in the destination without modification.

    Try EDGE_ZERO_FILL - that will give you black borders.

    You can also try to cut off the edges after blurring.

    The reason for why it can't do the edges has to do with how the algorithm works.

提交回复
热议问题