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

Exception in camera_calibration with Bumblebee

asked 2014-09-29 10:03:59 -0500

Ronald gravatar image

updated 2014-09-29 10:19:58 -0500

gvdhoorn gravatar image

I want to use the camera_calibration package to calibrate (both cameras of) the bumblebee 2 camera.

The images are being published correctly with topic names /camera/0/intensity and /camera/1/intensity. I can view the images in the viewer and I can see the values with rostopic echo.

When I run this command, nothing seems to happen:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/0/intensity camera:=/camera/0 --no-service-check

I also tried to calibrate just one camera:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/0/intensity camera:=/camera/0 --no-service-check

But in the case of one camera I get the following error:

Exception in thread Thread-5:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run()
    File "/opt/ros/indigo/lib/camera_calibration/cameracalibrator.py", line 93, in run self.function(m)
    File "/opt/ros/indigo/lib/camera_calibration/cameracalibrator.py", line 175, in handle_monocular drawable = self.c.handle_msg(msg)
    File "/opt/ros/indigo/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 691, in handle_msg gray = self.mkgray(msg)
    File "/opt/ros/indigo/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 255, in mkgray return self.br.imgmsg_to_cv2(msg, "mono8")
    File "/opt/ros/indigo/lib/python2.7/dist-packages/cv_bridge/core.py", line 121, in imgmsg_to_cv2 dtype=dtype, buffer=img_msg.data)
    TypeError: buffer is too small for requested array

I am using Ubuntu 14.04 with ROS Indigo and the calibration does work with other cameras. Does anyone have a clue how to solve this?

edit retag flag offensive close merge delete

Comments

Did you install all of the dependencies for camera calibration? Try rosdep install camera_calibration

l0g1x gravatar image l0g1x  ( 2014-09-29 13:42:36 -0500 )edit

All dependencies were installed with rosdep install camera_calibration, but unfortunately that did not solve it. I got exactly the same error.

Ronald gravatar image Ronald  ( 2014-09-30 02:48:01 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-09-30 03:37:44 -0500

gvdhoorn gravatar image

updated 2014-09-30 03:41:37 -0500

Not really a direct answer, but:

[..] TypeError: buffer is too small for requested array

These kind of errors are typically caused by the input byte array (in this case: img_msg.data) not having the expected layout, and thus not the required number of bytes to successfully convert into the desired dtype. That or the input array is really too small, for instance because of an incorrect assumption on image size / depth. See the Converting between ROS images and OpenCV images tutorial for some info on image encodings.

I'm not too familiar with imgmsg_to_cv2(..), but could it be that the images coming from your camera are not actually in the format that cv_bridge expects?


The Bumblebee Reverse engineering Calibration question (and in particular the answer by William) also could be interesting.

edit flag offensive delete link more

Comments

There are no problems with camera_calibration if I use the package pointgrey_camera_driver to publish the Bumblebee2 images. I think that you are right that the published topic I was using did not have the layout that was expected by camera_calibration.

Ronald gravatar image Ronald  ( 2014-09-30 04:05:59 -0500 )edit

Which package were you using originally? Might be an idea to contact the maintainer and try to figure out what went wrong. Also, rostopic echo should show you the actual encoding of the /camera/0/intensity topic.

gvdhoorn gravatar image gvdhoorn  ( 2014-09-30 04:26:34 -0500 )edit

The encoding is indeed different. The pointgrey_camera_package is publishing /camera/left/image_raw with bayer_grbg8 encoding. I was publishing and using /camera/0/intensity with bgr8 encoding before.

Ronald gravatar image Ronald  ( 2014-09-30 06:47:04 -0500 )edit

This was custom code that interfaced with the camera(s)? No package maintainer to contact then.

gvdhoorn gravatar image gvdhoorn  ( 2014-09-30 07:05:43 -0500 )edit

I was indeed using custom code.

Ronald gravatar image Ronald  ( 2014-09-30 07:20:17 -0500 )edit

Shame on you then :). Perhaps add your solution as an answer and use it to mark the question as answered.

gvdhoorn gravatar image gvdhoorn  ( 2014-09-30 07:46:19 -0500 )edit
0

answered 2014-09-30 09:09:20 -0500

Ronald gravatar image

It is solved by using the package pointgrey_camera_driver to publish the Bumblebee2 images. The images will be published in the layout that camera_calibration expects.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-09-29 10:03:59 -0500

Seen: 872 times

Last updated: Sep 30 '14