libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/progs calibrate.cxx


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd/progs calibrate.cxx
Date: Wed, 31 Oct 2007 11:11:46 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      07/10/31 11:11:46

Modified files:
        progs          : calibrate.cxx 

Log message:
        calibrate: render video image with rectangular texture instead of 
gldraw (slow on current Suse 10.3 on intel chipset); corrected help

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/progs/calibrate.cxx?cvsroot=libcvd&r1=1.1&r2=1.2

Patches:
Index: calibrate.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/progs/calibrate.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- calibrate.cxx       18 Jul 2007 16:20:55 -0000      1.1
+++ calibrate.cxx       31 Oct 2007 11:11:46 -0000      1.2
@@ -237,12 +237,14 @@
         "Move virtual grid over real grid until it snaps on.\n"
         "Record a number of frames ~100.\n"
         "Press SPACE to calculate camera parameters.\n\n"
+        "A calibration grid for the default parameters is in 
libcvd/doc/cameracalib2cm.pdf\n\n"
+        "flag  description\t\t\t\tdefault\n"
         "  -d  device to open, CVD video source URL\tv4l2:///dev/video0\n"
         "  -x  grid dimension in x (width) direction\t11\n"
         "  -y  grid dimension in y (height) direction\t7\n"
-        "  -s  grid cell size\t\t\t\t0.02 cm\n"
+        "  -s  grid cell size\t\t\t\t0.02 m\n"
         "  -t  interval between captured frames\t\t0.5 s\n"
-        "  -c  camera parameters\t\t\t\t1000 1000 320 240 0 0\n"
+        "  -c  initial camera parameters\t\t\t1000 1000 320 240 0 0\n"
         "  -e  generate image showing errors per pixel\n";
         exit(0);
       }
@@ -853,7 +855,25 @@
               vframe = videoBuffer->get_frame();
             }
           Image<float> gray = convert_image<float>(*vframe);
-          glDrawPixels(*vframe);
+          glDisable(GL_BLEND);
+          glEnable(GL_TEXTURE_RECTANGLE_ARB);
+          glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+          glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, 
GL_NEAREST );
+          glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, 
GL_NEAREST );
+          glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+          glTexImage2D( *vframe, 0, GL_TEXTURE_RECTANGLE_ARB);
+          glBegin(GL_QUADS);
+              glTexCoord2i(0, 0);
+              glVertex2i(0,0);
+              glTexCoord2i(vframe->size().x, 0);
+              glVertex2i(640,0);
+              glTexCoord2i(vframe->size().x,vframe->size().y);
+              glVertex2i(640,480);
+              glTexCoord2i(0, vframe->size().y);
+              glVertex2i(0, 480);
+          glEnd ();
+          glDisable(GL_TEXTURE_RECTANGLE_ARB);
+          glEnable(GL_BLEND);
           videoBuffer->put_frame(vframe);
 
           //this is the bit that does the calibrating




reply via email to

[Prev in Thread] Current Thread [Next in Thread]