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

rocapal en jderobot.org rocapal en jderobot.org
Lun Oct 28 12:29:28 CET 2013


Author: rocapal
Date: 2013-10-28 12:29:26 +0100 (Mon, 28 Oct 2013)
New Revision: 1079

Modified:
   trunk/src/stable/components/rgbdCalibrator/calibration.cpp
   trunk/src/stable/components/rgbdCalibrator/calibration.h
   trunk/src/stable/components/rgbdCalibrator/rgbdCalibrator.glade
   trunk/src/stable/components/rgbdCalibrator/viewer.cpp
   trunk/src/stable/components/rgbdCalibrator/viewer.h
Log:
#27 save calibration results and offset to file


Modified: trunk/src/stable/components/rgbdCalibrator/calibration.cpp
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/calibration.cpp	2013-10-25 10:56:31 UTC (rev 1078)
+++ trunk/src/stable/components/rgbdCalibrator/calibration.cpp	2013-10-28 11:29:26 UTC (rev 1079)
@@ -332,9 +332,9 @@
 	mPatternPoints.push_back(Eigen::Vector4d (0.,-410.,630.,1.));
 	mPatternPoints.push_back(Eigen::Vector4d (0.,-260.,630.,1.));
 	mPatternPoints.push_back(Eigen::Vector4d (0.,-110.,630.,1.));
-	//mPatternPoints.push_back(Eigen::Vector4d (0.,110.,630.,1.));
-	//mPatternPoints.push_back(Eigen::Vector4d (0.,260.,630.,1.));
-	//mPatternPoints.push_back(Eigen::Vector4d (0.,410.,630.,1.));
+	mPatternPoints.push_back(Eigen::Vector4d (0.,110.,630.,1.));
+	mPatternPoints.push_back(Eigen::Vector4d (0.,260.,630.,1.));
+	mPatternPoints.push_back(Eigen::Vector4d (0.,410.,630.,1.));
 
 	mPatternPoints.push_back(Eigen::Vector4d (-408.,0.,1310.,1.));
 	mPatternPoints.push_back(Eigen::Vector4d (-258.,0.,1310.,1.));
@@ -648,7 +648,20 @@
 	res3D(3) = 1.0;
 }
 
