Reputation: 13
I am working with OpenCV in Python. I found that working with uint8 and float32 works in OpenCV 4. This question OpenCV Mat element types and their sizes shows some more data types but I got an error when choosing e.g. 64bit float.
If I simply create a array of integers e.g.:
img1 = np.array([[[5, 255, 20], [4, 9, 85]],
[[6, 12, 150], [14, 8, 0]]
])
and try to convert BGR to RGB with img2 = cv2.cvtColor(img1, cv2.COLOR_BGR2RGB)
, I get an error:
OpenCV(4.6.0) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.simd_helpers.hpp:94: error: (-2:Unspecified error) in function '__cdecl cv::impl::`anonymous-namespace'::CvtHelper<struct cv::impl::`anonymous namespace'::Set<3,4,-1>,struct cv::impl::A0xf2302844::Set<3,4,-1>,struct cv::impl::A0xf2302844::Set<0,2,5>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'
> Unsupported depth of input image:
> 'VDepth::contains(depth)'
> where
> 'depth' is 4 (CV_32S)
If I read a PNG image and e.g. divide it by 2 and get decimal numbers, the error I get when trying to apply the same function is:
OpenCV(4.6.0) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.simd_helpers.hpp:94: error: (-2:Unspecified error) in function '__cdecl cv::impl::`anonymous-namespace'::CvtHelper<struct cv::impl::`anonymous namespace'::Set<3,4,-1>,struct cv::impl::A0xf2302844::Set<3,4,-1>,struct cv::impl::A0xf2302844::Set<0,2,5>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'
> Unsupported depth of input image:
> 'VDepth::contains(depth)'
> where
> 'depth' is 6 (CV_64F)
My questions are:
Upvotes: 0
Views: 865