Hello
I want to extract the keyframe images , I use get_map_data service to access MapGraph and MapData but when I want to process keyframe_image (and letter publish it as ros msg) I get error .Above screenshot is the output .
It seems that NodeData's image is empty ...
Here is my code :
#include "ros/ros.h"
#include <cstdlib>
#include <rtabmap_ros/GetMap.h>
#include "rtabmap_ros/MapData.h"
#include "rtabmap_ros/MapGraph.h"
#include "rtabmap_ros/NodeData.h"
#include "rtabmap_ros/MsgConversion.h"
#include "rtabmap/core/util3d.h"
#include "rtabmap/core/Compression.h"
int main(int argc, char **argv)
{
ros::init(argc, argv, "extract_serv");
ros::NodeHandle nh_;
ros::Publisher pub_;
ros::Rate rate(10);
ros::ServiceClient client = nh_.serviceClient<rtabmap_ros::GetMap>("/rtabmap/get_map_data");
rtabmap_ros::GetMap srv;
srv.request.global = 1; //true
srv.request.optimized = 1; //true
srv.request.graphOnly = 0; //true
int i=0;
while (ros::ok())
{
if (client.call(srv.request,srv.response))
{
std::cout<<"call service get_map_data"<<std::endl;
std::cout<<"MapData NodeData["<<i<<"]:\n"<<"\tPose_x: "<<srv.response.data.nodes[i].pose.position.x<<"\n\tPose_y: "<<srv.response.data.nodes[i].pose.position.y<<"\n\tPose_z: "<<srv.response.data.nodes[i].pose.position.z<<std::endl;
cv::Mat uncomp_image;
uncomp_image=rtabmap::uncompressImage(srv.response.data.nodes[i].image); //Keyframe_image
}
else
{
ROS_ERROR("Failed to call service extract_serv");
return 1;
}
i++;
}
ros::spin();
return 0;
}
I use kinect camera and here is the commands that I use to run the node ;
$ roslaunch openni_launch openni.launch depth_registration:=true device_id:=#2
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start"
$ rosrun sync_msgs extract_serv