Make your Raspberry Pi a WebRTC server to perform the camera calibration

Connect to your RPI directly or through SSH and launch these commands:

Then launch:

  1. on a RPI Zero/ZeroW:
  2. on a RPI 2/3/3b:

1 – Create a self signed certificate

The first step is to grab the openssl.cnf template available on your system:

Edit raspberrypi.cnf using your favorite editor. Example:

  1. Modify these sections:

  2. Add this section:

  3. Un-comment this section:

  4. Save the file!

2 – Create CA certificate

Type the following commands (you can choose accuware or any other password of your choice):

3 – Create server certificate signed by CA

Type the following commands:

4 – Setup the U4VL service

Type the following command to edit the configuration file:

Change these options accordingly:

NOTE: if your cam is mounted upside-down please change also this part:

Save the file

Type the following command to restart the UV4L service:

4 – Verify your installation

  1. Open the browser on your PC connected to the same network used by the RPI.
  2. To test the camera stream: call the following URL by specifying inside ip_of_the_pi field, the local IP address of the RPI

  3. To test the WebRTC interface: call the following URL by specifying inside ip_of_the_pi field, the local IP address of the RPI:

  4. If everything works properly please stop the stream by closing the browser window. Otherwise you won’t be able to make use of stream inside the Dragonfly Java App.

NOTE: since the certificate, which is used on your RPI is a self-signed, you might need to accept this first in your browser, especially if you are using Firefox. You might have to add a security exception. Sometimes it might be necessary to repeat this procedure from time to time. Opening https://<IP_of_PI>/stream occasionally should be sufficient.

5 – Perform the calibration of the camera

PLEASE NOTE: feel free to use your favorite browser but please note that it has been tested successfully only on Chrome.

  1. Open the browser on your PC connected to the same network used by the RPI.
  2. Call the following URL by specifying, inside ip_of_the_pi field, the local IP address of the RPI:
  3. Follow the instructions available inside the Dragonfly Web Calibration Tool.
  4. At the end of the calibration process:
    1. click on the Download button and download the JSON calibration file generated by the calibration tool.
    2. place the JSON calibration file inside the config folder at the root of the Dragonfly Java App installation folder: