Robotics StackExchange | Archived questions

How to use image_proc/crop_decimate to crop an image?

Hi, I used usbcam driver to publish a camera raw image, and I'm trying to crop the published image using imageproc/cropdecimate. when I viewed the output of imageproc/cropdecimate, I did not see any difference between the original image and the cropped image. it seems that the imageproc/crop_decimate node is bypassing the parameters of my launch file. the size of the original image 640x480 and I want to crop the image to 640x300 This is my launch file script:

<node pkg="image_proc" type="image_proc"
      ns="usb_cam"
      name="image_proc">
</node>

<node pkg="nodelet" type="nodelet"
      args="standalone image_proc/crop_decimate"
      name="my_decimator">
  <param name="x_offset" type="int" value="0" />
  <param name="y_offset" type="int" value="0" />
  <param name="width" type="int" value="640" />
  <param name="height" type="int" value="250" />

  <!-- remap input topics -->
  <remap from="usb_cam/image_rect_color" to="camera/image_raw"/>
  <remap from="usb_cam/camera_info" to="camera/camera_info"/>

  <!-- remap output topics -->
  <remap from="camera_out/image_raw" to="camera_crop/image_rect_color"/>
  <remap from="camera_out/camera_info" to="camera_crop/camera_info"/>
</node>

Does any one has an idea how to use imageproc/cropdecimate node?

Thanks

Asked by Hamz on 2016-11-15 17:08:34 UTC

Comments

Answers

The "from" and "to" topic names should be switched for the input mapping. I have had success implementing this.

Regardless of whether you are remapping an input or an output topic, the "from" is what is topic referenced in the node(let) source code, and the "to" is the rostopic this is the actual input/output.

Here is the exact syntax: http://wiki.ros.org/roslaunch/XML/remap

Name that you are remapping.

from="original-name"

Target name.

to="new-name"

See this as an example: http://gizmosmith.com/2018/09/24/configuring-video-cropping-and-resizing-with-ross-image_proc/

Asked by erush91 on 2019-04-25 11:52:09 UTC

Comments

Thanks, I think this should be marked as the answer

Asked by Ifx13 on 2022-01-19 04:33:15 UTC