Camera Intrinsic Calibration - Razyapoo/Indoor-Positioning-System GitHub Wiki
Overview
The calibration is performed in order to determine the following intrinsic parameters of the camera:
- Focal length
- Optical center
- Distortion coefficients
This process is essential for building the Optical method, as it provides the camera intrinsic parameters, which are used to calculate people's coordinates and undistort the image for better people detection.
For the camera calibration we use Chessboard pattern with known dimensions and coordinates of corners. The output calibration parameters are calculated by matching the estimated coordinates of the chessboard corners with the known their real coordinates, which are known beforehand.
Chessboard pattern can be found in the official OpenCV repository on the GitHub.
Output
intrinsic_parameters_to_be_used_in_GUI.xml
- prepared intrinsic parameters to use in Indoor Positioning System (GUI). XML format!!!
Installation
Installation process is detailed in the folder containing this application on GitHub.
Usage
Calibration initialization
# Assuming that we are in the build folder
./Calibration [options]
Options
--input_camera{id}
: the Linux identifier of the camera to use (video{id}), which can be found under the/dev
directory (default:2
)--intrinsic_file_path
: the path where to save resulting calibration parameters (default:parameters/intrinsic_parameters.xml
)
Management of calibration process
[!Note] The entire calibration process assumes to first collect the "best" detections of chessboard and then calibrate the camera based on the collected detections. This allows to achieve as accurate as possible calibration parameters.
The management of the calibration can be performed by using keyboard keys as follows:
c
: skip the image and do not save it for calibrations
: save the image to use it for calibrationn
: continue to the next stepx
: exit the calibration
[!Warning] Once the program is launched, it will enter the initial (IDLE) stage, which is intended for preparation. No chessboard detection is performed yet. To start detecting the chessboard corners, please press
n
.
Detection of corners
If the Chessboard is successfully detected, the detection will be shown in the image window (cv::imshow).
[!Tip] Rotate and tilt the pattern in different dimensions to make diverse collection. It is recommended to move the pattern closer and further away from the camera. The pattern should take at least 25 percent of the space in the image. Otherwise, detection will be bad, and might affect the result of the calibration.
-
You can either save the image by pressing
s
or skip (do not save) the image by pressingc
. -
Once you have collected enough samples, press
n
to continue to the next step of calibration process.
[!Tip] Recommended number of collected samples is around 15 different images.
An example of the board detection is shown below:
Intrinsic Calibration
The next step is the calibration itself. It is performed on the images (detections) collected during the previous stage.
Once the calibration is successfully finished, it will show the results in the terminal and save them to the output build/parameters/intrinsic_parameters.xml
file.