Robotics StackExchange | Archived questions

camera_calibration not working Melodic Ubuntu 18.04

Hi All

Trying to calibrate a USB camera, using usbcam to get the image topics and imagepipeline camera_calibration to calibrat. The calibration GUI shows up but the image is blank and get this error message. Searched for a solution few people have a similar problem but no solutions?

Run:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/usb_cam/image_raw camera:=/usb_cam

Output:

('Waiting for service', '/usb_cam/set_camera_info', '...')
OK
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/user/catkin_ws/src/image_pipeline/camera_calibration/src/camera_calibration/camera_calibrator.py", line 107, in run
    self.function(m)
  File "/home/user/catkin_ws/src/image_pipeline/camera_calibration/src/camera_calibration/camera_calibrator.py", line 181, in handle_monocular
    max_chessboard_speed = self._max_chessboard_speed)
  File "/home/user/catkin_ws/src/image_pipeline/camera_calibration/src/camera_calibration/calibrator.py", line 725, in __init__
    super(MonoCalibrator, self).__init__(*args, **kwargs)
TypeError: super() argument 1 must be type, not classobj


(display:26734): GLib-GObject-CRITICAL **: 15:54:17.428: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Asked by jondave on 2022-05-20 09:58:28 UTC

Comments

It looks like you are not using the version of image_pipeline designed for ros melodic. Have you checked out the git branch named melodic?

Asked by Mike Scheutzow on 2022-07-23 08:31:10 UTC

Answers

There is a solution.

Go to your catkin workstation/src/camera_calibration/src/camera_calibration.

Go to this file: calibrator.py and find this section:

```

class Calibrator():
    """
    Base class for calibration system
    """
    def __init__(self, boards, flags=0, fisheye_flags = 0, pattern=Patterns.Chessboard, name='',
    checkerboard_flags=cv2.CALIB_CB_FAST_CHECK, max_chessboard_speed = -1.0):
        # Ordering the dimen

```

Then change it to: ```

class Calibrator(object):
    """
    Base class for calibration system
    """
    def __init__(self, boards, flags=0, fisheye_flags = 0, pattern=Patterns.Chessboard, name='',
    checkerboard_flags=cv2.CALIB_CB_FAST_CHECK, max_chessboard_speed = -1.0):
        # Ordering the dimen 

```

Asked by farhad-bat on 2022-07-23 00:30:23 UTC

Comments

@farhad-bat Do you know that these changes work correctly? It'is generally a bad idea to rosrun python3 code in melodic, and especially so when there exists a specific version of the package for melodic.

Asked by Mike Scheutzow on 2022-07-23 08:34:42 UTC

Yes, you are right. I edited the post. It seems to change class Calibrator(): to class Calibrator(object): solved my problem and the other things was extra.

Asked by farhad-bat on 2022-07-23 10:39:40 UTC