Inverting an image or Negative transformation of an image is a very basic method of image processing
in which the brightest areas are transformed into the darkest and the darkest areas are transformed into the brightest.
This conversion or transformation is used widly in the field of image processing.
Use the package manager pip to install cv2 and numpy.
pip install cv2
pip install numpyUse import keyword to import modules.
import cv2
import numpy as npimg = cv2.imread("cat.png")Image negative is produced by subtracting each pixel from the maximum intensity value.
This is a very easy method rather than manipulating individual color channels.
inv = 255-imgprint('Negative Image created.')cv2.imshow('ORIGINAL',img)
cv2.imshow('INVERSE',inv)
cv2.waitKey(0)
cv2.destroyAllWindows()



