Revision: 6895 http://playerstage.svn.sourceforge.net/playerstage/?rev=6895&view=rev Author: natepak Date: 2008-07-21 16:12:15 +0000 (Mon, 21 Jul 2008)
Log Message: ----------- Changed disparity to depth images in stereo code Modified Paths: -------------- code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc code/gazebo/trunk/libgazebo/gazebo.h code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.hh Modified: code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc =================================================================== --- code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc 2008-07-21 16:00:01 UTC (rev 6894) +++ code/gazebo/trunk/examples/libgazebo/stereo/stereo.cc 2008-07-21 16:12:15 UTC (rev 6895) @@ -26,7 +26,7 @@ double max = 0; for (unsigned int i=0; i<stereoIface->data->height*stereoIface->data->width; i++) { - double v = stereoIface->data->left_disparity[i]; + double v = stereoIface->data->left_depth[i]; if (v > max) max = v; } @@ -36,7 +36,7 @@ { for (unsigned int j =0; j<stereoIface->data->width; j++) { - double v = stereoIface->data->left_disparity[i*stereoIface->data->width+j]; + double v = stereoIface->data->left_depth[i*stereoIface->data->width+j]; unsigned int value = (unsigned int)((v/max) * 32767); fwrite( &value, 2, 1, fp ); } Modified: code/gazebo/trunk/libgazebo/gazebo.h =================================================================== --- code/gazebo/trunk/libgazebo/gazebo.h 2008-07-21 16:00:01 UTC (rev 6894) +++ code/gazebo/trunk/libgazebo/gazebo.h 2008-07-21 16:12:15 UTC (rev 6895) @@ -1377,17 +1377,17 @@ /// Right image (R8G8B8) public: unsigned char right_rgb[GAZEBO_STEREO_CAMERA_MAX_RGB_SIZE]; - /// Left disparity size - public: unsigned int left_disparity_size; + /// Left depth map size + public: unsigned int left_depth_size; - /// Left disparity (float) - public: float left_disparity[GAZEBO_STEREO_CAMERA_MAX_DISPARITY_SIZE]; + /// Left depth map (float) + public: float left_depth[GAZEBO_STEREO_CAMERA_MAX_DISPARITY_SIZE]; - /// Right Disparity size - public: unsigned int right_disparity_size; + /// Right depth map size + public: unsigned int right_depth_size; - /// Right disparity (float) - public: float right_disparity[GAZEBO_STEREO_CAMERA_MAX_DISPARITY_SIZE]; + /// Right depth map (float) + public: float right_depth[GAZEBO_STEREO_CAMERA_MAX_DISPARITY_SIZE]; }; Modified: code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc =================================================================== --- code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc 2008-07-21 16:00:01 UTC (rev 6894) +++ code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc 2008-07-21 16:12:15 UTC (rev 6895) @@ -154,15 +154,15 @@ //stereo_data->right_rgb_size = stereo_data->width * stereo_data->height * 3; //stereo_data->left_rgb_size = stereo_data->width * stereo_data->height * 3; - stereo_data->right_disparity_size = stereo_data->width * stereo_data->height * sizeof(float); - stereo_data->left_disparity_size = stereo_data->width * stereo_data->height * sizeof(float); + stereo_data->right_depth_size = stereo_data->width * stereo_data->height * sizeof(float); + stereo_data->left_depth_size = stereo_data->width * stereo_data->height * sizeof(float); // Make sure there is room to store the image //assert (stereo_data->right_rgb_size <= sizeof(stereo_data->right_rgb)); //assert (stereo_data->left_rgb_size <= sizeof(stereo_data->left_rgb)); - assert (stereo_data->right_disparity_size <= sizeof(stereo_data->right_disparity)); - assert (stereo_data->left_disparity_size <= sizeof(stereo_data->left_disparity)); + assert (stereo_data->right_depth_size <= sizeof(stereo_data->right_depth)); + assert (stereo_data->left_depth_size <= sizeof(stereo_data->left_depth)); // Copy the left pixel data to the interface /*rgb_src = this->myParent->GetImageData(0); @@ -175,15 +175,15 @@ memcpy(rgb_dst, rgb_src, stereo_data->right_rgb_size); */ - // Copy the left disparity data to the interface - disp_src = this->myParent->GetDisparityData(0); - disp_dst = stereo_data->left_disparity; - memcpy(disp_dst, disp_src, stereo_data->left_disparity_size); + // Copy the left depth data to the interface + disp_src = this->myParent->GetDepthData(0); + disp_dst = stereo_data->left_depth; + memcpy(disp_dst, disp_src, stereo_data->left_depth_size); - // Copy the right disparity data to the interface - disp_src = this->myParent->GetDisparityData(1); - disp_dst = stereo_data->right_disparity; - memcpy(disp_dst, disp_src, stereo_data->right_disparity_size); + // Copy the right depth data to the interface + disp_src = this->myParent->GetDepthData(1); + disp_dst = stereo_data->right_depth; + memcpy(disp_dst, disp_src, stereo_data->right_depth_size); } Modified: code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc =================================================================== --- code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-07-21 16:00:01 UTC (rev 6894) +++ code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-07-21 16:12:15 UTC (rev 6895) @@ -291,23 +291,23 @@ { if (i > 1) - gzthrow("Index must be 0 for left, or 1 for right disparity image\n"); + gzthrow("Index must be 0 for left, or 1 for right depth image\n"); return this->rgbBuffer[i]; } ////////////////////////////////////////////////////////////////////////////// -// Get a pointer to the disparity data -const float *StereoCameraSensor::GetDisparityData(unsigned int i) +// Get a pointer to the depth data +const float *StereoCameraSensor::GetDepthData(unsigned int i) { if (i > 1) - gzthrow("Index must be 0 for left, or 1 for right disparity image\n"); + gzthrow("Index must be 0 for left, or 1 for right depth image\n"); return this->depthBuffer[i]; } ////////////////////////////////////////////////////////////////////////////// -// Fill all RGB and Disparity buffers +// Fill all RGB and depth buffers void StereoCameraSensor::FillBuffers() { Ogre::HardwarePixelBufferSharedPtr hardwareBuffer; Modified: code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.hh =================================================================== --- code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.hh 2008-07-21 16:00:01 UTC (rev 6894) +++ code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.hh 2008-07-21 16:12:15 UTC (rev 6895) @@ -86,9 +86,9 @@ /// \param i 0=left, 1=right public: virtual const unsigned char *GetImageData(unsigned int i=0); - /// \brief Get a point to the disparity data + /// \brief Get a point to the depth data /// \param i 0=left, 1=right - public: const float *GetDisparityData(unsigned int i=0); + public: const float *GetDepthData(unsigned int i=0); /// \brief Get the baselien of the camera public: double GetBaseline() const; 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