artivis / ros_imresize

[ROS] Resize an image and update its camera info
4 stars 9 forks source link

resize a depth image #3

Open miguelcrf450 opened 7 years ago

miguelcrf450 commented 7 years ago

HI there,

Thanks for this work. I already tested this package with the kinect v1 to down and up sample an rgb image topic and everything seems to be working well. My question is, i want to do the same but with the depth image witch is a different format from rgb. Anyone knows if it is simple to make that modification?

Thanks

artivis commented 7 years ago

Hi,

this may be related to #1 & #2 . As of now the image encoding used by cv_bridge is hardcoded to BGR8 (see here). It should be pretty straightforward to make it optional. Please feel free to give it a go and submit a pull request ;) .

Cheers.

miguelcrf450 commented 7 years ago

Hi,

I already changed the format for BGR8 to TYPE_16UC1 and everything seems to be working well except the camera_info topic.

In the rviz i can visualize the new image resized but for that i have to add a image topic. If i add a camera topic in the rviz it only shows a black screen.

I checked the camera_info topic and i compared with the topic original. Everything seems ok except the secs and nsecs that are not incrementing. They always have the same value, contrary to the camera that are always incrementing. Is there anyway to solve that ?

The original from camera

header: seq: 24887 stamp: secs: 1497003475 nsecs: 863075265 frame_id: camera height: 144 width: 176 distortion_model: '' D: [0.326436, 0.219347, 0.0, 0.0, 0.0] K: [146.548507, 0.0, 88.404663, 0.0, 146.548507, 71.498672, 0.0, 0.0, 0.0] R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] P: [146.548507, 0.0, 88.404663, 0.0, 0.0, 146.548507, 71.498672, 0.0, 0.0, 0.0, 1.0, 0.0] binning_x: 0 binning_y: 0 roi: x_offset: 0 y_offset: 0 height: 0 width: 0 do_rectify: False

The values of camera_info from the ros_imresize:

header: seq: 54673 stamp: secs: 1497001687 ------> not incrementing nsecs: 14029878 ------> not incrementing frame_id: camera height: 240 width: 320 distortion_model: '' D: [] K: [266.45183884997425, 0.0, 160.73575569938959, 0.0, 244.2475058433522, 119.16445049223137, 0.0, 0.0, 0.0] R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] P: [146.548507, 0.0, 88.404663, 0.0, 0.0, 146.548507, 71.498672, 0.0, 0.0, 0.0, 1.0, 0.0] binning_x: 0 binning_y: 0 roi: x_offset: 0 y_offset: 0 height: 0 width: 0 do_rectify: False

artivis commented 7 years ago

Hi,

the sensor_msgs::CameraInfo message is set only once in the function setCameraInfo and then periodically published here.
In order to increment the time stamp you could simply do something like

// the line below may not compile, I let you find out the proper way to do it.
_infoCam.header.stamp = cvPtr->toImageMsg()->header.stamp; 
_pub_info.publish(_infoCam);
miguelcrf450 commented 7 years ago

Hi,

Thank you @artivis. When i have more results i will tell you. Thank you for your support

miguelcrf450 commented 7 years ago

Hi,

I tested what you suggested to me and now the time is incrementing like the original topic of kinect. I did everything like you said and nothing more.

But i dont understand why in the rviz i still have to add a image topic to see the image. In the original topic i can add a camera that subscribes the image and info topic from camera.

Cheers

artivis commented 7 years ago

Sorry I didn't understood what you were aiming at. I'm not sure sure how to solve this problem but most probably this package is not well suited in its current form. My guess is that I'm not using the proper publisher (and/or message type) for your need. You should find more information on the ros sensor camera wiki page.

Sigmat29 commented 5 years ago

Hey, i get an error.

[ERROR] [1550842724.639346844]: Client [/ros_imresize] wants topic /kinect_rgb to have datatype/md5sum [sensor_msgs/CameraInfo/c9a58c1b0b154e0e6da7578cb991d214], but our version has [sensor_msgs/Image/060021388200f6f0f447d0fcd9c64743]. Dropping connection.

I am trying to resize resoultion of image from Kinect v2 Can anyone help me?