Skip to content

lpiekarski/camera-calibration

Repository files navigation

Camera Calibration

This repository contains a code that can be used to calibrate an ESP32 camera. The implementation of the cam package that is used here to get frames from the camera may or may not need to be modified to comply to the camera you are using.

Installation

After cloning the repository simply run pip install -r requirements.txt and you're all set to go.

Running demonstration

Run script calibration.py - it will take all the example images from screenshots/ directory and perform a camera calibration based on them. After the calibration the program will draw a raw realtime stream of frames from the camera and below it a rectified version of the same stream after applying the calibration.

Performing the Calibration

First off you need to print the chessboard calibration pattern. Then run the image_capture.py script and using spacebar capture around 20 images of the chessboard from different angles and using different parts of the camera screen. These images will be saved to screenshots/ directory which already contains a few sample images of the chessboard, so if you want to run a calibration only based on your new images you have to delete them prior to this. Secondly run calibration.py. All the images used for the calibration will be displayed one by one with the chessboard pattern drawn on them. After this process you will get stream of frames from your calibrated camera side-by-side to the image from before the calibration for comparison.

Example

Below are presented images used for calibration:

screenshot000

screenshot001

screenshot002

screenshot003

screenshot004

screenshot005

screenshot006

screenshot007

screenshot008

screenshot009

screenshot010

screenshot011

screenshot012

screenshot013

screenshot014

screenshot015

screenshot016

screenshot017

screenshot018

screenshot019

After running calibration.py on those images we get side-by-side view of images before and after calibration (difference is barely visible because the camera used here had already pretty good image prior to calibration):

before_after_000

before_after_001

before_after_002

before_after_003

before_after_004

before_after_005

before_after_006

before_after_007

before_after_008

before_after_009

About

ESP32 camera calibration with python-opencv

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages