Author : Zeryab Moussaoui Contributer: Raphael Casimir
A very simple tool to calibrate your monocular camera.
Python 2.7.12 is supported, but should also work on Python3.
The following libraries shall be installed :
- numpy
- pyyaml
- opencv-python
- Download the github project (zip)
- Unzip and copy all files in any directory.
Install v4l2-tools and run :
v4l2-ctl --list-devices
Which outputs :
Integrated Camera (usb-0000:00:1a.0-1.6):
/dev/video0
Please see tutorial : https://www.codepool.biz/multiple-camera-opencv-python-windows.html
If it is different from 0 : edit L24 of calibrate_camera.py
Print the chessboard.png and stick it to a flat surface.
Run :
python camera_calibration.py
it will display a video stream :
Depending on your environment, move either the camera or the cheesboard in all the operation.
Press [Space] on the displayed screen, if corners are detected you will see:
Repeat operation to get at least 10 images
Press [c] to compute calibration , it will save them in a yaml file :
camera_matrix:
- - 611.4552961374491
- 0.0
- 315.59196871694695
- - 0.0
- 590.4987441125558
- 225.73019949244863
- - 0.0
- 0.0
- 1.0
dist_coeff:
- - -0.42142237717306885
- 0.3413019078047165
- 5.686155424228582e-05
- 0.00041026072376253945
- 0.01644419849720093
You can add more images using [space] and perform calibration again to see if mean error is descreasing.
Press :
- [ESC] to exit.
- [r] to reset operation.