最新发表
友情链接
  • 图像运算(二)——减法(Subtraction)
  • 2026-01-04 00:41:08
  • 描述:图像的减法即两幅输入图像同意位置像素相减,得到一个输出图像的过程。

    公式描述:

    O(i,j) = I1(i,j) - I2(i,j) OR O(i,j) = |I1(i,j) - I2(i,j)|

    注意1:常值问题,输入图像也可以有一个是常量,即 O(i,j) = I(i,j) - C OR O(i,j) =| I(i,,j) - C|

    注意2:下限问题,如果两幅图像相减得出的像素低于0,则一律统统归为0.

    注意3:循环问题,如果图像格式支持循环问题,则不存在下限问题,即如果输出的像素为-20,则,系统自动把它变成236.

    Code:

    Similarity, displayed to the kernel function:

    /**

    *Applies the image difference operator on the specified image arrays, with the specified offset and scale value

    *@param src1_1d The first source image as a pixel array

    *@param src2_1d The second source image as a pixel array

    *@param width width of the destination image in pixels

    *@param height height of the destination image in pixels

    *@param oset The offset value

    *@param scale The scale value

    *@param reverse false if image2 - image 1

    *@return A pixel array containing the difference of the two inpu