我尝试根据本网站 http://www.lirtex.com/robotics/fast-object-tracking-robot-computer-vision/上写的内容运行以下程序
初始化参数
CvCapture *capture = cvCaptureFromCAM(0);
int width = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH );
int height = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT );
IplImage *frame;
CvSize size = cvSize(640,480);
cvNamedWindow( "Camera", CV_WINDOW_NORMAL );
cvNamedWindow( "HSV", CV_WINDOW_NORMAL );
cvNamedWindow( "EdgeDetection", CV_WINDOW_NORMAL );
cvResizeWindow("Camera",640,480);
cvResizeWindow("HSV",640,480);
cvResizeWindow("EdgeDetection",640,480);
IplImage * hsv_frame = cvCreateImage(size, IPL_DEPTH_8U, 3);
IplImage* thresholded = cvCreateImage(size, IPL_DEPTH_8U, 1);
当我像这样调用函数 cvCvtColor 时:
cvCvtColor(frame, frame , CV_BGR2HSV);
第二个参数等于第一个它的工作
但是当我像这样调用函数时
cvCvtColor(frame, hsv_frame , CV_BGR2HSV);
它失败并引发异常
有谁知道为什么会这样?