Jump to content

Image Stitching for NVIDIA Jetson/Spherical Video/Calibration Tool: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 11: Line 11:
{{DISPLAYTITLE:Calibration Tool|noerror}}
{{DISPLAYTITLE:Calibration Tool|noerror}}


== Panoramic Estimation Tool ==
 
The following section will introduce how to calibrate the equirectangular projection that can be used in the '''rreqrprojector''' element. This tool consists of a Python project that estimates the equirectangular projection of fisheye images and the horizontal offset to match the images.
 
=== Dependencies ===
 
* Python 3.8
* OpenCV headless.
* Numpy
 
=== Virtual Environment ===
 
It is recommended to work in a virtual environment since the required dependencies will be automatically installed. To create a new [https://docs.python.org/3/tutorial/venv.html Python virtual environment], run the following commands:
 
<syntaxhighlight lang=bash>
ENV_NAME=calibration-env
python3 -m venv $ENV_NAME
</syntaxhighlight>
 
A new folder will be created with the name ''ENV_NAME''. To activate the virtual environment, run the following command:
 
<syntaxhighlight lang=bash>
source $ENV_NAME/bin/activate
</syntaxhighlight>
 
In the directory of the stitching-calibrator project, run the following command:
 
<syntaxhighlight lang=bash>
pip3 install .
</syntaxhighlight>
 
=== Image Directory ===
 
In order to correctly upload the fisheye images to the calibration tool, a root folder with a series of folders named with the camera indexes starting from 0, 1, 2, ... all the way up to the number of cameras of the array being calibrated. The content of each folder will be a fisheye image of the specific camera index. The fisheye images must use the name format image_XX with XX being the camera index. The hierarchical structure of the root folder must look like:
 
<syntaxhighlight lang=bash>
fisheye-images/
├── 0
│   └── image_0.jpeg
├── 1
│   └── image_1.jpeg
└── 2
    └── image_2.jpeg
</syntaxhighlight>
 
== Calibration tool usage ==
 
'''1.''' To use the calibration tool run the following command and select the '''Panoramic Calibration''' button.
 
<syntaxhighlight lang=bash>
stitching-calibrator
</syntaxhighlight>
 
[[File:Stitcher-calibrator-main-window.png|center|Main-Window]]
 
'''2.''' Upload the fisheye images. In the menu bar select File->Open, this will open a file dialog to select the root directory with the cameras folders.
 
[[File:Stitcher-calibrator-open-menu.png|center|Open menu]]
 
An initial circle estimation and equirectangular projection will be estimated for each image, this will take a few seconds. The image of sensor 0 will be automatically selected in the '''Samples view''' to calibrate.
 
[[File:Stitcher-calibrator-initial-estimation.png|720px|center|Initial estimation]]
 
'''3.''' Adjust the parameter of the first fisheye image using the buttons of the right panel where:
 
* '''radius''': A float property that defines in pixels the radius of the circle containing the fisheye image.
* '''fov''': A float property that defines the fisheye lens aperture.
* '''circle-center-x''': An integer property that defines the center position of the fisheye circle over the input’s image X axis(horizontal).
* '''circle-center-y''': An integer property that defines the center position of the fisheye circle over the input’s image Y axis(vertical).
* '''angle-x''': A float property that defines the camera’s tilt angle correction in degrees between -180 and 180. This is assuming a coordinate system over the camera where the X axis looks over the side of the camera, and you rotate that axis, rotating the camera up and down.
* '''angle-y''': A float property that defines the camera’s roll angle correction in degrees between -180 and 180. This is assuming a coordinate system over the camera where the camera lens looks over the Y axis, if you rotate that axis, the camera will rotate rolling over its center.
 
The '''Preview view''' will show the result projection of the selected image with the selected parameters.
 
[[File:Stitcher-calibrator-adjust-parameters.png|720px|center|Projection parameters for sample 1]]
 
'''Note:''' The view size can be individually adjusted using the slider for a better appreciation of the images. Also, the images can be zoom in and zoom out using Ctrl+scroll.
 
[[File:Stitcher-calibrator-sliders.png|720px|center|Sliders of views]]
 
'''4.''' Select another sensor image in the '''Samples view''' to adjust the projection parameters for the next image, and continue with all the available sensor images. The current sensor image will be highlighted to recognize which image it is currently adjusting.
 
[[File:Stitcher-calibrator-adjust-parameters-2.png|720px|center|Projection parameters for sample 1]]
 
'''5.''' Once all the images are adjusted with the projection parameters adjust the horizontal offset to match the images in the '''Stitching view'''. To adjust the offset drag the images one of top of the other one and match the scene.
 
[[File:Stitcher-calibrator-stitching.png|720px|center|Stitching view]]
 
'''6.''' When the calibration is finished, save the parameters and homographies in a JSON file. In the menu bar select File->Save, this will open a file dialog to select the path and name for the JSON file.
 
[[File:Stitcher-calibrator-save-menu.png|720px|center|Save menu]]
 


<noinclude>
<noinclude>
{{Image_Stitching_for_NVIDIA_Jetson/Foot|Spherical_Video/Stitcher|Performance}}
{{Image_Stitching_for_NVIDIA_Jetson/Foot|Spherical_Video/Stitcher|Performance}}
</noinclude>
</noinclude>
335

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.