Analysis of Space Coordinate Accuracy of Binocular Stereo Vision

Reference link: https://zhuanlan.zhihu.com/p/362718946

This article mainly refers to the theoretical derivation of the link blogger, and analyzes and corrects it according to your own understanding

1. Questions to consider:

  1. The accuracy of the binocular stereo vision system is determined by those factors?

  2. Is the accuracy in the three directions of X/Y/Z the same? If not the same, which direction has better accuracy?

In the most common case, the final output of binocular stereo vision is the XYZ coordinates in the left camera coordinate system. This article takes these three components as the precision analysis object.

First, do some variable definitions:

b : Baseline length, unit mm

f : focal length

x, y : coordinates of the image point (with the image principal point as the origin)

X, Y, Z : Coordinates in the camera coordinate system, in mm

d : Parallax

Let's first look at the solution formulas of these three components:

Z = b f d ,    X = Z f x ,    Y = Z f y Z = \frac{bf}{d},\ \ X = \frac{Z}{f}x,\ \ Y = \frac{Z}{f}y Z=dbf,  X=fZx,  Y=fZy

It can be seen from the formula that when the hardware parameters b and f are fixed, the value of XYZ is directly related to the pixel coordinate value, and the precision of XYZ is actually the spatial deviation value under the pixel precision, so we take the pixel precision as the basis ( min) unit of precision.

2. Revise the blogger's derivation :

When the variable is defined as follows

The pixel x represents the size, in mm

The focal length f represents the physical size, in mm

Parallax d stands for physical size, unit mm

In order to use the blogger's derivation formula, the following is an explanation of the precision derivation in the Z direction.

Suppose the precision (pixel size) of the image point x, y is sx, sy s_{x},\ s_{y}sx, sy, the accuracy of the disparity d is sd s_{d}sd. It is generally considered that the precision of x and y is the same, that is, sx = sy = s s_{x} = s_{y} = ssx=sy=s , and the accuracy of the parallax can generally be expressed by the formula

s d = s x 2 s_{d} = \frac{s_{x}}{\sqrt{2}} sd=2 sx

Z direction precision

First of all, for Z, the independent variable is d, we take the partial derivative of d, we can get

∂ Z ∂ d = − b f d 2 = − Z 2 b f \frac{\partial Z}{\partial d} = - \frac{bf}{d^{2}} = - \frac{Z^{2}}{bf} dZ=d2bf=bfZ2

∂ Z / ∂ d \partial Z/\partial d The unit of ∂ Z / d
is mm/mm, and the physical meaning is the spatial distance represented by the parallax value per millimeter, which needs to be multiplied by the parallax precisionsd s_{d}sd, in order to get the spatial distance represented by a single parallax accuracy, the unit is mm/pix

Available:

s Z = Z b Z f s d =   Z b   Z f   s x 2 s_{Z} = \frac{Z}{b}\frac{Z}{f}s_{d} = \ \frac{Z}{b}\ \frac{Z}{f}\ \frac{s_{x}}{\sqrt{2}} sZ=bZfZsd= bZ fZ 2 sx

It can be seen that the accuracy in the Z direction is positively correlated with the square of Z, that is, it is positively correlated with the square of the distance between the object and the camera (strictly speaking,
the distance in the Z direction).

假设 q = Z b , m = Z f q = \frac{Z}{b},m = \frac{Z}{f} q=bZ,m=fZ, then q
is the reciprocal of the well-known base height ratio, and m is the scale of the image (ie, GSD, the spatial size represented by a pixel). This formula shows that the base height ratio and GSD play a key role in the accuracy of the Z direction, and more Larger base height (1/q) and smaller GSD (m) help to improve Z-direction accuracy. This can be used to guide the design of binocular stereo vision systems.

Similarly, referring to the derivation process of the blogger, the accuracy in the XY direction can be obtained.

3. Derivation simplification

The above derivation needs to know the actual size of the camera’s pixels and focal length, which is cumbersome.

Normally, the internal parameter data in the calibration file is in pix, and the following is deduced in units of pixel pix

When the variable is defined as follows

Pixel x represents the pixel coordinates, unit pix

The focal length f represents the pixel ratio, in pix

Parallax d stands for pixel ratio, unit pix

Z direction precision

First of all, for Z, the independent variable is d, we take the partial derivative of d, we can get

∂ Z ∂ d = − b f d 2 = − Z 2 b f \frac{\partial Z}{\partial d} = - \frac{bf}{d^{2}} = - \frac{Z^{2}}{bf} dZ=d2bf=bfZ2

