*/
CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
-//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
-CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
-
/** @brief Calculates an affine transform from three pairs of the corresponding points.
The function calculates the \f$2 \times 3\f$ matrix of an affine transform so that:
@param src Coordinates of quadrangle vertices in the source image.
@param dst Coordinates of the corresponding quadrangle vertices in the destination image.
+@param solveMethod method passed to cv::solve (#DecompTypes)
@sa findHomography, warpPerspective, perspectiveTransform
*/
-CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst );
+CV_EXPORTS_W Mat getPerspectiveTransform(InputArray src, InputArray dst, int solveMethod = DECOMP_LU);
+
+/** @overload */
+CV_EXPORTS Mat getPerspectiveTransform(const Point2f src[], const Point2f dst[], int solveMethod = DECOMP_LU);
+
CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst );
SANITY_CHECK_NOTHING();
}
+PERF_TEST(Transform, getPerspectiveTransform_QR_1000)
+{
+ unsigned int size = 8;
+ Mat source(1, size/2, CV_32FC2);
+ Mat destination(1, size/2, CV_32FC2);
+ Mat transformCoefficient;
+
+ declare.in(source, destination, WARMUP_RNG);
+
+ PERF_SAMPLE_BEGIN()
+ for (int i = 0; i < 1000; i++)
+ {
+ transformCoefficient = getPerspectiveTransform(source, destination, DECOMP_QR);
+ }
+ PERF_SAMPLE_END()
+
+ SANITY_CHECK_NOTHING();
+}
+
} // namespace
* where:
* cij - matrix coefficients, c22 = 1
*/
-cv::Mat cv::getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
+cv::Mat cv::getPerspectiveTransform(const Point2f src[], const Point2f dst[], int solveMethod)
{
CV_INSTRUMENT_REGION()
b[i+4] = dst[i].y;
}
- static int param_IMGPROC_GETPERSPECTIVETRANSFORM_SOLVE_METHOD =
- (int)utils::getConfigurationParameterSizeT("OPENCV_IMGPROC_GETPERSPECTIVETRANSFORM_SOLVE_METHOD", (size_t)DECOMP_LU);
- solve(A, B, X, param_IMGPROC_GETPERSPECTIVETRANSFORM_SOLVE_METHOD);
+ solve(A, B, X, solveMethod);
M.ptr<double>()[8] = 1.;
return M;
CV_Error( CV_StsUnsupportedFormat, "" );
}
-cv::Mat cv::getPerspectiveTransform(InputArray _src, InputArray _dst)
+cv::Mat cv::getPerspectiveTransform(InputArray _src, InputArray _dst, int solveMethod)
{
Mat src = _src.getMat(), dst = _dst.getMat();
CV_Assert(src.checkVector(2, CV_32F) == 4 && dst.checkVector(2, CV_32F) == 4);
- return getPerspectiveTransform((const Point2f*)src.data, (const Point2f*)dst.data);
+ return getPerspectiveTransform((const Point2f*)src.data, (const Point2f*)dst.data, solveMethod);
}
cv::Mat cv::getAffineTransform(InputArray _src, InputArray _dst)