Save an image during the subscription
Using that simple program how can I save an image during the subscription: like when I press a key (ctrl+s for example or s) I get an image *.jpeg file (or other extension doesn't matter) ?
void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
cv_bridge::CvImagePtr cv_ptr;
try
{
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
cv::imshow("OpenCV viewer uEye RGB", cv_ptr->image);
cv::waitKey(3);
}