#include "cv.h"
#include "highgui.h"
#include <stdio.h>
void main(){
IplImage* pImage=NULL;
IplImage* pImg8u=NULL;
IplImage* pImg8uSmooth=NULL;
IplImage* pImgCanny=NULL;
IplImage* frame;
CvCapture *capture=cvCaptureFromCAM(0);
if(!capture){
printf("ero");
}
cvNamedWindow("demo",CV_WINDOW_AUTOSIZE);
while(1){
frame=cvQueryFrame(capture);
if(!frame)
break;
char c=cvWaitKey(100);
if(c==27);
break;
pImage=cvCloneImage(frame);
pImg8u=cvCreateImage(cvGetSize(pImage),IPL_DEPTH_8U,1);
pImg8uSmooth=cvCreateImage(cvGetSize(pImage),IPL_DEPTH_8U,1);
pImgCanny=cvCreateImage(cvGetSize(pImage),IPL_DEPTH_8U,1);
cvCvtColor(pImage,pImg8u,CV_RGB2GRAY);
cvSmooth(pImg8u,pImg8uSmooth,CV_GAUSSIAN,3,0,0,0);
cvCanny(pImg8uSmooth,pImgCanny,100,200,3);
cvConvertScaleAbs(pImgCanny,pImg8u,1,0);
cvShowImage("demo",pImg8u);
cvWaitKey(50);
}
cvDestroyWindow("demo");
cvReleaseImage(&frame);
cvReleaseImage(&pImage);
cvReleaseImage(&pImg8u);
cvReleaseImage(&pImg8uSmooth);
cvReleaseImage(&pImgCanny);
}