Ciao a tutti, volevo un parere sul perchè non ho errori di compilazione ma nell'eseguirlo non riesco a compilare il seguente progettino...
Voglio prendere dal video della webcam solo una parte (in realtà un rettangolo)...
Questo il codice
codice:#include <highgui.h>#include <cxcore.h> #include <cv.h> int main (void) { cvNamedWindow("CameraON", CV_WINDOW_AUTOSIZE); CvCapture* capture; capture = cvCreateCameraCapture(0); IplImage *frame = 0; IplImage *maskimg; IplImage *frame1 = 0; // Prepara la maschera logica maskimg = cvCreateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 1); cvSetZero (maskimg); CvPoint pt1 = cvPoint( frame->width/2 - 60, frame->height/2 - 100 ); CvPoint pt2 = cvPoint( frame->width/2 + 60, frame->height/2 + 100 ); cvRectangle( maskimg, pt1, pt2, CV_RGB(255,255,255), CV_FILLED, 8, 0 ); while(1) // ciclo infinito { frame = cvQueryFrame(capture); if(!frame ) break; cvShowImage("CameraON", frame); cvAnd (frame, maskimg, frame1, 0); cvShowImage("window dest", frame1); cvWaitKey(0); } }
Utilizzo le Opencv...

Rispondi quotando