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

Camera calibration and ar_track_alvar pose

asked 2019-06-18 15:18:56 -0500

machinekoder gravatar image

I've managed to get ar_track_alvar working with my distortion-free USB camera. Tag recognition works wonderfully.

However, the marker poses detected by ar_track_alvar seem a bit off, meaning the scale of the values doesn't seem to be right.

How can I "calibrate" my camera, so the pose estimation of the detected tags is correct? As I have a distortion-free lens camera, I guess the typical checkerboard method for calibrating the camera wouldn't add much value.

I can't wrap my head around how the calibration method should be able to correct the distance/pose estimation. Am I missing something?

I noticed that the XY values of the pose are far more significant than the Z values. For example, having the tag ~10cm away from the camera gives me a Z value of 0.0005, which is 0.5mm, right?

The relative increase of the distance when I move the tag further away seems to be correct. For example, 20cm away results in Z ~0.001.

Thanks, Alex

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-06-18 16:47:05 -0500

Even if you do have a perfectly rectilinear pinhole camera you would still need to calibrate the FOV of the camera for the pose estimates from ar_track_alvar to be correct.

What is the distortion free camera you're using? I may be wrong but I suspect that it may mean that the lens doesn't have any barrel distortion, not that there is no distortion at all. Either way you will still need to calibrate your camera following the instructions shown here and make sure that the correct camera information is being published by your camera node. When you've completed this process you'll be able to find out exactly how distortion free or not your camera is by looking at the values in the calibration file.

The other thing to check is that the size of the markers you're using has been defined correctly, I think ar_track_alvar defaults to 5cm marker size but it can be adjusted in the launch file.

If you calibrate your camera and ensure the marker size is set correctly then the pose detection should be very precise at close range in well exposed images.

Hope this helps.

edit flag offensive delete link more

Comments

Thank you for the explanation. The estimated pose looks far better now. The matrix looks as follows:

image_width: 1280
image_height: 720
camera_name: camera
camera_matrix:
  rows: 3
  cols: 3
  data: [996.7275090000001, 0, 658.0003359999999, 0, 993.099216, 298.036377, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.077986, -0.14121, 0.000422, 0.003839, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [1004.31543, 0, 663.358353, 0, 0, 1006.614685, 298.055689, 0, 0, 0, 1, 0]

So I guess this means there is some distortion.

machinekoder gravatar image machinekoder  ( 2019-06-21 03:06:22 -0500 )edit

Thank you for the explanation. The estimated pose looks far better now. The matrix looks as follows:

image_width: 1280
image_height: 720
camera_name: camera
camera_matrix:
  rows: 3
  cols: 3
  data: [996.7275090000001, 0, 658.0003359999999, 0, 993.099216, 298.036377, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [0.077986, -0.14121, 0.000422, 0.003839, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [1004.31543, 0, 663.358353, 0, 0, 1006.614685, 298.055689, 0, 0, 0, 1, 0]

So I guess this means there is some distortion.

machinekoder gravatar image machinekoder  ( 2019-06-21 03:06:33 -0500 )edit

Glad you've improved the estimation accuracy. Yes it does look like there is a fair bit of distortion in your lens. The five distortion parameters define a polynomial which describes the radial distortion of the lens. If you're interesting you could use these calibration parameters with opencv to produce a truly distortion free image for comparison.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-06-21 03:18:40 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-06-18 15:18:56 -0500

Seen: 778 times

Last updated: Jun 18 '19