diff --git a/rtabmap/eclipse-launch/eclipse-launch.sh b/rtabmap/eclipse-launch/eclipse-launch.sh index 46310a17..01723f8f 100644 --- a/rtabmap/eclipse-launch/eclipse-launch.sh +++ b/rtabmap/eclipse-launch/eclipse-launch.sh @@ -1,8 +1,7 @@ #!/bin/bash -export GDK_NATIVE_WINDOWS=1 ## Source ROS setup.sh (adjust to your version : boxturtle, cturtle, diamondback, e...) -source /opt/ros/fuerte/setup.bash +source /opt/ros/groovy/setup.bash ## Setup ROS_PACKAGE_PATH export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/workspace/ros-pkg diff --git a/rtabmap/msg/InfoEx.msg b/rtabmap/msg/InfoEx.msg index 19f52911..714a7505 100644 --- a/rtabmap/msg/InfoEx.msg +++ b/rtabmap/msg/InfoEx.msg @@ -28,8 +28,9 @@ int32[] weightsValues string[] statsKeys float32[] statsValues -sensor_msgs/Image refImage -sensor_msgs/Image loopImage +#compressed images : using cv::imencode() +uint8[] refImage +uint8[] loopImage # # For features2d : std::multimap words diff --git a/rtabmap/src/CoreWrapper.cpp b/rtabmap/src/CoreWrapper.cpp index abf9ac1b..d2a110ef 100644 --- a/rtabmap/src/CoreWrapper.cpp +++ b/rtabmap/src/CoreWrapper.cpp @@ -99,7 +99,7 @@ void CoreWrapper::saveNodeParameters(const std::string & configFile) Rtabmap::writeParameters(configFile.c_str(), parameters); - std::string databasePath = parameters.at(Parameters::kRtabmapWorkingDirectory())+"LTM.db"; + std::string databasePath = parameters.at(Parameters::kRtabmapWorkingDirectory())+"/LTM.db"; printf("Saving database/long-term memory... (located at %s)\n", databasePath.c_str()); } @@ -180,6 +180,10 @@ void CoreWrapper::publishStats(const Statistics & stats) { if(!stats.refImage().empty()) { + // compress (the gui would work on a remote computer, this on the robot) + cv::imencode(".png", stats.refImage(), msg->refImage); + + /* cv_bridge::CvImage img; if(stats.refImage().channels() == 1) { @@ -194,9 +198,14 @@ void CoreWrapper::publishStats(const Statistics & stats) rosMsg->header.frame_id = "camera"; rosMsg->header.stamp = ros::Time::now(); msg->refImage = *rosMsg; + */ } if(!stats.loopImage().empty()) { + // compress (the gui would work on a remote computer, this on the robot) + cv::imencode(".png", stats.loopImage(), msg->loopImage); + + /* cv_bridge::CvImage img; if(stats.loopImage().channels() == 1) { @@ -211,6 +220,7 @@ void CoreWrapper::publishStats(const Statistics & stats) rosMsg->header.frame_id = "camera"; rosMsg->header.stamp = ros::Time::now(); msg->loopImage = *rosMsg; + */ } //Posterior, likelihood, childCount diff --git a/rtabmap/src/GuiWrapper.cpp b/rtabmap/src/GuiWrapper.cpp index 0842df82..75ecdc82 100644 --- a/rtabmap/src/GuiWrapper.cpp +++ b/rtabmap/src/GuiWrapper.cpp @@ -85,13 +85,27 @@ void GuiWrapper::infoExReceivedCallback(const rtabmap::InfoExConstPtr & msg) stat.setRefImageId(msg->refId); stat.setLoopClosureId(msg->loopClosureId); - if(msg->refImage.data.size()) + if(msg->refImage.size()) { - stat.setRefImage(cv_bridge::toCvShare(msg->refImage, msg)->image.clone()); + cv::Mat image; +#if CV_MAJOR_VERSION >=2 and CV_MINOR_VERSION >=4 + image = cv::imdecode(msg->refImage, cv::IMREAD_UNCHANGED); +#else + image = cv::imdecode(msg->refImage, -1); +#endif + stat.setRefImage(image); + //stat.setRefImage(cv_bridge::toCvShare(msg->refImage, msg)->image.clone()); } - if(msg->loopImage.data.size()) + if(msg->loopImage.size()) { - stat.setLoopImage(cv_bridge::toCvShare(msg->loopImage, msg)->image.clone()); + cv::Mat image; +#if CV_MAJOR_VERSION >=2 and CV_MINOR_VERSION >=4 + image = cv::imdecode(msg->loopImage, cv::IMREAD_UNCHANGED); +#else + image = cv::imdecode(msg->loopImage, -1); +#endif + stat.setRefImage(image); + //stat.setLoopImage(cv_bridge::toCvShare(msg->loopImage, msg)->image.clone()); } //Posterior, likelihood, childCount