资源简介
opencv 编写的相机平面检校,绝对可靠,精度高
代码片段和文件信息
/***************************************************************************
Calibration.cpp - description
-------------------
begin : aout 15 2004
copyright : (C) 2004 by Simon CONSEIL
email : bouldeglace@yahoo.fr
***************************************************************************/
#include “main.h“
//----------------------------------------------------------------------------------------------------------------
int Calibration(char** names int nbImages CvSize CBCornersSize int squareSize CCamera* camera)
//----------------------------------------------------------------------------------------------------------------
{
int i=0 j=0 t=0 x=0 y=0;
int nbCornersFound; // nb de points interieurs trouves
int nbLines = CBCornersSize.height ;// nb de lignes ds la mire
int nbCols = CBCornersSize.width ; // nb de colonnes ds la mire
int nbPoints = nbLines * nbCols;
int* pointnumbers = new int [nbImages] ;
int currPoint;
int useIntrinsicGuess = 0;
char savenames[128] ;
IplImage* img = 0;
IplImage* img0 = 0;
IplImage* img1 = 0;
IplImage* greyimg = 0;
CvMemStorage* storage = 0;
// Matrices et Vecteurs des parametres:
//-------------------------------------
CvMatr64d cameraMatrix = new double [3*3]; // parametres intrinseques
CvMatr64d rotMatrixes = new double [3*3 * nbImages]; // matrices de rotation 3x3
CvVect64d rotVect = new double [3 * nbImages]; // vecteur rotation
CvVect64d transVects = new double [3 * nbImages]; // vecteur de translation
CvVect64d distortion = new double [4]; // distortion
CvPoint2D64d* uv = new CvPoint2D64d [nbPoints * nbImages];
CvPoint3D64d* XYZ = new CvPoint3D64d [nbPoints * nbImages];
CvPoint2D32f* corners = new CvPoint2D32f [nbPoints + 1];
CvPoint onecorner;
// initialisation des variables et tableaux:
for( j = 0 ; j pointnumbers[j] = nbPoints ;
//创建窗口
cvNamedWindow( “image“ 1 );
//初始化字体
CvFont dfont;
float hscale = 0.3f;
float vscale = 0.3f;
float italicscale = 0.0f;
int thickness =1;
cvInitFont (&dfont CV_FONT_VECTOR0 hscale vscale italicscale thickness);
// Coordonnees reelles 3D des points de la mire ????
for( int currImage = 0; currImage < nbImages; currImage++ )
{
for( x = 0; x < nbLines; x++ )
{
for( y = 0; y < nbCols ; y++ )
{
XYZ[ currImage*nbPoints + x*nbCols + y ].x = double(squareSize * (nbLines - x-1) ); //(nbCols - i )) ;
XYZ[ currImage*nbPoints + x*nbCols + y ].y = double(squareSize * y ); //(nbLines - j));
XYZ[ currImage*nbPoints + x*nbCols + y ].z = 0;
}
}
}
//for visual number effect to see the corners that were found
char* numbers[] =
{ “1“ “2“ “3“ “4“ “5“ “6“ “7“ “8“ “9“ “10“
“11“ “12“ “13“ “14“ “15“ “16“ “17“ “18“ “19“ “20“
“21“ “22“ “23“ “24“ “25“ “26“ “2
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3202 2010-05-17 09:19 Calibration2\main.cpp
文件 146944 2010-06-16 16:51 Calibration2\Calibration.opt
文件 547 2006-08-25 17:16 Calibration2\Calibration.dsw
文件 113 2004-10-26 09:35 Calibration2\Calibration.h
文件 91136 2010-06-16 16:51 Calibration2\Calibration.ncb
文件 256 2010-06-16 16:51 Calibration2\Calibration.plg
文件 843824 2006-10-18 21:49 Calibration2\cv100.dll
文件 1011764 2006-10-18 21:49 Calibration2\cxcore100.dll
文件 626741 2006-10-18 21:50 Calibration2\highgui100.dll
文件 4720 2010-05-14 12:43 Calibration2\Calibration.dsp
文件 130381 2005-11-17 13:58 Calibration2\BoardStereoL1.jpg
文件 109360 2005-11-17 13:58 Calibration2\BoardStereoL2.jpg
文件 125663 2005-11-17 13:58 Calibration2\BoardStereoL3.jpg
文件 128246 2005-11-17 13:58 Calibration2\BoardStereoL4.jpg
文件 112619 2005-11-17 13:58 Calibration2\BoardStereoL5.jpg
文件 111641 2005-11-17 13:58 Calibration2\BoardStereoL6.jpg
文件 134 2010-05-22 16:24 Calibration2\picturename.txt
文件 977 2010-05-16 12:07 Calibration2\Camera.h
文件 383 2010-05-16 12:17 Calibration2\main.h
文件 3324 2010-05-16 15:27 Calibration2\Camera.cpp
文件 8318 2010-05-16 22:51 Calibration2\Calibration.cpp
..A.SH. 215552 2010-06-19 22:31 Calibration2\images\Thumbs.db
文件 320512 2010-06-16 16:51 Calibration2\Debug\vc60.idb
文件 200704 2010-05-17 09:19 Calibration2\Debug\vc60.pdb
文件 270457 2010-05-17 09:19 Calibration2\Debug\Calibration.exe
文件 1434624 2010-05-17 09:19 Calibration2\Debug\Calibration.pdb
文件 0 2010-05-16 22:51 Calibration2\Debug\Calibration.sbr
文件 0 2010-05-16 15:27 Calibration2\Debug\Camera.sbr
文件 4850688 2010-05-17 09:19 Calibration2\Debug\Calibration.bsc
文件 0 2010-05-17 09:19 Calibration2\Debug\main.sbr
............此处省略11个文件信息
- 上一篇:微波功率合成技术-
- 下一篇:魔域自动登录辅助源码
评论
共有 条评论