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

How to set up image_proc/crop_decimate nodelet properly?

asked 2012-10-04 04:38:06 -0500

aldo85ita gravatar image

updated 2012-10-10 22:10:48 -0500

Sorry for this question but I'm newbie about ros nodelets. I'd like to use image_proc/crop_decimate to do a cropping on the rectified images. This is a rectified image:

image description

As you can see, It has a little black border on the right and on the bottom, so I 'd like to crop it. This is my rxgraph connections:

image description

I've tried to set cropping with the following command, but It has no effect:

rosrun nodelet nodelet standalone image_proc/crop_decimate _x_offset=1 _y_offset=1 _width=639 _height=439  /camera:=/image_rect_color

How to set image_proc/crop_decimate properly?

this is my rostopic list:

aldo@aldo-ubuntu:/opt/ros/electric/stacks/image_pipeline/image_proc$ rostopic list
/gscam/camera_info
/gscam/image_raw
/gscam/image_raw/compressed
/gscam/image_raw/compressed/parameter_descriptions
/gscam/image_raw/compressed/parameter_updates
/gscam/image_raw/theora
/gscam/image_raw/theora/parameter_descriptions
/gscam/image_raw/theora/parameter_updates
/image_color
/image_color/compressed
/image_color/compressed/parameter_descriptions
/image_color/compressed/parameter_updates
/image_color/theora
/image_color/theora/parameter_descriptions
/image_color/theora/parameter_updates
/image_mono
/image_mono/compressed
/image_mono/compressed/parameter_descriptions
/image_mono/compressed/parameter_updates
/image_mono/theora
/image_mono/theora/parameter_descriptions
/image_mono/theora/parameter_updates
/image_proc_debayer/parameter_descriptions
/image_proc_debayer/parameter_updates
/image_proc_rectify_color/parameter_descriptions
/image_proc_rectify_color/parameter_updates
/image_proc_rectify_mono/parameter_descriptions
/image_proc_rectify_mono/parameter_updates
/image_rect
/image_rect/compressed
/image_rect/compressed/parameter_descriptions
/image_rect/compressed/parameter_updates
/image_rect/theora
/image_rect/theora/parameter_descriptions
/image_rect/theora/parameter_updates
/image_rect_color
/image_rect_color/compressed
/image_rect_color/compressed/parameter_descriptions
/image_rect_color/compressed/parameter_updates
/image_rect_color/theora
/image_rect_color/theora/parameter_descriptions
/image_rect_color/theora/parameter_updates
/rosout
/rosout_agg
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
7

answered 2012-10-04 22:20:19 -0500

Thomas gravatar image

updated 2012-10-10 23:46:20 -0500

As this node is a bit complex to launch and requires remapping and argument passing. I would suggest that you write a roslaunch file. The syntax is way easier to understand than the command line arguments (converting '~' to '_' where needed is tricky).

Here is a a roslaunch file adapted to your needs:

<?xml version="1" encoding="utf-8"?>
<launch>
<node pkg="nodelet" type="nodelet"
      args="standalone image_proc/crop_decimate"
      name="my_decimator">
  <param name="x_offset" type="int" value="1" />
  <param name="y_offset" type="int" value="1" />
  <param name="width" type="int" value="639" />
  <param name="height" type="int" value="439" />

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

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

Please see the roslaunch wiki page for more information.

Here is a complete ROS launch file which works on my computer (Ubuntu 10.04 / Electric):

<?xml version="1" encoding="utf-8"?>
<launch>

<node pkg="gscam" type="gscam"
      name="gscam"
      cwd="node">
  <env name="GSCAM_CONFIG"
       value="v4l2src device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"/>

</node>

<node pkg="image_proc" type="image_proc"
      ns="gscam"
      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="1" />
  <param name="y_offset" type="int" value="1" />
  <param name="width" type="int" value="639" />
  <param name="height" type="int" value="439" />

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

  <!-- remap output topics -->
  <remap from="camera_out/image_raw" to="/camera_crop/image_rect_color"/>
  <remap from="camera_out/image_info" to="/camera_crop/camera_info"/>
</node>
</launch>
edit flag offensive delete link more

Comments

Hi @Thomas,my problem is not how to set the parameters of nodelet, but what values to remap. My image_proc node has /gscam/camera_info(sensor_msgs/CameraInfo) and /gscam/image_raw (sensor_msgs/Image) as input,/image_rect_color(sensor_msgs/Image) as output. How to set the nodelet to crop...

aldo85ita gravatar image aldo85ita  ( 2012-10-09 05:09:52 -0500 )edit

...on image_rect_color?

aldo85ita gravatar image aldo85ita  ( 2012-10-09 05:10:18 -0500 )edit

This corresponds to the two lines below "edit values here". Ie. /your/image/topic should be /something/image_rect_color and /your/image/info/topic should be /something/camera_info where /something is the image_rect topic prefix.

Thomas gravatar image Thomas  ( 2012-10-10 03:15:19 -0500 )edit

BTW, if it is still unclear, give me the output of rostopic list and I'll give you the exact result in your particular case.

Thomas gravatar image Thomas  ( 2012-10-10 03:16:04 -0500 )edit

@Thomas, I published "rostopic list" results above, in my first post.

aldo85ita gravatar image aldo85ita  ( 2012-10-10 22:13:19 -0500 )edit

Ok, I edited the XML file to match what I think is correct. Let me know if it works ;)

Thomas gravatar image Thomas  ( 2012-10-10 22:59:31 -0500 )edit

Thank you @Thomas again, your last launch file work: all nodes are connected properly. But,If I look at rxgraph (my_decimator properties), I read Subscriptions: * /camera_info [unknown type] * /image_rect_color [sensor_msgs/Image] and so, no image is published by my_decimator node. any idea?

aldo85ita gravatar image aldo85ita  ( 2012-10-10 23:07:18 -0500 )edit

Hum ok. Not sure what the problem is so I wrote the full launch file. Maybe by looking at yours and mine you'll figure out the mistake :)

Thomas gravatar image Thomas  ( 2012-10-10 23:47:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-10-04 04:38:06 -0500

Seen: 3,652 times

Last updated: Oct 10 '12