FullScreen picture from webcam

728 views Asked by At

I use openCV to take picture from the cam. Here is code:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef( 1.0f, 1.0f, -1.0f);
glTranslatef(0,0,FOCAL_LENGTH);
glRasterPos2d(-width/2,height/2);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelZoom(1.0,-1.0);
glDrawPixels(bg->width, bg->height, GL_BGR_EXT, GL_UNSIGNED_BYTE, bg->imageData);

But when i maximized my window the picture size is only 640*480 - my webcam resolution. And it is only in top left corner of the window. What i must do to match picture size and window size.

1

There are 1 answers

0
rossb83 On

You must resize the image using the cvResize function. Please note this may slow things down a bit depending upon your PC configuration.