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: Sat, 01 Mar 2008 13:38:18 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      08/03/01 13:38:18

Modified files:
        progs          : calibrate.cxx 

Log message:
        calibrate works now under OSX with X11 videodisplay

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

Patches:
Index: calibrate.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/progs/calibrate.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- calibrate.cxx       31 Oct 2007 11:11:46 -0000      1.2
+++ calibrate.cxx       1 Mar 2008 13:38:18 -0000       1.3
@@ -20,6 +20,8 @@
 #include <cvd/videodisplay.h>
 #include <cvd/random.h>
 #include <cvd/timer.h>
+#include <cvd/colourspaces.h>
+#include <cvd/colourspace_convert.h>
 
 using namespace std;
 using namespace TooN;
@@ -28,10 +30,20 @@
 #include <X11/keysym.h>
 #include <X11/Xlib.h>
 
-VideoBuffer<byte>* videoBuffer=0;
+#ifdef CVD_HAVE_QTBUFFER
+typedef vuy422 CAMERA_PIXEL;
+#else
+typedef byte CAMERA_PIXEL;
+#endif
+
+VideoBuffer<CAMERA_PIXEL>* videoBuffer=0;
 
 // global configuration variables, can be set via command line options
+#ifdef CVD_HAVE_QTBUFFER
+string videoDevice = "qt://0";
+#else
 string videoDevice = "v4l2:///dev/video0";
+#endif
 Vector<6> cameraParameters = (make_Vector, 1000,  1000,  320,  240,  0,  0);
 int bottomLeftWhite = 1;
 int gridx = 11;
@@ -253,9 +265,9 @@
     return;
   try {
         cout << "opening " << videoDevice << endl;
-        videoBuffer = open_video_source<byte>(videoDevice);
+        videoBuffer = open_video_source<CAMERA_PIXEL>(videoDevice);
   }
-  catch (CVD::Exceptions::V4LBuffer::All& e) {
+  catch (CVD::Exceptions::All& e) {
       cerr << e.what << endl;
       exit(1);
   }
@@ -848,33 +860,35 @@
                 }
             }
 
-          VideoFrame<byte>* vframe = videoBuffer->get_frame();
+          VideoFrame<CAMERA_PIXEL>* vframe = videoBuffer->get_frame();
           while(videoBuffer->frame_pending())
             {
               videoBuffer->put_frame(vframe);
               vframe = videoBuffer->get_frame();
             }
-          Image<float> gray = convert_image<float>(*vframe);
+          Image<byte> temp = convert_image(*vframe);
+          Image<float> gray = convert_image(temp);
+          videoBuffer->put_frame(vframe);
+
           glDisable(GL_BLEND);
-          glEnable(GL_TEXTURE_RECTANGLE_ARB);
+          glEnable(GL_TEXTURE_RECTANGLE_NV);
           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 );
+          glTexParameterf( GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, 
GL_NEAREST );
+          glTexParameterf( GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, 
GL_NEAREST );
           glPixelStorei(GL_UNPACK_ALIGNMENT,1);
-          glTexImage2D( *vframe, 0, GL_TEXTURE_RECTANGLE_ARB);
+          glTexImage2D( temp, 0, GL_TEXTURE_RECTANGLE_NV);
           glBegin(GL_QUADS);
               glTexCoord2i(0, 0);
               glVertex2i(0,0);
-              glTexCoord2i(vframe->size().x, 0);
+              glTexCoord2i(temp.size().x, 0);
               glVertex2i(640,0);
-              glTexCoord2i(vframe->size().x,vframe->size().y);
+              glTexCoord2i(temp.size().x,temp.size().y);
               glVertex2i(640,480);
-              glTexCoord2i(0, vframe->size().y);
+              glTexCoord2i(0, temp.size().y);
               glVertex2i(0, 480);
           glEnd ();
-          glDisable(GL_TEXTURE_RECTANGLE_ARB);
+          glDisable(GL_TEXTURE_RECTANGLE_NV);
           glEnable(GL_BLEND);
-          videoBuffer->put_frame(vframe);
 
           //this is the bit that does the calibrating
           vector<pair<size_t, Vector<2> > > measurements;




reply via email to

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