/camera-calibration

This repository include implementation of calibrating intrinsic and extrinsic camera parameter for distance calculation

Primary LanguageC++MIT LicenseMIT

Camera Calibration

Implementation of calibrating intrinsic and extrinsic camera parameter with pso optimization and quaternion rotation for distance calculation .

Dependencies

sudo apt install libopencv-dev cmake

Environment Setup

First, set the camera in a fixed position then place the chessboard in front of it at a fixed distance, as shown below :

Compilation

cmake .
make all
./Calibration

Code Setup

In "main.cpp" file i write some comments which that helps you ...

1) Input Real Points :

generally you should first set the actual distance in "realPoint" array in main.cpp file just note that the array is as follows :

2) Set Optimization Parameter :

This part of process very important because pso algorithm highly parameter based so pay attention to the parameters.

How To Use ?

After the setup environment and code, compile and run code . if print "pattern not found" there is a problem in your chessboard check that if print "pattern found" that's ok . after calibration process you have 10 parameter . now you can use that and calculate distance or pixel . for this work there is two function :

F1) Field2Image

Field2Image function get distance "milimeter" and calculate pixel .

F2) Image2Field

vice versa :)

Detected Corners

Projected Corners After Calibration

Euler angles and quaternions

If you want read more about euler angles and quaternions i suggest you read the following paper :
A Tutorial on Euler Angles and Quaternions

License

This project is licensed under the MIT License - see the LICENSE file for details

Finale

Report any comment or bugs or question to:
fathierfan97@gmail.com