OpenCVを用いたカメラキャリブレーションのサンプルです。2021/06/21時点でPython実装のある3種類(通常カメラ向け、魚眼レンズ向け(fisheyeモジュール)、全方位カメラ向け(omnidirモジュール))について用意しています。

Overview

OpenCV-CameraCalibration-Example

FishEyeCameraCalibration.mp4

OpenCVを用いたカメラキャリブレーションのサンプルです
2021/06/21時点でPython実装のある以下3種類について用意しています。

  • 通常カメラ向け
  • 魚眼レンズ向け(fisheyeモジュール)
  • 全方位カメラ向け(omnidirモジュール)
    全方位カメラは以下のような構造のカメラを想定しています。

    画像はWikipediaのOmnidirectional (360-degree) cameraから引用

Requirement

  • opencv-python 4.5.2.54 or later
  • opencv-contrib-python 4.5.2.54 or later ※omnidirモジュールを使用する場合のみ

Calibration Pattern

サンプルでは以下の7×10のチェスボード型のキャリブレーションパターンを使用します。

他の行列数のキャリブレーションパターンを使用したい場合は、以下を参照して作成or入手してください。

また、以下のようなサークル型のパターンやセクターベース型のパターンのサンプルは用意していません。

Usage

calibrateCameraのサンプルでキャリブレーションパラメータをcsvに保存し、
undistortのサンプルで歪み補正を実施してください。

01.calibrateCamera

python 01-01_calibrateCamera.py
python 02-01_fisheyeCalibrateCamera.py
python 03-01_omnidirCalibrateCamera.py

キャリブレーションパターン検出時にEnterを押すことで撮影します。
ESCを押すことでプログラムを終了し、キャリブレーションパラメータを保存します。

実行時には、以下のオプションが指定可能です。

オプション指定
  • --device
    カメラデバイス番号の指定
    デフォルト:
    • 01-01_calibrateCamera:0
    • 02-01_fisheyeCalibrateCamera.py:0
    • 03-01_omnidirCalibrateCamera.py:0
  • --file
    動画ファイル名の指定 ※指定時はカメラデバイスより優先し動画を読み込む
    デフォルト:
    • 01-01_calibrateCamera:None
    • 02-01_fisheyeCalibrateCamera.py:None
    • 03-01_omnidirCalibrateCamera.py:None
  • --width
    カメラキャプチャ時の横幅
    デフォルト:
    • 01-01_calibrateCamera:640
    • 02-01_fisheyeCalibrateCamera.py:640
    • 03-01_omnidirCalibrateCamera.py:640
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:
    • 01-01_calibrateCamera:360
    • 02-01_fisheyeCalibrateCamera.py:360
    • 03-01_omnidirCalibrateCamera.py:360
  • --square_len
    キャリブレーションパターン(チェスボード)の1辺の長さ(mm)
    デフォルト:
    • 01-01_calibrateCamera:23.0
    • 02-01_fisheyeCalibrateCamera.py:23.0
    • 03-01_omnidirCalibrateCamera.py:23.0
  • --square_len
    キャリブレーションパターン(チェスボード)の1辺の長さ(mm)
    デフォルト:
    • 01-01_calibrateCamera:23.0
    • 02-01_fisheyeCalibrateCamera.py:23.0
    • 03-01_omnidirCalibrateCamera.py:23.0
  • --grid_size
    キャリブレーションパターン(チェスボード)の行列数(カンマ区切り指定)
    デフォルト:
    • 01-01_calibrateCamera:10,7
    • 02-01_fisheyeCalibrateCamera.py:10,7
    • 03-01_omnidirCalibrateCamera.py:10,7
  • --k_filename
    半径方向の歪み係数の保存ファイル名(csv)
    デフォルト:
    • 01-01_calibrateCamera:K.csv
    • 02-01_fisheyeCalibrateCamera.py:K_fisheye.csv
    • 03-01_omnidirCalibrateCamera.py:K_omni.csv
  • --d_filename
    円周方向の歪み係数の保存ファイル名(csv)
    デフォルト:
    • 01-01_calibrateCamera:d.csv
    • 02-01_fisheyeCalibrateCamera.py:d_fisheye.csv
    • 03-01_omnidirCalibrateCamera.py:d_omni.csv
  • --xi_filename
    Mei'sモデルパラメータxiの保存ファイル名(csv)
    デフォルト:
    • 03-01_omnidirCalibrateCamera.py:xi_omni.csv
  • --use_autoappend
    キャリブレーションパターン検出時に自動で撮影するか否か(指定しない場合はEnterで明示的に撮影)
    デフォルト:
    • 01-01_calibrateCamera:指定なし
    • 02-01_fisheyeCalibrateCamera.py:指定なし
    • 03-01_omnidirCalibrateCamera.py:指定なし
  • --interval_time
    use_autoappend指定時の撮影間隔(ms)
    デフォルト:
    • 01-01_calibrateCamera:500
    • 02-01_fisheyeCalibrateCamera.py:500
    • 03-01_omnidirCalibrateCamera.py:500

