[ros-users] image_proc crop and decimate (binning) nodelet and bayer

Joan Pau Beltran joanpau.beltran at uib.cat
Tue Nov 8 15:10:29 UTC 2011

Hi again,

Finally it comes the OpenCV version suggested. Details below.

Al 26/10/11 00:58, En/na Joan Pau Beltran ha escrit:
>> I created a ticket to track your code and suggestions: 
>> https://code.ros.org/trac/ros-pkg/ticket/5201. Further comments below.
> If it is better to discuss it there, let me know.
I did not find how to annotate that ticket, so I am responding here. 
Sorry if it is not the right place.

> I am working on that version. My first approach is to create a nodelet 
> that, depending on the subscribers, takes as inputs a camera_info 
> topic and an image_mono, image_color, image_rect and/or 
> image_rect_color topic using a TimeSynchonizer. Then the needed images 
> are subsampled with cv::resize from OpenCV, and published all together 
> with the adapted camera_info under a different namespace (the scaled 
> camera namespace). The TimeSynchronizer trick is needed to provide 
> just one camera_info message for all the scaled images. Think of it as 
> simulating a whole new camera with ROI/binning in a new namespace.
The attached code implements this approach.  The connection callback is 
a little bit tricky, but it works fine with a limitation explained 
below. The only thing that is missing is the handling of the do_rectify 
field of the output camera_info. Since the node scales both rectified 
and unrectified images, I am not pretty sure how should be treated. 
Because I started the code some time ago, the reconfigure parameters 
have a different name (matching the members of the camera_info). But 
despite of their name, they are exactly the same that the ones used in 
the original crop_decimate.cpp. As noted by a colleague, the scaling 
factor could be a float, but then how to fill the binning fields of the 
outgoing camera_info?

> It should be noted that in this approach Bayer images are not handled, 
> and that an image_proc should be running on the original camera 
> namespace to provide the needed full size images. Another image_proc 
> in the scaled namespace will NOT be needed. Alternatively, 
> rectification and RGB to mono nodelets may be launched only in the 
> scaled namespace, provided that a debayering node is running in the 
> original camera namespace if the camera is bayer. Any idea of what is 
> more accurate/efficient?
Actually, that alternative approach is not possible with the given code. 
When a client subscribes to one of the image topics (mono, color, rect 
or rect_color) a TimeSynchronizer is used to synchronize the needed 
inputs and the camera_info, so missing images on that topic will lead 
the nodelet to an idle status, waiting until a whole set of synchronized 
messages arrives on all topics.

Joan Pau Beltran
Grup de Sistemes, Robòtica i Visió - DMI
Universitat de les Illes Balears
Ctra. Valldemossa, km 7.5 07122 Palma
Campus Universitari, edifici Anselm Turmeda
Telf (+34) 971 17 28 13
Fax (+34) 971 17 30 03

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Scale.cfg
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20111108/c8e470fd/attachment-0003.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scale_nodelet.cpp
Type: text/x-c++src
Size: 10252 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20111108/c8e470fd/attachment-0003.cpp>

More information about the ros-users mailing list