You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			151 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			C++
		
	
			
		
		
	
	
			151 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			C++
		
	
/*M///////////////////////////////////////////////////////////////////////////////////////
 | 
						|
//
 | 
						|
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
 | 
						|
//
 | 
						|
//  By downloading, copying, installing or using the software you agree to this license.
 | 
						|
//  If you do not agree to this license, do not download, install,
 | 
						|
//  copy or use the software.
 | 
						|
//
 | 
						|
//
 | 
						|
//                          License Agreement
 | 
						|
//                For Open Source Computer Vision Library
 | 
						|
//
 | 
						|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
 | 
						|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
 | 
						|
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
 | 
						|
// Third party copyrights are property of their respective owners.
 | 
						|
//
 | 
						|
// Redistribution and use in source and binary forms, with or without modification,
 | 
						|
// are permitted provided that the following conditions are met:
 | 
						|
//
 | 
						|
//   * Redistribution's of source code must retain the above copyright notice,
 | 
						|
//     this list of conditions and the following disclaimer.
 | 
						|
//
 | 
						|
//   * Redistribution's in binary form must reproduce the above copyright notice,
 | 
						|
//     this list of conditions and the following disclaimer in the documentation
 | 
						|
//     and/or other materials provided with the distribution.
 | 
						|
//
 | 
						|
//   * The name of the copyright holders may not be used to endorse or promote products
 | 
						|
//     derived from this software without specific prior written permission.
 | 
						|
//
 | 
						|
// This software is provided by the copyright holders and contributors "as is" and
 | 
						|
// any express or implied warranties, including, but not limited to, the implied
 | 
						|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
 | 
						|
// In no event shall the Intel Corporation or contributors be liable for any direct,
 | 
						|
// indirect, incidental, special, exemplary, or consequential damages
 | 
						|
// (including, but not limited to, procurement of substitute goods or services;
 | 
						|
// loss of use, data, or profits; or business interruption) however caused
 | 
						|
// and on any theory of liability, whether in contract, strict liability,
 | 
						|
// or tort (including negligence or otherwise) arising in any way out of
 | 
						|
// the use of this software, even if advised of the possibility of such damage.
 | 
						|
//
 | 
						|
//M*/
 | 
						|
 | 
						|
#ifndef OPENCV_CALIB3D_C_H
 | 
						|
#define OPENCV_CALIB3D_C_H
 | 
						|
 | 
						|
#include "opencv2/core/types_c.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/* Calculates fundamental matrix given a set of corresponding points */
 | 
						|
#define CV_FM_7POINT 1
 | 
						|
#define CV_FM_8POINT 2
 | 
						|
 | 
						|
#define CV_LMEDS 4
 | 
						|
#define CV_RANSAC 8
 | 
						|
 | 
						|
#define CV_FM_LMEDS_ONLY  CV_LMEDS
 | 
						|
#define CV_FM_RANSAC_ONLY CV_RANSAC
 | 
						|
#define CV_FM_LMEDS CV_LMEDS
 | 
						|
#define CV_FM_RANSAC CV_RANSAC
 | 
						|
 | 
						|
enum
 | 
						|
{
 | 
						|
    CV_ITERATIVE = 0,
 | 
						|
    CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
 | 
						|
    CV_P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
 | 
						|
    CV_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
 | 
						|
};
 | 
						|
 | 
						|
#define CV_CALIB_CB_ADAPTIVE_THRESH  1
 | 
						|
#define CV_CALIB_CB_NORMALIZE_IMAGE  2
 | 
						|
#define CV_CALIB_CB_FILTER_QUADS     4
 | 
						|
#define CV_CALIB_CB_FAST_CHECK       8
 | 
						|
 | 
						|
#define CV_CALIB_USE_INTRINSIC_GUESS  1
 | 
						|
#define CV_CALIB_FIX_ASPECT_RATIO     2
 | 
						|
#define CV_CALIB_FIX_PRINCIPAL_POINT  4
 | 
						|
#define CV_CALIB_ZERO_TANGENT_DIST    8
 | 
						|
#define CV_CALIB_FIX_FOCAL_LENGTH 16
 | 
						|
#define CV_CALIB_FIX_K1  32
 | 
						|
#define CV_CALIB_FIX_K2  64
 | 
						|
#define CV_CALIB_FIX_K3  128
 | 
						|
#define CV_CALIB_FIX_K4  2048
 | 
						|
#define CV_CALIB_FIX_K5  4096
 | 
						|
#define CV_CALIB_FIX_K6  8192
 | 
						|
#define CV_CALIB_RATIONAL_MODEL 16384
 | 
						|
#define CV_CALIB_THIN_PRISM_MODEL 32768
 | 
						|
#define CV_CALIB_FIX_S1_S2_S3_S4  65536
 | 
						|
#define CV_CALIB_TILTED_MODEL  262144
 | 
						|
#define CV_CALIB_FIX_TAUX_TAUY  524288
 | 
						|
#define CV_CALIB_FIX_TANGENT_DIST 2097152
 | 
						|
 | 
						|
#define CV_CALIB_NINTRINSIC 18
 | 
						|
 | 
						|
#define CV_CALIB_FIX_INTRINSIC  256
 | 
						|
#define CV_CALIB_SAME_FOCAL_LENGTH 512
 | 
						|
 | 
						|
#define CV_CALIB_ZERO_DISPARITY 1024
 | 
						|
 | 
						|
/* stereo correspondence parameters and functions */
 | 
						|
#define CV_STEREO_BM_NORMALIZED_RESPONSE  0
 | 
						|
#define CV_STEREO_BM_XSOBEL               1
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
} // extern "C"
 | 
						|
 | 
						|
//////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
class CV_EXPORTS CvLevMarq
 | 
						|
{
 | 
						|
public:
 | 
						|
    CvLevMarq();
 | 
						|
    CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria=
 | 
						|
              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
 | 
						|
              bool completeSymmFlag=false );
 | 
						|
    ~CvLevMarq();
 | 
						|
    void init( int nparams, int nerrs, CvTermCriteria criteria=
 | 
						|
              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
 | 
						|
              bool completeSymmFlag=false );
 | 
						|
    bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
 | 
						|
    bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
 | 
						|
 | 
						|
    void clear();
 | 
						|
    void step();
 | 
						|
    enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
 | 
						|
 | 
						|
    cv::Ptr<CvMat> mask;
 | 
						|
    cv::Ptr<CvMat> prevParam;
 | 
						|
    cv::Ptr<CvMat> param;
 | 
						|
    cv::Ptr<CvMat> J;
 | 
						|
    cv::Ptr<CvMat> err;
 | 
						|
    cv::Ptr<CvMat> JtJ;
 | 
						|
    cv::Ptr<CvMat> JtJN;
 | 
						|
    cv::Ptr<CvMat> JtErr;
 | 
						|
    cv::Ptr<CvMat> JtJV;
 | 
						|
    cv::Ptr<CvMat> JtJW;
 | 
						|
    double prevErrNorm, errNorm;
 | 
						|
    int lambdaLg10;
 | 
						|
    CvTermCriteria criteria;
 | 
						|
    int state;
 | 
						|
    int iters;
 | 
						|
    bool completeSymmFlag;
 | 
						|
    int solveMethod;
 | 
						|
};
 | 
						|
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /* OPENCV_CALIB3D_C_H */
 |