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

Median's profile - activity

2015-07-27 15:03:39 -0500 received badge  Notable Question (source)
2015-07-27 15:03:39 -0500 received badge  Famous Question (source)
2015-03-24 07:31:02 -0500 received badge  Nice Question (source)
2013-11-10 15:59:51 -0500 received badge  Famous Question (source)
2013-09-30 14:50:08 -0500 received badge  Student (source)
2013-07-02 03:01:08 -0500 received badge  Popular Question (source)
2013-06-03 01:11:51 -0500 received badge  Notable Question (source)
2013-05-26 09:02:11 -0500 received badge  Popular Question (source)
2013-05-26 08:17:28 -0500 received badge  Scholar (source)
2013-05-26 07:04:35 -0500 commented answer ROSTopics: Only advertiser can publish?

What that means is that multiple nodes may advertise the same ROS topic, is that right?

2013-05-26 06:15:27 -0500 asked a question ROSTopics: Only advertiser can publish?

This is a simple question about the ROS communication between nodes.

Only the node that advertises a topic can publish to it?

2013-05-10 03:11:41 -0500 received badge  Famous Question (source)
2013-04-11 03:33:51 -0500 received badge  Notable Question (source)
2013-03-20 07:25:29 -0500 received badge  Popular Question (source)
2013-03-12 04:57:11 -0500 commented answer Error when converting IR kinect image to CvImage using cv_bridge

I don't understand what ImageIn_ is .. is it a cv_bridge::CvImagePtr ??

2013-03-11 06:13:28 -0500 commented answer error: cannot convert ‘cv::Mat’ to ‘const CvArr* - Video from ROS node to OpenCV

Can you please show me the code you have for the node which is serving the image?

2013-03-11 06:10:56 -0500 commented answer Error when converting IR kinect image to CvImage using cv_bridge

Can you please share the whole code? I have the exact same problem and your solution is not working. If I try to run toCvCopy without a 2nd argument I get the same exception (Unrecognized enconding).

2013-03-11 05:58:50 -0500 received badge  Supporter (source)
2013-03-11 05:52:25 -0500 answered a question error: cannot convert ‘cv::Mat’ to ‘const CvArr* - Video from ROS node to OpenCV

Can you please show me the code you have for the node which is serving the image?

2013-03-11 05:33:21 -0500 commented answer openvc/cv_bridge encoding

No matter what enconding type I use, I always get the same message: [ERROR] [1363015855.837613897]: cv_bridge exception: Unrecognized image encoding []. Can you please help me?

2013-03-06 03:33:09 -0500 asked a question Image transfer issue: cv_bridge

Hey everyone.

I'm a complete newbie in ROS and am attempting to create a simple publishing/subscribing image platform. Some ROS tutorials regarding this issue use a deprecated protocol (CvBridge) so I'm stuck.

Here is what I have so far:

Image server (adapted from image_transfer tutorial (can't post links)):

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_publisher");


  ros::NodeHandle nh;
  image_transport::ImageTransport it(nh);

  cv_bridge::CvImagePtr cv_ptr(new cv_bridge::CvImage);

  cv_ptr->image = cv::imread("socio_32.jpg",CV_LOAD_IMAGE_COLOR);

  image_transport::Publisher pub = it.advertise("/topic_imgtransport", 1);


  sensor_msgs::ImagePtr msg = cv_ptr->toImageMsg();


  ros::Rate loop_rate(5);


  while (nh.ok()) 
  {
    pub.publish(msg);
    ros::spinOnce();
    loop_rate.sleep();
  }


}

And the Image Client (taken from UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages):

class ImageConverter
{
  ros::NodeHandle nh_;
  image_transport::ImageTransport it_;
  image_transport::Subscriber image_sub_;
  image_transport::Publisher image_pub_;

public:
  ImageConverter()
    : it_(nh_)
  {
    image_pub_ = it_.advertise("out", 1);
    image_sub_ = it_.subscribe("/topic_imgtransport", 1, &ImageConverter::imageCb, this);

    cv::namedWindow(WINDOW);
  }

  ~ImageConverter()
  {
    cv::destroyWindow(WINDOW);
  }

  void imageCb(const sensor_msgs::ImageConstPtr& msg)
  {
    cout<<"Hello callback"<<endl;
    cv_bridge::CvImagePtr cv_ptr;
    try
    {
      cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8);
    }
    catch (cv_bridge::Exception& e)
    {
      ROS_ERROR("cv_bridge exception: %s", e.what());
      return;
    }

    if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
      cv::circle(cv_ptr->image, cv::Point(50, 50), 10, CV_RGB(255,0,0));

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

    image_pub_.publish(cv_ptr->toImageMsg());
  }
};

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_converter");
  ImageConverter ic;
  ros::spin();
  return 0;
}

This doesn't work. Here is the output when I run the client and then the server:

Hello callback

[ERROR] [1362578421.357583807]: cv_bridge exception: Unrecognized image encoding []

In the cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8); line I tried several encoding types, namely "bgr8", "mono8" (as the documentation actually states) and the exception remains the same.

I can visualize the image in the server side, and rostopic echos the correct data about the image.

So obviously the problem is in the way I am receiving the image.

Any thoughts?

2013-03-06 03:28:26 -0500 asked a question Image transfer problem: ros_bridge

Hey everyone.