At this time ∂ Z / ∂ d \partial Z/\partial dThe unit of ∂ Z / d
is mm/pix, and the physical meaning is the spatial distance represented by a single pixel pix, which needs to be divided by2 \sqrt{2}2 , to get the spatial distance represented by a single parallax precision

Available:

s Z = 1 2 Z b Z f   s_{Z} = \frac{1}{\sqrt{2}}\frac{Z}{b}\frac{Z}{f}\ sZ=2 1bZfZ 

It can be seen that the accuracy in the Z direction is positively correlated with the square of Z
, that is, it is positively correlated with the square of the distance between the object and the camera (strictly speaking,
the distance in the Z direction).

XY direction precision

Similarly, for X, the independent variables are Z and x, we take partial derivatives for Z and x, we can get

∂ X ∂ Z = x f ,    ∂ X ∂ x = Z f \frac{\partial X}{\partial Z} = \frac{x}{f},\ \ \frac{\partial X}{\partial x} = \frac{Z}{f} ZX=fx,  xX=fZ

The accuracy in the X direction can be expressed as

s X = ( x f s Z ) 2 + ( Z f ) 2 s_{X} = \sqrt{ {(\frac{x}{f}s_{Z})}^{2} + {(\frac{Z}{f})}^{2}} sX=(fxsZ)2+(fZ)2

Similarly, the accuracy in the Y direction can be expressed as

s Y = ( y f s Z ) 2 + ( Z f ) 2 s_{Y} = \sqrt{ {(\frac{y}{f}s_{Z})}^{2} + {(\frac{Z}{f})}^{2}} sY=(fysZ)2+(fZ)2

s Z = Z 2 2 b f ,    X = Z f x ,    Y = Z f y s_{Z} = \frac{Z^{2}}{\sqrt{2}bf},\ \ X = \frac{Z}{f}x,\ \ Y = \frac{Z}{f}y sZ=2 bfZ2,  X=fZx,  Y=fZSubstituting y into the formula, we can get

s X = Z f 1 + ( x Z 2 f b ) 2   = Z f 1 + ( X 2 b ) 2   s_{X} = \frac{Z}{f}\sqrt{1 + {(\frac{xZ}{\sqrt{2}fb})}^{2}}\ = \frac{Z}{f}\sqrt{1 + {(\frac{X}{\sqrt{2}b})}^{2}}\ sX=fZ1+(2 fbxZ)2  =fZ1+(2 bX)2  

s Y = Z f 1 + ( y Z 2 f b ) 2   = Z f 1 + ( Y 2 b ) 2   s_{Y} = \frac{Z}{f}\sqrt{1 + {(\frac{yZ}{\sqrt{2}fb})}^{2}}\ = \frac{Z}{f}\sqrt{1 + {(\frac{Y}{\sqrt{2}b})}^{2}}\ sY=fZ1+(2 fbyZ)2  =fZ1+(2 bY)2  

It can be seen that the accuracy in the X and Y directions is not only positively correlated with the distance of Z, but also positively correlated with the respective distances in the X and Y directions.

Y/Z Accuracy Curve

In order to more clearly observe the trend of the Y/Z direction accuracy changing with the Z value, let's do a simulation, calculate and draw the accuracy curves in the Z and Y directions (Y direction and X direction have the same scale, the trend is consistent).

According to the actual case parameter data analysis

Case number one:

Y = 58 mm, accuracy at 58 mm in Y direction

f = 275 pix

b = 32 mm

The drawn accuracy curve is as follows:
insert image description here
Case 2:

Y = 580 mm, accuracy at 580 mm in Y direction

f = 275 pix

b = 32 mm
insert image description here

It can be seen from the results of precision calculation and the trend chart that the precision value becomes larger with the increase of Z (meaning that the precision is getting worse), and when the Z value is large, the precision in the Z direction is worse than the precision in the Y direction
. As Z increases, the gap becomes more pronounced.

From the simulation data, when the distance in the Z direction is 1000mm, the accuracy value is as high as 80mm, which is 8% accuracy error. In fact, it is not so big, which is related to the binocular stereo vision algorithm. The post-processing of the algorithm does sub-pixel fitting, and the precision is the space size represented by subpix, so the actual precision may only be a fraction of the simulated data.

The accuracy in the Y direction is not only related to the Z value, but also positively related to the Y value itself. The larger the Y, the worse the accuracy in the Y direction.

Guess you like

Origin blog.csdn.net/h1527820835/article/details/128275652