OpenCV学习笔记(12)canny 边缘检测小程序

来源:互联网 发布:滁州学院网络电视台 编辑:程序博客网 时间:2024/05/17 07:51
//canny 边缘检测#include <opencv2/highgui/highgui.hpp>  #include <opencv2/imgproc/imgproc.hpp>#include <iostream>  #include <opencv2/opencv.hpp>using namespace cv;Mat srcImage = imread("102.jpg");Mat cannyImage;void on_trackbar(int threshold,void*){Canny(srcImage, cannyImage, threshold, threshold * 3, 3);imshow("canny边缘检测", cannyImage);}void canny_edge_detection(){int nThresholdEdge = 5;   //初始化阈值 on_trackbar(1,0);createTrackbar("Threshold", "canny边缘检测", &nThresholdEdge, 100, on_trackbar);}void main(){canny_edge_detection();namedWindow("canny边缘检测");waitKey(0);}

原创粉丝点击