I want to load and display a .tif image in OpenCV Python. I load the image using cv2.imread('1_00001.tif') and then I display it using plt.imshow(img), but the image displayed is all black instead of what it was originally.
I can load and display the image correctly using PIL's Image.open() and matplotlib's mpimg.imread() so I think it is a cv2 specific problem. However, I have also successfully displayed .jpg and .tiff images using the same cv2.imread() function so it may also be a problem with specifically that .tif image.
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('1_00001.tif')
plt.imshow(img)
I expect an image of a circle with a few blurry lines inside, but the actual output is just a black image.
img.shape
andimg.dtype
andimg.max()
. – Mark Setchell.tif
images, its most likely a problem with that specific.tif
image – nathancy