Im using the following code to open webcam in my mac.
#define CAMERA_OUTPUT_WINDOW_NAME "camera"
int main(int argc, char **argv)
{
CvCapture *camCapture;
int ret = 0;
if (!(camCapture = cvCaptureFromCAM(CV_CAP_ANY))) {
cout << "Failed to capture from camera" << endl;
ret = 1;
goto exitCameraOpenFailed;
}
cout << "Camera opened successfully" << endl;
cvNamedWindow(CAMERA_OUTPUT_WINDOW_NAME, CV_WINDOW_AUTOSIZE);
IplImage *cameraFrame;
cvSetCaptureProperty( camCapture, CV_CAP_PROP_FRAME_WIDTH, 640 );
cvSetCaptureProperty( camCapture, CV_CAP_PROP_FRAME_HEIGHT, 480 );
while (true) {
if ((cameraFrame = cvQueryFrame(camCapture))) {
cvShowImage(CAMERA_OUTPUT_WINDOW_NAME, cameraFrame);
}
if (cvWaitKey(60) != -1) {
cout << "Input" << endl;
break;
}
}
cout << "Done" << endl;
cvReleaseCapture(&camCapture);
cvDestroyWindow(CAMERA_OUTPUT_WINDOW_NAME);
exitCameraOpenFailed:
return ret;
}
But the output window frame resolution is too small. only the toolbar of the output frame is visible not the actual frame though i have set its size to 640x480. How can I be able to sort this out?
I tried chaning the window_cocoa.mm file as
@implementation CVView
@synthesize image = _image;
But it has no effects on the final result