I have a 32-bit 3-band TIF image that I am trying to load using OpenCV with Python. I'm specifically avoiding GDAL as it is not user-friendly to install on Windows, and this script is targeted at Windows machines.
When I try to load the image with imread (
img = cv2.imread(file, flags=(cv2.IMREAD_UNCHANGED | cv2.IMREAD_ANYDEPTH))
), and either write it out or imshow it, the 3 bands appear to be tiled, like so:
For comparison, rendering in Windows looks like this: So there should be no issue from an OS support perspective.
Is there a way to override this behaviour? Is there a known cause to this?
CodePudding user response:
I found a solution. Using the tifffile library in conjunction with scikit-image, I was able to load my TIFFs in a format understandable by OpenCV.
Thus, my load statement became:
img = skimage.io.imread(file,plugin='tifffile')
And the image: