相机标定 Camera Calibration

OpenCV Camera Calibration


首先,修改路径下xml文档,存入照片

  1. <?xml version="1.0"?>  
  2. <opencv_storage>  
  3. <Settings>  
  4.   <!-- Number of inner corners per a item row and column. (square, circle) -->  
  5.   <BoardSize_Width>9</BoardSize_Width>   //设定CHESSBOARD角点
  6.   <BoardSize_Height>6</BoardSize_Height>  
  7.     
  8.   <!-- The size of a square in some user defined metric system (pixel, millimeter)-->  
  9.   <Square_Size>50</Square_Size>   //标定板方块边长/mm
  10.     
  11.   <!-- The type of input used for camera calibration. One of: CHESSBOARD CIRCLES_GRID ASYMMETRIC_CIRCLES_GRID -->  
  12.   <Calibrate_Pattern>"CHESSBOARD"</Calibrate_Pattern>  //标定模式
  13.     
  14.   <!-- The input to use for calibration. 所采集的标定图像存储的路径及名称xml档  
  15.         To use an input camera -> give the ID of the camera, like "1"  
  16.         To use an input video  -> give the path of the input video, like "/tmp/x.avi"  
  17.         To use an image list   -> give the path to the XML or YAML file containing the list of the images, like "/tmp/circles_list.xml"  
  18.         -->  
  19.   <Input>"./vtDirTest.xml"</Input>  
  20.   <!--  If true (non-zero) we flip the input images around the horizontal axis.-->  
  21.   <Input_FlipAroundHorizontalAxis>0</Input_FlipAroundHorizontalAxis>  
  22.     
  23.   <!-- Time delay between frames in case of camera. -->  
  24.   <Input_Delay>100</Input_Delay>      
  25.     
  26.   <!-- How many frames to use, for calibration. -->  
  27.   <Calibrate_NrOfFrameToUse>25</Calibrate_NrOfFrameToUse>  
  28.   <!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix.   
  29.        Use or not setting. 0 - False Non-Zero - True-->  
  30.   <Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>  
  31.   <!-- If true (non-zero) tangential distortion coefficients  are set to zeros and stay zero.-->  
  32.   <Calibrate_AssumeZeroTangentialDistortion>1</Calibrate_AssumeZeroTangentialDistortion>  
  33.   <!-- If true (non-zero) the principal point is not changed during the global optimization.-->  
  34.   <Calibrate_FixPrincipalPointAtTheCenter> 1 </Calibrate_FixPrincipalPointAtTheCenter>  
  35.     
  36.   <!-- The name of the output log file. -->  
  37.   <Write_outputFileName>"out_camera_vt.xml"</Write_outputFileName>  //输出标定后的内参/外参以及其他参数的文档名称路径
  38.   <!-- If true (non-zero) we write to the output file the feature points.-->  
  39.   <Write_DetectedFeaturePoints>1</Write_DetectedFeaturePoints>  
  40.   <!-- If true (non-zero) we write to the output file the extrinsic camera parameters.-->  
  41.   <Write_extrinsicParameters>1</Write_extrinsicParameters>  
  42.   <!-- If true (non-zero) we show after calibration the undistorted images.-->  
  43.   <Show_UndistortedImage>1</Show_UndistortedImage>  
  44.    
  45. </Settings>  
  46. </opencv_storage>  

运行D:\OPENCV\opencv\sources\samples\cpp\tutorial_code\calib3d\camera_calibration 下camera_calibration.cpp
得到out_camera_vt.xml

内参
Camera_Matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 6.5746697810243404e+002, 0., 3.1950000000000000e+002, 0.,
       6.5746697810243404e+002, 2.3950000000000000e+002, 0., 0., 1. ]

外参
Extrinsic_Parameters: !!opencv-matrix
   rows: 8
   cols: 6
   dt: d
   data: [ -7.8704123655486097e-002, -1.5922384772614945e-001,
       3.1166227207451498e+000, 2.4224388101960471e+002,
       1.1795590397660339e+002, 6.2576484126093249e+002,
       -1.4117480285164308e-001, -1.7917415443804836e-002,
...
但,OpenCV将这些外参放在一起,不方便分开使用

http://research.microsoft.com/en-us/um/people/zhang/

http://blog.csdn.net/aptx704610875/article/details/48914043
后论内参、外参的使用

运行D:\OPENCV\opencv\sources\samples\cpp\tutorial_code\calib3d\camera_calibration 下camera_calibration.cpp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值