【OpenCV】 大津展之法

来源:互联网 发布:网吧奖励软件 编辑:程序博客网 时间:2024/06/13 01:20
#include <cv.h>#include <highgui.h>#include<io.h>#include <string.h> #include "opencv2/opencv.hpp"  using   namespace   std;using   namespace   cv;#include <iostream>  using namespace std;using namespace cv;int main(){    VideoCapture capture(0);    bool stop(false);    Mat frame;    Mat frame_gray;    Mat result;    Mat convert;        frame = imread("F:\\data\\t.png",1);        cvtColor(frame, frame_gray, COLOR_BGR2GRAY);//图像灰度化          int i = threshold(frame_gray, result, 0, 255, CV_THRESH_OTSU);//大津法          printf("%d",i);        imshow("大津法", result);        waitKey(33);    waitKey(0);    return 0;}
0 0