Different Pixel Information In Pil And Cv2
I have load the same image using both PIL and cv2, but the pixel information is different for the same index. Here is my code: import cv2 from PIL import Image img = cv2.imread('F
Solution 1:
OpenCV returns a numpy array. Your indexing thus is [row_idx, col_idx], or [y, x] whereas PIL pixel access is the exact opposite, using [x, y] coordinates.
Flip the PIL access to [200, 100] to see the same pixel.
Careful, there will be another confusion: PIL reads the channels in RGB order, but OpenCV reads them in BGR!
Post a Comment for "Different Pixel Information In Pil And Cv2"