#include "cv.h" #include "highgui.h" int main(int argc, char **argv) { CvCapture* cap; cap=cvCaptureFromCAM(-1); IplImage* img=cvQueryFrame(cap); IplImage* img_result=cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,1); IplImage* img_result2=cvCreateImage(cvGetSize(img),IPL_DEPTH_16S,1); cvCvtColor(img,img_result,CV_RGB2GRAY); cvSobel(img_result,img_result2,1,1,3); cvSaveImage("cap.png",img); cvSaveImage("result.png",img_result2); // cvAddWeighted(img_result,2./3.,b,1./3.,0,img_result); // cvSobel(img_result,img_result,1,1,3); cvReleaseCapture(&cap); }