RGB是三通道彩色图,在矩阵(图像)中的顺序是B,G,R;GRAY是单通道灰度图
COLOR_BGR2GRAY的原理:

GRAY = B * 0.114 + G * 0.587 + R * 0.299

在这里插入图片描述
COLOR_GRAY2BGR的原理:
R = G = B = GRAY; A = 0;
而R,G,B相等时,图像会显示为灰值,不相等时颜色会偏向于较大的基色; 在这里插入图片描述
在这里插入图片描述

GitHub 加速计划 / opencv31 / opencv
154
15
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
4d26e16a Speed up and reduce memory consumption for findContours 2 天前
1db98278 Add jxl (JPEG XL) codec support #26379 ### Pull Request Readiness Checklist Related CI and Docker changes: - https://github.com/opencv/ci-gha-workflow/pull/190 - https://github.com/opencv-infrastructure/opencv-gha-dockerfile/pull/44 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work https://github.com/opencv/opencv/issues/20178 - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake 2 天前
Logo

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

更多推荐