cv bridge image size for a standard image is odd

asked 2018-04-19 06:45:14 -0500

rsmitha gravatar image

Hi,

I am working with the point grey camera and am using the flycap package with ROS on the jackal. Once I capture the image I use cv_bridge with bgr8 encoding to convert the raw image.

The code in the ROS callback function for the topic "/camera/image_color" is:

 cv_bridge::CvImagePtr cv_ptr;
 std::vector<cv::Mat> channels;
 std::vector<cv::Mat> a_ch(3);
 static int iter = 0;

 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;
 }
 size_t rows = cv_ptr->image.rows; // this is 480
 size_t cols = cv_ptr->image.cols;  // this is 752

However, the size of the image is 480x752 which is a non standard size. When images are captured with just the flycap on ubuntu, the size is the standard 480x600.

Why does cv_bridge give odd image sizes? Is there some setting I need to add?

Regards, rsmitha.

edit retag flag offensive close merge delete

Comments

Can you run rostopic echo --noarr /your/image/topic. This should print you the image size of the sensor_msgs/Image messages, without interference of your own nodes logic ....

Wolf gravatar image Wolf  ( 2018-04-19 19:36:02 -0500 )edit

Hi @Wolf, Thanks for the suggestion. I will try this out and post a comment.

rsmitha gravatar image rsmitha  ( 2018-04-19 23:08:45 -0500 )edit

Hi @Wolf, Sorry for delay. I was able to check this today: Here is the header information:header: seq: 95 stamp: secs: 1524968893 nsecs: 460908321 frame_id: camera height: 480 width: 752 encoding: bgr8 is_bigendian: 0 step: 2256 So we see that the size is being reported as 480x752.

rsmitha gravatar image rsmitha  ( 2018-04-28 21:30:03 -0500 )edit