在图形处理过程中出现上面的错误,如果你也有相同问题那么可以用以下方法来解决。

报错原因:cv2只能处理BGR格式图片,而image.open()读取的图片是RBG格式。

解决方式:把RBG图片转化成BGR格式,转化代码如下所示:

opencv
OpenCV: 开源计算机视觉库
#将RGB转换成BGR方法
r,g,b = cv2.split(median)
out = cv2.merge([b,g,r])

把上述代码插入到你的图片处理完毕的后面对准备输出图片进行转换就可以了。

推荐内容
GitHub 加速计划 / opencv31 / opencv
198
14
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:7 个月前 )
19c4d976 Extract all HALs from 3rdparty to dedicated folder. #27252 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake 18 小时前
9533c563 Update houghcircles.py 21 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