enumDecompTypes { /** Gaussian elimination with the optimal pivot element chosen. */ DECOMP_LU = 0,//最佳主轴元素的高斯消元法 /** singular value decomposition (SVD) method; the system can be over-defined and/or the matrix src1 can be singular */ DECOMP_SVD = 1,//奇异值分解(SVD)方法 /** eigenvalue decomposition; the matrix src1 must be symmetrical */ DECOMP_EIG = 2,//特征值分解法 /** Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical and positively defined */ DECOMP_CHOLESKY = 3,//Cholesky分解法 /** QR factorization; the system can be over-defined and/or the matrix src1 can be singular */ DECOMP_QR = 4,//QR分解法 /** while all the previous flags are mutually exclusive, this flag can be used together with any of the previous; it means that the normal equations \f$\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}\f$ are solved instead of the original system \f$\texttt{src1}\cdot\texttt{dst}=\texttt{src2}\f$ */ DECOMP_NORMAL = 16//使用正规方程公式,可以去前面的标志一起使用 };
重载二函数定义:
1 2 3 4 5
Mat getPerspectiveTransform( InputArray src, //输入图像 InputArray dst, //输出图像 int solveMethod = DECOMP_LU//同上 );
warpPerspective函数
函数作用:对图像进行透视变换 函数定义:
1 2 3 4 5 6 7 8 9
voidwarpPerspective( InputArray src, OutputArray dst, InputArray M, Size dsize, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, const Scalar& borderValue = Scalar() );
enumInterpolationFlags{ /** nearest neighbor interpolation */ INTER_NEAREST = 0, /** bilinear interpolation */ INTER_LINEAR = 1, /** bicubic interpolation */ INTER_CUBIC = 2, /** resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method. */ INTER_AREA = 3, /** Lanczos interpolation over 8x8 neighborhood */ INTER_LANCZOS4 = 4, /** Bit exact bilinear interpolation */ INTER_LINEAR_EXACT = 5, /** Bit exact nearest neighbor interpolation. This will produce same results as the nearest neighbor method in PIL, scikit-image or Matlab. */ INTER_NEAREST_EXACT = 6, /** mask for interpolation codes */ INTER_MAX = 7, /** flag, fills all of the destination image pixels. If some of them correspond to outliers in the source image, they are set to zero */ WARP_FILL_OUTLIERS = 8, /** flag, inverse transformation For example, #linearPolar or #logPolar transforms: - flag is __not__ set: \f$dst( \rho , \phi ) = src(x,y)\f$ - flag is set: \f$dst(x,y) = src( \rho , \phi )\f$ */ WARP_INVERSE_MAP = 16 };
BORDER_REFLECT101 = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101 BORDER_DEFAULT = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101 BORDER_ISOLATED = 16//!< do not look outside of ROI };