opencv第三课 Canny边缘检测

 

#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;
}

 

posted @ 2015-01-11 14:22  qscqesze  阅读(306)  评论(0编辑  收藏  举报