I'm a complete newbie in ROS and am attempting to create a simple publishing/subscribing image platform. Some ROS tutorials regarding this issue use a deprecated protocol (CvBridge) so I'm stuck.

Here is what I have so far:

Image server (adapted from image_transfer tutorial (can't post links)):

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_publisher");


  ros::NodeHandle nh;
  image_transport::ImageTransport it(nh);

  cv_bridge::CvImagePtr cv_ptr(new cv_bridge::CvImage);

  cv_ptr->image = cv::imread("socio_32.jpg",CV_LOAD_IMAGE_COLOR);

  image_transport::Publisher pub = it.advertise("/topic_imgtransport", 1);


  sensor_msgs::ImagePtr msg = cv_ptr->toImageMsg();


  ros::Rate loop_rate(5);


  while (nh.ok()) 
  {
    pub.publish(msg);
    ros::spinOnce();
    loop_rate.sleep();
  }


}

And the Image Client (taken from UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages):

class ImageConverter
{
  ros::NodeHandle nh_;
  image_transport::ImageTransport it_;
  image_transport::Subscriber image_sub_;
  image_transport::Publisher image_pub_;

public:
  ImageConverter()
    : it_(nh_)
  {
    image_pub_ = it_.advertise("out", 1);
    image_sub_ = it_.subscribe("/topic_imgtransport", 1, &ImageConverter::imageCb, this);

    cv::namedWindow(WINDOW);
  }

  ~ImageConverter()
  {
    cv::destroyWindow(WINDOW);
  }

  void imageCb(const sensor_msgs::ImageConstPtr& msg)
  {
    cout<<"Hello callback"<<endl;
    cv_bridge::CvImagePtr cv_ptr;
    try
    {
      cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8);
    }
    catch (cv_bridge::Exception& e)
    {
      ROS_ERROR("cv_bridge exception: %s", e.what());
      return;
    }

    if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
      cv::circle(cv_ptr->image, cv::Point(50, 50), 10, CV_RGB(255,0,0));

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

    image_pub_.publish(cv_ptr->toImageMsg());
  }
};

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_converter");
  ImageConverter ic;
  ros::spin();
  return 0;
}

This doesn't work. Here is the output when I run the client and then the server:

Hello callback

[ERROR] [1362578421.357583807]: cv_bridge exception: Unrecognized image encoding []

In the cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8); line I tried several encoding types, namely "bgr8", "mono8" and the exception remains the same.

I can visualize the image in the server side, and rostopic echos the correct data about the image.

So obviously the problem is in the way I am receiving the image.

Any thoughts?

2013-03-06 02:35:08 -0500 received badge  Editor (source)
2013-03-06 02:33:40 -0500 asked a question Trouble with image transfer: cv_bridge issues

Hey everyone.

I'm a complete newbie in ROS and am attempting to create a simple publishing/subscribing image platform. Some ROS tutorials regarding this issue use a deprecated protocol (CvBridge) so I'm stuck.

Here is what I have so far:

Image server (adapted from image_transfer tutorial (can't post links)):

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_publisher");


  ros::NodeHandle nh;
  image_transport::ImageTransport it(nh);

  cv_bridge::CvImagePtr cv_ptr(new cv_bridge::CvImage);

  cv_ptr->image = cv::imread("socio_32.jpg",CV_LOAD_IMAGE_COLOR);

  image_transport::Publisher pub = it.advertise("/topic_imgtransport", 1);


  sensor_msgs::ImagePtr msg = cv_ptr->toImageMsg();


  ros::Rate loop_rate(5);


  while (nh.ok()) 
  {
    pub.publish(msg);
    ros::spinOnce();
    loop_rate.sleep();
  }


}

And the Image Client (taken from UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages):

class ImageConverter
{
  ros::NodeHandle nh_;
  image_transport::ImageTransport it_;
  image_transport::Subscriber image_sub_;
  image_transport::Publisher image_pub_;

public:
  ImageConverter()
    : it_(nh_)
  {
    image_pub_ = it_.advertise("out", 1);
    image_sub_ = it_.subscribe("/topic_imgtransport", 1, &ImageConverter::imageCb, this);

    cv::namedWindow(WINDOW);
  }

  ~ImageConverter()
  {
    cv::destroyWindow(WINDOW);
  }

  void imageCb(const sensor_msgs::ImageConstPtr& msg)
  {
    cout<<"Hello callback"<<endl;
    cv_bridge::CvImagePtr cv_ptr;
    try
    {
      cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8);
    }
    catch (cv_bridge::Exception& e)
    {
      ROS_ERROR("cv_bridge exception: %s", e.what());
      return;
    }

    if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
      cv::circle(cv_ptr->image, cv::Point(50, 50), 10, CV_RGB(255,0,0));

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

    image_pub_.publish(cv_ptr->toImageMsg());
  }
};

int main(int argc, char** argv)
{
  ros::init(argc, argv, "image_converter");
  ImageConverter ic;
  ros::spin();
  return 0;
}

This doesn't work. Here is the output when I run the client and then the server:

Hello callback

[ERROR] [1362578421.357583807]: cv_bridge exception: Unrecognized image encoding []

And using the rostopic echo to check what message is being sent this is what I get:

header: 
  seq: 315
  stamp: 
    secs: 0
    nsecs: 0
  frame_id: ''
height: 0
width: 0
encoding: ''
is_bigendian: 0
step: 0
data: []

So obviously the problem is in the way I am transferring the image.

Any thoughts?