微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何修复 cv2.error: OpenCV(4.2.0) Invalid number of channels in input image:, 这个错误

如何解决如何修复 cv2.error: OpenCV(4.2.0) Invalid number of channels in input image:, 这个错误

我收到此错误

<ul id="list"></ul>

在这行出错

  File "E:\demo3\modules\modelTrain.py",line 179,in grayscaleImage
    gry = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
cv2.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,4,-1>,struct cv::impl::A0xe227985e::Set<1,-1,struct cv::impl::A0xe227985e::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

我的完整代码

gry = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。