1 | initial version |
You can use :
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 480 );
or resize the image (not recommended):
resize(img,img,Size(640,480);
2 | No.2 Revision |
You can use :
cvSetCaptureProperty( capture, webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( capture, webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
or resize the image (not recommended):
resize(img,img,Size(640,480);
3 | No.3 Revision |
You can use :
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
or resize the image (not recommended):
resize(img,img,Size(640,480);
resize(img,img,Size(640,480));
4 | No.4 Revision |
You can use :
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
or resize the image (not recommended):
resize(img,img,Size(640,480));
p.p. In your case:
int main() {
CvCapture *webcam = cvCreateCameraCapture(0);
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
if (!webcam)return -1;
while (true) {
Mat img = cvQueryFrame(webcam);
if (img.data) {
imwrite("photo.jpg",img);
imshow("Photo",img);
if (waitKey(3000) == 0x1B) break;
}
}
return 0;
}
5 | No.5 Revision |
You can use :
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
or resize the image (not recommended):
resize(img,img,Size(640,480));
p.p. In your case:
int main() {
CvCapture *webcam = cvCreateCameraCapture(0);
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( webcam, CV_CAP_PROP_FRAME_HEIGHT, 480 );
if (!webcam)return -1;
while (true) {
Mat img = cvQueryFrame(webcam);
if (img.data) {
imwrite("photo.jpg",img);
imshow("Photo",img);
if (waitKey(3000) == 0x1B) break;
}
}
return 0;
}