Invert a binary image. This is a wrapper for the OpenCV function bitwise_not

invert(img, device, debug=None)

returns device, inverted image

  • Parameters:
    • img = image to be inverted (works best with binary image)
    • device- Counter for image processing steps
    • debug - None, "print", or "plot". Print = save to file, Plot = print to screen. Default = None
  • Context:
    • Invert image values. Useful for inverting an image mask.
  • Example use:

Input binary image


from plantcv import plantcv as pcv

# Invert a binary mask.
device, inverted_img = pcv.invert(img, device, debug="print")

Inverted image