Skip to content

Extract the intrinsic and distortion camera calibration parameters

License

Notifications You must be signed in to change notification settings

viam-labs/camera-calibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camera calibration

Calibrate a camera and extract the intrinsic and distortion parameters.

Original script and more info can be found here.

Prerequisites

Functions from OpenCV are used to do the calibration. The script will also need numpy to do image processing.

$ pip install numpy
$ pip install opencv-python

Instructions

  1. Print out the checkerboard and attach it to a flat surface that doesn't distort the checkerboard.
  2. Take images of the checkerboard with your camera from various angles and distances.
    • Save between 10 - 15 images (see examples below).
    • NOTE: In order for the calibration to be compatible with the rdk, take the images by running the camera using the rdk.
  3. Run python3 cameraCalib.py YOUR_PICTURES_DIRECTORY
  4. Copy-paste the intrinsic_parameters and distortion_parameters into your rdk config.

Note: On Linux with GTK you may have to run the script with the --no-gui flag. Ex: python3 cameraCalib.py --no-gui YOUR_PICTURES_DIRECTORY

Example images

alt text

Example output

"intrinsic_parameters": {
   "fx": 3347.5897730591887,
   "fy": 3357.346343504132,
   "height_px": 1716,
   "ppx": 1423.2516702442595,
   "ppy": 857.5527662715425,
   "width_px": 2572
 },
 "distortion_parameters": {
   "rk1": 0.23522578742981753,
   "rk2": -2.1964442495635335,
   "rk3": 4.901102139172379,
   "tp1": -0.0014605787360963544,
   "tp2": 0.012912997198465524
 },

About

Extract the intrinsic and distortion camera calibration parameters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages