Revision: 6894
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6894&view=rev
Author:   natepak
Date:     2008-07-21 16:00:01 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Updates to stereo vision

Modified Paths:
--------------
    code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc
    code/gazebo/trunk/worlds/stereocamera.world

Modified: code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc
===================================================================
--- code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc       2008-07-21 
06:08:31 UTC (rev 6893)
+++ code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc       2008-07-21 
16:00:01 UTC (rev 6894)
@@ -21,16 +21,24 @@
     return;
   }
 
-  fprintf( fp, "P6\n# Gazebo\n%d %d\n255\n", stereoIface->data->width, 
stereoIface->data->height);
+  fprintf( fp, "P5\n# Gazebo\n%d %d\n32768\n", stereoIface->data->width, 
stereoIface->data->height);
 
+  double max = 0;
+  for (unsigned int i=0; i<stereoIface->data->height*stereoIface->data->width; 
i++)
+  {
+    double v = stereoIface->data->left_disparity[i];
+    if (v > max)
+      max = v;
+  }
+
+  printf("Max[%f]\n",max);
   for (unsigned int i = 0; i<stereoIface->data->height; i++)
   {
     for (unsigned int j =0; j<stereoIface->data->width; j++)
     {
-      unsigned char value = 
stereoIface->data->left_disparity[i*stereoIface->data->width+j] * 255;
-      fwrite( &value, 1, 1, fp );
-      fwrite( &value, 1, 1, fp );
-      fwrite( &value, 1, 1, fp );
+      double v = 
stereoIface->data->left_disparity[i*stereoIface->data->width+j];
+      unsigned int value = (unsigned int)((v/max) * 32767);
+      fwrite( &value, 2, 1, fp );
     }
   }
 

Modified: code/gazebo/trunk/worlds/stereocamera.world
===================================================================
--- code/gazebo/trunk/worlds/stereocamera.world 2008-07-21 06:08:31 UTC (rev 
6893)
+++ code/gazebo/trunk/worlds/stereocamera.world 2008-07-21 16:00:01 UTC (rev 
6894)
@@ -100,7 +100,7 @@
         <imageSize>320 240</imageSize>
         <hfov>60</hfov>
         <nearClip>0.1</nearClip>
-        <farClip>100</farClip>
+        <farClip>1000</farClip>
         <saveFrames>false</saveFrames>
         <saveFramePath>frames</saveFramePath>
         <baseline>0.2</baseline>
@@ -108,6 +108,10 @@
         <controller:stereocamera name="stereo_camera_controller">
           <interface:stereocamera name="stereo_iface_0" />
           <interface:camera name="camera_iface_0" />
+          <interface:camera name="camera_iface_1" />
+
+          <leftcamera>camera_iface_0</leftcamera>
+          <rightcamera>camera_iface_1</rightcamera>
         </controller:stereocamera>
       </sensor:stereocamera>
     </body:empty>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to