Convert cv_bridge Image to cv::Mat image
I would like to have a pure OpenCV version cv::Mat
of the Image on which I can do further modifications. I tried cv_ptr->dImg;
but it outputs errors. So far I have
void imageCb(const sensor_msgs::ImageConstPtr& msg)
{
cv_bridge::CvImagePtr cv_ptr;
try
{
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::TYPE_16UC1);
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
// Draw an example circle on the video stream
//if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
// cv::circle(cv_ptr->image, cv::Point(px, py), 10, CV_RGB(255,0,0));
cv::Mat dImg;