#include "cxcore.h"
#include "cvcam.h"
#include "windows.h"
#include "cv.h"
#include "highgui.h"
#include "stdio.h"
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "highgui.lib")
int main(int argc,char ** argv)
{
IplImage * laplace = 0;
IplImage * colorlaplace = 0;
IplImage * planes[3] = {0,0,0};
CvCapture *capture = 0;
IplImage* logpolar_frame ;
//从摄像头读取
capture = cvCaptureFromCAM(0);
cvNamedWindow("灰度图",1);
//循环捕捉,直到用户按键跳出循环体
while(1)
{
IplImage * frame =0;
frame = cvQueryFrame(capture); //抓起一祯
logpolar_frame = cvCreateImage(cvSize(frame->width,frame->height), IPL_DEPTH_8U, 1); //创建图像
cvCvtColor( frame, logpolar_frame, CV_BGR2GRAY );//彩色装换成灰度值
logpolar_frame->origin=1;//视频与原视频方向一致
cvShowImage("灰度图",logpolar_frame);
if(cvWaitKey(10)>0)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("灰度图");
return 0;
}