我是靠谱客的博主 俊逸发卡,这篇文章主要介绍opencv GRB三通道颜色分离,现在分享给大家,希望可以做个参考。

#include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/core.hpp>

using namespace std;
using namespace cv;

int showPicture()
{
	Mat img = imread("pic.jpg");
	if (img.empty())
	{
		cout << "opencv image failed!" << endl;
		return -1;
	}

	cout << "rows:" << img.rows << ", cols:" << img.cols << endl;

	cv::imshow("Picture", img);

	waitKey(10000);

	Mat channels[3];
	split(img, channels);

	imshow("B", channels[0]);
	imshow("G", channels[1]);
	imshow("R", channels[2]);

	imwrite("channelB.jpg", channels[0]);
	imwrite("channelG.jpg", channels[1]);
	imwrite("channelR.jpg", channels[2]);

	waitKey(0);

	return 0;
}

int showVideo()
{
	return 0;
}

int main()
{
	showPicture();

	return 0;
}

最后

以上就是俊逸发卡最近收集整理的关于opencv GRB三通道颜色分离的全部内容,更多相关opencv内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部