[Jderobot-admin] jderobot-r1031 - in trunk/src/stable/components: . rgbdViewer
frivas en jderobot.org
frivas en jderobot.org
Jue Oct 10 15:58:26 CEST 2013
Author: frivas
Date: 2013-10-10 15:57:26 +0200 (Thu, 10 Oct 2013)
New Revision: 1031
Added:
trunk/src/stable/components/rgbdViewer/
trunk/src/stable/components/rgbdViewer/camera-0.cfg
trunk/src/stable/components/rgbdViewer/rgbdViewer.cfg
trunk/src/stable/components/rgbdViewer/rgbdViewer.cpp
trunk/src/stable/components/rgbdViewer/rgbdViewergui.cpp
trunk/src/stable/components/rgbdViewer/rgbdViewergui.glade
trunk/src/stable/components/rgbdViewer/rgbdViewergui.h
Removed:
trunk/src/stable/components/kinectViewer/
trunk/src/stable/components/rgbdViewer/kinectViewer.cfg
trunk/src/stable/components/rgbdViewer/kinectViewer.cfg.save
trunk/src/stable/components/rgbdViewer/kinectViewer.cpp
trunk/src/stable/components/rgbdViewer/kinectViewergui.cpp
trunk/src/stable/components/rgbdViewer/kinectViewergui.glade
trunk/src/stable/components/rgbdViewer/kinectViewergui.h
Modified:
trunk/src/stable/components/rgbdViewer/CMakeLists.txt
trunk/src/stable/components/rgbdViewer/drawarea.cpp
trunk/src/stable/components/rgbdViewer/drawarea.h
trunk/src/stable/components/rgbdViewer/myprogeo.cpp
trunk/src/stable/components/rgbdViewer/myprogeo.h
Log:
#66 solved problems with resolutions != 640x480m, updated to progeo c++ and renamed to rgbdViewer
Modified: trunk/src/stable/components/rgbdViewer/CMakeLists.txt
===================================================================
--- trunk/src/stable/components/kinectViewer/CMakeLists.txt 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/CMakeLists.txt 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,4 +1,4 @@
-SET(SOURCE_FILES kinectViewer.cpp drawarea.cpp kinectViewergui.cpp myprogeo.cpp util3d.cpp)
+SET(SOURCE_FILES rgbdViewer.cpp drawarea.cpp rgbdViewergui.cpp myprogeo.cpp)
add_definitions(-DGLADE_DIR="${gladedir}")
@@ -14,10 +14,10 @@
${gtkglextmm_INCLUDE_DIRS}
)
-add_executable (kinectViewer ${SOURCE_FILES})
+add_executable (rgbdViewer ${SOURCE_FILES})
-TARGET_LINK_LIBRARIES(kinectViewer
+TARGET_LINK_LIBRARIES(rgbdViewer
${CMAKE_THREAD_LIBS_INIT}
${GLUT_LIBRARIES}
${OpenCV_LIBRARIES}
@@ -29,6 +29,7 @@
JderobotInterfaces
jderobotutil
progeo
+ geometry
pioneer
parallelIce
${gsl_LIBRARIES}
Added: trunk/src/stable/components/rgbdViewer/camera-0.cfg
===================================================================
--- trunk/src/stable/components/rgbdViewer/camera-0.cfg (rev 0)
+++ trunk/src/stable/components/rgbdViewer/camera-0.cfg 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<calibration_camera>
+ <position>
+ <x>1582,000000</x>
+ <y>4983,000000</y>
+ <z>857,000000</z>
+ </position>
+ <foa>
+ <x>1297,000000</x>
+ <y>381,000000</y>
+ <z>1088,000000</z>
+ </foa>
+ <k_matrix>
+ <k11>515,000000</k11>
+ <k12>0,000000</k12>
+ <k13>320,000000</k13>
+ <k14>0,000000</k14>
+ <k21>0,000000</k21>
+ <k22>515,000000</k22>
+ <k23>240,000000</k23>
+ <k24>0,000000</k24>
+ <k31>0,000000</k31>
+ <k32>0,000000</k32>
+ <k33>1,000000</k33>
+ <k34>0,000000</k34>
+ </k_matrix>
+ <rt_matrix>
+ <rt11>0,003093</rt11>
+ <rt12>0,049941</rt12>
+ <rt13>0,998747</rt13>
+ <rt14>-1109,676147</rt14>
+ <rt21>-0,998088</rt21>
+ <rt22>0,061811</rt22>
+ <rt23>0,000000</rt23>
+ <rt24>1270,969971</rt24>
+ <rt31>-0,061734</rt31>
+ <rt32>-0,996838</rt32>
+ <rt33>0,050037</rt33>
+ <rt34>5022,022949</rt34>
+ <rt41>0,000000</rt41>
+ <rt42>0,000000</rt42>
+ <rt43>0,000000</rt43>
+ <rt44>1,000000</rt44>
+ </rt_matrix>
+ <roll>0,000000</roll>
+ <fdistx>515,000000</fdistx>
+ <fdisty>515,000000</fdisty>
+ <u0>320,000000</u0>
+ <v0>240,000000</v0>
+ <skew>0,000000</skew>
+ <rows>480</rows>
+ <columns>640</columns>
+</calibration_camera>
Modified: trunk/src/stable/components/rgbdViewer/drawarea.cpp
===================================================================
--- trunk/src/stable/components/kinectViewer/drawarea.cpp 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/drawarea.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -27,7 +27,7 @@
#define eval2(N) (N*N)
-namespace kinectViewer {
+namespace rgbdViewer {
const float DrawArea::MAXWORLD = 50.;
const float DrawArea::PI = 3.141592654;
@@ -535,11 +535,11 @@
numlines++;
}
else{
- printf("kinectViewer: error, too much lines in the world file configuration.\n");
+ printf("rgbdViewer: error, too much lines in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, worldfile line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, worldfile line not valid: %s\n",buffer_file);
}
}
else if (strcmp(word1, "post")==0){
@@ -558,11 +558,11 @@
post_p++;
}
else{
- printf("kinectViewer: error, too much posts in the world file configuration.\n");
+ printf("rgbdViewer: error, too much posts in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, post line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, post line not valid: %s\n",buffer_file);
}
}
else if (strcmp(word1, "jamb")==0){
@@ -581,11 +581,11 @@
jamb_p++;
}
else{
- printf("kinectViewer: error, too much jambs in the world file configuration.\n");
+ printf("rgbdViewer: error, too much jambs in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, post line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, post line not valid: %s\n",buffer_file);
}
}
else if (strcmp(word1, "circle")==0){
@@ -597,11 +597,11 @@
circle_p++;
}
else{
- printf("kinectViewer: error, too much circles in the world file configuration.\n");
+ printf("rgbdViewer: error, too much circles in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, circle line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, circle line not valid: %s\n",buffer_file);
}
}
else if (strcmp(word1, "triangle")==0){
@@ -613,11 +613,11 @@
triangle_p++;
}
else{
- printf("kinectViewer: error, too much triangles in the world file configuration.\n");
+ printf("rgbdViewer: error, too much triangles in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, triangle line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, triangle line not valid: %s\n",buffer_file);
}
}
else if (strcmp(word1, "sq")==0){
@@ -629,11 +629,11 @@
sq_p++;
}
else{
- printf("kinectViewer: error, too much sqs in the world file configuration.\n");
+ printf("rgbdViewer: error, too much sqs in the world file configuration.\n");
}
}
else{
- printf("kinectViewer: error, sq line not valid: %s\n",buffer_file);
+ printf("rgbdViewer: error, sq line not valid: %s\n",buffer_file);
}
}
}
@@ -649,7 +649,7 @@
int i;
if ((myfile=fopen(worldfile,"r"))==NULL){
- printf("kinectViewer: cannot find config file\n");
+ printf("rgbdViewer: cannot find config file\n");
return -1;
}
Modified: trunk/src/stable/components/rgbdViewer/drawarea.h
===================================================================
--- trunk/src/stable/components/kinectViewer/drawarea.h 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/drawarea.h 2013-10-10 13:57:26 UTC (rev 1031)
@@ -62,7 +62,7 @@
float roll;
} SofReference;
-namespace kinectViewer {
+namespace rgbdViewer {
class DrawArea : public Gtk::DrawingArea, public Gtk::GL::Widget<DrawArea>
{
public:
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewer.cfg
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewer.cfg 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewer.cfg 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,16 +0,0 @@
-kinectViewer.CameraRGBActive=1
-kinectViewer.CameraRGB.Proxy=cameraA:tcp -h 127.0.0.1 -p 9998
-kinectViewer.CameraDEPTHActive=1
-kinectViewer.CameraDEPTH.Proxy=cameraB:tcp -h 127.0.0.1 -p 9998
-kinectViewer.pointCloudActive=1
-kinectViewer.pointCloud.Proxy=pointcloud1:tcp -h 127.0.0.1 -p 9998
-kinectViewer.Pose3DMotorsActive=0
-kinectViewer.Pose3DMotors.Proxy=Pose3DMotors1:tcp -h 127.0.0.1 -p 9998
-kinectViewer.KinectLedsActive=0
-kinectViewer.KinectLeds.Proxy=kinectleds1:tcp -h 127.0.0.1 -p 9998
-kinectViewer.WorldFile=./config/lambecom.cfg
-#kinectViewer.camRGB=./config/camRGB
-#kinectViewer.camIR=./config/camRGB
-kinectViewer.Height=240
-kinectViewer.Width=320
-kinectViewer.Fps=15
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewer.cfg.save
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewer.cfg.save 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewer.cfg.save 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,11 +0,0 @@
-kinectViewer.CameraRGBActive=1
-kinectViewer.CameraRGB.Proxy=cameraA:tcp -h 193.147.14.20 -p 8888
-kinectViewer.CameraDEPTHActive=1
-kinectViewer.CameraDEPTH.Proxy=cameraB:tcp -h 193.147.14.20 -p 9999
-kinectViewer.PTMotorsActive=1
-kinectViewer.PTMotors.Proxy=ptmotors1:tcp -h 193.147.14.20 -p 9999
-kinectViewer.KinectLedsActive=1
-kinectViewer.KinectLeds.Proxy=kinectleds1:tcp -h 193.147.14.20 -p 9999
-kinectViewer.WorldFile=./config/lambecom.cfg
-kinectViewer.camRGB=./config/camRGB
-kinectViewer.camIR=./config/camIR
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewer.cpp
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewer.cpp 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewer.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- *
- * Author : Jose María Cañas <jmplaza en gsyc.es>
- Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
-
- */
-
-
-
-
-
-#include <iostream>
-#include <Ice/Ice.h>
-#include <IceUtil/IceUtil.h>
-#include <jderobot/pointcloud.h>
-#include "kinectViewergui.h"
-#include "pthread.h"
-#include "parallelIce/cameraClient.h"
-#include "parallelIce/pointcloudClient.h"
-
-
-
-#define MAX_COMPONENTS 20
-
-kinectViewer::kinectViewergui* kinectViewergui_ptx;
-
-jderobot::cameraClient* camRGB=NULL;
-jderobot::cameraClient* camDEPTH=NULL;
-jderobot::pointcloudClient* pcClient=NULL;
-
-
-
-
-void *gui_thread(void* arg){
- try{
- //local data
- std::vector<jderobot::RGBPoint> cloud;
- cv::Mat rgb,depth;
-
- struct timeval post;
- long long int totalpre=0;
- long long int totalpost=0;
-
- //std::cout << "******************************** entro" << std::endl;
- while(kinectViewergui_ptx->isVisible() && ! kinectViewergui_ptx->isClosed()){
- //std::cout << "******************************** entro1" << std::endl;
- gettimeofday(&post,NULL);
- totalpost=post.tv_sec*1000000+post.tv_usec;
-
- if (camRGB!=NULL)
- rgb=camRGB->getImage();
- if (camDEPTH!=NULL)
- depth=camDEPTH->getImage();
- if (pcClient!=NULL)
- cloud=pcClient->getData();
-
-
- if ((rgb.rows!=0)&&(depth.rows!=0)){
- kinectViewergui_ptx->updateAll(rgb,depth, cloud);
- }
- else if (rgb.rows!=0){
- kinectViewergui_ptx->updateRGB(rgb);
- }
- else if (depth.rows!=0){
- kinectViewergui_ptx->updateDEPTH(depth);
- }
- else{
- kinectViewergui_ptx->updatePointCloud(cloud);
- }
- if (totalpre !=0){
- if ((totalpost - totalpre) > kinectViewergui_ptx->getCycle() ){
- std::cout<<"-------- kinectViewer: timeout-" << std::endl;
- }
- else{
- usleep(kinectViewergui_ptx->getCycle() - (totalpost - totalpre));
- }
- }
- totalpre=totalpost;
-
-
- }
- }catch (const Ice::Exception& ex) {
- std::cerr << ex << std::endl;
- }
- catch (const char* msg) {
- std::cerr << msg << std::endl;
- }
- pthread_exit(NULL);
- return NULL;
-}
-
-/**
- * \brief Main program function code
- */
-int main(int argc, char** argv){
-
- int status,i;
- Ice::CommunicatorPtr ic;
- int n_components=0;
- pthread_t threads[MAX_COMPONENTS];
- pthread_attr_t attr;
- Ice::PropertiesPtr prop;
- bool create_gui=false;
-
-
-
- bool rgbCamSelected=false;
- bool depthCamSelected=false;
- bool pointCloudSelected=false;
- int globalWidth;
- int globalHeight;
-
-
-
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- try{
- ic = Ice::initialize(argc,argv);
- prop = ic->getProperties();
- }catch (const Ice::Exception& ex) {
- std::cerr << ex << std::endl;
- return 1;
- }
- catch (const char* msg) {
- std::cerr <<"Error :" << msg << std::endl;
- return 1;
- }
- if (prop->getPropertyAsIntWithDefault("kinectViewer.CameraRGBActive",0)){
- camRGB = new jderobot::cameraClient(ic,"kinectViewer.CameraRGB.",false);
- if (camRGB != NULL){
- rgbCamSelected=true;
- camRGB->start();
- create_gui=true;
- }
-
- }
- if (prop->getPropertyAsIntWithDefault("kinectViewer.CameraDEPTHActive",0)){
- camDEPTH = new jderobot::cameraClient(ic,"kinectViewer.CameraDEPTH.",false);
- if (camDEPTH != NULL){
- depthCamSelected=true;
- camDEPTH->start();
- create_gui=true;
- }
- }
-
-
- if (prop->getPropertyAsIntWithDefault("kinectViewer.pointCloudActive",0)){
- pcClient = new jderobot::pointcloudClient(ic,"kinectViewer.pointCloud.",false);
- if (pcClient!= NULL){
- pcClient->start();
- pointCloudSelected=true;
- create_gui=true;
- }
- }
-
- globalHeight=prop->getPropertyAsIntWithDefault("kinectViewer.Height",240);
- globalWidth=prop->getPropertyAsIntWithDefault("kinectViewer.Width",320);
- int fps=prop->getPropertyAsIntWithDefault("kinectViewer.Fps",10);
- float cycle=(float)(1/(float)fps)*1000000;
-
-
- std::cout << rgbCamSelected <<", " << depthCamSelected << ", " << pointCloudSelected << std::endl;
-
- kinectViewergui_ptx = new kinectViewer::kinectViewergui(rgbCamSelected,depthCamSelected, pointCloudSelected, prop->getProperty("kinectViewer.WorldFile"), prop->getProperty("kinectViewer.camRGB"), prop->getProperty("kinectViewer.camIR"),globalWidth,globalHeight, cycle);
-
- if (create_gui){
- pthread_create(&threads[n_components], &attr, gui_thread,NULL);
- n_components++;
- }
-
-
- if (kinectViewergui_ptx == NULL)
- throw "kinectViewer: Could not create the grafic interface";
- for (i = 0; i < n_components; i++) {
- pthread_join(threads[i], NULL);
- }
-
- if (camRGB!=NULL)
- delete camRGB;
- if (camDEPTH!=NULL)
- delete camDEPTH;
- if (pcClient!=NULL)
- delete pcClient;
-
-
- if (ic)
- ic->destroy();
- return status;
-}
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewergui.cpp
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewergui.cpp 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewergui.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,589 +0,0 @@
-/*
- * Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- *
- * Author : Jose María Cañas <jmplaza en gsyc.es>
- Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
-
- */
-
-#include "kinectViewergui.h"
-#include <jderobot/pointcloud.h>
-
-namespace kinectViewer {
-kinectViewergui::kinectViewergui(bool rgb, bool depth,bool pointCloud , std::string path, std::string path_rgb, std::string path_ir, int width, int height, float cycle): gtkmain(0,0) {
-
- /*Init OpenGL*/
- if(!Gtk::GL::init_check(NULL, NULL)) {
- std::cerr << "Couldn't initialize GL\n";
- std::exit(1);
- }
- this->cycle=cycle;
-
- if (rgb)
- cam_rgb_active=1;
- else
- cam_rgb_active=0;
- if (depth)
- cam_depth_active=1;
- else
- cam_depth_active=0;
- modesAvalables=0;
- if (pointCloud) {
- if ((rgb)&&(depth)) {
- reconstructMode=1;
- modesAvalables=2; //only one mode
- }
- else {
- reconstructMode=1;
- modesAvalables=1; //both modes
- }
- }
- else {
- if ((rgb)&&(depth)) {
- reconstructMode=1;
- modesAvalables=1; //only point cloud mode
- }
- else {
- reconstructMode=0;
- modesAvalables=0; // no mode available
- }
- }
-
- reconstruct_depth_activate=false;
- lines_depth_active=false;
- lines_rgb_active=false;
- std::cout << "Loading glade\n";
- refXml = Gnome::Glade::Xml::create("./kinectViewergui.glade");
- cWidth=width;
- cHeight=height;
-
-
-
-
- /*Get widgets*/
- refXml->get_widget("kinectViewer", mainwindow);
- refXml->get_widget("imageRGB", w_imageRGB);
- refXml->get_widget("imageDEPTH", w_imageDEPTH);
- refXml->get_widget("eventboxRGB", w_event_rgb);
- refXml->get_widget("eventboxDEPTH", w_event_depth);
- refXml->get_widget("toggle_reconstruct", w_reconstruct);
- refXml->get_widget("toggle_camera_pos", w_camera_pos);
- refXml->get_widget("toggle_lines_rgb", w_lines_rgb);
- refXml->get_widget("toggle_lines_depth", w_lines_depth);
- refXml->get_widget("toggle_depth", w_toggle_depth);
- refXml->get_widget("toggle_rgb", w_toggle_rgb);
- refXml->get_widget("view_controller",w_view_controller);
- refXml->get_widget("window_controller",w_window_controller);
- refXml->get_widget("vbox_reconstruct_selection",w_reconstruct_selection);
- refXml->get_widget("vbox_reconstruct_mode",w_reconstruct_mode);
- refXml->get_widget("radio_mode_pointcloud",w_radio_mode_pointcloud);
- refXml->get_widget("radio_mode_image",w_radio_mode_image);
- refXml->get_widget("radio_depth",w_radio_depth);
- refXml->get_widget("radio_rgb",w_radio_rgb);
- refXml->get_widget("button_clear_lines",w_button_clear_lines);
- refXml->get_widget("window_gl",w_window_gl);
- refXml->get_widget("tg_gl",w_tg_gl);
- refXml->get_widget("vbox_gl",w_vbox_gl);
-
- if (!cam_rgb_active) {
- w_toggle_rgb->hide();
- }
- if (!cam_depth_active) {
- w_toggle_depth->hide();
- }
-
- w_event_rgb->signal_button_press_event().connect(sigc::mem_fun(this,&kinectViewergui::on_clicked_event_rgb));
- w_event_depth->signal_button_press_event().connect(sigc::mem_fun(this,&kinectViewergui::on_clicked_event_depth));
- w_reconstruct->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_reconstruct_depth));
- w_camera_pos->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::add_camera_position));
- w_lines_rgb->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_lines_rgb_toggled));
- w_lines_depth->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_lines_depth_toggled));
- w_tg_gl->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_tg_gl_toggled));
- w_view_controller->signal_activate().connect(sigc::mem_fun(this,&kinectViewergui::on_w_view_controller_activate));
- w_radio_depth->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_radio_depth_activate));
- w_radio_rgb->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_radio_rgb_activate));
- w_radio_mode_pointcloud->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_radio_mode_pointcloud_activate));
- w_radio_mode_image->signal_toggled().connect(sigc::mem_fun(this,&kinectViewergui::on_w_radio_mode_image_activate));
- w_button_clear_lines->signal_clicked().connect(sigc::mem_fun(this,&kinectViewergui::on_clicked_clear_lines));
-
- if (modesAvalables==0) {
- w_reconstruct->hide();
- }
-
- // Mundo OpenGL
- refXml->get_widget_derived("gl_world",world);
- world->setCamerasResolution(width,height);
-
- std::cout << "Creating Progeos Virtual Cameras" << std::endl;
- mypro= new kinectViewer::myprogeo();
- mypro->load_cam((char*)path_rgb.c_str(),0,width, height);
-
- mypro->load_cam((char*)path_ir.c_str(),1,width, height);
- util = new kinectViewer::util3d(mypro);
-
- /*Show window. Note: Set window visibility to false in Glade, otherwise opengl won't work*/
- world->readFile(path);
- mainwindow->show();
-
-}
-
-kinectViewergui::~kinectViewergui() {
- //delete this->controller;
-}
-
-
-void
-kinectViewergui::updateAll( cv::Mat imageRGB, cv::Mat imageDEPTH, std::vector<jderobot::RGBPoint> cloud )
-{
- std::cout << imageRGB.rows << std::endl;
-
- cv::Mat distance(imageRGB.rows, imageRGB.cols, CV_32FC1);
- cv::Mat colorDepth(imageDEPTH.size(),imageDEPTH.type());
- CvPoint pt1,pt2;
- if (w_toggle_rgb->get_active()) {
- Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageRGB.data,Gdk::COLORSPACE_RGB,false,8,imageRGB.cols,imageRGB.rows,imageRGB.step);
- w_imageRGB->clear();
- /*si queremos pintar las lineas*/
- if (lines_rgb_active) {
- util->draw_room(imageRGB,0, world->lines, world->numlines);
- }
- w_imageRGB->set(imgBuff);
- while (gtkmain.events_pending())
- gtkmain.iteration();
- }
- if (w_toggle_depth->get_active()||((reconstruct_depth_activate)&&(reconstructMode==0))) {
-
- /*split channels to separate distance from image*/
- std::vector<cv::Mat> layers;
- cv::split(imageDEPTH, layers);
-
- cv::cvtColor(layers[0],colorDepth,CV_GRAY2RGB);
- /*cv::imshow("color", colorDepth);
- cv::waitKey(1);*/
-
- for (int x=0; x< layers[1].cols ; x++) {
- for (int y=0; y<layers[1].rows; y++) {
- distance.at<float>(y,x) = ((int)layers[1].at<unsigned char>(y,x)<<8)|(int)layers[2].at<unsigned char>(y,x);
- }
- }
-
- if (w_toggle_depth->get_active()) {
- cv::Mat localDepth;
- Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) colorDepth.data,Gdk::COLORSPACE_RGB,false,8,colorDepth.cols,colorDepth.rows,colorDepth.step);
- w_imageDEPTH->clear();
- if (lines_depth_active) {
- util->draw_room(colorDepth,1, world->lines, world->numlines);
- }
- w_imageDEPTH->set(imgBuff);
- }
- while (gtkmain.events_pending())
- gtkmain.iteration();
- }
- if (reconstruct_depth_activate) {
- if (reconstructMode==0) {
- add_depth_pointsImage(imageRGB, distance);
- }
- else
- add_depth_pointsCloud(cloud);
- }
- world->my_expose_event();
- while (gtkmain.events_pending())
- gtkmain.iteration();
-}
-
-void
-kinectViewergui::updateRGB( cv::Mat imageRGB)
-{
- CvPoint pt1,pt2;
- if (w_toggle_rgb->get_active()) {
- Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageRGB.data,Gdk::COLORSPACE_RGB,false,8,imageRGB.cols,imageRGB.rows,imageRGB.step);
- w_imageRGB->clear();
- /*si queremos pintar las lineas*/
- if (lines_rgb_active) {
- util->draw_room(imageRGB,0, world->lines, world->numlines);
-
- }
- w_imageRGB->set(imgBuff);
- displayFrameRate();
- while (gtkmain.events_pending())
- gtkmain.iteration();
- }
- if (reconstruct_depth_activate) {
- if (reconstructMode!=0) {
- //add_depth_pointsCloud();
- }
- }
- world->my_expose_event();
- while (gtkmain.events_pending())
- gtkmain.iteration();
-}
-
-void
-kinectViewergui::updateDEPTH(cv::Mat imageDEPTH )
-{
- CvPoint pt1,pt2;
- if (w_toggle_depth->get_active()) {
- Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageDEPTH.data,Gdk::COLORSPACE_RGB,false,8,imageDEPTH.cols,imageDEPTH.rows,imageDEPTH.step);
- w_imageDEPTH->clear();
- if (lines_depth_active) {
- util->draw_room(imageDEPTH,1, world->lines, world->numlines);
-
- }
- w_imageDEPTH->set(imgBuff);
- displayFrameRate();
- while (gtkmain.events_pending())
- gtkmain.iteration();
- }
- if (reconstruct_depth_activate) {
- if (reconstructMode!=0) {
- //add_depth_pointsCloud();
- }
- }
- world->my_expose_event();
- while (gtkmain.events_pending())
- gtkmain.iteration();
-}
-
-void
-kinectViewergui::updatePointCloud(std::vector<jderobot::RGBPoint> cloud )
-{
- displayFrameRate();
- while (gtkmain.events_pending())
- gtkmain.iteration();
- if (reconstruct_depth_activate) {
- if (reconstructMode==1) {
- add_depth_pointsCloud(cloud);
- }
- }
- world->my_expose_event();
- while (gtkmain.events_pending())
- gtkmain.iteration();
-}
-
-
-bool kinectViewergui::isClosed() {
- return false;
-}
-
-bool kinectViewergui::isVisible() {
- return mainwindow->is_visible();
-}
-
-void kinectViewergui::displayFrameRate()
-{
- double diff;
- IceUtil::Time diffT;
-
- currentFrameTime = IceUtil::Time::now();
- diff = (currentFrameTime - oldFrameTime).toMilliSecondsDouble();
- if (diff < 1000.0)
- frameCount++;
- else {
- oldFrameTime = currentFrameTime;
- fps = frameCount*1000.0/diff;
- frameCount=0;
- // Display the frame rate
- std::stringstream fpsString;
- fpsString << "fps = " << int(fps);
- //fpslabel->set_label(fpsString.str());
- }
-}
-
-bool kinectViewergui::on_clicked_event_rgb(GdkEventButton* event) {
- int x,y;
- float xp,yp,zp,camx,camy,camz;
- float xu,yu,zu;
- float k;
-
- gdk_window_at_pointer(&x,&y);
- std::cout << x << ", " << y << std::endl;
- mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,0);
- xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
-
- k= 5000;
- world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
- return true;
-}
-
-
-bool kinectViewergui::on_clicked_event_depth(GdkEventButton* event) {
- int x,y;
- float xp,yp,zp,camx,camy,camz;
- float xu,yu,zu;
- float k;
-
- gdk_window_at_pointer(&x,&y);
- mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,1);
- xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
-
- k= 5000;
- world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
-
- world->add_line(k*xu + camx,k*yu + camy,k*zu + camz,camx,camy,camz);
- return true;
-}
-
-void kinectViewergui::add_cameras_position() {
- int x,y;
- float xp,yp,zp,camx,camy,camz;
- float xu,yu,zu;
- float k;
-
- gdk_window_at_pointer(&x,&y);
- mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,0);
- xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
- zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
-
- k= 500;
- world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
- world->add_line(1905,800,1240,camx,camy,camz);
-}
-
-void
-kinectViewergui::on_reconstruct_depth() {
- if (w_reconstruct->get_active()) {
- reconstruct_depth_activate=true;
- world->draw_kinect_points=true;
- w_reconstruct_selection->show();
- if (modesAvalables==2)
- w_reconstruct_mode->show();
- }
- else {
- reconstruct_depth_activate=false;
- world->draw_kinect_points=false;
- w_reconstruct_selection->hide();
- }
-}
-
-void
-kinectViewergui::add_depth_pointsImage(cv::Mat imageRGB, cv::Mat distance) {
- float d;
- //std::cout << "point image" << std::endl;
-
- world->clear_points();
- //std::cout << "inicio reconstrucción" << std::endl;
- for (int xIm=0; xIm< cWidth; xIm++) {
- for (int yIm=0; yIm<cHeight ; yIm++) {
- d=distance.at<float>(yIm,xIm);
- if (d!=0) {
- //std::cout << d << std::endl;
- //d=d*10;
- float xp,yp,zp,camx,camy,camz;
- float ux,uy,uz;
- float x,y;
- float k;
- float c1x, c1y, c1z;
- float fx,fy,fz;
- float fmod;
- float t;
- float Fx,Fy,Fz;
-
-
-
-
- mypro->mybackproject(xIm, yIm, &xp, &yp, &zp, &camx, &camy, &camz,0);
-
-
-
- //vector unitario
- float modulo;
-
- modulo = sqrt(1/(((camx-xp)*(camx-xp))+((camy-yp)*(camy-yp))+((camz-zp)*(camz-zp))));
- mypro->mygetcamerafoa(&c1x, &c1y, &c1z, 0);
-
-
- fmod = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
- fx = (c1x - camx)*fmod;
- fy = (c1y - camy)*fmod;
- fz = (c1z - camz) * fmod;
- ux = (xp-camx)*modulo;
- uy = (yp-camy)*modulo;
- uz = (zp-camz)*modulo;
-
- Fx= d*fx + camx;
- Fy= d*fy + camy;
- Fz= d*fz + camz;
-
- /* calculamos el punto real */
- t = (-(fx*camx) + (fx*Fx) - (fy*camy) + (fy*Fy) - (fz*camz) + (fz*Fz))/((fx*ux) + (fy*uy) + (fz*uz));
-
-
-
- /*world->points[i][0]=distance*ux+camx;
- world->points[i][1]=distance*uy+camy;
- world->points[i][2]=distance*uz+camz;*/
- //std::cout << c1x << "," << c1y << "," << c1f << "," << std::endl;
- /*std::cout << xp-camx << "," << yp-camy<< "," << zp-camz << std::endl;
- std::cout << ux << "," << uy<< "," << uz << std::endl;*/
- //k= (80-yp)/uy;
- //std::cout << "distancia" << distance << std::endl;
- //std::cout<< t*ux + camx << ", " << t*uy + camy << ", " << t*uz + camz << std::endl;
- world->add_kinect_point(t*ux + camx,t*uy+ camy,t*uz + camz,(int)imageRGB.data[3*(yIm*cWidth+xIm)],(int)imageRGB.data[3*(yIm*cWidth+xIm)+1],(int)imageRGB.data[3*(yIm*cWidth+xIm)+2]);
-
- //world->add_line(distance*ux + camx,distance*uy+ camy,distance*uz + camz,camx,camy,camz);
- }
- }
- }
-
- //std::cout << "fin reconstrucción" << std::endl;
-}
-
-void
-kinectViewergui::add_depth_pointsCloud(std::vector<jderobot::RGBPoint> cloud) {
- world->clear_points();
- for (std::vector<jderobot::RGBPoint>::iterator it = cloud.begin(); it != cloud.end(); ++it) {
- world->add_kinect_point(it->x,it->y,it->z,(int)it->r,(int)it->g,(int)it->b);
- }
-}
-
-void
-kinectViewergui::add_camera_position() {
- float c1x, c1y, c1z, c2x, c2y, c2z, c3x, c3y, c3z, c4x, c4y,c4z;
- float camx, camy, camz;
- float w,h;
- float modulo,distance;
-
-
- if (w_camera_pos->get_active()) {
- distance=300;
- mypro->mygetcamerasize(&w,&h,1);
- mypro->mybackproject(0,0,&c1x,&c1y,&c1z,&camx, &camy, &camz,1);
- mypro->mybackproject(0,cWidth,&c2x,&c2y,&c2z,&camx, &camy, &camz,1);
- mypro->mybackproject(cHeight,0,&c3x,&c3y,&c3z,&camx, &camy, &camz,1);
- mypro->mybackproject(cHeight,cWidth,&c4x,&c4y,&c4z,&camx, &camy, &camz,1);
-
- modulo = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
- c1x = (c1x-camx)*modulo;
- c1y = (c1y-camy)*modulo;
- c1z = (c1z-camz)*modulo;
-
- modulo = sqrt(1/(((camx-c2x)*(camx-c2x))+((camy-c2y)*(camy-c2y))+((camz-c2z)*(camz-c2z))));
- c2x = (c2x-camx)*modulo;
- c2y = (c2y-camy)*modulo;
- c2z = (c2z-camz)*modulo;
-
- modulo = sqrt(1/(((camx-c3x)*(camx-c3x))+((camy-c3y)*(camy-c3y))+((camz-c3z)*(camz-c3z))));
- c3x = (c3x-camx)*modulo;
- c3y = (c3y-camy)*modulo;
- c3z = (c3z-camz)*modulo;
-
- modulo = sqrt(1/(((camx-c4x)*(camx-c4x))+((camy-c4y)*(camy-c4y))+((camz-c4z)*(camz-c4z))));
- c4x = (c4x-camx)*modulo;
- c4y = (c4y-camy)*modulo;
- c4z = (c4z-camz)*modulo;
-
-
-
- world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,camx,camy,camz);
- world->add_camera_line(distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz,camx,camy,camz);
- world->add_camera_line(distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz,camx,camy,camz);
- world->add_camera_line(distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz,camx,camy,camz);
- world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz);
- world->add_camera_line(distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz,distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz);
- world->add_camera_line(distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz,distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz);
- world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz);
-
- mypro->mygetcamerafoa(&c1x, &c1y, &c1z, 1);
- modulo = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
- c1x = (c1x-camx)*modulo;
- c1y = (c1y-camy)*modulo;
- c1z = (c1z-camz)*modulo;
- distance=distance*3;
- world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,camx,camy,camz);
- }
- else {
- world->clear_camera_lines();
- }
-
-
- //mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,1);
-}
-
-void
-kinectViewergui::on_w_lines_rgb_toggled() {
- if (w_lines_rgb->get_active()) {
- lines_rgb_active=true;
- }
- else
- lines_rgb_active=false;
-}
-
-void
-kinectViewergui::on_w_lines_depth_toggled() {
- if (w_lines_depth->get_active()) {
- lines_depth_active=true;
- }
- else
- lines_depth_active=false;
-}
-
-void
-kinectViewergui::on_w_view_controller_activate() {
- w_window_controller->show();
-}
-
-void
-kinectViewergui::on_w_radio_depth_activate() {
- if (w_radio_depth->get_active())
- world->draw_kinect_with_color=false;
-}
-
-void
-kinectViewergui::on_w_radio_mode_pointcloud_activate() {
- if (w_radio_mode_pointcloud->get_active())
- reconstructMode=1;
-}
-
-void
-kinectViewergui::on_w_radio_mode_image_activate() {
- if (w_radio_mode_image->get_active())
- reconstructMode=0;
-}
-
-void
-kinectViewergui::on_w_radio_rgb_activate() {
- if (w_radio_rgb->get_active())
- world->draw_kinect_with_color=true;
-}
-
-void
-kinectViewergui::on_clicked_clear_lines() {
- world->clearExtraLines();
-}
-
-void
-kinectViewergui::on_w_tg_gl_toggled() {
- if (w_tg_gl->get_active()) {
- w_window_gl->show();
- w_vbox_gl->show();
- }
- else {
- w_window_gl->hide();
- w_vbox_gl->hide();
- }
-}
-
-float
-kinectViewergui::getCycle() {
- return this->cycle;
-}
-
-} // namespace
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewergui.glade
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewergui.glade 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewergui.glade 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,604 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<glade-interface>
- <!-- interface-requires gtk+ 2.16 -->
- <!-- interface-naming-policy project-wide -->
- <widget class="GtkWindow" id="kinectViewer">
- <property name="title" translatable="yes">kinectViewer</property>
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <child>
- <widget class="GtkMenuBar" id="menubar2">
- <property name="visible">True</property>
- <child>
- <widget class="GtkMenuItem" id="menuitem5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_File</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu4">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem11">
- <property name="label">gtk-new</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem12">
- <property name="label">gtk-open</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem13">
- <property name="label">gtk-save</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem14">
- <property name="label">gtk-save-as</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem15">
- <property name="label">gtk-quit</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu5">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem16">
- <property name="label">gtk-cut</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem17">
- <property name="label">gtk-copy</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem18">
- <property name="label">gtk-paste</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem19">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu7">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImageMenuItem" id="view_controller">
- <property name="label" translatable="yes">Controller</property>
- <property name="visible">True</property>
- <property name="use_stock">False</property>
- <child internal-child="image">
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-missing-image</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="menuitem8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu6">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImageMenuItem" id="imagemenuitem20">
- <property name="label">gtk-about</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <child>
- <widget class="GtkEventBox" id="eventboxRGB">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImage" id="imageRGB">
- <property name="visible">True</property>
- <property name="stock">gtk-missing-image</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator1">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkEventBox" id="eventboxDEPTH">
- <property name="visible">True</property>
- <child>
- <widget class="GtkImage" id="imageDEPTH">
- <property name="visible">True</property>
- <property name="stock">gtk-missing-image</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator2">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHSeparator" id="hseparator1">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <widget class="GtkWindow" id="window_controller">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Controller</property>
- <child>
- <widget class="GtkVBox" id="vbox3">
- <property name="visible">True</property>
- <child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <child>
- <widget class="GtkToggleButton" id="toggle_rgb">
- <property name="label" translatable="yes">Camera RGB</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToggleButton" id="toggle_depth">
- <property name="label" translatable="yes">Camera Depth</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <child>
- <widget class="GtkVBox" id="vbox_Pose3DMotors">
- <child>
- <widget class="GtkButton" id="button_up">
- <property name="label" translatable="yes">UP</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_down">
- <property name="label" translatable="yes">DOWN</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox_leds">
- <child>
- <widget class="GtkButton" id="buttonled_off">
- <property name="label" translatable="yes">OFF</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="buttonled_green">
- <property name="label" translatable="yes">GREEN</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="buttonled_red">
- <property name="label" translatable="yes">RED</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="buttonled_yellow">
- <property name="label" translatable="yes">YELLOW</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="buttonled_bgreen">
- <property name="label" translatable="yes">BGREEN</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="buttonled_bred">
- <property name="label" translatable="yes">BRED</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">5</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHSeparator" id="hseparator2">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <child>
- <widget class="GtkToggleButton" id="tg_gl">
- <property name="label" translatable="yes">View World</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_gl">
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <child>
- <widget class="GtkToggleButton" id="toggle_lines_rgb">
- <property name="label" translatable="yes">Show room on rgb</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToggleButton" id="toggle_lines_depth">
- <property name="label" translatable="yes">Show room on depth</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_clear_lines">
- <property name="label" translatable="yes">Clear projection lines</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <child>
- <widget class="GtkToggleButton" id="toggle_reconstruct">
- <property name="label" translatable="yes">Reconstruct</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator3">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_reconstruct_mode">
- <child>
- <widget class="GtkRadioButton" id="radio_mode_pointcloud">
- <property name="label" translatable="yes">PointCloud</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radio_mode_image">
- <property name="label" translatable="yes">Images cnv</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="yalign">0.52999997138977051</property>
- <property name="draw_indicator">True</property>
- <property name="group">radio_mode_pointcloud</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator4">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vbox_reconstruct_selection">
- <child>
- <widget class="GtkRadioButton" id="radio_depth">
- <property name="label" translatable="yes">DEPTH</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radio_rgb">
- <property name="label" translatable="yes">RGB on DEPTH</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radio_depth</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator5">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- <child>
- <widget class="GtkToggleButton" id="toggle_camera_pos">
- <property name="label" translatable="yes">Camera Position</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </widget>
- <packing>
- <property name="position">6</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <widget class="GtkWindow" id="window_gl">
- <property name="width_request">640</property>
- <property name="height_request">480</property>
- <property name="title" translatable="yes">World</property>
- <child>
- <widget class="GtkDrawingArea" id="gl_world">
- <property name="height_request">300</property>
- <property name="visible">True</property>
- </widget>
- </child>
- </widget>
-</glade-interface>
Deleted: trunk/src/stable/components/rgbdViewer/kinectViewergui.h
===================================================================
--- trunk/src/stable/components/kinectViewer/kinectViewergui.h 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/kinectViewergui.h 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- *
- * Author : Jose María Cañas <jmplaza en gsyc.es>
- Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
-
- */
-
-#ifndef kinectViewer_VIEW_H
-#define kinectViewer_VIEW_H
-
-#include <string>
-#include <iostream>
-#include <gtkmm.h>
-#include <libglademm.h>
-#include "drawarea.h"
-#include <visionlib/colorspaces/colorspacesmm.h>
-#include <jderobot/camera.h>
-#include <IceUtil/Thread.h>
-#include <IceUtil/Time.h>
-#include "myprogeo.h"
-#include <cv.h>
-#include <highgui.h>
-#include "util3d.h"
-
-namespace kinectViewer {
- class kinectViewergui {
- public:
-
- kinectViewergui(bool rgb, bool depth,bool pointCloud , std::string path, std::string path_rgb, std::string path_ir, int width, int height, float cycle);
- virtual ~kinectViewergui();
-
- /*Return true if the windows is visible*/
- bool isVisible();
-
-
- /*Display window*/
- void updateAll( cv::Mat imageRGB, cv::Mat imageDEPTH, std::vector<jderobot::RGBPoint> cloud );
- void updateRGB( cv::Mat imageRGB);
- void updateDEPTH(cv::Mat imageDEPTH );
- void updatePointCloud(std::vector<jderobot::RGBPoint> cloud);
- bool isClosed();
- float getCycle();
-
- private:
- float cycle;
-
-
- Glib::RefPtr<Gnome::Glade::Xml> refXml;
- Gtk::Main gtkmain;
- Gtk::Window *mainwindow;
- Gtk::Window *w_window_controller;
- Gtk::Window *w_window_gl;
- Gtk::Image* w_imageRGB;
- Gtk::Image* w_imageDEPTH;
- Gtk::EventBox *w_event_rgb;
- Gtk::EventBox *w_event_depth;
- Gtk::ToggleButton *w_reconstruct;
- Gtk::ToggleButton *w_camera_pos;
- Gtk::ToggleButton *w_tg_gl;
- Gtk::ToggleButton *w_lines_rgb;
- Gtk::ToggleButton *w_lines_depth;
- Gtk::ToggleButton *w_toggle_rgb;
- Gtk::ToggleButton *w_toggle_depth;
- Gtk::ImageMenuItem *w_view_controller;
- Gtk::VBox * w_reconstruct_selection;
- Gtk::VBox * w_reconstruct_mode;
- Gtk::VBox * w_vbox_gl;
- Gtk::RadioButton *w_radio_depth;
- Gtk::RadioButton *w_radio_rgb;
- Gtk::RadioButton *w_radio_mode_pointcloud;
- Gtk::RadioButton *w_radio_mode_image;
- Gtk::Button *w_button_clear_lines;
- util3d* util;
- DrawArea* world;
- int cWidth, cHeight;
- int reconstructMode;
- int modesAvalables;
- int cam_rgb_active;
- int cam_depth_active;
-
- void displayFrameRate();
- IceUtil::Time currentFrameTime,oldFrameTime;
- double fps;
- int frameCount;
-
- myprogeo *mypro;
- bool lines_depth_active;
- bool lines_rgb_active;
-
- bool on_clicked_event_rgb(GdkEventButton* event);
- bool on_clicked_event_depth(GdkEventButton* event);
- bool reconstruct_depth_activate;
- void on_reconstruct_depth();
- void add_depth_pointsImage(cv::Mat imageRGB, cv::Mat distance);
- void add_depth_pointsCloud(std::vector<jderobot::RGBPoint> cloud);
- void add_cameras_position();
- void add_camera_position();
- void on_w_lines_rgb_toggled();
- void on_w_lines_depth_toggled();
- void on_w_view_controller_activate();
- void on_w_radio_depth_activate();
- void on_w_radio_rgb_activate();
- void on_w_radio_mode_pointcloud_activate();
- void on_w_radio_mode_image_activate();
- void on_clicked_clear_lines();
- void on_w_tg_gl_toggled();
-
-
-
-
- };
-} // namespace
-
-#endif /*kinectViewer_VIEW_H*/
Modified: trunk/src/stable/components/rgbdViewer/myprogeo.cpp
===================================================================
--- trunk/src/stable/components/kinectViewer/myprogeo.cpp 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/myprogeo.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ * Copyright (C) 1997-2013 JDE Developers TeamrgbdViewer.camRGB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,8 +22,15 @@
#include "myprogeo.h"
-namespace kinectViewer {
-myprogeo::myprogeo(){
+
+namespace rgbdViewer {
+myprogeo::myprogeo(int nCam, int w, int h){
+
+ for (int i=0; i< nCam; i++){
+ cameras[i]=new Progeo::Progeo();
+ }
+ this->w=w;
+ this->h=h;
std::cout << "CREADO" << std::endl;
}
@@ -31,95 +38,148 @@
}
+void myprogeo::pixel2optical(float*x,float*y){
+ int localX=*x;
+ int localY=*y;
+
+ *x= this->h-1-localY;
+ *y= localX;
+}
+
+void myprogeo::optical2pixel(float*x,float*y){
+
+ int localX=*x;
+ int localY=*y;
+
+ *x= localY;
+ *y= this->h-1-localX;
+}
+
+void myprogeo::new_camera(){
+
+}
+
+
/* gets the calibration of the camera from a file */
void myprogeo::load_cam(char *fich_in,int cam, int w, int h)
{
FILE *entrada;
int i;
if (strlen(fich_in) ==0 ){
- std::cout << w << ", " << h << std::endl;
- this->cameras[cam].fdistx=515;
- this->cameras[cam].fdisty=515;
- this->cameras[cam].u0=h/2;
- this->cameras[cam].v0=w/2;
- this->cameras[cam].position.X=0;
- this->cameras[cam].position.Y=0;
- this->cameras[cam].position.Z=0;
- this->cameras[cam].foa.X=0;
- this->cameras[cam].foa.Y=1;
- this->cameras[cam].foa.Z=0;
- this->cameras[cam].skew=0;
- this->cameras[cam].roll=0;
- update_camera_matrix(&cameras[cam]);
+ Eigen::Matrix3d K;
+ K(0,0) = 511;
+ K(0,1) = 0;
+ K(0,2) = w/2;
+ K(1,0) = 0;
+ K(1,1) = 511;
+ K(1,2) = h/2;
+
+ K(2,0) = 0;
+ K(2,1) = 0;
+ K(2,2) = 1;
+
+ this->cameras[cam]->setKMatrix(K);
+
+ Eigen::Vector4d pos;
+ pos(0)=0;
+ pos(1)=0;
+ pos(2)=0;
+ pos(3)=1;
+ this->cameras[cam]->setPosition (pos);
+
+ Eigen::Vector4d foa;
+ foa(0)=0;
+ foa(1)=1;
+ foa(2)=0;
+ foa(3)=1;
+ this->cameras[cam]->setFoaRoll(foa,0.);
+
+ //this->cameras[cam]->updateKMatrix();
+ this->cameras[cam]->updateRTMatrix();
+
}
else{
- xmlReader(&(this->cameras[cam]), fich_in);
- update_camera_matrix(&cameras[cam]);
+ this->cameras[cam]->readFromFile(std::string(fich_in));
+ //this->cameras[cam]->updateKMatrix();
+ this->cameras[cam]->updateRTMatrix();
}
-
- display_camerainfo(cameras[cam]);
+ this->cameras[cam]->displayCameraInfo();
}
void
myprogeo::mybackproject(float x, float y, float* xp, float* yp, float* zp, float* camx, float* camy, float* camz, int cam){
- HPoint2D p;
- HPoint3D pro;
+ Eigen::Vector3d p;
+ Eigen::Vector4d pro;
+
+ pixel2optical(&x, &y);
+ p(0)=x;
+ p(1)=y;
+ p(2)=1;
+ this->cameras[cam]->backproject(p,pro);
+ *xp=pro(0);
+ *yp=pro(1);
+ *zp=pro(2);
- p.x=GRAPHIC_TO_OPTICAL_X(x,y);
- p.y=GRAPHIC_TO_OPTICAL_Y(x,y);
- p.h=1;
- backproject(&pro,p,cameras[cam]);
- *xp=pro.X;
- *yp=pro.Y;
- *zp=pro.Z;
- *camx=cameras[cam].position.X;
- *camy=cameras[cam].position.Y;
- *camz=cameras[cam].position.Z;
+
+ Eigen::Vector4d pos;
+
+ pos=this->cameras[cam]->getPosition();
+
+ *camx=pos(0);
+ *camy=pos(1);
+ *camz=pos(2);
}
void
myprogeo::myproject(float x, float y, float z, float* xp, float* yp, int cam){
- HPoint2D p;
- HPoint3D p3;
+ Eigen::Vector3d p;
+ Eigen::Vector4d p3;
- p3.X=x;
- p3.Y=y;
- p3.Z=z;
- p3.H=1;
+ p3(0)=x;
+ p3(1)=y;
+ p3(2)=z;
+ p3(3)=1;
- project(p3, &p, cameras[cam]);
- *xp=p.x;
- *yp=p.y;
+ this->cameras[cam]->project(p3,p);
+ *xp=p(0);
+ *yp=p(1);
}
void
myprogeo::mygetcameraposition(float *x, float *y, float *z, int cam){
- *x=cameras[cam].position.X;
- *y=cameras[cam].position.Y;
- *z=cameras[cam].position.Z;
+ Eigen::Vector4d pos;
+
+ pos=this->cameras[cam]->getPosition();
+
+ *x=pos(0);
+ *y=pos(1);
+ *z=pos(2);
}
void
myprogeo::mygetcamerafoa(float *x, float *y, float *z, int cam){
- *x=cameras[cam].foa.X;
- *y=cameras[cam].foa.Y;
- *z=cameras[cam].foa.Z;
+ Eigen::Vector4d foa;
+
+ foa=this->cameras[cam]->getFoa();
+ *x=foa(0);
+ *y=foa(1);
+ *z=foa(2);
}
void
myprogeo::mygetcamerasize(float *w, float *h, int cam){
- *w = cameras[cam].columns;
- *h = cameras[cam].rows;
+ *w = this->w;
+ *h = this->h;
}
-TPinHoleCamera
+Progeo::Progeo*
myprogeo::getCamera(int camera){
return cameras[camera];
}
Modified: trunk/src/stable/components/rgbdViewer/myprogeo.h
===================================================================
--- trunk/src/stable/components/kinectViewer/myprogeo.h 2013-10-10 10:48:39 UTC (rev 1029)
+++ trunk/src/stable/components/rgbdViewer/myprogeo.h 2013-10-10 13:57:26 UTC (rev 1031)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ * Copyright (C) 1997-2013 JDE Developers TeamrgbdViewer.camRGB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,29 +19,26 @@
*/
-#ifndef KINECTVIEWER_MYPROGEO_H
-#define KINECTVIEWER_MYPROGEO_H
+#ifndef rgbdViewer_MYPROGEO_H
+#define rgbdViewer_MYPROGEO_H
-#include <progeo/progeo.h>
+#include <geometry/progeo/Progeo.h>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <vector>
+#include <cmath>
/* GRAPHIC coordenates to OPTICAL coordenates */
-#define WORKING_IMG_HEIGHT 480
-#define GRAPHIC_TO_OPTICAL_X(x,y) (WORKING_IMG_HEIGHT-1-y)
-#define GRAPHIC_TO_OPTICAL_Y(x,y) (x)
-#define OPTICAL_TO_GRAPHIC_X(x,y) (y)
-#define OPTICAL_TO_GRAPHIC_Y(x,y) (WORKING_IMG_HEIGHT-1-x)
#define MAX_CAMERAS 8
#define MAX_BUFFER 1024
-namespace kinectViewer {
+namespace rgbdViewer {
class myprogeo {
public:
- myprogeo();
+ myprogeo(int nCam, int w, int h);
~myprogeo();
void load_cam(char *fich_in,int cam, int w, int h);
void mybackproject(float x, float y, float* xp, float* yp, float* zp, float* camx, float* camy, float* camz, int cam);
@@ -49,12 +46,17 @@
void mygetcameraposition(float *x, float *y, float *z, int cam);
void mygetcamerafoa(float *x, float *y, float *z, int cam);
void mygetcamerasize(float *w, float *h, int cam);
- TPinHoleCamera getCamera(int camera);
+ Progeo::Progeo* getCamera(int camera);
+ void new_camera();
private:
+ void pixel2optical(float*x,float*y);
+ void optical2pixel(float* x, float* y);
+
/* cameras */
- TPinHoleCamera cameras[MAX_CAMERAS];
+ Progeo::Progeo* cameras[MAX_CAMERAS];
+ int w,h;
};
} // namespace
-#endif /*KINECTVIEWER_MYPROGEO_H*/
+#endif /*rgbdViewer_MYPROGEO_H*/
Copied: trunk/src/stable/components/rgbdViewer/rgbdViewer.cfg (from rev 1029, trunk/src/stable/components/kinectViewer/kinectViewer.cfg)
===================================================================
--- trunk/src/stable/components/rgbdViewer/rgbdViewer.cfg (rev 0)
+++ trunk/src/stable/components/rgbdViewer/rgbdViewer.cfg 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,18 @@
+rgbdViewer.CameraRGBActive=1
+rgbdViewer.CameraRGB.Proxy=cameraA:tcp -h 127.0.0.1 -p 9998
+rgbdViewer.CameraDEPTHActive=1
+rgbdViewer.CameraDEPTH.Proxy=cameraB:tcp -h 127.0.0.1 -p 9998
+rgbdViewer.pointCloudActive=1
+rgbdViewer.pointCloud.Proxy=pointcloud1:tcp -h 127.0.0.1 -p 9998
+rgbdViewer.Pose3DMotorsActive=0
+rgbdViewer.Pose3DMotors.Proxy=Pose3DMotors1:tcp -h 127.0.0.1 -p 9998
+rgbdViewer.KinectLedsActive=0
+rgbdViewer.KinectLeds.Proxy=kinectleds1:tcp -h 127.0.0.1 -p 9998
+rgbdViewer.WorldFile=./config/lambecom.cfg
+#rgbdViewer.camRGB=camera-0.cfg
+#rgbdViewer.camIR=camera-0.cfg
+rgbdViewer.camRGB=cameraB.xml
+rgbdViewer.camIR=cameraB.xml
+rgbdViewer.Width=320
+rgbdViewer.Height=240
+rgbdViewer.Fps=15
Copied: trunk/src/stable/components/rgbdViewer/rgbdViewer.cpp (from rev 1029, trunk/src/stable/components/kinectViewer/kinectViewer.cpp)
===================================================================
--- trunk/src/stable/components/rgbdViewer/rgbdViewer.cpp (rev 0)
+++ trunk/src/stable/components/rgbdViewer/rgbdViewer.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 1997-2013 JDE Developers TeamrgbdViewer.camRGB
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ * Author : Jose María Cañas <jmplaza en gsyc.es>
+ Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+
+
+
+
+#include <iostream>
+#include <Ice/Ice.h>
+#include <IceUtil/IceUtil.h>
+#include <jderobot/pointcloud.h>
+#include "rgbdViewergui.h"
+#include "pthread.h"
+#include "parallelIce/cameraClient.h"
+#include "parallelIce/pointcloudClient.h"
+
+
+
+#define MAX_COMPONENTS 20
+
+rgbdViewer::rgbdViewergui* rgbdViewergui_ptx;
+
+jderobot::cameraClient* camRGB=NULL;
+jderobot::cameraClient* camDEPTH=NULL;
+jderobot::pointcloudClient* pcClient=NULL;
+
+
+
+
+void *gui_thread(void* arg){
+ try{
+ //local data
+ std::vector<jderobot::RGBPoint> cloud;
+ cv::Mat rgb,depth;
+
+ struct timeval post;
+ long long int totalpre=0;
+ long long int totalpost=0;
+
+ //std::cout << "******************************** entro" << std::endl;
+ while(rgbdViewergui_ptx->isVisible() && ! rgbdViewergui_ptx->isClosed()){
+ //std::cout << "******************************** entro1" << std::endl;
+ gettimeofday(&post,NULL);
+ totalpost=post.tv_sec*1000000+post.tv_usec;
+
+ if (camRGB!=NULL)
+ rgb=camRGB->getImage();
+ if (camDEPTH!=NULL)
+ depth=camDEPTH->getImage();
+ if (pcClient!=NULL)
+ cloud=pcClient->getData();
+
+
+ if ((rgb.rows!=0)&&(depth.rows!=0)){
+ rgbdViewergui_ptx->updateAll(rgb,depth, cloud);
+ }
+ else if (rgb.rows!=0){
+ rgbdViewergui_ptx->updateRGB(rgb);
+ }
+ else if (depth.rows!=0){
+ rgbdViewergui_ptx->updateDEPTH(depth);
+ }
+ else{
+ rgbdViewergui_ptx->updatePointCloud(cloud);
+ }
+ if (totalpre !=0){
+ if ((totalpost - totalpre) > rgbdViewergui_ptx->getCycle() ){
+ std::cout<<"-------- rgbdViewer: timeout-" << std::endl;
+ }
+ else{
+ usleep(rgbdViewergui_ptx->getCycle() - (totalpost - totalpre));
+ }
+ }
+ totalpre=totalpost;
+
+
+ }
+ }catch (const Ice::Exception& ex) {
+ std::cerr << ex << std::endl;
+ }
+ catch (const char* msg) {
+ std::cerr << msg << std::endl;
+ }
+ pthread_exit(NULL);
+ return NULL;
+}
+
+/**
+ * \brief Main program function code
+ */
+int main(int argc, char** argv){
+
+ int status,i;
+ Ice::CommunicatorPtr ic;
+ int n_components=0;
+ pthread_t threads[MAX_COMPONENTS];
+ pthread_attr_t attr;
+ Ice::PropertiesPtr prop;
+ bool create_gui=false;
+
+
+
+ bool rgbCamSelected=false;
+ bool depthCamSelected=false;
+ bool pointCloudSelected=false;
+ int globalWidth;
+ int globalHeight;
+
+
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+ try{
+ ic = Ice::initialize(argc,argv);
+ prop = ic->getProperties();
+ }catch (const Ice::Exception& ex) {
+ std::cerr << ex << std::endl;
+ return 1;
+ }
+ catch (const char* msg) {
+ std::cerr <<"Error :" << msg << std::endl;
+ return 1;
+ }
+ if (prop->getPropertyAsIntWithDefault("rgbdViewer.CameraRGBActive",0)){
+ camRGB = new jderobot::cameraClient(ic,"rgbdViewer.CameraRGB.",false);
+ if (camRGB != NULL){
+ rgbCamSelected=true;
+ camRGB->start();
+ create_gui=true;
+ }
+
+ }
+ if (prop->getPropertyAsIntWithDefault("rgbdViewer.CameraDEPTHActive",0)){
+ camDEPTH = new jderobot::cameraClient(ic,"rgbdViewer.CameraDEPTH.",false);
+ if (camDEPTH != NULL){
+ depthCamSelected=true;
+ camDEPTH->start();
+ create_gui=true;
+ }
+ }
+
+
+ if (prop->getPropertyAsIntWithDefault("rgbdViewer.pointCloudActive",0)){
+ pcClient = new jderobot::pointcloudClient(ic,"rgbdViewer.pointCloud.",false);
+ if (pcClient!= NULL){
+ pcClient->start();
+ pointCloudSelected=true;
+ create_gui=true;
+ }
+ }
+
+ globalHeight=prop->getPropertyAsIntWithDefault("rgbdViewer.Height",240);
+ globalWidth=prop->getPropertyAsIntWithDefault("rgbdViewer.Width",320);
+ int fps=prop->getPropertyAsIntWithDefault("rgbdViewer.Fps",10);
+ float cycle=(float)(1/(float)fps)*1000000;
+
+
+ std::cout << rgbCamSelected <<", " << depthCamSelected << ", " << pointCloudSelected << std::endl;
+
+ rgbdViewergui_ptx = new rgbdViewer::rgbdViewergui(rgbCamSelected,depthCamSelected, pointCloudSelected, prop->getProperty("rgbdViewer.WorldFile"), prop->getProperty("rgbdViewer.camRGB"), prop->getProperty("rgbdViewer.camIR"),globalWidth,globalHeight, cycle);
+
+ if (create_gui){
+ pthread_create(&threads[n_components], &attr, gui_thread,NULL);
+ n_components++;
+ }
+
+
+ if (rgbdViewergui_ptx == NULL)
+ throw "rgbdViewer: Could not create the grafic interface";
+ for (i = 0; i < n_components; i++) {
+ pthread_join(threads[i], NULL);
+ }
+
+ if (camRGB!=NULL)
+ delete camRGB;
+ if (camDEPTH!=NULL)
+ delete camDEPTH;
+ if (pcClient!=NULL)
+ delete pcClient;
+
+
+ if (ic)
+ ic->destroy();
+ return status;
+}
Copied: trunk/src/stable/components/rgbdViewer/rgbdViewergui.cpp (from rev 1029, trunk/src/stable/components/kinectViewer/kinectViewergui.cpp)
===================================================================
--- trunk/src/stable/components/rgbdViewer/rgbdViewergui.cpp (rev 0)
+++ trunk/src/stable/components/rgbdViewer/rgbdViewergui.cpp 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,605 @@
+/*
+ * Copyright (C) 1997-2013 JDE Developers TeamrgbdViewer.camRGB
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ * Author : Jose María Cañas <jmplaza en gsyc.es>
+ Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+#include "rgbdViewergui.h"
+#include <jderobot/pointcloud.h>
+
+namespace rgbdViewer {
+rgbdViewergui::rgbdViewergui(bool rgb, bool depth,bool pointCloud , std::string path, std::string path_rgb, std::string path_ir, int width, int height, float cycle): gtkmain(0,0) {
+
+ /*Init OpenGL*/
+ if(!Gtk::GL::init_check(NULL, NULL)) {
+ std::cerr << "Couldn't initialize GL\n";
+ std::exit(1);
+ }
+ this->cycle=cycle;
+
+ if (rgb)
+ cam_rgb_active=1;
+ else
+ cam_rgb_active=0;
+ if (depth)
+ cam_depth_active=1;
+ else
+ cam_depth_active=0;
+ modesAvalables=0;
+ if (pointCloud) {
+ if ((rgb)&&(depth)) {
+ reconstructMode=1;
+ modesAvalables=2; //only one mode
+ }
+ else {
+ reconstructMode=1;
+ modesAvalables=1; //both modes
+ }
+ }
+ else {
+ if ((rgb)&&(depth)) {
+ reconstructMode=1;
+ modesAvalables=1; //only point cloud mode
+ }
+ else {
+ reconstructMode=0;
+ modesAvalables=0; // no mode available
+ }
+ }
+
+ reconstruct_depth_activate=false;
+ lines_depth_active=false;
+ lines_rgb_active=false;
+ std::cout << "Loading glade\n";
+ refXml = Gnome::Glade::Xml::create("./rgbdViewergui.glade");
+ cWidth=width;
+ cHeight=height;
+
+
+
+
+ /*Get widgets*/
+ refXml->get_widget("rgbdViewer", mainwindow);
+ refXml->get_widget("imageRGB", w_imageRGB);
+ refXml->get_widget("imageDEPTH", w_imageDEPTH);
+ refXml->get_widget("eventboxRGB", w_event_rgb);
+ refXml->get_widget("eventboxDEPTH", w_event_depth);
+ refXml->get_widget("toggle_reconstruct", w_reconstruct);
+ refXml->get_widget("toggle_camera_pos", w_camera_pos);
+ refXml->get_widget("toggle_lines_rgb", w_lines_rgb);
+ refXml->get_widget("toggle_lines_depth", w_lines_depth);
+ refXml->get_widget("toggle_depth", w_toggle_depth);
+ refXml->get_widget("toggle_rgb", w_toggle_rgb);
+ refXml->get_widget("view_controller",w_view_controller);
+ refXml->get_widget("window_controller",w_window_controller);
+ refXml->get_widget("vbox_reconstruct_selection",w_reconstruct_selection);
+ refXml->get_widget("vbox_reconstruct_mode",w_reconstruct_mode);
+ refXml->get_widget("radio_mode_pointcloud",w_radio_mode_pointcloud);
+ refXml->get_widget("radio_mode_image",w_radio_mode_image);
+ refXml->get_widget("radio_depth",w_radio_depth);
+ refXml->get_widget("radio_rgb",w_radio_rgb);
+ refXml->get_widget("button_clear_lines",w_button_clear_lines);
+ refXml->get_widget("window_gl",w_window_gl);
+ refXml->get_widget("tg_gl",w_tg_gl);
+ refXml->get_widget("vbox_gl",w_vbox_gl);
+
+ if (!cam_rgb_active) {
+ w_toggle_rgb->hide();
+ }
+ if (!cam_depth_active) {
+ w_toggle_depth->hide();
+ }
+
+ w_event_rgb->signal_button_press_event().connect(sigc::mem_fun(this,&rgbdViewergui::on_clicked_event_rgb));
+ w_event_depth->signal_button_press_event().connect(sigc::mem_fun(this,&rgbdViewergui::on_clicked_event_depth));
+ w_reconstruct->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_reconstruct_depth));
+ w_camera_pos->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::add_camera_position));
+ w_lines_rgb->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_lines_rgb_toggled));
+ w_lines_depth->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_lines_depth_toggled));
+ w_tg_gl->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_tg_gl_toggled));
+ w_view_controller->signal_activate().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_view_controller_activate));
+ w_radio_depth->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_radio_depth_activate));
+ w_radio_rgb->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_radio_rgb_activate));
+ w_radio_mode_pointcloud->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_radio_mode_pointcloud_activate));
+ w_radio_mode_image->signal_toggled().connect(sigc::mem_fun(this,&rgbdViewergui::on_w_radio_mode_image_activate));
+ w_button_clear_lines->signal_clicked().connect(sigc::mem_fun(this,&rgbdViewergui::on_clicked_clear_lines));
+
+ if (modesAvalables==0) {
+ w_reconstruct->hide();
+ }
+
+ // Mundo OpenGL
+ refXml->get_widget_derived("gl_world",world);
+ world->setCamerasResolution(width,height);
+
+ std::cout << "Creating Progeos Virtual Cameras" << std::endl;
+ mypro= new rgbdViewer::myprogeo(2,width,height);
+ mypro->load_cam((char*)path_rgb.c_str(),0,width, height);
+
+ mypro->load_cam((char*)path_ir.c_str(),1,width, height);
+ //util = new rgbdViewer::util3d(mypro);
+
+ /*Show window. Note: Set window visibility to false in Glade, otherwise opengl won't work*/
+ world->readFile(path);
+ mainwindow->show();
+
+}
+
+rgbdViewergui::~rgbdViewergui() {
+ //delete this->controller;
+}
+
+
+void
+rgbdViewergui::updateAll( cv::Mat imageRGB, cv::Mat imageDEPTH, std::vector<jderobot::RGBPoint> cloud )
+{
+ //std::cout << imageRGB.rows << std::endl;
+
+ cv::Mat distance(imageRGB.rows, imageRGB.cols, CV_32FC1);
+ cv::Mat colorDepth(imageDEPTH.size(),imageDEPTH.type());
+ CvPoint pt1,pt2;
+ if (w_toggle_rgb->get_active()) {
+ Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageRGB.data,Gdk::COLORSPACE_RGB,false,8,imageRGB.cols,imageRGB.rows,imageRGB.step);
+ w_imageRGB->clear();
+ /*si queremos pintar las lineas*/
+ if (lines_rgb_active) {
+ //util->draw_room(imageRGB,0, world->lines, world->numlines);
+ }
+ w_imageRGB->set(imgBuff);
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+ }
+ if (w_toggle_depth->get_active()||((reconstruct_depth_activate)&&(reconstructMode==0))) {
+
+ /*split channels to separate distance from image*/
+ std::vector<cv::Mat> layers;
+ cv::split(imageDEPTH, layers);
+
+ cv::cvtColor(layers[0],colorDepth,CV_GRAY2RGB);
+ /*cv::imshow("color", colorDepth);
+ cv::waitKey(1);*/
+
+ for (int x=0; x< layers[1].cols ; x++) {
+ for (int y=0; y<layers[1].rows; y++) {
+ distance.at<float>(y,x) = ((int)layers[1].at<unsigned char>(y,x)<<8)|(int)layers[2].at<unsigned char>(y,x);
+ }
+ }
+
+ if (w_toggle_depth->get_active()) {
+ cv::Mat localDepth;
+ Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) colorDepth.data,Gdk::COLORSPACE_RGB,false,8,colorDepth.cols,colorDepth.rows,colorDepth.step);
+ w_imageDEPTH->clear();
+ if (lines_depth_active) {
+ //util->draw_room(colorDepth,1, world->lines, world->numlines);
+ }
+ w_imageDEPTH->set(imgBuff);
+ }
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+ }
+ if (reconstruct_depth_activate) {
+ if (reconstructMode==0) {
+ add_depth_pointsImage(imageRGB, distance);
+ }
+ else
+ add_depth_pointsCloud(cloud);
+ }
+ world->my_expose_event();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+}
+
+void
+rgbdViewergui::updateRGB( cv::Mat imageRGB)
+{
+ CvPoint pt1,pt2;
+ if (w_toggle_rgb->get_active()) {
+ Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageRGB.data,Gdk::COLORSPACE_RGB,false,8,imageRGB.cols,imageRGB.rows,imageRGB.step);
+ w_imageRGB->clear();
+ /*si queremos pintar las lineas*/
+ if (lines_rgb_active) {
+ //util->draw_room(imageRGB,0, world->lines, world->numlines);
+
+ }
+ w_imageRGB->set(imgBuff);
+ displayFrameRate();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+ }
+ if (reconstruct_depth_activate) {
+ if (reconstructMode!=0) {
+ //add_depth_pointsCloud();
+ }
+ }
+ world->my_expose_event();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+}
+
+void
+rgbdViewergui::updateDEPTH(cv::Mat imageDEPTH )
+{
+ CvPoint pt1,pt2;
+ if (w_toggle_depth->get_active()) {
+ Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) imageDEPTH.data,Gdk::COLORSPACE_RGB,false,8,imageDEPTH.cols,imageDEPTH.rows,imageDEPTH.step);
+ w_imageDEPTH->clear();
+ if (lines_depth_active) {
+ //util->draw_room(imageDEPTH,1, world->lines, world->numlines);
+
+ }
+ w_imageDEPTH->set(imgBuff);
+ displayFrameRate();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+ }
+ if (reconstruct_depth_activate) {
+ if (reconstructMode!=0) {
+ //add_depth_pointsCloud();
+ }
+ }
+ world->my_expose_event();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+}
+
+void
+rgbdViewergui::updatePointCloud(std::vector<jderobot::RGBPoint> cloud )
+{
+ displayFrameRate();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+ if (reconstruct_depth_activate) {
+ if (reconstructMode==1) {
+ add_depth_pointsCloud(cloud);
+ }
+ }
+ world->my_expose_event();
+ while (gtkmain.events_pending())
+ gtkmain.iteration();
+}
+
+
+bool rgbdViewergui::isClosed() {
+ return false;
+}
+
+bool rgbdViewergui::isVisible() {
+ return mainwindow->is_visible();
+}
+
+void rgbdViewergui::displayFrameRate()
+{
+ double diff;
+ IceUtil::Time diffT;
+
+ currentFrameTime = IceUtil::Time::now();
+ diff = (currentFrameTime - oldFrameTime).toMilliSecondsDouble();
+ if (diff < 1000.0)
+ frameCount++;
+ else {
+ oldFrameTime = currentFrameTime;
+ fps = frameCount*1000.0/diff;
+ frameCount=0;
+ // Display the frame rate
+ std::stringstream fpsString;
+ fpsString << "fps = " << int(fps);
+ //fpslabel->set_label(fpsString.str());
+ }
+}
+
+bool rgbdViewergui::on_clicked_event_rgb(GdkEventButton* event) {
+ int x,y;
+ float xp,yp,zp,camx,camy,camz;
+ float xu,yu,zu;
+ float k;
+
+ gdk_window_at_pointer(&x,&y);
+ mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,0);
+ xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+
+ k= 5000;
+ world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
+ return true;
+}
+
+
+bool rgbdViewergui::on_clicked_event_depth(GdkEventButton* event) {
+ int x,y;
+ float xp,yp,zp,camx,camy,camz;
+ float xu,yu,zu;
+ float k;
+
+ gdk_window_at_pointer(&x,&y);
+ mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,1);
+ xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+
+ k= 5000;
+ world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
+
+ world->add_line(k*xu + camx,k*yu + camy,k*zu + camz,camx,camy,camz);
+ return true;
+}
+
+void rgbdViewergui::add_cameras_position() {
+ int x,y;
+ float xp,yp,zp,camx,camy,camz;
+ float xu,yu,zu;
+ float k;
+
+ gdk_window_at_pointer(&x,&y);
+ mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,0);
+
+ xu=(xp-camx)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ yu=(yp-camy)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+ zu=(zp-camz)/sqrt((xp-camx)*(xp-camx) + (yp-camy)*(yp-camy) + (zp-camz)*(zp-camz));
+
+ k= 500;
+ world->add_line(camx+k*xu,camy+k*yu,camz+k*zu,camx,camy,camz);
+ world->add_line(1905,800,1240,camx,camy,camz);
+}
+
+void
+rgbdViewergui::on_reconstruct_depth() {
+ if (w_reconstruct->get_active()) {
+ reconstruct_depth_activate=true;
+ world->draw_kinect_points=true;
+ w_reconstruct_selection->show();
+ if (modesAvalables==2)
+ w_reconstruct_mode->show();
+ }
+ else {
+ reconstruct_depth_activate=false;
+ world->draw_kinect_points=false;
+ w_reconstruct_selection->hide();
+ }
+}
+
+void
+rgbdViewergui::add_depth_pointsImage(cv::Mat imageRGB, cv::Mat distance) {
+ float d;
+ //std::cout << "point image" << std::endl;
+
+ world->clear_points();
+ //std::cout << "inicio reconstrucción" << std::endl;
+ for (int xIm=0; xIm< cWidth; xIm++) {
+ for (int yIm=0; yIm<cHeight ; yIm++) {
+ d=distance.at<float>(yIm,xIm);
+ if (d!=0) {
+ //std::cout << d << std::endl;
+ //d=d*10;
+ float xp,yp,zp,camx,camy,camz;
+ float ux,uy,uz;
+ float x,y;
+ float k;
+ float c1x, c1y, c1z;
+ float fx,fy,fz;
+ float fmod;
+ float t;
+ float Fx,Fy,Fz;
+
+
+
+
+ mypro->mybackproject(xIm, yIm, &xp, &yp, &zp, &camx, &camy, &camz,0);
+
+
+
+ //vector unitario
+ float modulo;
+
+ modulo = sqrt(1/(((camx-xp)*(camx-xp))+((camy-yp)*(camy-yp))+((camz-zp)*(camz-zp))));
+ mypro->mygetcamerafoa(&c1x, &c1y, &c1z, 0);
+
+
+ fmod = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
+ fx = (c1x - camx)*fmod;
+ fy = (c1y - camy)*fmod;
+ fz = (c1z - camz) * fmod;
+ ux = (xp-camx)*modulo;
+ uy = (yp-camy)*modulo;
+ uz = (zp-camz)*modulo;
+
+ Fx= d*fx + camx;
+ Fy= d*fy + camy;
+ Fz= d*fz + camz;
+
+ /* calculamos el punto real */
+ t = (-(fx*camx) + (fx*Fx) - (fy*camy) + (fy*Fy) - (fz*camz) + (fz*Fz))/((fx*ux) + (fy*uy) + (fz*uz));
+
+
+
+ /*world->points[i][0]=distance*ux+camx;
+ world->points[i][1]=distance*uy+camy;
+ world->points[i][2]=distance*uz+camz;*/
+ //std::cout << c1x << "," << c1y << "," << c1f << "," << std::endl;
+ /*std::cout << xp-camx << "," << yp-camy<< "," << zp-camz << std::endl;
+ std::cout << ux << "," << uy<< "," << uz << std::endl;*/
+ //k= (80-yp)/uy;
+ //std::cout << "distancia" << distance << std::endl;
+ //std::cout<< t*ux + camx << ", " << t*uy + camy << ", " << t*uz + camz << std::endl;
+ world->add_kinect_point(t*ux + camx,t*uy+ camy,t*uz + camz,(int)imageRGB.data[3*(yIm*cWidth+xIm)],(int)imageRGB.data[3*(yIm*cWidth+xIm)+1],(int)imageRGB.data[3*(yIm*cWidth+xIm)+2]);
+
+ //world->add_line(distance*ux + camx,distance*uy+ camy,distance*uz + camz,camx,camy,camz);
+ }
+ }
+ }
+
+ //std::cout << "fin reconstrucción" << std::endl;
+}
+
+void
+rgbdViewergui::add_depth_pointsCloud(std::vector<jderobot::RGBPoint> cloud) {
+ world->clear_points();
+ for (std::vector<jderobot::RGBPoint>::iterator it = cloud.begin(); it != cloud.end(); ++it) {
+ world->add_kinect_point(it->x,it->y,it->z,(int)it->r,(int)it->g,(int)it->b);
+ }
+}
+
+void
+rgbdViewergui::add_camera_position() {
+ float c1x, c1y, c1z, c2x, c2y, c2z, c3x, c3y, c3z, c4x, c4y,c4z;
+ float camx, camy, camz;
+ float w,h;
+ float modulo,distance;
+
+
+ if (w_camera_pos->get_active()){
+ distance=300;
+ mypro->mygetcamerasize(&w,&h,1);
+ mypro->mybackproject(0,0,&c1x,&c1y,&c1z,&camx, &camy, &camz,1);
+ mypro->mybackproject(cWidth,0,&c2x,&c2y,&c2z,&camx, &camy, &camz,1);
+ mypro->mybackproject(0,cHeight,&c3x,&c3y,&c3z,&camx, &camy, &camz,1);
+ mypro->mybackproject(cWidth,cHeight,&c4x,&c4y,&c4z,&camx, &camy, &camz,1);
+
+ modulo = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
+ c1x = (c1x-camx)*modulo;
+ c1y = (c1y-camy)*modulo;
+ c1z = (c1z-camz)*modulo;
+
+ modulo = sqrt(1/(((camx-c2x)*(camx-c2x))+((camy-c2y)*(camy-c2y))+((camz-c2z)*(camz-c2z))));
+ c2x = (c2x-camx)*modulo;
+ c2y = (c2y-camy)*modulo;
+ c2z = (c2z-camz)*modulo;
+
+ modulo = sqrt(1/(((camx-c3x)*(camx-c3x))+((camy-c3y)*(camy-c3y))+((camz-c3z)*(camz-c3z))));
+ c3x = (c3x-camx)*modulo;
+ c3y = (c3y-camy)*modulo;
+ c3z = (c3z-camz)*modulo;
+
+ modulo = sqrt(1/(((camx-c4x)*(camx-c4x))+((camy-c4y)*(camy-c4y))+((camz-c4z)*(camz-c4z))));
+ c4x = (c4x-camx)*modulo;
+ c4y = (c4y-camy)*modulo;
+ c4z = (c4z-camz)*modulo;
+
+
+
+ world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,camx,camy,camz);
+ world->add_camera_line(distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz,camx,camy,camz);
+ world->add_camera_line(distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz,camx,camy,camz);
+ world->add_camera_line(distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz,camx,camy,camz);
+ world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz);
+ world->add_camera_line(distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz,distance*c2x + camx,distance*c2y+ camy,distance*c2z + camz);
+ world->add_camera_line(distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz,distance*c4x + camx,distance*c4y+ camy,distance*c4z + camz);
+ world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,distance*c3x + camx,distance*c3y+ camy,distance*c3z + camz);
+
+ mypro->mygetcamerafoa(&c1x, &c1y, &c1z, 1);
+
+
+
+
+ modulo = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
+ c1x = (c1x-camx)*modulo;
+ c1y = (c1y-camy)*modulo;
+ c1z = (c1z-camz)*modulo;
+ distance=distance*3;
+ world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,camx,camy,camz);
+
+ mypro->mybackproject(320,240,&c1x,&c1y,&c1z,&camx, &camy, &camz,1);
+ modulo = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
+ c1x = (c1x-camx)*modulo;
+ c1y = (c1y-camy)*modulo;
+ c1z = (c1z-camz)*modulo;
+ distance=distance*3;
+ world->add_camera_line(distance*c1x + camx,distance*c1y+ camy,distance*c1z + camz,camx,camy,camz);
+
+
+
+
+ }
+ else {
+ world->clear_camera_lines();
+ }
+
+
+ //mypro->mybackproject(x, y, &xp, &yp, &zp, &camx, &camy, &camz,1);
+}
+
+void
+rgbdViewergui::on_w_lines_rgb_toggled() {
+ if (w_lines_rgb->get_active()) {
+ lines_rgb_active=true;
+ }
+ else
+ lines_rgb_active=false;
+}
+
+void
+rgbdViewergui::on_w_lines_depth_toggled() {
+ if (w_lines_depth->get_active()) {
+ lines_depth_active=true;
+ }
+ else
+ lines_depth_active=false;
+}
+
+void
+rgbdViewergui::on_w_view_controller_activate() {
+ w_window_controller->show();
+}
+
+void
+rgbdViewergui::on_w_radio_depth_activate() {
+ if (w_radio_depth->get_active())
+ world->draw_kinect_with_color=false;
+}
+
+void
+rgbdViewergui::on_w_radio_mode_pointcloud_activate() {
+ if (w_radio_mode_pointcloud->get_active())
+ reconstructMode=1;
+}
+
+void
+rgbdViewergui::on_w_radio_mode_image_activate() {
+ if (w_radio_mode_image->get_active())
+ reconstructMode=0;
+}
+
+void
+rgbdViewergui::on_w_radio_rgb_activate() {
+ if (w_radio_rgb->get_active())
+ world->draw_kinect_with_color=true;
+}
+
+void
+rgbdViewergui::on_clicked_clear_lines() {
+ world->clearExtraLines();
+}
+
+void
+rgbdViewergui::on_w_tg_gl_toggled() {
+ if (w_tg_gl->get_active()) {
+ w_window_gl->show();
+ w_vbox_gl->show();
+ }
+ else {
+ w_window_gl->hide();
+ w_vbox_gl->hide();
+ }
+}
+
+float
+rgbdViewergui::getCycle() {
+ return this->cycle;
+}
+
+} // namespace
Copied: trunk/src/stable/components/rgbdViewer/rgbdViewergui.glade (from rev 1029, trunk/src/stable/components/kinectViewer/kinectViewergui.glade)
===================================================================
--- trunk/src/stable/components/rgbdViewer/rgbdViewergui.glade (rev 0)
+++ trunk/src/stable/components/rgbdViewer/rgbdViewergui.glade 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,604 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<glade-interface>
+ <!-- interface-requires gtk+ 2.16 -->
+ <!-- interface-naming-policy project-wide -->
+ <widget class="GtkWindow" id="rgbdViewer">
+ <property name="title" translatable="yes">rgbdViewer</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkMenuBar" id="menubar2">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkMenuItem" id="menuitem5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_File</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu4">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem11">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem12">
+ <property name="label">gtk-open</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem13">
+ <property name="label">gtk-save</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem14">
+ <property name="label">gtk-save-as</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem15">
+ <property name="label">gtk-quit</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkMenuItem" id="menuitem6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu5">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem16">
+ <property name="label">gtk-cut</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem17">
+ <property name="label">gtk-copy</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem18">
+ <property name="label">gtk-paste</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem19">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkMenuItem" id="menuitem7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_View</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu7">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="view_controller">
+ <property name="label" translatable="yes">Controller</property>
+ <property name="visible">True</property>
+ <property name="use_stock">False</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkMenuItem" id="menuitem8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Help</property>
+ <property name="use_underline">True</property>
+ <child>
+ <widget class="GtkMenu" id="menu6">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImageMenuItem" id="imagemenuitem20">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkEventBox" id="eventboxRGB">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImage" id="imageRGB">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEventBox" id="eventboxDEPTH">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImage" id="imageDEPTH">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator2">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="window_controller">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Controller</property>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_rgb">
+ <property name="label" translatable="yes">Camera RGB</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_depth">
+ <property name="label" translatable="yes">Camera Depth</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox_Pose3DMotors">
+ <child>
+ <widget class="GtkButton" id="button_up">
+ <property name="label" translatable="yes">UP</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_down">
+ <property name="label" translatable="yes">DOWN</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_leds">
+ <child>
+ <widget class="GtkButton" id="buttonled_off">
+ <property name="label" translatable="yes">OFF</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonled_green">
+ <property name="label" translatable="yes">GREEN</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonled_red">
+ <property name="label" translatable="yes">RED</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonled_yellow">
+ <property name="label" translatable="yes">YELLOW</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonled_bgreen">
+ <property name="label" translatable="yes">BGREEN</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonled_bred">
+ <property name="label" translatable="yes">BRED</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator2">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkToggleButton" id="tg_gl">
+ <property name="label" translatable="yes">View World</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox_gl">
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_lines_rgb">
+ <property name="label" translatable="yes">Show room on rgb</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_lines_depth">
+ <property name="label" translatable="yes">Show room on depth</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_clear_lines">
+ <property name="label" translatable="yes">Clear projection lines</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_reconstruct">
+ <property name="label" translatable="yes">Reconstruct</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator3">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox_reconstruct_mode">
+ <child>
+ <widget class="GtkRadioButton" id="radio_mode_pointcloud">
+ <property name="label" translatable="yes">PointCloud</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_mode_image">
+ <property name="label" translatable="yes">Images cnv</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="yalign">0.52999997138977051</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_mode_pointcloud</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator4">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox_reconstruct_selection">
+ <child>
+ <widget class="GtkRadioButton" id="radio_depth">
+ <property name="label" translatable="yes">DEPTH</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_rgb">
+ <property name="label" translatable="yes">RGB on DEPTH</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_depth</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator5">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_camera_pos">
+ <property name="label" translatable="yes">Camera Position</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="window_gl">
+ <property name="width_request">640</property>
+ <property name="height_request">480</property>
+ <property name="title" translatable="yes">World</property>
+ <child>
+ <widget class="GtkDrawingArea" id="gl_world">
+ <property name="height_request">300</property>
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
Copied: trunk/src/stable/components/rgbdViewer/rgbdViewergui.h (from rev 1029, trunk/src/stable/components/kinectViewer/kinectViewergui.h)
===================================================================
--- trunk/src/stable/components/rgbdViewer/rgbdViewergui.h (rev 0)
+++ trunk/src/stable/components/rgbdViewer/rgbdViewergui.h 2013-10-10 13:57:26 UTC (rev 1031)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 1997-2013 JDE Developers TeamrgbdViewer.camRGB
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ * Author : Jose María Cañas <jmplaza en gsyc.es>
+ Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+#ifndef rgbdViewer_VIEW_H
+#define rgbdViewer_VIEW_H
+
+#include <string>
+#include <iostream>
+#include <gtkmm.h>
+#include <libglademm.h>
+#include "drawarea.h"
+#include <visionlib/colorspaces/colorspacesmm.h>
+#include <jderobot/camera.h>
+#include <IceUtil/Thread.h>
+#include <IceUtil/Time.h>
+#include "myprogeo.h"
+#include <cv.h>
+#include <highgui.h>
+//#include "util3d.h"
+
+namespace rgbdViewer {
+ class rgbdViewergui {
+ public:
+
+ rgbdViewergui(bool rgb, bool depth,bool pointCloud , std::string path, std::string path_rgb, std::string path_ir, int width, int height, float cycle);
+ virtual ~rgbdViewergui();
+
+ /*Return true if the windows is visible*/
+ bool isVisible();
+
+
+ /*Display window*/
+ void updateAll( cv::Mat imageRGB, cv::Mat imageDEPTH, std::vector<jderobot::RGBPoint> cloud );
+ void updateRGB( cv::Mat imageRGB);
+ void updateDEPTH(cv::Mat imageDEPTH );
+ void updatePointCloud(std::vector<jderobot::RGBPoint> cloud);
+ bool isClosed();
+ float getCycle();
+
+ private:
+ float cycle;
+
+
+ Glib::RefPtr<Gnome::Glade::Xml> refXml;
+ Gtk::Main gtkmain;
+ Gtk::Window *mainwindow;
+ Gtk::Window *w_window_controller;
+ Gtk::Window *w_window_gl;
+ Gtk::Image* w_imageRGB;
+ Gtk::Image* w_imageDEPTH;
+ Gtk::EventBox *w_event_rgb;
+ Gtk::EventBox *w_event_depth;
+ Gtk::ToggleButton *w_reconstruct;
+ Gtk::ToggleButton *w_camera_pos;
+ Gtk::ToggleButton *w_tg_gl;
+ Gtk::ToggleButton *w_lines_rgb;
+ Gtk::ToggleButton *w_lines_depth;
+ Gtk::ToggleButton *w_toggle_rgb;
+ Gtk::ToggleButton *w_toggle_depth;
+ Gtk::ImageMenuItem *w_view_controller;
+ Gtk::VBox * w_reconstruct_selection;
+ Gtk::VBox * w_reconstruct_mode;
+ Gtk::VBox * w_vbox_gl;
+ Gtk::RadioButton *w_radio_depth;
+ Gtk::RadioButton *w_radio_rgb;
+ Gtk::RadioButton *w_radio_mode_pointcloud;
+ Gtk::RadioButton *w_radio_mode_image;
+ Gtk::Button *w_button_clear_lines;
+ //util3d* util;
+ DrawArea* world;
+ int cWidth, cHeight;
+ int reconstructMode;
+ int modesAvalables;
+ int cam_rgb_active;
+ int cam_depth_active;
+
+ void displayFrameRate();
+ IceUtil::Time currentFrameTime,oldFrameTime;
+ double fps;
+ int frameCount;
+
+ myprogeo *mypro;
+ bool lines_depth_active;
+ bool lines_rgb_active;
+
+ bool on_clicked_event_rgb(GdkEventButton* event);
+ bool on_clicked_event_depth(GdkEventButton* event);
+ bool reconstruct_depth_activate;
+ void on_reconstruct_depth();
+ void add_depth_pointsImage(cv::Mat imageRGB, cv::Mat distance);
+ void add_depth_pointsCloud(std::vector<jderobot::RGBPoint> cloud);
+ void add_cameras_position();
+ void add_camera_position();
+ void on_w_lines_rgb_toggled();
+ void on_w_lines_depth_toggled();
+ void on_w_view_controller_activate();
+ void on_w_radio_depth_activate();
+ void on_w_radio_rgb_activate();
+ void on_w_radio_mode_pointcloud_activate();
+ void on_w_radio_mode_image_activate();
+ void on_clicked_clear_lines();
+ void on_w_tg_gl_toggled();
+
+
+
+
+ };
+} // namespace
+
+#endif /*rgbdViewer_VIEW_H*/
More information about the Jderobot-admin
mailing list