cvtColor throws unsupported depth [closed]

asked 2020-05-03 21:05:01 -0500

kunaltyagi gravatar image

updated 2020-05-03 21:08:46 -0500

The following snippet:

>>> cv2.cvtColor(np.zeros((480, 620, 3), dtype='int8'), cv2.COLOR_HSV2BGR)

Gives the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.simd_helpers.hpp:94: error: (-2:Unspecified error) in function 'cv::impl::(anonymous namespace)::CvtHelper<cv::impl::(anonymous namespace)::Set<3, -1, -1>, cv::impl::(anonymous namespace)::Set<3, 4, -1>, cv::impl::(anonymous namespace)::Set<0, 5, -1>, cv::impl::(anonymous namespace)::SizePolicy::NONE>::CvtHelper(cv::InputArray, cv::OutputArray, int) [VScn = cv::impl::(anonymous namespace)::Set<3, -1, -1>, VDcn = cv::impl::(anonymous namespace)::Set<3, 4, -1>, VDepth = cv::impl::(anonymous namespace)::Set<0, 5, -1>, sizePolicy = cv::impl::(anonymous namespace)::SizePolicy::NONE]'
> Unsupported depth of input image:
>     'VDepth::contains(depth)'
> where
>     'depth' is 1 (CV_8S)

What silly error am I making?

I used int8 as dtype instead of uint8

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kunaltyagi
close date 2020-05-03 21:08:59.085480