Manual calibration of monocular and stereo cameras

This page describes the usage of the Calibration App. The Calibration App is a complete command-line program allowing to perform advanced camera calibration and is available for Linux (Ubuntu) and macOS. It is meant to be used only when:

  • you  have to calibrate a monocular camera but you are not obtaining good results following the automatic procedure available under the Calibration tab of the Dragonfly Java App.
  • you have to calibrate a stereo camera different than the ASTAR stereo camera. For the calibration of the ASTAR stereo camera please follow the information here.
  • you have to calibrate a stereo camera that is made of 2 monocular cameras.

1 – Requirements

These are the prerequisites that MUST be met to make use of the Calibration App:

  • OS: Linux, macOS.
  • USB camera: monocular or stereo.
  • Dragonfly Java App installed at this link you can find all the information about the setup process.

2 – Setup

  1. Download the Calibration App available at this link.
  2. Download the calibration pattern at this link.
  3. Open the calibration pattern on the screen of your PC or print it out on an A4 or Letter paper and place it on a plain table/desk or stick the calibration pattern on a cardboard cover. Do not perform the calibration with wobbly paper in your hand. Those results are unusable.
  4. Measure the distance in meters of the HDIST line visible inside the calibration pattern. Regardless of the fact that you read “distance in millimeters” on the calibration pattern.

3 –  Perform the calibration

  1. Open a Terminal on your Linux/macOS.
  2. Go to the directory where you have downloaded the Calibration App and extract it.
  3. Run the executable named CalibrationApp. It should display the help and all the available options:

3.1 – Monocular camera

  • Now that you are aware about the options you can launch the Calibration App with the following options to calibrate a monocular camera. Example (change the values it accordingly):
  • You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  • Your challenge is now to collect 30 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  • To collect a picture press P.
  • Once you have collected 30 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  • You can now press Q to stop the Calibration App.
  • The JSON calibration file has been saved inside the Calibration App directory and can be now moved inside the Dragonfly folder (cd dragonfly_linux/application/data/config). Continue with the configuration process of Dragonfly at this link.

3.2 – Stereo camera (single device)

The stereo calibration is tricky and a bit longer to perform:

  1. First, it is required to perform a monocular calibration of the 2 cameras.
  2. If you have a single device stereo camera with concatenated images, launch this command to calibrate the LEFT side of the stereo camera (change the hdist value accordingly):
  3. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  4. Your challenge is now to collect 30 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  5. To collect a picture press P.
  6. Once you have collected 30 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  7. Press CTRL + C to terminate the command.
  8. Launch this command to calibrate the RIGHT side of the stereo camera (change the hdist value accordingly):
  9. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  10. Your challenge is now to collect 30 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  11. To collect a picture press P.
  12. Once you have collected 30 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  13. Press CTRL + C to terminate the command.
  14. Once the calibration file for both cameras is available, you can perform the stereo calibration by providing the 2 calibration files in option. Example (change the hdist value accordingly):
  15. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  16. Your challenge is now to collect 40 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  17. To collect a picture press P.
  18. Once you have collected at least 40 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  19. You can now press Q to stop the Calibration App.
  20. The “stereo.json” calibration file has been saved inside the Calibration App directory and can be now moved inside the Dragonfly folder (cd dragonfly_linux/application/data/config). Continue with the configuration process of Dragonfly at this link.

3.3 – Stereo camera (dual device – 2 monocular cameras)

The stereo calibration is tricky and a bit longer to perform:

  1. First, it is required to perform a monocular calibration of the 2 cameras.
  2. If you have a stereo camera made of 2 monocular cameras launch this command to calibrate the LEFT camera (change the hdist value accordingly):
  3. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  4. Your challenge is now to collect 30 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  5. To collect a picture press P.
  6. Once you have collected 30 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  7. Press CTRL + C to terminate the command.
  8. Launch this command to calibrate the RIGHT camera (change the hdist value accordingly):
  9. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  10. Your challenge is now to collect 30 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  11. To collect a picture press P.
  12. Once you have collected 30 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  13. Press CTRL + C to terminate the command.
  14. Once the calibration file for both cameras is available, you can perform the stereo calibration by providing the 2 calibration files in option. Example (change the hdist value accordingly):
  15. You should now see the preview of your camera. If you hold your calibration pattern plate into the camera, you should see the black dots being connected by colored lines. It doesn’t matter whether you move the camera over the calibration pattern or the calibration pattern in front of the camera.
  16. Your challenge is now to collect 40 different pictures. The pictures taken should be as diversified as possible:
    • Translate and rotate the pattern between each picture along every axis.
    • Avoid taking two pictures of the pattern in the same position.
  17. To collect a picture press P.
  18. Once you have collected at least 40 pictures press ENTER. The Calibration App will start the computation of the calibration parameters of your camera and will be notified once this process is finished.
  19. You can now press Q to stop the Calibration App.
  20. The “stereo.json” calibration file has been saved inside the Calibration App directory and can be now moved inside the Dragonfly folder (cd dragonfly_linux/application/data/config). Continue with the configuration process of Dragonfly at this link.