Image Subtract

Obtain a image of the pixelwise input values within two image files. This is a wrapper for the OpenCV function subtract.

image_subtract(img, img2, device, debug=None)

returns device, subtracted image

  • Parameters:
    • img - image to be analyzed
    • img2 - image to subtract
    • device - Counter for image processing steps
    • debug - None, "print", or "plot". Print = save to file, Plot = print to screen. Default = None
  • Context:
    • Get features that are different between images
  • Example use:

Original grayscale image (image 1)


Image to be subtracted (image 2)


import plantcv as pcv

# Subtract image from another image. 
device, subtracted_img = pcv.image_subtract(img, img2,  device, debug="print")

Subtraction of image 2 from image 1