OpenCV加载彩色图像及灰度图像
作者:互联网
/** * 读取路径中的图像并显示 * @param inputPath */ void readImage(char *inputPath) { //读取图像,ps:opencv默认读取的是彩色图,其色彩格式BGR Mat color = imread(inputPath); //加载灰度图 Mat gray = imread(inputPath, IMREAD_GRAYSCALE); // if (!color.data) { cout << "Could not open or find the image" << endl; return; } //展示彩色图像 imshow("Image(BGR)", color); //展示灰度图像 imshow("Image(Gray)", gray); //wait for any key press waitKey(0); }
标签:彩色图像,读取,color,OpenCV,灰度,inputPath,imread,Mat 来源: https://www.cnblogs.com/tony-yang-flutter/p/14841121.html