#ifdef _CH_
#pragma package<opencv>
#endif
#pragma comment(lib,"cv.lib")
#pragma comment(lib,"cvcam.lib")
#pragma comment(lib,"cxcore.lib")
#pragma comment(lib,"highgui.lib")
#include <cv.h>
#include <cvcam.h>
#include <cxcore.h>
#include <highgui.h>
void main()
{
//载入图像
IplImage *src_image=cvLoadImage("1.jpg",CV_LOAD_IMAGE_GRAYSCALE);
assert(src_image!=NULL);
IplImage *dst_image=cvCreateImage(cvGetSize(src_image),IPL_DEPTH_16S,1);
assert(dst_image!=NULL);
//执行sobel变换
cvSobel(src_image,dst_image,1,0,7);
//创建窗口
cvNamedWindow("Show_Src");
cvNamedWindow("Show_Dst");
//显示图像
cvShowImage("Show_Src",src_image);
cvShowImage("Show_Dst",dst_image);
cvWaitKey();
}