代码
#include <iostream>
#include <chrono>
using namespace std;
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
int main(int argc, char **argv) {
cv::Mat image;
image = cv::imread("/home/automobile/wcm/slambook2/ch5/ubuntu.png");
if (image.data == nullptr){
cerr << "文件不存在" << endl;
return 0;
}
cout << "图像宽为 " << image.cols << ", 高为 " << image.rows
<< ", 通道数为 " << image.channels() << endl;
cv::imshow("image_原图", image);
cv::waitKey(0);
if (image.type() != CV_8UC1 && image.