Ask Your Question

se6OH43Q's profile - activity

2018-04-20 11:24:50 -0600 received badge  Famous Question (source)
2015-11-04 05:09:22 -0600 received badge  Notable Question (source)
2015-01-21 02:06:16 -0600 received badge  Popular Question (source)
2013-08-19 09:39:03 -0600 commented answer Webcam image size

Spas, thanks for your answer but unfortunately neither cvSetCaptureProperty nor resize are working. In fact, I cannot use resize at all because it says that it is an undefined function. //UPD Thanks for adding. How can I change your program in C? Now I cannot run it because of Mat.

2013-08-19 09:15:20 -0600 asked a question Webcam image size

Hello, I've downloaded OpenCV and made a simple program which takes a photo of you using the webcam. But the size of photos is only 160x120 so I was wondering if I can somehow scale it. I tried to use cvResize but it didn't help. Can anybody help me? Here is the code:

int main() {
    CvCapture *webcam = cvCreateCameraCapture(0); 
    if (!webcam)
        return 1;
    while (1) {
        IplImage *camImg = cvQueryFrame(webcam),*camImgSize = cvCreateImage(cvSize(640,480),camImg->depth,camImg->nChannels);
        if (camImg) {
            cvResize(camImg,camImgSize,CV_INTER_LINEAR);
            cvSaveImage("photo.jpg",camImg,0);
            cvShowImage("Photo",camImg);
            if (cvWaitKey(3000) == 0x1B) break;
        }
    }
    return 0;
}