#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat imag, result;
imag = imread("can10.jpg",16);
namedWindow("原图", 0);
imshow("原图", imag);
result = imag.clone(); // 不知道这是干啥的。
threshold(imag, result, 100, 250, THRESH_OTSU);//otsu
namedWindow("二值化图像");
imshow("二值化图像", result);
imwrite("save.jpg",result);
waitKey(2000);
return 0;
}