Opencv&matlab of Camera Calibration

Source: Internet
Author: User
Camera Calibration
1.OpenCV Camera Calibration

OPENCV provides specific calibration strategies and documentation that can be used directly to illustrate the location of the document "D:\opencv\sources\doc\tutorials\calib3d\camera_calibration";

The location of the routine "D:\opencv\sources\samples\cpp\camera_calibration.cpp"

How do I use routines? First modify the configuration document XML

<?xml version= "1.0"?> <opencv_storage> <Settings> <!--the width of the calibration plate how many corners are there, number of inner corners per a It EM row and column. (Square, circle)-<BoardSize_Width>7</BoardSize_Width> <boardsize_height>7</boardsize_
  Height> <!--The length of the block on the calibration board, in millimeters, the size of a square in some user defined metric system (pixel, millimeter)- <Square_Size>50</Square_Size> <!--Select calibration mode the type of input used for camera calibration. One of:chessboard circles_grid Asymmetric_circles_grid-<Calibrate_Pattern> "chessboard" </calibrate_ Pattern> <!--the input to calibration. The path and name of the captured image storage XML file to use a input camera--give the ID of the camera, like ' 1 ' to use an input video--GIV E The path of the input video, like "/tmp/x.avi" to use a image list, give the path to the XML or YAML file cont Aining the list of the images, like "/tmp/circles_list.xml" and <Input> "./vtdIrtest.xml "</Input> <!--If true (Non-zero) We flip the Input images around the horizontal axis.--> <i Nput_fliparoundhorizontalaxis>0</input_fliparoundhorizontalaxis> <!--time delay between frames in case O F camera. -<Input_Delay>100</Input_Delay> <!--How many frames to use, for calibration. -<Calibrate_NrOfFrameToUse>25</Calibrate_NrOfFrameToUse> <!--consider only FY as a free paramete 
	   R, the ratio Fx/fy stays the same as in the input Cameramatrix. Use or not setting. 0-false non-zero-true--> <Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio> <!--If True ( Non-zero) tangential distortion coefficients is set to zeros and stay zero.--> <calibrate_assumezerotangentialdi Stortion>1</calibrate_assumezerotangentialdistortion> <!--If true (Non-zero) The principal point isn't Cha Nged during the global optimization.--> <calibrate_fixPrincipalpointatthecenter> 1 </Calibrate_FixPrincipalPointAtTheCenter> <!--output calibrated internal/ The document name path of the external parameter and other parameters the name of the output log file. -<Write_outputFileName> "Out_camera_vt.xml" </Write_outputFileName> <!--If true (Non-zero) we WRI Te to the output file the feature points.--> <write_detectedfeaturepoints>1</write_detectedfeaturepoints&
  Gt <!--If true (Non-zero) We write to the output file the extrinsic camera parameters.--> <write_extrinsicparamet Ers>1</write_extrinsicparameters> <!--If true (Non-zero) we show after calibration the undistorted images.- <Show_UndistortedImage>1</Show_UndistortedImage> </Settings> </opencv_storage>
Probably modify the above-mentioned label several positions, and then run camera_calibration.cpp can;

Project Download Address

Reference "1" "2"

Because it is said that the use of Matlab Toolbox calibration will be more accurate, so plan to compare the two calibration methods; 2.Matlab Calibration

Reference "3" "4"

First download toolbox_calib.zip, in "3" has a download link, after decompression placed in the working directory, while following the "4" for calibration, narrative is very detailed;

But because of more content, it is briefly described:

2.1 Starting the Calibration toolbox

Run CALIB.M, select image loading mode


The second method is required when the image is large and long; Here is the standard mode for example:


2.2 Loading images

Go to the directory where the image is located, then click the Image Names button


First, enter the name prefix of the calibration image sequence (not including the serial number) as above, then select the format; OK;


2.3 Extracting corner points

Click the Extract Grid Corners button in the command window as described below


The direct carriage return will select the default mode, the window size is 11x11, and then manually set the outermost four corner points for each test document

Select in counter-clockwise order


At this time, we need to set the width of each small square in the real world, so that the subsequent corner of the automatic selection;

This is set to 30mmx30mm; only the first time setting;



Then each image needs to set the periphery of the four corner point, so will not hand acid ...

If you have done this once, you can click the Load option to automatically load the corner information in the Calib_results.mat;

2.4 Calibration

After all the drawing files have been extracted, click Calibration to calibrate;


Description

A. Through Recomp. Corners button to improve calibration accuracy;

B. Analyse error Display corner error distribution, with the left mouse button click, in the command window can directly display the point information;


C.add/suppress images removal of unwanted drawings;

D. Show extrinsic simulates the position angle of the camera relative to each image acquisition;


Other slowly explored, the document "3" "4" is quite detailed;

In order to facilitate the subsequent search, also upload a copy of toobox and drawings; Download address


4.Halcon Calibration Steps

"5" Method one

"6" Method two









Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.