02.undistort

python 01-02_undistort.py
python 02-02_fisheyeUndistort.py
python 03-02_omnidirUndistort.py

実行時には、以下のオプションが指定可能です。

オプション指定
  • --device
    カメラデバイス番号の指定
    デフォルト:
    • 01-01_calibrateCamera:0
    • 02-01_fisheyeCalibrateCamera.py:0
    • 03-01_omnidirCalibrateCamera.py:0
  • --file
    動画ファイル名の指定 ※指定時はカメラデバイスより優先し動画を読み込む
    デフォルト:
    • 01-01_calibrateCamera:None
    • 02-01_fisheyeCalibrateCamera.py:None
    • 03-01_omnidirCalibrateCamera.py:None
  • --width
    カメラキャプチャ時の横幅
    デフォルト:
    • 01-01_calibrateCamera:640
    • 02-01_fisheyeCalibrateCamera.py:640
    • 03-01_omnidirCalibrateCamera.py:640
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:
    • 01-01_calibrateCamera:360
    • 02-01_fisheyeCalibrateCamera.py:360
    • 03-01_omnidirCalibrateCamera.py:360
  • --k_filename
    半径方向の歪み係数の読み込みファイル名(csv)
    デフォルト:
    • 01-01_calibrateCamera:K.csv
    • 02-01_fisheyeCalibrateCamera.py:K_fisheye.csv
    • 03-01_omnidirCalibrateCamera.py:K_omni.csv
  • --d_filename
    円周方向の歪み係数の読み込みファイル名(csv)
    デフォルト:
    • 01-01_calibrateCamera:d.csv
    • 02-01_fisheyeCalibrateCamera.py:d_fisheye.csv
    • 03-01_omnidirCalibrateCamera.py:d_omni.csv
  • --xi_filename
    Mei'sモデルパラメータxiの読み込みファイル名(csv)
    デフォルト:
    • 03-01_omnidirCalibrateCamera.py:xi_omni.csv
  • --k_new_param
    Knewパラメータ指定時のスケール
    デフォルト:
    • 01-01_calibrateCamera:1.0
    • 02-01_fisheyeCalibrateCamera.py:0.9
    • 03-01_omnidirCalibrateCamera.py:0.5

Reference

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

OpenCV-CameraCalibration-Example is under Apache-2.0 License.

Owner
KazuhitoTakahashi
KazuhitoTakahashi
Optical character recognition for Japanese text, with the main focus being Japanese manga

Manga OCR Optical character recognition for Japanese text, with the main focus being Japanese manga. It uses a custom end-to-end model built with Tran

Maciej Budyś 327 Jan 01, 2023
TableBank: A Benchmark Dataset for Table Detection and Recognition

TableBank TableBank is a new image-based table detection and recognition dataset built with novel weak supervision from Word and Latex documents on th

844 Jan 04, 2023
Textboxes_plusplus implementation with Tensorflow (python)

TextBoxes++-TensorFlow TextBoxes++ re-implementation using tensorflow. This project is greatly inspired by slim project And many functions are modifie

81 Dec 07, 2022
ERQA - Edge Restoration Quality Assessment

ERQA - a full-reference quality metric designed to analyze how good image and video restoration methods (SR, deblurring, denoising, etc) are restoring real details.

MSU Video Group 27 Dec 17, 2022
Erosion and dialation using structure element in OpenCV python

Erosion and dialation using structure element in OpenCV python

