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

capturing 12-bit with pylon_camera

asked 2018-11-19 05:55:20 -0500

updated 2018-11-19 06:28:37 -0500

gvdhoorn gravatar image

Hi guys,

I just bought this basler camera, which has 74db of dynamic range, and supports 8/12 bits mono. I am trying to use pylon_camera package to capture the images with 12-bit depth by changing image_encoding in config/default.yaml to 'mono12', but I got this warn;

[ WARN] [1542626430.607438860]: Desired image encoding parameter: 'mono12' is not part of the 'sensor_msgs/image_encodings.h' list! Will not set encoding
[ INFO] [1542626430.988273140]: Cam supports the following [GenAPI|ROS] image encodings: ['Mono8'|'mono8'] ['Mono12'|'NO_ROS_EQUIVALENT'] 
[ WARN] [1542626430.988326369]: No image encoding provided. Will use 'mono8' or 'rgb8' as fallback!

I checked the code inside pylon_camera package, seems like it only supports 'mono8' 'rgb8' and "BayerBG8". Can anyone tell me if there is way to capture 12-bit image with this camera?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-19 08:05:44 -0500

lucasw gravatar image

updated 2018-11-19 08:36:01 -0500

The code says that format is unsupported:

    ...
    else
    {
        /* Unsupported are:
         * - Mono10
         * - Mono10p
         * - Mono12
         * - Mono12p
         * - BayerGR10
         ...

There is an issue about it https://github.com/magazino/pylon_cam... .

It may not be very difficult to add support for 12 bit images yourself. There would probably need to be a new grab method in include/pylon_camera/internal/impl/pylon_camera_base.hpp alongside the 8-bit grabs() that are there now:

bool PylonCameraImpl<CameraTrait>::grab(std::vector<uint8_t>& image)

The Basler Pylon SDK examples may have some code that grabs 12-bit images.

12 bit images are usually re-encoded into 16 bit images- image_encodings.h lists rgb16, bgr16, and mono16 and others but no 12 bit types.

There may be issues with 16 bit image handling in image processing nodes and image viewers (like image_proc and rqt_image_view).

https://github.com/lucasw/image_manip... is an image format conversion nodelet that wraps opencv convertTo and cvtColor and is possibly useful here.

edit flag offensive delete link more

Comments

1

magazino/pylon_camera#17 seems to already track 12bit image support.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-19 08:07:36 -0500 )edit

Thanks, updated.

lucasw gravatar image lucasw  ( 2018-11-19 08:33:11 -0500 )edit

Thank you, @lucasw. I could be able to capture 12-bit image by changing PixelFormat to "PixelFormat_Mono12" in LegacyAcquireSingleFrame.cpp from Basler Pylon SDK samples, Images are re-encoded into 16-bit pixel. Now trying to control exposure time as well as other camera parameters during runtime.

Nguyen-Quang gravatar image Nguyen-Quang  ( 2018-11-20 21:42:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-19 05:53:49 -0500

Seen: 1,148 times

Last updated: Nov 19 '18