ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could have a look at this node, which does something similar for kinect data. You should be able to take the general idea and adapt it to your needs with only color images instead of kinect data: https://github.com/SharedAutonomyToolkit/shared_autonomy_perception/blob/hydro-devel/assemble_kinect/src/assemble_kinect.cpp

The .srv file used in for this node is here: https://github.com/SharedAutonomyToolkit/shared_autonomy_perception/blob/hydro-devel/shared_autonomy_msgs/srv/KinectAssembly.srv

I'm not saying this is the best solution, but maybe it helps.

You could have a look at this node, which does something similar for kinect data. You should be able to take the general idea and adapt it to your needs with only color images instead of kinect data: https://github.com/SharedAutonomyToolkit/shared_autonomy_perception/blob/hydro-devel/assemble_kinect/src/assemble_kinect.cpp

The .srv file used in for this node is here: https://github.com/SharedAutonomyToolkit/shared_autonomy_perception/blob/hydro-devel/shared_autonomy_msgs/srv/KinectAssembly.srv

I'm not saying this is the best solution, but maybe it helps.

Edit:

In response to your clarification of what you want to do: You could build a node along the following lines:

  1. Create class to implement your node. In particular you have one Image message member variable to store the latest received input image, and you have another image object as member variable (message or cv::Mat or whatever) that will contain the first image without the laser line.
  2. Subscribe to the image topic, and in the callback always save the the incoming image to the corresponding member variable
  3. Subscribe to some sort of command topic (maybe of type std_msgs/String) with which you tell your node to store the current image as the first image. In the callback you copy the one member variable to the other
  4. When you receive a second command (you could either count the commands, or use different strings or whatever), you take the current image and compare it to the one you saved on the first command.

For help on converting between ROS image messages and OpenCV images, see http://wiki.ros.org/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages