# Camera Calibration on a Computer

This page describes how to calibrate Skynode's camera using a calibration tool on a connected computer.

## Installing the calibration tool

The calibration tool is available in a virtual machine. We recommend using it on either a **Windows 11** or **Ubuntu** host machine.

Please [contact Auterion](https://auterion.com/company/contact-us/) to receive a download link for the necessary software.

### Virtual machine installation

{% hint style="info" %}
Installing the virtual machine requires **20GB of free storage** on the host machine.
{% endhint %}

1. Download the **Ubuntu22.ova** file provided by Auterion.\
   Note that this is a large file: approximately 7GB.
2. Download and install VirtualBox.
   1. Download the latest version for your host machine from <https://www.virtualbox.org/wiki/Downloads>.
   2. Install VirtualBox by double-clicking the downloaded file. Follow the installation prompts, using the default settings.
   3. Restart your computer after the installation if prompted.
3. Launch the newly installed VirtualBox application. A shortcut should be visible on your desktop as **Oracle VM VirtualBox**.
4. Import the virtual machine.
   1. In VirtualBox, go to **File > Import Appliance…**.
   2. In the window that appears, click ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXckJwe-KvCszotXRrX7HbhXESKUvORcFX8jj1yvD37kf5toQ8rJsGtYMWeYuaPyDm2WM8oZYmUK1qqfV_7cBySvljDdPmN3yaPPpnrN-iTtg4TVOV4DcnoS07MUKmnebrn-dbjyhvx7SL_SpK0WBrEFHAY6?key=YOvfwEFfLS38SLRDATd9VQ) and select the **Ubuntu22.ova** file provided by Auterion.
   3. Click **Next**, then click **Finish** to start the import process.

      This process might take a few minutes, and you’ll see a progress bar labelled **Importing appliance…**.
   4. Once the import is complete, you will see **Ubuntu 22.04** listed in the left sidebar of VirtualBox.
5. Start the virtual machine.
   1. Click on **Ubuntu 22.04**, then click **Start** to launch the virtual machine.
   2. When prompted, select the user **auterion**.
   3. Enter the password **auterion**.
6. On the desktop, you will now see two files:
   1. **AuterionCameraCalibration.AppImage**
   2. **calibration\_settings.env**

### Ubuntu 22.04 installation (advanced)

Some users with Ubuntu 22.04 machines may wish to install and run the calibration tool without using a virtual machine. The steps for this advanced installation are described in the section below.

<details>

<summary>Advanced installation</summary>

1. Install [ROS 2 Humble](https://docs.ros.org/en/humble/Installation.html). We recommend using the binary packages.
2. Extract the calibration tool ZIP file provided by Auterion to a convenient location on your machine. There should now be two files in the same directory:
   1. **AuterionCameraCalibration.AppImage**
   2. **calibration\_settings.env**

</details>

## Performing a calibration

Start by preparing the calibration target, then run the calibration tool.

The calibration process should take around 1 to 2 minutes.

### Prepare the calibration target

Download and print the checkerboard calibration pattern in the PDF file below and mount it to a flat, rigid surface.

Measure the width of one square as accurately as possible. If printed on an A4 page, the width should be close to 25mm (0.025m).

{% file src="<https://3329189600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFW1Ge1p1f6WHyiYCb146%2Fuploads%2Fgit-blob-35a51f9d9535299c055c778887116e723ba76eb5%2FCheckerboard-A4-25mm-8x6.pdf?alt=media>" %}

Double-click and open the **calibration\_settings.env** file distributed with the calibration tool. Check and adjust the environment variables to fit your setup.

| Setting                        | Default value                    | Meaning                                                                                                                                                            |
| ------------------------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| CALIBRATION\_OUTPUT\_DIRECTORY | \~/Documents/camera\_calibration | Path to the folder on your computer where the calibration files will be saved, additionally to your Skynode device.                                                |
| CALIBRATION\_PATTERN           | chessboard                       | The pattern used for camera calibration. Only the chessboard pattern is currently supported.                                                                       |
| CHESSBOARD\_SIZE               | 8x6                              | Number of inner corners on the chessboard (width x height). The order of width and height doesn't matter (8x6 = 6x8). On one axis, this is `number_of_squares-1` . |
| SQUARE\_WIDTH                  | 0.025                            | Width of one square on the checkerboard, as measured above, in metres.                                                                                             |
| N\_DISTORTION\_COEFFS          | 5                                | Number of distortion coefficients for the calibration model. Only 4 or 5 are allowed.                                                                              |
| SKYNODE\_IP                    | 10.41.1.1                        | IP address of the skynode device.                                                                                                                                  |

### Prepare Skynode

1. Ensure that the **video2ros** app is installed on Skynode. If not, you can download and install it from Auterion Suite.
2. Open the apps page of the Skynode web UI at <http://10.41.1.1/apps>.
3. Open the settings for the **video2ros** app, under **System Services**, by clicking the gear icon and then **Settings.**
4. Set **Use Custom Auto Exposure** to **false**, and click **Save**.

{% hint style="info" %}
On Skynode X and Skynode ENT, the **gst-ros-bridge** app is also required.\
Please contact Auterion to obtain a copy of the app and for further assistance.
{% endhint %}

### Start the calibration

Ensure that the square width is correct in **calibration\_settings.env** (see above), then double-click on **AuterionCameraCalibration.AppImage** to open the calibration tool.

A window will appear with the video stream from the camera. Hold the checkerboard in front of the camera such that the entire pattern is visible in the image. If the pattern is recognised, a multi-coloured grid will be drawn on the checkerboard.

Move the checkerboard around in front of the camera, keeping the entire pattern visible. Data must be captured with the pattern at different positions and orientations:

1. at the **top and bottom** of the image,
2. at the **left and right** sides of the image,
3. **near and far** from the camera, and
4. with different angles of **skew** (where one corner of the pattern is closer to or further from the camera).

The coloured bars to the right of the image will indicate how many images have been captured at each of these positions. They will turn green when sufficient data has been captured.

Once the data capture is complete, the **Calibrate** button will turn green. When ready, click this button to compute the calibration parameters for the camera and generate a calibration file from them.

If the calibration is successful, the calibration file will automatically be uploaded to Skynode and you can close the calibration tool.

If the calibration is completed but reports a poor calibration result, we recommend restarting the calibration. Close the calibration tool and ensure that the calibration pattern is flat, the square width is correct and the camera lens is clean before restarting.

### Restore Skynode to its original state

1. Open the apps page of the Skynode web UI at <http://10.41.1.1/apps>.
2. Open the settings for the **video2ros** app, set **Use Custom Auto Exposure** back to **true**, and click **Save**.
