当前位置:网站首页>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
边栏推荐
- Vs installation of vassistx plug-in causes Chinese input of wpf-xaml file to be garbled. Solution
- WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]
- GBase 8a磁盘问题及处理
- 浅析Visual Studio 使用
- Cesium displays a pop-up box at the specified position and moves with the map
- 1. preliminary understanding of Express
- 抖音关键词搜索列表接口,超详细的接口对接步骤
- JS string method
- Taobao commodity sales interface / Taobao commodity sales monitoring interface / cumulative commodity sales interface
- I set up a blog
猜你喜欢

Diversified tables through TL table row consolidation

JS - simple ATM of the for cycle case

Vscode define code block -- define cursor position

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

0.一些自己初学Solidworks的疑惑

Uni app subcontracting loading and optimization

Sky background map, navigation page lovefanfan top

Differences and uses among cookies, localstorage, sessionstorage, and application caching

redis

Animation through svg
随机推荐
JS wrapper object
centos 安装mysql及设置远程访问
Vscode define code block -- define cursor position
Uni app essay
JS array method
JS - for cycle case: Horse grain
Differences among let, VaR and const when JS declares variables
Object in ES6 Use of entries()
VS安装VAssistX插件导致WPF-XAML文件输入中文出现乱码问题解决方案
京东商品详情接口,京东详情页接口,宝贝详情页接口,商品属性接口,商品信息查询,商品详细信息接口,h5详情,京东APP详情,京东api接口,京东历史价格数据接口代码对接分享
3、 JS notes
JS - print 99 multiplication table of the for cycle case
Vscode plug in
Container concept and cloud native
[leetcode weekly race record] record of the 80th biweekly race
VBA format word (page, paragraph, table, picture)
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory
WARNING:tornado. access:404 GET /favicon. ICO (172.16.8.1) 1.84ms [with static file settings]
In order to resist the flood, the soldiers have been fighting for 89 hours. How many days and hours are there in total?
0. some doubts about learning SolidWorks for the first time