I am trying to convert the image that I read using cv2.imread which is store in numpy array to PIL Image object , the color of Image will be changed Here is the code
I=cv2.imread("Image.jpg")
PILImage=Image.fromarray(I,mode='RGB')
How can get back my original Image?
OpenCV likes to treat images as having BGR layers instead of RGB layers. Adding
I = cv2.cvtColor(I, cv2.COLOR_BGR2RGB)
will swap layers to what you expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With