How do I configure AI-TRAFFIC and AI-CROWD-DEEP plugins 3D calibration?

Calibration is a mandatory procedure to enable AI-Traffic available functionalities. Since it is a crucial step of the configuration process, the interface has been designed to be as intuitive as possible also for less experienced users. You can find all the calibration parameters in the sheets "Calibration" and "3D Calibration".

Calibration

In the drop-down menu on the left side by selecting the panel "Algorithm Parameters" and the panel “Calibration” it is possible to set the real parameters of the camera with respect to the road.
A mistake during the configuration of this field negatively affects the results of the calibration process.

Calibrazione

Then, you will have to set the following parameters:

  1. Camera height in (m): camera height in meters with respect to the street
  2. Horizontal angle: the horizontal field of view of the camera in degrees
  3. Vertical angle: the vertical field of view of the camera in degrees

3D Calibration

Only after you have set "Calibration" parameters you can start with the "3D Calibration" that you can find in the panel "Algorithm Parameters" as well. From the drop-down menu you can choose between two different types of calibration:
A) Lines parallel to road and vertical lines
B) Lines parallel to road only

Calibrazione3D-B Calibrazione3D-A

The procedures consist in three steps:

Step 1: Drawing lines parallel to road(blue)

Linee Orizzontali

This step is common to both types of calibration.
As shown in the image on the right, you can use the boundary lines of the carriageway or any other line parallel to the motion direction. Be careful that the lines are drawn with accuracy, since an error in this step may negatively affect the results of the calibration.

Step 2: Drawing lines vertical with respect to the road (green) (A)

Linee Verticali

As shown in the picture, if there are parallel vertical lines (for instance,street lamps, buildings), you can use them to perform the Step 2 of the calibration. Be careful in drawing lines with accuracy, as a mistake in this step could negatively affect the results of the calibration.

Step 2: Drawing lines transversal to the road (red) (B)

Linee Verticali

If there are no vertical parallel lines available in the scene or that kind of calibration fails or is imprecise, an alternative way to complete the calibration is shown in the image. You can use parallel lines on the ground to perform the step 2 of the calibration if those are perpendicular to the blue ones from step 1. Be careful to draw the lines accurately, since an error in this step may negatively affect the results of the calibration

Step 3: Configuration of camera parameters

You can obtain the best calibration possible through the configuration of camera parameters, namely:

  • sensor width
  • camera lense

Parametri della fotocamera

The first can be easily retrieved from the camera data sheets and it is given as an inch fraction (a table for conversion can be retrieved HERE.
The latter may also be available on the datasheet, though some cameras may mount lenses with a variable level of zoom (i.e. variable focal length, varifocal).
For varifocal cameras, the datasheet provides a range (minimum to maximum focal length, e.g. 5.2-62.4 mm), but the specific value depends on how the lens is configured, either manually (rotating a wheel) or electronically (via software); in this case, keep in mind that a small number means a large field of view with possible distortion of the image, while a large number means maximum zoom.

Step 3: Fine tuning and trubleshooting

Fine tuning and trubleshooting

  • Send the configuration; a message will appear on the top:“Calibration data visible e = X.XX”
  • Furthermore, a grid will appear on the ground inside the sensor area. Each tile of the grid measures 1x1 meters in the estimated 3d space.
    The grid and the message be used for troubleshooting and fine tuning. Remember to disable them when you are finished with fine tuning unchecking the box “show/edit calibration data”.


The number e = X.XX represents the estimated calibration error:
if it is large (e.g. >1), it means that the three parameters (focal length, height, calibration lines) do not match with each other.
The most common problem is that you forgot to set one.

TIP: If you don’t see the grid or the error you may have forgot to draw the analytic sensor.



Fine tuning and trubleshooting
Each tile of the grid measures 1x1 meters.
If the tiles look small, this may mean that the configured height is too high. Decrease it.
If the tiles are too large, it means that the configured height is low and you need to increase it.

In the top figure, the tiles are too large: one runway only covers one tile and one half in width. The with of the car is wrongly estimated to be 60cm.
In the bottom figure the height is increased from 3 meters to 8 and the problem is fixed.



Fine tuning and trubleshooting
Focal length controls how fast the tiles shrink with depth. It is crucial to have it right in order to have a low error

  1. In the first image the focal Length too small (10mm). The tile size varies too much with depth. Furthermore, note that the error is higher (3.77) and the grid is shifted w.r.t. the senso because the different parameters do not match.
  2. In the third image the focal Length too large (110mm). All the tiles have equal size and they are squeezed
  3. In the second image is just right (40mm)



F.A.Q.
Other common problems and relative causes/solutions:

  1. Can’t see the error on the top right corner

    • You may have forgot to draw an analytic sensor that uses 3d calibration.
    • You may have disabled the function “show/edit calibration data”.
  2. The focal length and the height are right, the lines are accurate but the configuration is broken:

    • Consider changing the calibration method: green vertical lines instead of red ones on the ground or vice-versa.
  3. The grid appears in weird spots (e.g. on the ceiling):

    • The sensor is not drawn on the ground but some points are in the air.
    • The error is too high, check the height, the focal distance and sensor size, and .