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

Camera calibration crashes

asked 2013-03-05 20:25:09 -0600

r0nald gravatar image

While trying to use camera calibration with the command

rosrun camera_calibration cameracalibrator.py --size 8x6
--square 0.03 image:=/camera/image camera:=/camera

the utility crashes, sometimes during start, sometimes when the checkboard is moving in the frame. If the checkboard is in the middle of the frame when the utility starts, then sometimes I can see the checkboard from the GUI and the utility gets the first calibration data, but the utility crashes as soon as I try to move the board. The error messages are always:

OpenCV Error: Assertion failed (blockSize % 2 == 1 && blockSize > 1) in adaptiveThreshold, file /tmp/buildd/ros-groovy-opencv2-2.4.4-1precise-20130301-2025/modules/imgproc/src/thresh.cpp, line 797
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/opt/ros/groovy/lib/camera_calibration/cameracalibrator.py", line 68, in run
    self.function(m)
  File "/opt/ros/groovy/lib/camera_calibration/cameracalibrator.py", line 134, in handle_monocular
    drawable = self.c.handle_msg(msg)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 729, in handle_msg
    scrib_mono, corners, downsampled_corners, board, (x_scale, y_scale) = self.downsample_and_detect(gray)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 399, in downsample_and_detect
    (ok, downsampled_corners, board) = self.get_corners(scrib, refine = True)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 367, in get_corners
    (ok, corners) = _get_corners(img, b, refine)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/camera_calibration/calibrator.py", line 156, in _get_corners
    (ok, corners) = cv.FindChessboardCorners(mono, (board.n_cols, board.n_rows), cv.CV_CALIB_CB_ADAPTIVE_THRESH | cv.CV_CALIB_CB_NORMALIZE_IMAGE | cv2.CALIB_CB_FAST_CHECK)
error: blockSize % 2 == 1 && blockSize > 1

Any ideas what could be wrong and how to fix this?

edit retag flag offensive close merge delete

Comments

We are just trying to calibrate a camera and see exactly the same thing.

TommyP gravatar image TommyP  ( 2013-03-11 06:11:06 -0600 )edit

I'm getting the exact same problem as well using Groovy on Ubuntu 11.10.

kamek gravatar image kamek  ( 2013-03-14 07:44:21 -0600 )edit

Any other case, can you please state your g++ version and whether you are 32 bits or not ? Thx

Vincent Rabaud gravatar image Vincent Rabaud  ( 2013-04-16 11:18:38 -0600 )edit

same issue here. g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Linux xxx 3.2.0-43-generic-pae #68-Ubuntu SMP Wed May 15 03:55:10 UTC 2013 i686 i686 i386 GNU/Linux

Crusty gravatar image Crusty  ( 2013-06-03 04:04:03 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
4

answered 2013-03-20 08:50:30 -0600

r0nald gravatar image

Try this: download OpenCV source, compile it and replace the opencv libraries(make a backup!) of ROS with the compiled libraries. It helped me with 32bit Ubuntu 12.04 and ROS Groovy.

In some other code, I had a problem that cv::findCirclesGrid was corrupting fpu stack and causing other parts of my code to fail. This happenned only when using OpenCV libraries of ROS. After replacing the OpenCV libraries, findCirclesGrid() worked and also calibration started to work! Colleagues with 32bit Ubuntu 12.10 or 64bit systems did not experience the same issues.

edit flag offensive delete link more

Comments

I thought that work but unfortunately it doesn't

destogl gravatar image destogl  ( 2013-03-28 00:30:11 -0600 )edit

Hi, I am the maintainer of OpenCV on ROS. This is very grave and we heard around 2.3.2 but could not pinpoint it then. But gcc 32 bit on Precise seems to be the culprit (or OpenCV of course :) ). Can you please send me the flags ASAP ? Thx (my email is in the ROS package)

Vincent Rabaud gravatar image Vincent Rabaud  ( 2013-04-16 10:19:45 -0600 )edit

I just upgraded to Ubuntu 12.10 64-bit, and that pretty much resolved all of my problems

mortonjt gravatar image mortonjt  ( 2013-04-17 10:03:43 -0600 )edit

Is there a solution for Ubuntu 12.04 and ROS Groovy?

ZoltanS gravatar image ZoltanS  ( 2013-04-24 22:06:43 -0600 )edit

I downloaded the OpenCV source v.2.4.5, compiled it, then I made "sudo checkinstall" not to mess up my system, but still have the same problem with the camera calibration. Do I need to recompile the camera calibration and eventuell the usb_cam sources too?

ZoltanS gravatar image ZoltanS  ( 2013-04-30 05:01:00 -0600 )edit

It turned out, that it still uses the old version (2.4.4) no matter I installed the new OpenCV. How should I replace the old with the new version?

ZoltanS gravatar image ZoltanS  ( 2013-05-01 23:10:12 -0600 )edit

ROS uses OpenCV libraries that are installed under /opt/ros, even if you have other installs of OpenCV in your system. Compile the same version of OpenCV that ROS has and replace the .so files of ROS OpenCV with the ones you compiled. This MIGHT help.

r0nald gravatar image r0nald  ( 2013-05-02 00:22:37 -0600 )edit

thanks r0nald! I overwrote the opencv related files in /opt/ros/groovy/lib but it didn't work. I get a lot of error: (process:26659): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.3/./gobject/gtype.c:2722: You forgot to call g_type_init()

ZoltanS gravatar image ZoltanS  ( 2013-05-02 05:10:01 -0600 )edit
0

answered 2013-05-02 08:14:21 -0600

Thanks a lot dude. I downloaded opencv-2.4.5 and replaced in the ROS of course making backup of the old opencv libraries and it worked without any problem.

edit flag offensive delete link more
0

answered 2013-05-15 06:40:27 -0600

I tried overwriting the existing files (in /opt/ros/groovy/lib) with a fresh compile/install of opencv. It doesn't crash but it doesn't show the gui either. Oddly enough, the same behavior happens on a 64bit Ubuntu 12.10 installation.

My fix has been to install the fuerte version (sudo apt-get install ros-fuerte-image-pipeline) and run the fuerte version of the calibration. It works fine on Ubuntu 12.04 32bit.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2013-03-05 20:25:09 -0600

Seen: 3,178 times

Last updated: May 15 '13