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
Detect textlines in document images

Textline Detection Detect textlines in document images Introduction This tool performs border, region and textline detection from document image data

QURATOR-SPK 70 Jun 30, 2022
Vietnamese Language Detection and Recognition

Table of Content Introduction (Khôi viết) Dataset (đổi link thui thành 3k5 ảnh mình) Getting Started (An Viết) Requirements Usage Example Training & E

6 May 27, 2022
Code for the paper "Controllable Video Captioning with an Exemplar Sentence"

SMCG Code for the paper "Controllable Video Captioning with an Exemplar Sentence" Introduction We investigate a novel and challenging task, namely con

10 Dec 04, 2022
Deep LearningImage Captcha 2

滑动验证码深度学习识别 本项目使用深度学习 YOLOV3 模型来识别滑动验证码缺口,基于 https://github.com/eriklindernoren/PyTorch-YOLOv3 修改。 只需要几百张缺口标注图片即可训练出精度高的识别模型,识别效果样例: 克隆项目 运行命令: git cl

Python3WebSpider 117 Dec 28, 2022
Select range and every time the screen changes, OCR is activated.

ASOCR(Auto Screen OCR) Select range and every time you press Space key, OCR is activated. 範囲を選ぶと、あなたがスペースキーを押すたびに、画面が変わる度にOCRが起動します。 usage1: simple OC

1 Feb 13, 2022
Detect and fix skew in images containing text

Alyn Skew detection and correction in images containing text Image with skew Image after deskew Install and use via pip! Recommended way(using virtual

Kakul 230 Dec 21, 2022
Image Detector and Convertor App created using python's Pillow, OpenCV, cvlib, numpy and streamlit packages.

Image Detector and Convertor App created using python's Pillow, OpenCV, cvlib, numpy and streamlit packages.

Siva Prakash 11 Jan 02, 2022
Ackermann Line Follower Robot Simulation.

Ackermann Line Follower Robot This is a simulation of a line follower robot that works with steering control based on Stanley: The Robot That Won the

Lucas Mazzetto 2 Apr 16, 2022
A semi-automatic open-source tool for Layout Analysis and Region EXtraction on early printed books.

LAREX LAREX is a semi-automatic open-source tool for layout analysis on early printed books. It uses a rule based connected components approach which

162 Jan 05, 2023
CVPR 2021 Oral paper "LED2-Net: Monocular 360˚ Layout Estimation via Differentiable Depth Rendering" official PyTorch implementation.

LED2-Net This is PyTorch implementation of our CVPR 2021 Oral paper "LED2-Net: Monocular 360˚ Layout Estimation via Differentiable Depth Rendering". Y

Fu-En Wang 83 Jan 04, 2023
A Python wrapper for Google Tesseract

Python Tesseract Python-tesseract is an optical character recognition (OCR) tool for python. That is, it will recognize and "read" the text embedded i

Matthias A Lee 4.6k Jan 06, 2023
基于Paddle框架的PSENet复现

PSENet-Paddle 基于Paddle框架的PSENet复现 本项目基于paddlepaddle框架复现PSENet,并参加百度第三届论文复现赛,将在2021年5月15日比赛完后提供AIStudio链接~敬请期待 AIStudio链接 参考项目: whai362-PSENet 环境配置 本项目

QuanHao Guo 4 Apr 24, 2022
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
Autonomous Driving project for Euro Truck Simulator 2

hope-autonomous-driving Autonomous Driving project for Euro Truck Simulator 2 Video: How is it working ? In this video, the program processes the imag

Umut Görkem Kocabaş 36 Nov 06, 2022
This repository contains codes on how to handle mouse event using OpenCV

Handling-Mouse-Click-Events-Using-OpenCV This repository contains codes on how t

Happy N. Monday 3 Feb 15, 2022
Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight'

SSTDNet Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight' using pytorch. This code is work for general object detecti

HotaekHan 84 Jan 05, 2022
Extract tables from scanned image PDFs using Optical Character Recognition.

ocr-table This project aims to extract tables from scanned image PDFs using Optical Character Recognition. Install Requirements Tesseract OCR sudo apt

Abhijeet Singh 209 Dec 06, 2022
https://arxiv.org/abs/1904.01941

Character-Region-Awareness-for-Text-Detection- https://arxiv.org/abs/1904.01941 Train You can train SynthText data use python source/train_SynthText.p

DayDayUp 120 Dec 28, 2022
"Very simple but works well" Computer Vision based ID verification solution provided by LibraX.

ID Verification by LibraX.ai This is the first free Identity verification in the market. LibraX.ai is an identity verification platform for developers

LibraX.ai 46 Dec 06, 2022
A selectional auto-encoder approach for document image binarization

The code of this repository was used for the following publication. If you find this code useful please cite our paper: @article{Gallego2019, title =

Javier Gallego 89 Nov 18, 2022