calib3d_c.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*M///////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
  4. //
  5. // By downloading, copying, installing or using the software you agree to this license.
  6. // If you do not agree to this license, do not download, install,
  7. // copy or use the software.
  8. //
  9. //
  10. // License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
  14. // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
  15. // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
  16. // Third party copyrights are property of their respective owners.
  17. //
  18. // Redistribution and use in source and binary forms, with or without modification,
  19. // are permitted provided that the following conditions are met:
  20. //
  21. // * Redistribution's of source code must retain the above copyright notice,
  22. // this list of conditions and the following disclaimer.
  23. //
  24. // * Redistribution's in binary form must reproduce the above copyright notice,
  25. // this list of conditions and the following disclaimer in the documentation
  26. // and/or other materials provided with the distribution.
  27. //
  28. // * The name of the copyright holders may not be used to endorse or promote products
  29. // derived from this software without specific prior written permission.
  30. //
  31. // This software is provided by the copyright holders and contributors "as is" and
  32. // any express or implied warranties, including, but not limited to, the implied
  33. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  34. // In no event shall the Intel Corporation or contributors be liable for any direct,
  35. // indirect, incidental, special, exemplary, or consequential damages
  36. // (including, but not limited to, procurement of substitute goods or services;
  37. // loss of use, data, or profits; or business interruption) however caused
  38. // and on any theory of liability, whether in contract, strict liability,
  39. // or tort (including negligence or otherwise) arising in any way out of
  40. // the use of this software, even if advised of the possibility of such damage.
  41. //
  42. //M*/
  43. #ifndef OPENCV_CALIB3D_C_H
  44. #define OPENCV_CALIB3D_C_H
  45. #include "opencv2/core/types_c.h"
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49. /* Calculates fundamental matrix given a set of corresponding points */
  50. #define CV_FM_7POINT 1
  51. #define CV_FM_8POINT 2
  52. #define CV_LMEDS 4
  53. #define CV_RANSAC 8
  54. #define CV_FM_LMEDS_ONLY CV_LMEDS
  55. #define CV_FM_RANSAC_ONLY CV_RANSAC
  56. #define CV_FM_LMEDS CV_LMEDS
  57. #define CV_FM_RANSAC CV_RANSAC
  58. enum
  59. {
  60. CV_ITERATIVE = 0,
  61. CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
  62. CV_P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
  63. CV_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
  64. };
  65. #define CV_CALIB_CB_ADAPTIVE_THRESH 1
  66. #define CV_CALIB_CB_NORMALIZE_IMAGE 2
  67. #define CV_CALIB_CB_FILTER_QUADS 4
  68. #define CV_CALIB_CB_FAST_CHECK 8
  69. #define CV_CALIB_USE_INTRINSIC_GUESS 1
  70. #define CV_CALIB_FIX_ASPECT_RATIO 2
  71. #define CV_CALIB_FIX_PRINCIPAL_POINT 4
  72. #define CV_CALIB_ZERO_TANGENT_DIST 8
  73. #define CV_CALIB_FIX_FOCAL_LENGTH 16
  74. #define CV_CALIB_FIX_K1 32
  75. #define CV_CALIB_FIX_K2 64
  76. #define CV_CALIB_FIX_K3 128
  77. #define CV_CALIB_FIX_K4 2048
  78. #define CV_CALIB_FIX_K5 4096
  79. #define CV_CALIB_FIX_K6 8192
  80. #define CV_CALIB_RATIONAL_MODEL 16384
  81. #define CV_CALIB_THIN_PRISM_MODEL 32768
  82. #define CV_CALIB_FIX_S1_S2_S3_S4 65536
  83. #define CV_CALIB_TILTED_MODEL 262144
  84. #define CV_CALIB_FIX_TAUX_TAUY 524288
  85. #define CV_CALIB_FIX_TANGENT_DIST 2097152
  86. #define CV_CALIB_NINTRINSIC 18
  87. #define CV_CALIB_FIX_INTRINSIC 256
  88. #define CV_CALIB_SAME_FOCAL_LENGTH 512
  89. #define CV_CALIB_ZERO_DISPARITY 1024
  90. /* stereo correspondence parameters and functions */
  91. #define CV_STEREO_BM_NORMALIZED_RESPONSE 0
  92. #define CV_STEREO_BM_XSOBEL 1
  93. #ifdef __cplusplus
  94. } // extern "C"
  95. //////////////////////////////////////////////////////////////////////////////////////////
  96. class CV_EXPORTS CvLevMarq
  97. {
  98. public:
  99. CvLevMarq();
  100. CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria=
  101. cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
  102. bool completeSymmFlag=false );
  103. ~CvLevMarq();
  104. void init( int nparams, int nerrs, CvTermCriteria criteria=
  105. cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
  106. bool completeSymmFlag=false );
  107. bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
  108. bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
  109. void clear();
  110. void step();
  111. enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
  112. cv::Ptr<CvMat> mask;
  113. cv::Ptr<CvMat> prevParam;
  114. cv::Ptr<CvMat> param;
  115. cv::Ptr<CvMat> J;
  116. cv::Ptr<CvMat> err;
  117. cv::Ptr<CvMat> JtJ;
  118. cv::Ptr<CvMat> JtJN;
  119. cv::Ptr<CvMat> JtErr;
  120. cv::Ptr<CvMat> JtJV;
  121. cv::Ptr<CvMat> JtJW;
  122. double prevErrNorm, errNorm;
  123. int lambdaLg10;
  124. CvTermCriteria criteria;
  125. int state;
  126. int iters;
  127. bool completeSymmFlag;
  128. int solveMethod;
  129. };
  130. #endif
  131. #endif /* OPENCV_CALIB3D_C_H */