rtabmap-pkg: for infoEx message, images are transferred compressed

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/ros-pkg@835 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2013-03-02 22:16:32 +00:00
parent ef6af14e2a
commit 92ea04f61a
4 changed files with 33 additions and 9 deletions
+1 -2
View File
@@ -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
+3 -2
View File
@@ -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<int, cv::Keypoint> words
+11 -1
View File
@@ -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
+18 -4
View File
@@ -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