当前位置:网站首页>An error CV2 is reported when the picture is converted to grayscale cvtColor(img, cv2.COLOR_BGR2GRAY)
An error CV2 is reported when the picture is converted to grayscale cvtColor(img, cv2.COLOR_BGR2GRAY)
2022-06-13 08:51:00 【Human high quality Algorithm Engineer】
Turn the picture to grayscale cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) An error is as follows :
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.5.4) d:\a\opencv-python\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::A0x5252fd2b::Set<1,-1,-1>,struct cv::impl::A0x5252fd2b::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
The image should be three channels when positioning to gray conversion , Otherwise, the report will be wrong , Before converting to grayscale , Add the following code to convert the diagram into three channels
img = cv2.merge([img,img,img])
reason :
use CV_BGR2GRAY,
Conversion formula Gray = 0.1140B + 0.5870G + 0.2989*R
Therefore, a single channel will definitely report an error
边栏推荐
- 12. constructor explanation, explicit, initialization list
- Uni app essay
- Implement authentication code login and remember password (cookie)
- 1. Learning sequence of SolidWorks modules
- Knowledge points related to system architecture 1
- JS - set countdown for Date object case
- Object in ES6 Use of entries()
- 银行理财产品有哪些?清算期是多长?
- Paging query template of Oracle
- Three methods to make the scroll bar of div automatically scroll to the bottom
猜你喜欢

Knowledge points related to system architecture 1
![[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)](/img/95/2109ddf1a0ff0223109eb9b5a02f00.jpg)
[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)
![[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory](/img/71/92c06496a9d982294cac61595e0392.png)
[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory

redis.exceptions.ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.

useRoutes() may be used only in the context of a <Router> component.

关于RSA加密解密原理

顺时针打印个数组

關於RSA加密解密原理

VS安装VAssistX插件导致WPF-XAML文件输入中文出现乱码问题解决方案

ADT Google browser plug-in ad Terminator
随机推荐
顺时针打印个数组
JS array using the reduce() method
useRoutes() may be used only in the context of a <Router> component.
VI editor
A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
4. Relationship selector (parent-child relationship, ancestor offspring relationship, brother relationship)
Differences and uses among cookies, localstorage, sessionstorage, and application caching
5、 Constant, variable
Redis distributed cluster setup
Installing pytorch under Anaconda
What is the difference between getfullyear() and getyear()
JS array method
天猫商品详情接口,天猫商品优惠券接口,天猫api接口,天猫价格监控接口,天猫比价接口,品牌维权接口,天猫销量api接口,接口代码可对接数据分析业务,品牌维权,比价业务,行业分析业务接口代码分享
JS obtain geographic location information according to longitude and latitude and mark it on the map
Use of addeventlistener in JS
ES6 use of dynamic attributes
\Difference between N and \r
On the use of visual studio
Vscode define code block -- define cursor position
Browser render passes