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

camera_calibration not working Melodic Ubuntu 18.04

asked 2022-05-20 09:58:28 -0500

jondave gravatar image

Hi All

Trying to calibrate a USB camera, using usb_cam to get the image topics and image_pipeline 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
edit retag flag offensive close merge delete

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?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-07-23 08:31:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-23 00:30:23 -0500

farhad-bat gravatar image

updated 2022-07-23 10:37:52 -0500

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

```

edit flag offensive delete link more

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.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-07-23 08:34:42 -0500 )edit

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.

farhad-bat gravatar image farhad-bat  ( 2022-07-23 10:39:40 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-05-20 09:58:28 -0500

Seen: 496 times

Last updated: Jul 23 '22