opencv 对RGB图像直接二值化

 1 #include <opencv2/opencv.hpp>
 2 #include <iostream>
 3 using namespace cv;
 4 using namespace std;
 5 
 6 int main()
 7 {
 8 
 9     const char* inputImage = "33.jpg";
10     Mat img;
11 
12     img = imread(inputImage, 0);
13     if (img.empty())
14     {
15         cout << "Could not read input image file: " << inputImage << endl;
16         return -1;
17     }
18 
19     img = img >200;
20     imshow("Img", img);
21     waitKey(0);
22     return 0;
23 }

                

原文地址:https://www.cnblogs.com/hsy1941/p/7726131.html