#include<stdio.h> #include<iostream> #include<opencv2\opencv.hpp> using namespace std; using namespace cv; IplImage *g_psrcimage,*g_pcannyima; void on_trackbar(int threshold) { cvCanny(g_psrcimage,g_pcannyima,threshold,threshold*3,3); cvShowImage("picture",g_pcannyima); } int main() { g_psrcimage = cvLoadImage("D:\\1.jpg",CV_LOAD_IMAGE_GRAYSCALE); g_pcannyima = cvCreateImage(cvGetSize(g_psrcimage), IPL_DEPTH_8U, 1); int nthresholdedge=1; cvCreateTrackbar("1","2",&nthresholdedge,100,on_trackbar); cvShowImage("1",g_psrcimage); on_trackbar(1); cvWaitKey(); return 0; }
时间: 2024-11-12 07:26:57