彩色图像RGB通道的分离、合并
程序员文章站
2022-04-01 09:29:09
...
#include <iostream>
#include "cv.h"
#include "highgui.h"
using namespace std;
using namespace cv;
int main(int argc,char* argv[])
{
Mat img = imread("lena.jpg"/*,CV_LOAD_IMAGE_COLOR*/);
Mat channel[3];
split(img,channel);
imshow("original",img);
imshow("B",channel[0]);
imshow("G",channel[1]);
imshow("R",channel[2]);
//set blue channel to 0
channel[0] = Mat::zeros(img.rows,img.cols,CV_8UC1);
//merge red and green channels
merge(channel,3,img);
imshow("R_G_merge",img);
waitKey(0);
return 1;
}
对摄像头摄入视频帧的RGB彩色通道分离
Mat frame; vector<Mat> rgb; cap >> frame; imshow("original", frame); split(frame, rgb); imshow("red", rgb.at(2)); imshow("green", rgb.at(1)); imshow("blue", rgb.at(0));
From: http://lib.csdn.net/article/opencv/25901
推荐阅读
-
python图像处理之通道分离与合并
-
python中图像通道分离与合并实例
-
荐 opencv进阶学习笔记2:numpy操作图像,色彩空间,查找指定颜色范围,通道分离与合并
-
python图像处理之通道分离与合并
-
openCV-色彩通道的分离与合并
-
【OpenCV3.3+Python3.6】图片的BGR通道的分离、修改以及合并
-
Pytorh 三通道的彩色图像转单通道的灰度图像
-
python-修改图像的尺寸和RGB三个通道的像素值(opencv)
-
荐 opencv进阶学习笔记2:numpy操作图像,色彩空间,查找指定颜色范围,通道分离与合并
-
【学习OpenCV4】图像通道的分离、合并与混合方法(C++)