that would mean the image is single-channel, i.e. grayscale, and you can’t apply channel reordering (COLOR_BGR2RGB) on something that has a single channel.
what kind of TIFF is this? something weird, a stack of images? if you probe it with imagemagick’s magick identify ..., what does it say?
With QGIS I have read it! But I need to read it with opencv to do some calculations with its pixels. It is 32-bit float grayscale, 1 channel geotif. Any idea what to change to the above mentioned lines of code? Just to read the file, nothing to convert to 3-channels and things like this…
This is code found by google searching… I don’t know if I need cvtColor. I need to read that 1-channel grayscale 32-bit float image… Can I load it as 1-channel and not converting it to RGB?
import numpy as np
from PIL import Image
reloaded = np.array(Image.open('uav_image.tif'))
But I got this error:
File "/home/test/.local/lib/python3.9/site-packages/PIL/Image.py", line 3008, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file 'uav_image.tif'
Is this problem of my image? Because other uav images i tested (but RGB, not grayscale) are ok with the above code…
How can I transform the 32 bit float image to 8bit int with normalized negative pixel values? I don’t see something else to do… I have spent all day trying to do something…