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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/***************************************************************************
* Copyright (C) 2008 by Luca Baronti *
* lbaronti@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/***************************************************************************
History
Modified by sottile on July 2009
****************************************************************************/
/** <b>Tsai Methods -- Interface with the tsai lib </b>
The class is static, so a simple call to <code>calibrate()</code> is
sufficient to get a calibrated shot.<br>
<i>Comment:</i><br>
Sometimes the Tsai Lib returns a irregular shifted translation values.<br>
Since now no solution found.
*/
/****************************************************************************\
* *
* Camera parameters are usually the fixed parameters of the given camera *
* system, typically obtained from manufacturers specifications. *
* *
* Cy and Cy (the center of radial lens distortion), may be calibrated *
* separately or as part of the coplanar/noncoplanar calibration. *
* The same with sx (x scale uncertainty factor). *
* *
\*******************************************************************************/
#ifndef _TSAI_METHODS_
#define _TSAI_METHODS_
#include <vcg/math/matrix44.h>
#include <vcg/space/point3.h>
#include <vcg/space/point2.h>
#include <vcg/math/shot.h>
#include <list>
// minimum points that need tsai for a proper calibration
static const int MIN_POINTS_FOR_CALIBRATE = 13;
struct TsaiCorrelation {
vcg::Point3d point3d;
vcg::Point2d point2d;
};
class TsaiMethods
{
public:
//Calibration of the shot according to the 2D and 3D points
static bool calibrate( vcg::Shot<double>* shot,std::list<TsaiCorrelation>* corr, bool p_foc); /// send all the valid binded points of the image at the calibration lib, then set the intinsic param of the image
///Transformation of the camera data between tsai structure and vcg structure
static void Shot2Tsai(vcg::Shot<double>*);
///Transformation of the camera data between tsai structure and vcg structure
static void Tsai2Shot(vcg::Shot<double>*, bool p_foc=true);
private:
static void Cam2Tsai(vcg::Shot<double>*);
static bool createDataSet(std::list<TsaiCorrelation>* corr,vcg::Shot<double>* s);
};
#endif //_TSAI_METHODS_
|