+void Calibration::saveFile(std::string fileName, Eigen::Vector4d offset)
+{
 
+	mRTsolution(0,3) += offset(0);
+	mRTsolution(1,3) += offset(1);
+	mRTsolution(2,3) += offset(2);
+
+	mProgeo->setRTMatrix(mRTsolution);
+	mProgeo->saveToFile(fileName, false);
+
+	std::cout << "Calibration file saved OK in: " << fileName << std::endl;
+}
+
+
 void Calibration::test(Eigen::Vector3d pixel, std::vector<colorspaces::Image> depthVector)
 {
 	std::cout << "====== TEST ====== " << std::endl;

Modified: trunk/src/stable/components/rgbdCalibrator/calibration.h
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/calibration.h	2013-10-25 10:56:31 UTC (rev 1078)
+++ trunk/src/stable/components/rgbdCalibrator/calibration.h	2013-10-28 11:29:26 UTC (rev 1079)
@@ -78,6 +78,8 @@
 
     Eigen::Matrix4d getRTSolution() { return mRTsolution; };
 
+    void saveFile(std::string fileName, Eigen::Vector4d offset);
+
     void test(Eigen::Vector3d pixel, std::vector<colorspaces::Image> depthVector);
 
   private:

Modified: trunk/src/stable/components/rgbdCalibrator/rgbdCalibrator.glade
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/rgbdCalibrator.glade	2013-10-25 10:56:31 UTC (rev 1078)
+++ trunk/src/stable/components/rgbdCalibrator/rgbdCalibrator.glade	2013-10-28 11:29:26 UTC (rev 1079)
@@ -235,7 +235,7 @@
           </widget>
           <packing>
             <property name="x">381</property>
-            <property name="y">147</property>
+            <property name="y">153</property>
           </packing>
         </child>
         <child>
@@ -259,26 +259,26 @@
         </child>
         <child>
           <widget class="GtkImage" id="hsv_image">
-            <property name="width_request">320</property>
-            <property name="height_request">240</property>
+            <property name="width_request">0</property>
+            <property name="height_request">0</property>
             <property name="visible">True</property>
             <property name="stock">gtk-missing-image</property>
           </widget>
           <packing>
-            <property name="x">358</property>
-            <property name="y">306</property>
+            <property name="x">28</property>
+            <property name="y">571</property>
           </packing>
         </child>
         <child>
           <widget class="GtkImage" id="blob_image">
-            <property name="width_request">320</property>
-            <property name="height_request">240</property>
+            <property name="width_request">0</property>
+            <property name="height_request">0</property>
             <property name="visible">True</property>
             <property name="stock">gtk-missing-image</property>
           </widget>
           <packing>
-            <property name="x">688</property>
-            <property name="y">306</property>
+            <property name="x">375</property>
+            <property name="y">571</property>
           </packing>
         </child>
         <child>
@@ -296,10 +296,94 @@
             </child>
           </widget>
           <packing>
-            <property name="x">28</property>
-            <property name="y">577</property>
+            <property name="x">377</property>
+            <property name="y">306</property>
           </packing>
         </child>
+        <child>
+          <widget class="GtkLabel" id="label7">
+            <property name="width_request">113</property>
+            <property name="height_request">48</property>
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Position Offset</property>
+          </widget>
+          <packing>
+            <property name="x">738</property>
+            <property name="y">317</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="label8">
+            <property name="width_request">29</property>
+            <property name="height_request">117</property>
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">X:
+
+Y:
+
+Z:</property>
+          </widget>
+          <packing>
+            <property name="x">714</property>
+            <property name="y">370</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkEntry" id="et_offset_x">
+            <property name="width_request">98</property>
+            <property name="height_request">25</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="text" translatable="yes">0</property>
+          </widget>
+          <packing>
+            <property name="x">751</property>
+            <property name="y">379</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkEntry" id="et_offset_y">
+            <property name="width_request">98</property>
+            <property name="height_request">25</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="text" translatable="yes">0</property>
+          </widget>
+          <packing>
+            <property name="x">751</property>
+            <property name="y">416</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkEntry" id="et_offset_z">
+            <property name="width_request">98</property>
+            <property name="height_request">25</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x25CF;</property>
+            <property name="text" translatable="yes">0</property>
+          </widget>
+          <packing>
+            <property name="x">751</property>
+            <property name="y">453</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkButton" id="bt_save">
+            <property name="label" translatable="yes">Save</property>
+            <property name="width_request">96</property>
+            <property name="height_request">34</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </widget>
+          <packing>
+            <property name="x">754</property>
+            <property name="y">508</property>
+          </packing>
+        </child>
       </widget>
     </child>
   </widget>

Modified: trunk/src/stable/components/rgbdCalibrator/viewer.cpp
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/viewer.cpp	2013-10-25 10:56:31 UTC (rev 1078)
+++ trunk/src/stable/components/rgbdCalibrator/viewer.cpp	2013-10-28 11:29:26 UTC (rev 1079)
@@ -63,6 +63,10 @@
 	refXml->get_widget("bt_intrinsic_calib", btIntrinsic);
 	refXml->get_widget("eventbox", ebImage);
 	refXml->get_widget("eb_extrinsics", ebImageExtrinsics);
+	refXml->get_widget("et_offset_x", etOffsetX);
+	refXml->get_widget("et_offset_y", etOffsetY);
+	refXml->get_widget("et_offset_z", etOffsetZ);
+	refXml->get_widget("bt_save", btSave);
 
 	// connect signals
 	btTakePhoto->signal_clicked().connect(sigc::mem_fun(this,&Viewer::on_bt_take_photo_clicked));
@@ -72,6 +76,7 @@
 
 	ebImageExtrinsics->signal_button_press_event().connect(sigc::mem_fun(this, &Viewer::on_eventbox_extrinsics_clicked));
 
+	btSave->signal_clicked().connect(sigc::mem_fun(this,&Viewer::on_bt_save_clicked));
 	// start the timer for calculating the number of frames per second
 	// the images are being displayed at
 	oldFrameTime = IceUtil::Time::now();
@@ -81,6 +86,8 @@
 
 	mCalibration = new Calibration();
 
+	on_bt_intrinsic();
+
 	pthread_mutex_init(&mutex, NULL);
 
 
@@ -416,6 +423,21 @@
 	return true;
 }
 
+void Viewer::on_bt_save_clicked()
+{
+	Eigen::Vector4d offset;
+	std::string strX (etOffsetX->get_buffer()->get_text());
+	offset(0) = atoi(strX.c_str());
+
+	std::string strY (etOffsetY->get_buffer()->get_text());
+	offset(1) = atoi(strY.c_str());
+
+	std::string strZ (etOffsetZ->get_buffer()->get_text());
+	offset(2) = atoi(strZ.c_str());
+
+	mCalibration->saveFile("file.xml", offset);
+}
+
 void Viewer::on_bt_take_photo_clicked()
 {
 	intrinsicsEnable = 1;

Modified: trunk/src/stable/components/rgbdCalibrator/viewer.h
===================================================================
--- trunk/src/stable/components/rgbdCalibrator/viewer.h	2013-10-25 10:56:31 UTC (rev 1078)
+++ trunk/src/stable/components/rgbdCalibrator/viewer.h	2013-10-28 11:29:26 UTC (rev 1079)
@@ -64,12 +64,16 @@
     Gtk::Label* lbSleepPhoto;
     Gtk::Button* btTakePhoto;
     Gtk::Button* btIntrinsic;
+    Gtk::Button* btSave;
     Gtk::Entry* etSleepPhoto;
     Gtk::Entry* etNumPhoto;
     Gtk::TextView* tvStatus;
     Gtk::EventBox* ebImage;
     Gtk::EventBox* ebImageExtrinsics;
     Gtk::Main gtkmain;
+    Gtk::Entry* etOffsetX;
+    Gtk::Entry* etOffsetY;
+    Gtk::Entry* etOffsetZ;
   
     //! display the frame rate of the received images
     void displayFrameRate();
@@ -104,6 +108,7 @@
     // onclicks
     bool on_eventbox_clicked(GdkEventButton * event);
     bool on_eventbox_extrinsics_clicked(GdkEventButton * event);
+    void on_bt_save_clicked();
     void on_bt_take_photo_clicked ();
     void on_bt_intrinsic();
     



More information about the Jderobot-admin mailing list