我已经通过windows DOS安装了opencv,并且可以成功地在vscode中导入,但是当我使用此方法时:cvtColor显示Module 'cv2' has no 'cvtColor' memberpylint(no-member)
当我运行这段代码时:
cv2_rgb = cv2.cvtColor(val_xyz, cv2.COLOR_XYZ2RGB)
瓦尔_xyz = [ 15.4999257 20.91432805 8.15938343]
它显示:
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)
1条答案
按热度按时间icomxhvb1#
这是Pylint的一个缺点。你可以:
# pylint: disable=no-member
)上的警告.pylintrc
文件禁用cv2的此警告:.pylintrc
文件全局禁用警告: