I want to read pgm image in python. I use cv2.imread('a.pgm') but it returns wrong results. In Matlab, I use imread and get the right result which is a single channel 16-bit image. But cv2.imread in python returns a 3-channel image and the pixel values are also wrong. Why it happens? How should I read the 16-bit pgm images in python? And what libraries?
Thanks in advance.
I got it.
cv2.imread('a.pgm',-1)
works.