2010-05-12 01:44:00 +08:00
/*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.
//
//
2013-04-11 23:27:54 +08:00
// License Agreement
2010-05-12 01:44:00 +08:00
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
2013-03-22 05:05:30 +08:00
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
2010-05-12 01:44:00 +08:00
// 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_HPP__
# define __OPENCV_CALIB3D_HPP__
2013-04-11 23:27:54 +08:00
# include "opencv2/core.hpp"
2013-03-13 20:22:44 +08:00
# include "opencv2/features2d.hpp"
2014-07-08 18:33:56 +08:00
# include "opencv2/core/affine.hpp"
2010-05-12 01:44:00 +08:00
2013-04-11 23:27:54 +08:00
namespace cv
{
2010-11-30 07:56:33 +08:00
2013-04-11 23:27:54 +08:00
//! type of the robust estimation algorithm
enum { LMEDS = 4 , //!< least-median algorithm
RANSAC = 8 //!< RANSAC algorithm
} ;
2014-08-11 22:28:09 +08:00
enum { SOLVEPNP_ITERATIVE = 0 ,
2014-08-11 22:31:28 +08:00
SOLVEPNP_EPNP = 1 , // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
SOLVEPNP_P3P = 2 , // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
SOLVEPNP_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
2014-07-15 15:58:49 +08:00
} ;
2013-04-11 23:27:54 +08:00
enum { CALIB_CB_ADAPTIVE_THRESH = 1 ,
CALIB_CB_NORMALIZE_IMAGE = 2 ,
CALIB_CB_FILTER_QUADS = 4 ,
CALIB_CB_FAST_CHECK = 8
} ;
enum { CALIB_CB_SYMMETRIC_GRID = 1 ,
CALIB_CB_ASYMMETRIC_GRID = 2 ,
CALIB_CB_CLUSTERING = 4
} ;
enum { CALIB_USE_INTRINSIC_GUESS = 0x00001 ,
CALIB_FIX_ASPECT_RATIO = 0x00002 ,
CALIB_FIX_PRINCIPAL_POINT = 0x00004 ,
CALIB_ZERO_TANGENT_DIST = 0x00008 ,
CALIB_FIX_FOCAL_LENGTH = 0x00010 ,
CALIB_FIX_K1 = 0x00020 ,
CALIB_FIX_K2 = 0x00040 ,
CALIB_FIX_K3 = 0x00080 ,
CALIB_FIX_K4 = 0x00800 ,
CALIB_FIX_K5 = 0x01000 ,
CALIB_FIX_K6 = 0x02000 ,
CALIB_RATIONAL_MODEL = 0x04000 ,
CALIB_THIN_PRISM_MODEL = 0x08000 ,
CALIB_FIX_S1_S2_S3_S4 = 0x10000 ,
// only for stereo
CALIB_FIX_INTRINSIC = 0x00100 ,
CALIB_SAME_FOCAL_LENGTH = 0x00200 ,
// for stereo rectification
CALIB_ZERO_DISPARITY = 0x00400
} ;
2012-05-28 15:36:14 +08:00
2013-04-11 23:27:54 +08:00
//! the algorithm for finding fundamental matrix
enum { FM_7POINT = 1 , //!< 7-point algorithm
FM_8POINT = 2 , //!< 8-point algorithm
FM_LMEDS = 4 , //!< least-median algorithm
FM_RANSAC = 8 //!< RANSAC algorithm
} ;
2011-12-26 20:59:07 +08:00
2012-05-28 15:36:14 +08:00
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! converts rotation vector to rotation matrix or vice versa using Rodrigues transformation
2013-04-11 23:27:54 +08:00
CV_EXPORTS_W void Rodrigues ( InputArray src , OutputArray dst , OutputArray jacobian = noArray ( ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! computes the best-fit perspective transformation mapping srcPoints to dstPoints.
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W Mat findHomography ( InputArray srcPoints , InputArray dstPoints ,
2013-04-11 23:27:54 +08:00
int method = 0 , double ransacReprojThreshold = 3 ,
2014-08-17 07:13:39 +08:00
OutputArray mask = noArray ( ) , const int maxIters = 2000 ,
const double confidence = 0.995 ) ;
2011-04-23 20:49:14 +08:00
//! variant of findHomography for backward compatibility
2011-06-06 22:51:27 +08:00
CV_EXPORTS Mat findHomography ( InputArray srcPoints , InputArray dstPoints ,
2013-04-11 23:27:54 +08:00
OutputArray mask , int method = 0 , double ransacReprojThreshold = 3 ) ;
2012-05-28 15:36:14 +08:00
2010-05-25 23:59:48 +08:00
//! Computes RQ decomposition of 3x3 matrix
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W Vec3d RQDecomp3x3 ( InputArray src , OutputArray mtxR , OutputArray mtxQ ,
2013-04-11 23:27:54 +08:00
OutputArray Qx = noArray ( ) ,
OutputArray Qy = noArray ( ) ,
OutputArray Qz = noArray ( ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W void decomposeProjectionMatrix ( InputArray projMatrix , OutputArray cameraMatrix ,
2011-04-17 21:14:45 +08:00
OutputArray rotMatrix , OutputArray transVect ,
2013-04-11 23:27:54 +08:00
OutputArray rotMatrixX = noArray ( ) ,
OutputArray rotMatrixY = noArray ( ) ,
OutputArray rotMatrixZ = noArray ( ) ,
OutputArray eulerAngles = noArray ( ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients
2013-04-11 23:27:54 +08:00
CV_EXPORTS_W void matMulDeriv ( InputArray A , InputArray B , OutputArray dABdA , OutputArray dABdB ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W void composeRT ( InputArray rvec1 , InputArray tvec1 ,
InputArray rvec2 , InputArray tvec2 ,
2011-04-17 21:14:45 +08:00
OutputArray rvec3 , OutputArray tvec3 ,
2013-04-11 23:27:54 +08:00
OutputArray dr3dr1 = noArray ( ) , OutputArray dr3dt1 = noArray ( ) ,
OutputArray dr3dr2 = noArray ( ) , OutputArray dr3dt2 = noArray ( ) ,
OutputArray dt3dr1 = noArray ( ) , OutputArray dt3dt1 = noArray ( ) ,
OutputArray dt3dr2 = noArray ( ) , OutputArray dt3dt2 = noArray ( ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! projects points from the model coordinate space to the image coordinates. Also computes derivatives of the image coordinates w.r.t the intrinsic and extrinsic camera parameters
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W void projectPoints ( InputArray objectPoints ,
InputArray rvec , InputArray tvec ,
InputArray cameraMatrix , InputArray distCoeffs ,
2011-04-17 21:14:45 +08:00
OutputArray imagePoints ,
2013-04-11 23:27:54 +08:00
OutputArray jacobian = noArray ( ) ,
double aspectRatio = 0 ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! computes the camera pose from a few 3D points and the corresponding projections. The outliers are not handled.
2011-12-26 20:59:07 +08:00
CV_EXPORTS_W bool solvePnP ( InputArray objectPoints , InputArray imagePoints ,
2011-06-06 22:51:27 +08:00
InputArray cameraMatrix , InputArray distCoeffs ,
2011-04-17 21:14:45 +08:00
OutputArray rvec , OutputArray tvec ,
2014-08-11 22:28:09 +08:00
bool useExtrinsicGuess = false , int flags = SOLVEPNP_ITERATIVE ) ;
2010-05-12 01:44:00 +08:00
2011-03-05 08:18:49 +08:00
//! computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.
2014-07-09 16:37:37 +08:00
CV_EXPORTS_W bool solvePnPRansac ( InputArray objectPoints , InputArray imagePoints ,
2013-04-11 23:27:54 +08:00
InputArray cameraMatrix , InputArray distCoeffs ,
OutputArray rvec , OutputArray tvec ,
bool useExtrinsicGuess = false , int iterationsCount = 100 ,
2014-08-11 16:17:42 +08:00
float reprojectionError = 8.0 , double confidence = 0.99 ,
2014-08-11 22:28:09 +08:00
OutputArray inliers = noArray ( ) , int flags = SOLVEPNP_ITERATIVE ) ;
2011-03-05 08:18:49 +08:00
2010-05-25 23:59:48 +08:00
//! initializes camera matrix from a few 3D points and the corresponding projections.
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W Mat initCameraMatrix2D ( InputArrayOfArrays objectPoints ,
InputArrayOfArrays imagePoints ,
2013-04-11 23:27:54 +08:00
Size imageSize , double aspectRatio = 1.0 ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! finds checkerboard pattern of the specified size in the image
2013-04-11 23:27:54 +08:00
CV_EXPORTS_W bool findChessboardCorners ( InputArray image , Size patternSize , OutputArray corners ,
int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE ) ;
2010-05-12 01:44:00 +08:00
2012-05-28 15:36:14 +08:00
//! finds subpixel-accurate positions of the chessboard corners
2013-04-11 23:27:54 +08:00
CV_EXPORTS bool find4QuadCornerSubpix ( InputArray img , InputOutputArray corners , Size region_size ) ;
2011-02-10 04:55:11 +08:00
2010-05-25 23:59:48 +08:00
//! draws the checkerboard pattern (found or partly found) in the image
2011-04-17 21:14:45 +08:00
CV_EXPORTS_W void drawChessboardCorners ( InputOutputArray image , Size patternSize ,
2011-06-06 22:51:27 +08:00
InputArray corners , bool patternWasFound ) ;
2010-12-21 17:24:36 +08:00
//! finds circles' grid pattern of the specified size in the image
2012-03-12 19:40:46 +08:00
CV_EXPORTS_W bool findCirclesGrid ( InputArray image , Size patternSize ,
2013-04-11 23:27:54 +08:00
OutputArray centers , int flags = CALIB_CB_SYMMETRIC_GRID ,
2013-08-13 21:03:56 +08:00
const Ptr < FeatureDetector > & blobDetector = makePtr < SimpleBlobDetector > ( ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern.
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W double calibrateCamera ( InputArrayOfArrays objectPoints ,
2013-04-11 23:27:54 +08:00
InputArrayOfArrays imagePoints , Size imageSize ,
InputOutputArray cameraMatrix , InputOutputArray distCoeffs ,
2011-06-18 05:21:01 +08:00
OutputArrayOfArrays rvecs , OutputArrayOfArrays tvecs ,
2013-04-11 23:27:54 +08:00
int flags = 0 , TermCriteria criteria = TermCriteria (
TermCriteria : : COUNT + TermCriteria : : EPS , 30 , DBL_EPSILON ) ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.
2013-04-11 23:27:54 +08:00
CV_EXPORTS_W void calibrationMatrixValues ( InputArray cameraMatrix , Size imageSize ,
double apertureWidth , double apertureHeight ,
CV_OUT double & fovx , CV_OUT double & fovy ,
CV_OUT double & focalLength , CV_OUT Point2d & principalPoint ,
CV_OUT double & aspectRatio ) ;
2010-05-25 23:59:48 +08:00
//! finds intrinsic and extrinsic parameters of a stereo camera
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W double stereoCalibrate ( InputArrayOfArrays objectPoints ,
2013-04-11 23:27:54 +08:00
InputArrayOfArrays imagePoints1 , InputArrayOfArrays imagePoints2 ,
InputOutputArray cameraMatrix1 , InputOutputArray distCoeffs1 ,
InputOutputArray cameraMatrix2 , InputOutputArray distCoeffs2 ,
Size imageSize , OutputArray R , OutputArray T , OutputArray E , OutputArray F ,
2013-12-17 13:53:44 +08:00
int flags = CALIB_FIX_INTRINSIC ,
TermCriteria criteria = TermCriteria ( TermCriteria : : COUNT + TermCriteria : : EPS , 30 , 1e-6 ) ) ;
2010-05-12 01:44:00 +08:00
2012-05-28 15:36:14 +08:00
2010-05-25 23:59:48 +08:00
//! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters
2011-10-05 08:14:43 +08:00
CV_EXPORTS_W void stereoRectify ( InputArray cameraMatrix1 , InputArray distCoeffs1 ,
2013-04-11 23:27:54 +08:00
InputArray cameraMatrix2 , InputArray distCoeffs2 ,
Size imageSize , InputArray R , InputArray T ,
OutputArray R1 , OutputArray R2 ,
OutputArray P1 , OutputArray P2 ,
OutputArray Q , int flags = CALIB_ZERO_DISPARITY ,
double alpha = - 1 , Size newImageSize = Size ( ) ,
CV_OUT Rect * validPixROI1 = 0 , CV_OUT Rect * validPixROI2 = 0 ) ;
2010-05-12 01:44:00 +08:00
2010-05-25 23:59:48 +08:00
//! computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed)
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W bool stereoRectifyUncalibrated ( InputArray points1 , InputArray points2 ,
InputArray F , Size imgSize ,
2011-04-17 21:14:45 +08:00
OutputArray H1 , OutputArray H2 ,
2013-04-11 23:27:54 +08:00
double threshold = 5 ) ;
2010-10-28 02:26:39 +08:00
//! computes the rectification transformations for 3-head camera, where all the heads are on the same line.
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W float rectify3Collinear ( InputArray cameraMatrix1 , InputArray distCoeffs1 ,
InputArray cameraMatrix2 , InputArray distCoeffs2 ,
InputArray cameraMatrix3 , InputArray distCoeffs3 ,
InputArrayOfArrays imgpt1 , InputArrayOfArrays imgpt3 ,
Size imageSize , InputArray R12 , InputArray T12 ,
InputArray R13 , InputArray T13 ,
2011-04-17 21:14:45 +08:00
OutputArray R1 , OutputArray R2 , OutputArray R3 ,
OutputArray P1 , OutputArray P2 , OutputArray P3 ,
OutputArray Q , double alpha , Size newImgSize ,
2010-10-28 02:26:39 +08:00
CV_OUT Rect * roi1 , CV_OUT Rect * roi2 , int flags ) ;
2012-05-28 15:36:14 +08:00
2010-05-25 23:59:48 +08:00
//! returns the optimal new camera matrix
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W Mat getOptimalNewCameraMatrix ( InputArray cameraMatrix , InputArray distCoeffs ,
2013-04-11 23:27:54 +08:00
Size imageSize , double alpha , Size newImgSize = Size ( ) ,
CV_OUT Rect * validPixROI = 0 ,
bool centerPrincipalPoint = false ) ;
2010-05-12 15:33:21 +08:00
2010-05-25 23:59:48 +08:00
//! converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W void convertPointsToHomogeneous ( InputArray src , OutputArray dst ) ;
2012-05-28 15:36:14 +08:00
2010-05-25 23:59:48 +08:00
//! converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W void convertPointsFromHomogeneous ( InputArray src , OutputArray dst ) ;
2010-05-12 01:44:00 +08:00
2011-05-03 06:20:22 +08:00
//! for backward compatibility
2011-06-06 22:51:27 +08:00
CV_EXPORTS void convertPointsHomogeneous ( InputArray src , OutputArray dst ) ;
2012-05-28 15:36:14 +08:00
2010-05-26 16:40:25 +08:00
//! finds fundamental matrix from a set of corresponding 2D points
2011-06-06 22:51:27 +08:00
CV_EXPORTS_W Mat findFundamentalMat ( InputArray points1 , InputArray points2 ,
2013-04-11 23:27:54 +08:00
int method = FM_RANSAC ,
double param1 = 3. , double param2 = 0.99 ,
OutputArray mask = noArray ( ) ) ;
2010-05-12 01:44:00 +08:00
2011-04-23 20:49:14 +08:00
//! variant of findFundamentalMat for backward compatibility
2011-06-06 22:51:27 +08:00
CV_EXPORTS Mat findFundamentalMat ( InputArray points1 , InputArray points2 ,
2013-04-11 23:27:54 +08:00
OutputArray mask , int method = FM_RANSAC ,
double param1 = 3. , double param2 = 0.99 ) ;
2011-04-23 20:49:14 +08:00
2012-12-27 01:58:50 +08:00
//! finds essential matrix from a set of corresponding 2D points using five-point algorithm
2013-09-09 17:55:35 +08:00
CV_EXPORTS_W Mat findEssentialMat ( InputArray points1 , InputArray points2 ,
2013-04-11 23:27:54 +08:00
double focal = 1.0 , Point2d pp = Point2d ( 0 , 0 ) ,
int method = RANSAC , double prob = 0.999 ,
double threshold = 1.0 , OutputArray mask = noArray ( ) ) ;
2012-12-27 01:58:50 +08:00
//! decompose essential matrix to possible rotation matrix and one translation vector
2013-09-09 17:55:35 +08:00
CV_EXPORTS_W void decomposeEssentialMat ( InputArray E , OutputArray R1 , OutputArray R2 , OutputArray t ) ;
2012-12-27 01:58:50 +08:00
//! recover relative camera pose from a set of corresponding 2D points
2013-09-09 17:55:35 +08:00
CV_EXPORTS_W int recoverPose ( InputArray E , InputArray points1 , InputArray points2 ,
2013-04-11 23:27:54 +08:00
OutputArray R , OutputArray t ,
2013-03-13 20:22:44 +08:00
double focal = 1.0 , Point2d pp = Point2d ( 0 , 0 ) ,
2013-04-11 23:27:54 +08:00
InputOutputArray mask = noArray ( ) ) ;
2013-03-13 20:22:44 +08:00
2012-12-27 01:58:50 +08:00
2010-05-26 16:40:25 +08:00
//! finds coordinates of epipolar lines corresponding the specified points
2013-06-25 18:08:23 +08:00
CV_EXPORTS_W void computeCorrespondEpilines ( InputArray points , int whichImage ,
InputArray F , OutputArray lines ) ;
2010-05-12 01:44:00 +08:00
2012-03-29 18:39:06 +08:00
CV_EXPORTS_W void triangulatePoints ( InputArray projMatr1 , InputArray projMatr2 ,
InputArray projPoints1 , InputArray projPoints2 ,
OutputArray points4D ) ;
2012-03-29 21:21:24 +08:00
CV_EXPORTS_W void correctMatches ( InputArray F , InputArray points1 , InputArray points2 ,
OutputArray newPoints1 , OutputArray newPoints2 ) ;
2013-04-11 23:27:54 +08:00
//! filters off speckles (small regions of incorrectly computed disparity)
CV_EXPORTS_W void filterSpeckles ( InputOutputArray img , double newVal ,
int maxSpeckleSize , double maxDiff ,
InputOutputArray buf = noArray ( ) ) ;
//! computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify())
CV_EXPORTS_W Rect getValidDisparityROI ( Rect roi1 , Rect roi2 ,
int minDisparity , int numberOfDisparities ,
int SADWindowSize ) ;
//! validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
CV_EXPORTS_W void validateDisparity ( InputOutputArray disparity , InputArray cost ,
int minDisparity , int numberOfDisparities ,
int disp12MaxDisp = 1 ) ;
//! reprojects disparity image to 3D: (x,y,d)->(X,Y,Z) using the matrix Q returned by cv::stereoRectify
CV_EXPORTS_W void reprojectImageTo3D ( InputArray disparity ,
OutputArray _3dImage , InputArray Q ,
bool handleMissingValues = false ,
int ddepth = - 1 ) ;
CV_EXPORTS_W int estimateAffine3D ( InputArray src , InputArray dst ,
OutputArray out , OutputArray inliers ,
double ransacThreshold = 3 , double confidence = 0.99 ) ;
2010-05-12 01:44:00 +08:00
2014-04-28 01:02:36 +08:00
CV_EXPORTS_W int decomposeHomographyMat ( InputArray H ,
InputArray K ,
OutputArrayOfArrays rotations ,
OutputArrayOfArrays translations ,
OutputArrayOfArrays normals ) ;
2013-03-25 03:09:17 +08:00
2013-03-01 06:24:46 +08:00
class CV_EXPORTS_W StereoMatcher : public Algorithm
{
public :
2013-04-11 23:27:54 +08:00
enum { DISP_SHIFT = 4 ,
DISP_SCALE = ( 1 < < DISP_SHIFT )
} ;
2013-03-22 05:05:30 +08:00
2013-03-01 06:24:46 +08:00
CV_WRAP virtual void compute ( InputArray left , InputArray right ,
OutputArray disparity ) = 0 ;
2012-05-28 15:36:14 +08:00
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getMinDisparity ( ) const = 0 ;
CV_WRAP virtual void setMinDisparity ( int minDisparity ) = 0 ;
2013-03-01 06:24:46 +08:00
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getNumDisparities ( ) const = 0 ;
CV_WRAP virtual void setNumDisparities ( int numDisparities ) = 0 ;
2013-03-13 20:22:44 +08:00
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getBlockSize ( ) const = 0 ;
CV_WRAP virtual void setBlockSize ( int blockSize ) = 0 ;
2013-03-01 06:24:46 +08:00
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getSpeckleWindowSize ( ) const = 0 ;
CV_WRAP virtual void setSpeckleWindowSize ( int speckleWindowSize ) = 0 ;
CV_WRAP virtual int getSpeckleRange ( ) const = 0 ;
CV_WRAP virtual void setSpeckleRange ( int speckleRange ) = 0 ;
CV_WRAP virtual int getDisp12MaxDiff ( ) const = 0 ;
CV_WRAP virtual void setDisp12MaxDiff ( int disp12MaxDiff ) = 0 ;
} ;
2013-03-01 06:24:46 +08:00
2013-03-25 03:09:17 +08:00
2013-04-11 23:27:54 +08:00
2013-03-22 05:05:30 +08:00
class CV_EXPORTS_W StereoBM : public StereoMatcher
2010-05-12 01:44:00 +08:00
{
public :
2013-04-11 23:27:54 +08:00
enum { PREFILTER_NORMALIZED_RESPONSE = 0 ,
PREFILTER_XSOBEL = 1
} ;
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getPreFilterType ( ) const = 0 ;
CV_WRAP virtual void setPreFilterType ( int preFilterType ) = 0 ;
CV_WRAP virtual int getPreFilterSize ( ) const = 0 ;
CV_WRAP virtual void setPreFilterSize ( int preFilterSize ) = 0 ;
CV_WRAP virtual int getPreFilterCap ( ) const = 0 ;
CV_WRAP virtual void setPreFilterCap ( int preFilterCap ) = 0 ;
CV_WRAP virtual int getTextureThreshold ( ) const = 0 ;
CV_WRAP virtual void setTextureThreshold ( int textureThreshold ) = 0 ;
CV_WRAP virtual int getUniquenessRatio ( ) const = 0 ;
CV_WRAP virtual void setUniquenessRatio ( int uniquenessRatio ) = 0 ;
CV_WRAP virtual int getSmallerBlockSize ( ) const = 0 ;
CV_WRAP virtual void setSmallerBlockSize ( int blockSize ) = 0 ;
CV_WRAP virtual Rect getROI1 ( ) const = 0 ;
CV_WRAP virtual void setROI1 ( Rect roi1 ) = 0 ;
CV_WRAP virtual Rect getROI2 ( ) const = 0 ;
CV_WRAP virtual void setROI2 ( Rect roi2 ) = 0 ;
2010-05-12 01:44:00 +08:00
} ;
2013-04-11 23:27:54 +08:00
CV_EXPORTS_W Ptr < StereoBM > createStereoBM ( int numDisparities = 0 , int blockSize = 21 ) ;
2010-05-12 01:44:00 +08:00
2013-03-22 05:05:30 +08:00
class CV_EXPORTS_W StereoSGBM : public StereoMatcher
2010-05-12 01:44:00 +08:00
{
public :
2013-04-11 23:27:54 +08:00
enum { MODE_SGBM = 0 ,
MODE_HH = 1
} ;
2013-03-22 05:05:30 +08:00
CV_WRAP virtual int getPreFilterCap ( ) const = 0 ;
CV_WRAP virtual void setPreFilterCap ( int preFilterCap ) = 0 ;
CV_WRAP virtual int getUniquenessRatio ( ) const = 0 ;
CV_WRAP virtual void setUniquenessRatio ( int uniquenessRatio ) = 0 ;
CV_WRAP virtual int getP1 ( ) const = 0 ;
CV_WRAP virtual void setP1 ( int P1 ) = 0 ;
CV_WRAP virtual int getP2 ( ) const = 0 ;
CV_WRAP virtual void setP2 ( int P2 ) = 0 ;
CV_WRAP virtual int getMode ( ) const = 0 ;
CV_WRAP virtual void setMode ( int mode ) = 0 ;
2010-05-12 01:44:00 +08:00
} ;
2013-03-22 05:05:30 +08:00
2013-03-25 04:42:46 +08:00
CV_EXPORTS_W Ptr < StereoSGBM > createStereoSGBM ( int minDisparity , int numDisparities , int blockSize ,
2013-04-11 23:27:54 +08:00
int P1 = 0 , int P2 = 0 , int disp12MaxDiff = 0 ,
int preFilterCap = 0 , int uniquenessRatio = 0 ,
int speckleWindowSize = 0 , int speckleRange = 0 ,
int mode = StereoSGBM : : MODE_SGBM ) ;
2013-03-22 05:05:30 +08:00
2014-07-08 18:33:56 +08:00
namespace fisheye
{
enum {
CALIB_USE_INTRINSIC_GUESS = 1 ,
CALIB_RECOMPUTE_EXTRINSIC = 2 ,
CALIB_CHECK_COND = 4 ,
CALIB_FIX_SKEW = 8 ,
CALIB_FIX_K1 = 16 ,
CALIB_FIX_K2 = 32 ,
CALIB_FIX_K3 = 64 ,
CALIB_FIX_K4 = 128 ,
CALIB_FIX_INTRINSIC = 256
} ;
//! projects 3D points using fisheye model
CV_EXPORTS void projectPoints ( InputArray objectPoints , OutputArray imagePoints , const Affine3d & affine ,
InputArray K , InputArray D , double alpha = 0 , OutputArray jacobian = noArray ( ) ) ;
//! projects points using fisheye model
CV_EXPORTS void projectPoints ( InputArray objectPoints , OutputArray imagePoints , InputArray rvec , InputArray tvec ,
InputArray K , InputArray D , double alpha = 0 , OutputArray jacobian = noArray ( ) ) ;
//! distorts 2D points using fisheye model
CV_EXPORTS void distortPoints ( InputArray undistorted , OutputArray distorted , InputArray K , InputArray D , double alpha = 0 ) ;
//! undistorts 2D points using fisheye model
CV_EXPORTS void undistortPoints ( InputArray distorted , OutputArray undistorted ,
InputArray K , InputArray D , InputArray R = noArray ( ) , InputArray P = noArray ( ) ) ;
//! computing undistortion and rectification maps for image transform by cv::remap()
//! If D is empty zero distortion is used, if R or P is empty identity matrixes are used
CV_EXPORTS void initUndistortRectifyMap ( InputArray K , InputArray D , InputArray R , InputArray P ,
const cv : : Size & size , int m1type , OutputArray map1 , OutputArray map2 ) ;
//! undistorts image, optionally changes resolution and camera matrix. If Knew zero identity matrix is used
CV_EXPORTS void undistortImage ( InputArray distorted , OutputArray undistorted ,
InputArray K , InputArray D , InputArray Knew = cv : : noArray ( ) , const Size & new_size = Size ( ) ) ;
//! estimates new camera matrix for undistortion or rectification
CV_EXPORTS void estimateNewCameraMatrixForUndistortRectify ( InputArray K , InputArray D , const Size & image_size , InputArray R ,
OutputArray P , double balance = 0.0 , const Size & new_size = Size ( ) , double fov_scale = 1.0 ) ;
//! performs camera calibaration
CV_EXPORTS double calibrate ( InputArrayOfArrays objectPoints , InputArrayOfArrays imagePoints , const Size & image_size ,
InputOutputArray K , InputOutputArray D , OutputArrayOfArrays rvecs , OutputArrayOfArrays tvecs , int flags = 0 ,
TermCriteria criteria = TermCriteria ( TermCriteria : : COUNT + TermCriteria : : EPS , 100 , DBL_EPSILON ) ) ;
//! stereo rectification estimation
CV_EXPORTS void stereoRectify ( InputArray K1 , InputArray D1 , InputArray K2 , InputArray D2 , const Size & imageSize , InputArray R , InputArray tvec ,
OutputArray R1 , OutputArray R2 , OutputArray P1 , OutputArray P2 , OutputArray Q , int flags , const Size & newImageSize = Size ( ) ,
double balance = 0.0 , double fov_scale = 1.0 ) ;
//! performs stereo calibaration
CV_EXPORTS double stereoCalibrate ( InputArrayOfArrays objectPoints , InputArrayOfArrays imagePoints1 , InputArrayOfArrays imagePoints2 ,
InputOutputArray K1 , InputOutputArray D1 , InputOutputArray K2 , InputOutputArray D2 , Size imageSize ,
OutputArray R , OutputArray T , int flags = CALIB_FIX_INTRINSIC ,
TermCriteria criteria = TermCriteria ( TermCriteria : : COUNT + TermCriteria : : EPS , 100 , DBL_EPSILON ) ) ;
}
2013-04-11 23:27:54 +08:00
} // cv
2010-05-12 01:44:00 +08:00
# endif