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

Here is the example how to copy your ImageConstPtr& object to opencv obj:

void filterImage (const sensor_msgs::ImageConstPtr& rgb_msg) { cv::namedWindow(WINDOW); cv_bridge::CvImagePtr cv_ptr; try { cv_ptr = cv_bridge::toCvCopy(rgb_msg, enc::BGR8);

}
catch (cv_bridge::Exception& e)
{
  ROS_ERROR("cv_bridge exception: %s", e.what());
  return;
}
cv::imshow(WINDOW, cv_ptr->image);   
cv::waitKey(10);

Here is the example how to copy your ImageConstPtr& object to opencv obj:

void filterImage (const sensor_msgs::ImageConstPtr& rgb_msg) { cv::namedWindow(WINDOW); cv_bridge::CvImagePtr cv_ptr; try { cv_ptr = cv_bridge::toCvCopy(rgb_msg, enc::BGR8);

}
catch (cv_bridge::Exception& e)
{
  ROS_ERROR("cv_bridge exception: %s", e.what());
  return;
}
cv::imshow(WINDOW, cv_ptr->image);   
cv::waitKey(10);

}

Here is the example how to copy your ImageConstPtr& object to opencv obj:

void filterImage (const sensor_msgs::ImageConstPtr& rgb_msg) { cv::namedWindow(WINDOW); cv_bridge::CvImagePtr cv_ptr; try { cv_ptr = cv_bridge::toCvCopy(rgb_msg, enc::BGR8);

enc::BGR8);
      }
 catch (cv_bridge::Exception& e)
 {
   ROS_ERROR("cv_bridge exception: %s", e.what());
   return;
 }
 cv::imshow(WINDOW, cv_ptr->image); 
cv::waitKey(10);

}

Here is the example how to copy your ImageConstPtr& object to opencv obj:

void filterImage (const sensor_msgs::ImageConstPtr& rgb_msg) { cv::namedWindow(WINDOW); rgb_msg)

{

cv::namedWindow(WINDOW);

cv_bridge::CvImagePtr cv_ptr; cv_ptr;

try { {

cv_ptr = cv_bridge::toCvCopy(rgb_msg, enc::BGR8); } enc::BGR8);

}

catch (cv_bridge::Exception& e) { e)

{

ROS_ERROR("cv_bridge exception: %s", e.what()); return; } cv::imshow(WINDOW, cv_ptr->image);
cv::waitKey(10);
}

cv::imshow(WINDOW, cv_ptr->image);

cv::waitKey(10);

}