How can I open UAV image files (as a result of Vegetation Indices) as occurs with QGIS?

I did some calculations with UAV image tif files, I extracted bands, and I jave calculated Vegetation Indices. I display them just fine in QGIS. But when I try to open float 32bit images with openCV it fails. How can QGIS open any .tif file but OpenCV can’t? How can I open any .tif image file with openCV and up to 4 channel bands?

OpenCV uses libtiff. what does QGIS use?

can you provide for investigation such a TIFF file that can’t be read by OpenCV?

your “UAV” images sound familiar. haven’t you had this issue before?

1 Like

Yes! I haven’t found a solution and I say that QGIS has solved it, how can I do the same thing with opencv? I don’t know…

I get this:

cv2.error: OpenCV(3.4.14) /tmp/pip-req-build-m7h7rfem/opencv/modules/imgproc/src/color.simd_helpers.hpp:88: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<3, 4>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::<unnamed>::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 1

What should I do?

you gave a single-channel input to cvtColor but you called it with a COLOR_* code that requires multi-channel input.

1 Like