Ask Your Question

Distance from camera to object.. The error increasing linearly!

asked 2017-04-18 09:24:55 -0600

ROSpioneer gravatar image

I compute the distance from an object (Chessboard) using OpenCV and my camera parameters following those steps:

1- findChessboardCorners

2- solvePnP

3- ->Distance from the translation vector given by solvePnP

The issue is that the error is increasing linearly when I get far from the camera.

The error is simply the difference between the real distance and the one given by my program.

The camera is calibrated (focal length 2.8mm, wide angle + distortion)

I want to know why the error is increasing? Is that normal?

edit retag flag offensive close merge delete



like in this link

LBerger gravatar imageLBerger ( 2017-04-18 09:38:26 -0600 )edit

@LBerger So what do you think that error is due to? is it normal as I'm using a single camera?

ROSpioneer gravatar imageROSpioneer ( 2017-04-18 10:29:48 -0600 )edit

yes with one camera error should be something like d*pixel_size/focal/2

LBerger gravatar imageLBerger ( 2017-04-18 12:17:55 -0600 )edit

Yep. Basically, your error in finding the chessboard corners goes up with the distance, because a 0.1 (or whatever) pixel error is now a larger distance. So a higher uncertainty in your world points means a higher uncertainty in your camera location.

Tetragramm gravatar imageTetragramm ( 2017-04-18 17:42:32 -0600 )edit

@LBerger@Tetragramm Do you have any references about that? I'm interested more in that error so I can correct it with respect to my camera parameters :)

ROSpioneer gravatar imageROSpioneer ( 2017-04-19 03:41:47 -0600 )edit

reference "Multiple view geometry in computer vision" R. Hartley A. Zisserman

LBerger gravatar imageLBerger ( 2017-04-19 04:15:13 -0600 )edit

@LBerger I mean that error d*pixel_size/focal/2, how did you get it ? it's not linear!

ROSpioneer gravatar imageROSpioneer ( 2017-04-20 02:13:38 -0600 )edit

pixel_size is constant, focal length is constant, 2 is constant, only d changes, so it is linear.

What that equation means is basically what I said. As you move further away, each pixel covers more area on the object. So if you double the distance, what was 4 pixels is now one pixel.

Tetragramm gravatar imageTetragramm ( 2017-04-20 20:33:25 -0600 )edit

OK got it! I'll write an answer.. thanks both of you

ROSpioneer gravatar imageROSpioneer ( 2017-04-26 03:52:00 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-04-26 03:53:37 -0600

ROSpioneer gravatar image

I'll write an answer to the issue after doing some experiments. I corrected my distance as follow:

Distance_corrected = distNorme+distNorme*correction

distNorme is the distance to the chessboard which is the norm of the translation vector given by solvePnP OpenCV function.

correction is

correction=pixel_size/focal_mm/2 = 2/focal_pixel

The results are better, still have an error increasing linearly though but not very strong as distNorme (distance not corrected).

I'm still seeking for references or documentation of that correction error. I need more details about it.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-04-18 09:24:55 -0600

Seen: 696 times

Last updated: Apr 26 '17