一般彩色RGB图像为三通道,而灰度图为单通道,由判断图像的通道数来对图像类型做区分,采用的方法是使用Mat对象的.channels()方法。
程序如下:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main()
{
Mat photo =
一般彩色RGB图像为三通道,而灰度图为单通道,由判断图像的通道数来对图像类型做区分,采用的方法是使用Mat对象的.channels()方法。
程序如下:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main()
{
Mat photo =