Camera calibration using pattern image / C++ source (OpenCV) / 패턴 그림을 이용한 카메라 캘리브레이션 소스




Created Date : 2008.11
Language : C/C++
Tool : Microsoft Visual C++
Library & Utilized : OpenCV 1.0
Reference : Learning OpenCV Book


I made Camera calibration source for my convenience using the book that is "Learning OpenCV".
First of all, prepare several pattern images. And make same file name with ordered index.
Ex) pattern1.jpg, pattern2.jpg, pattern3.jpg ...
And answer the some questions.

Pattern width box count(black box number), height box count, the number of image
and file path and file name. Then point extraction is processed.

After all processing, below file is saved in the folder that is same location as images.

Distortion.xml
Distortion.txt
intrinsic.xml
intrinsic_matrix.txt
rotation_matricex.txt
rotation_matricex.xml
translation_matrices.txt
translation_matrices.xml

The points of each pattern image is saved as below file names.
pattern1.txt, pattern2.txt, pattern3.txt......

This source uses 'cvFindChessboardCorners' and 'cvFindCornerSubPix' functions for detecting pattern point. And for drawing, 'cvDrawChessboardCorners' function is used. 'cvCalibrateCamera2' is used for calibration.

This code is programed by Microsoft Visual studio 6.0 and OpenCV 1.0 Lib.
All OpenCv 1.0 dlls are included in the zip file.

You can download heare - > < entire source >

If you have any progressive agenda, Plz give me using reply.
Thank you.


(Please understand my bad english ability. If you point out my mistake, I would correct pleasurably. Thank you!!)

------------------------------------------------------------------------------




OpenCV를 이용한 카메라 캘리브레이션(캡쳐된 이미지를 이용함)

체스 보드 패턴의 교정판을 사용함
프로그램 실행후
패턴의 가로, 세로 점 개수 입력
패턴의 경로 입력 (예: ./p1/image)
패턴의 개수 입력 (10으로 입력하면 ./p1/image1.jpg ./p1/image2.jpg ... ./p1/image10.jpg)

이미지 한 장씩 교정점을 찾는다.
교정점을 제대로 찾지 못한 이미지는 실패로 간주하고 사용하지 않는다.
입력된 이미지를 모두 다 처리한 후
Zhang's 캘리브레이션을 수행
콘솔 창에 내부 파라미터 Instrinsic Matrirx와 왜곡 계수 Distortion Vector 값을 출력 해주고
또한 각각을 xml 파일로 저장한다.
그리고 각 패턴에 대한 Rotion 과 Translation Matrix 또한 콘솔 창에 출력하고 xml파일로 저장한다.

저장된 Instrinsic parameter, distortion coffecient를 이용하여 어플리케이션 구현이 가능하다.

체스보드에서 교정점을 찾는 방법은
cvFindChessboardCorners, cvFindCornerSubPix 함수를 이용하였으며
찾은 교정점을 그려주는 함수는 cvDrawChessboardCorners를 이용
캘리브레이션은 cvCalibrateCamera2 함수를 이용함


본 소스는 microsoft visual studio 6.0, opencv 1.0을 이용하여 만든 소스입니다.

여기서 다운 받을수 있습니다. - > < entire source >

Comments

  1. Your study is very interesting!! I hope that you attach to next subjects. Always Thank you.

    ReplyDelete

  2. can you plz Sir send me the source code to my email :
    yahyaalkhaldi@yahoo.com

    ReplyDelete
  3. Hello yahya, I have linked the source code in here -> https://docs.google.com/file/d/0B7Z5A9fd6h29MWUxNTllMmQtMzJmMi00NGM2LWIzZmUtYmM5ZmUyNjM1YjU2/edit?hl=ko

    thank you

    ReplyDelete

Post a Comment

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write