got error while converting HSV2BGR
Below is the code i wrote.
> import cv2
> import numpy as np
> image = cv2.imread('67.png')
> cv2.imshow('original', image) hsv =
> cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
> hsv= hsv[:, :, 1] n1=
> np.where(np.logical_and(80<=hsv,
> hsv<=180), 255, hsv) res =
> cv2.cvtColor(n1, cv2.COLOR_HSV2BGR)
> cv2.imshow('result', res)
> cv2.waitKey(0)
Got following error
cv2.error: OpenCV(4.1.0) c:\projects\opencv-python\opencv\modules\imgproc\src\color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function '__cdecl cv::impl::anonymous-namespace'::CvtHelper<struct cv::impl::
anonymous namespace'::Set<3,-1,-1>,struct cv::impl::A0x3b52564f::Set<3,4,-1>,struct cv::impl::A0x3b52564f::Set<0,5,-1>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'
Invalid number of channels in input image: 'VScn::contains(scn)' where 'scn' is 1
I have found the issue can be solve by using img = np.array(img, dtype=np.uint8) . But its not working. Any help will be appreciated