[Jderobot-admin] jderobot-r990 - trunk/src/stable/components/rgbdCalibrator

rocapal en jderobot.org rocapal en jderobot.org
Mie Sep 25 15:27:59 CEST 2013


Author: rocapal
Date: 2013-09-25 15:26:59 +0200 (Wed, 25 Sep 2013)
New Revision: 990

Modified:
   trunk/src/stable/components/rgbdCalibrator/calibration.cpp
   trunk/src/stable/components/rgbdCalibrator/viewer.cpp
Log:
#27 Added generic number of points in pattern and enabled just channel 1 of depthImage


Modified: trunk/src/stable/components/rgbdCalibrator/calibration.cpp
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/calibration.cpp	2013-09-25 09:18:53 UTC (rev 989)
+++ trunk/src/stable/components/rgbdCalibrator/calibration.cpp	2013-09-25 13:26:59 UTC (rev 990)
@@ -284,23 +284,36 @@
 
   void Calibration::initPatternPoints()
   {
-    mPatternPoints.push_back(Eigen::Vector4d (0.,0.,0.,1.));
+    // Down line, right to left
     mPatternPoints.push_back(Eigen::Vector4d (120.,0.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (60.0,0.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (0.,0.,0.,1.));    
+    mPatternPoints.push_back(Eigen::Vector4d (0.,0.,60.,1.));
     mPatternPoints.push_back(Eigen::Vector4d (0.,0.,120.,1.));
+
+    // Up line, right to left
+    mPatternPoints.push_back(Eigen::Vector4d (120.,120.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (60.,120.,0.,1.));
     mPatternPoints.push_back(Eigen::Vector4d (0.,120.,0.,1.));
-    mPatternPoints.push_back(Eigen::Vector4d (120.,120.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (0.,120.,60.,1.));
     mPatternPoints.push_back(Eigen::Vector4d (0.,120.,120.,1.));
 
+    // Middle line, right to left
+    mPatternPoints.push_back(Eigen::Vector4d (120.,60.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (0.,60.,0.,1.));
+    mPatternPoints.push_back(Eigen::Vector4d (0.,60.,120.,1.));
+    
+    
   }
 
   bool Calibration::addPatternPixel (Eigen::Vector3d pixel, const colorspaces::Image depthData)
   {
     mPixelPoints.push_back(pixel);
     
-    if  (mPixelPoints.size() > 6)
+    if  (mPixelPoints.size() > mPatternPoints.size())
       return false;
 
-    if (mPixelPoints.size() == 6)
+    if (mPixelPoints.size() == mPatternPoints.size())
     {  
 
       std::cout << "\tPixels" << "\t\t" << "Pattern" << "\t\t" << "Camera" << std::endl;
@@ -347,11 +360,11 @@
       mPairPoints.clear();
       
       //Build pairs
-      for (int i = 0; i<4; i++)
+      for (int i = 0; i< mPatternPoints.size(); i++)
 	mPairPoints.push_back(std::make_pair(mPatternPoints[i] ,mCameraPoints[i]));
 
       
-      for (int i = 0; i<4; i++)
+      for (int i = 0; i< mPatternPoints.size(); i++)
       {
 	std::cout << "(" << mPairPoints[i].first(0) 
 		  << "," << mPairPoints[i].first(1)

Modified: trunk/src/stable/components/rgbdCalibrator/viewer.cpp
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/viewer.cpp	2013-09-25 09:18:53 UTC (rev 989)
+++ trunk/src/stable/components/rgbdCalibrator/viewer.cpp	2013-09-25 13:26:59 UTC (rev 990)
@@ -129,23 +129,24 @@
     mImageDepth = imageDepth.clone();
     pthread_mutex_unlock(&mutex);
     
-    // Show depth image          
-    /*
-    colorspaces::ImageRGB8 img_rgb8D(imageDepth);
+    // Show depth image in color
+    // 3 RGB canals
+    // 0: Image in gray scale
+    // [1,2]: Real data of distance
+    // 1: 8bit MSB
+    // 2: 8bit LSB
+
+    std::vector<cv::Mat> layers;
+    cv::Mat colorDepth(imageDepth.size(),imageDepth.type());
+    cv::split(imageDepth, layers);
+
+    cv::cvtColor(layers[0],colorDepth,CV_GRAY2RGB);
+
     Glib::RefPtr<Gdk::Pixbuf> imgBuffDepth = 
-      Gdk::Pixbuf::create_from_data((const guint8*)img_rgb8D.data,
+      Gdk::Pixbuf::create_from_data((const guint8*) colorDepth.data,
 				    Gdk::COLORSPACE_RGB,
 				    false,
 				    8,
-				    img_rgb8D.width,
-				    img_rgb8D.height,
-				    img_rgb8D.step);
-    */
-    Glib::RefPtr<Gdk::Pixbuf> imgBuffDepth = 
-      Gdk::Pixbuf::create_from_data((const guint8*)imageDepth.data,
-				    Gdk::COLORSPACE_RGB,
-				    false,
-				    8,
 				    imageDepth.width,
 				    imageDepth.height,
 				    imageDepth.step);



More information about the Jderobot-admin mailing list