Subtract images

Subtracts a reference image from another image and outputs the difference.

Inputs

image
Input image
reference
Reference image that will be subtracted from input images. A run-time error will occur if the type or size of the reference is not the same as that of the input.
allowNegativeGray
If this flag is true and the input images are both gray-level images, the output image will be signed 32-bit ints. Otherwise, the type of the output will be the same as that of the input.

Outputs

image
Either abs(image - reference) (when allowNegativeGray is false) or image - reference (when allowNegativeGray is true).