Reputation: 2045
I have installed opencv by windows DOS, and it can be sucessfully imported in vscode, but when I use this method: cvtColor it shows Module 'cv2' has no 'cvtColor' memberpylint(no-member)
and when I run this code:
cv2_rgb = cv2.cvtColor(val_xyz, cv2.COLOR_XYZ2RGB)
val_xyz = [ 15.4999257 20.91432805 8.15938343]
it shows:
Exception has occurred: error
OpenCV(4.2.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::A0x2c98332e::Set<3,4,-1>,struct cv::impl::A0x2c98332e::Set<0,2,5>,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
File "C:\dataset\opencv_hello.py", line 33, in <module>
cv2_lab = cv2.cvtColor(val_xyz, cv2.COLOR_XYZ2RGB)
Upvotes: 0
Views: 3216
Reputation: 16010
It's a shortcoming of Pylint. You can either:
# pylint: disable=no-member
).pylintrc
file: [TYPECHECK]
ignored-modules=cv2
.pylintrc
file: [MESSAGES CONTROL]
disable=no-member
Upvotes: 7