Tamzid hasan 2 Nov 11, 2021
This is a pytorch re-implementation of EAST: An Efficient and Accurate Scene Text Detector.

EAST: An Efficient and Accurate Scene Text Detector Description: This version will be updated soon, please pay attention to this work. The motivation

Dejia Song 544 Dec 20, 2022
Opencv face recognition desktop application

Opencv-Face-Recognition Opencv face recognition desktop application Program developed by Gustavo Wydler Azuaga - 2021-11-19 Screenshots of the program

Gus 1 Nov 19, 2021
Application that instantly translates sign-language to letters.

Sign Language Translator Project Description The main purpose of project is translating sign-language to letters. In accordance with this purpose we d

3 Sep 29, 2022
A Vietnamese personal card OCR website built with Django.

Django VietCardOCR Installation Creation of virtual environments is done by executing the command venv: python -m venv venv That will create a new fol

Truong Hoang Thuan 4 Sep 04, 2021
Camera Intrinsic Calibration and Hand-Eye Calibration in Pybullet

This repository is mainly for camera intrinsic calibration and hand-eye calibration. Synthetic experiments are conducted in PyBullet simulator. 1. Tes

CAI Junhao 7 Oct 03, 2022
Repository collecting all the submodules for the new PyTorch-based OCR System.

OCRopus3 is being replaced by OCRopus4, which is a rewrite using PyTorch 1.7; release should be soonish. Please check github.com/tmbdev/ocropus for up

NVIDIA Research Projects 138 Dec 09, 2022
Detect text blocks and OCR poorly scanned PDFs in bulk. Python module available via pip.

doc2text doc2text extracts higher quality text by fixing common scan errors Developing text corpora can be a massive pain in the butt. Much of the tex

Joe Sutherland 1.3k Jan 04, 2023
CUTIE (TensorFlow implementation of Convolutional Universal Text Information Extractor)

CUTIE TensorFlow implementation of the paper "CUTIE: Learning to Understand Documents with Convolutional Universal Text Information Extractor." Xiaohu

Zhao,Xiaohui 147 Dec 20, 2022
An advanced 2D image manipulation with features such as edge detection and image segmentation built using OpenCV

OpenCV-ToothPaint3-Advanced-Digital-Image-Editor This application named ‘Tooth Paint’ version TP_2020.3 (64-bit) or version 3 was developed within a w

JunHong 1 Nov 05, 2021
Some Boring Research About Products Recognition 、Duplicate Img Detection、Img Stitch、OCR

Products Recognition 介绍 商品识别,围绕在复杂的商场零售场景中,识别出货架图像中的商品信息。主要组成部分: 重复图像检测。【更新进度 4/10】 图像拼接。【更新进度 0/10】 目标检测。【更新进度 0/10】 商品识别。【更新进度 1/10】 OCR。【更新进度 1/10】

zhenjieWang 18 Jan 27, 2022
Train custom VR face tracking parameters

Pal Buddy Guy: The anipal's best friend This is a small script to improve upon the tracking capabilities of the Vive Pro Eye and facial tracker. You c

7 Dec 12, 2021
Detecting Text in Natural Image with Connectionist Text Proposal Network (ECCV'16)

Detecting Text in Natural Image with Connectionist Text Proposal Network The codes are used for implementing CTPN for scene text detection, described

Tian Zhi 1.3k Dec 22, 2022
天池2021"全球人工智能技术创新大赛"【赛道一】:医学影像报告异常检测 - 第三名解决方案

天池2021"全球人工智能技术创新大赛"【赛道一】:医学影像报告异常检测 比赛链接 个人博客记录 目录结构 ├── final------------------------------------决赛方案PPT ├── preliminary_contest--------------------

19 Aug 17, 2022
Visual Attention based OCR

Attention-OCR Authours: Qi Guo and Yuntian Deng Visual Attention based OCR. The model first runs a sliding CNN on the image (images are resized to hei

Yuntian Deng 1.1k Jan 02, 2023
Pytorch implementation of PSEnet with Pyramid Attention Network as feature extractor

Scene Text-Spotting based on PSEnet+CRNN Pytorch implementation of an end to end Text-Spotter with a PSEnet text detector and CRNN text recognizer. We

azhar shaikh 62 Oct 10, 2022