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

**URL:** <https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101>\
**Category:** Uncategorized\
**Tags:** imgcodecs\
**Created:** [March 24, 2022, 7:30pm UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101 "2022-03-24T19:30:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike123](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mike123](https://forum.opencv.org/u/mike123)\
**Post date:** [March 24, 2022, 7:30pm UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101/1 "2022-03-24T19:30:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [March 25, 2022, 8:50am UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101/2 "2022-03-25T08:50:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mike123](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mike123](https://forum.opencv.org/u/mike123)\
**Post date:** [March 25, 2022, 10:30am UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101/3 "2022-03-25T10:30:06Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![mike123](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mike123](https://forum.opencv.org/u/mike123)\
**Post date:** [March 30, 2022, 12:36pm UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101/4 "2022-03-30T12:36:07Z")

</div>

I get this:

```auto
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?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [March 30, 2022, 9:03pm UTC](https://forum.opencv.org/t/how-can-i-open-uav-image-files-as-a-result-of-vegetation-indices-as-occurs-with-qgis/8101/5 "2022-03-30T21:03:48Z")

</div>

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