\****************************************************************************************/
template<typename _Tp> static inline int
-LUImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n)
+LUImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n, _Tp eps)
{
int i, j, k, p = 1;
astep /= sizeof(A[0]);
if( std::abs(A[j*astep + i]) > std::abs(A[k*astep + i]) )
k = j;
- if( std::abs(A[k*astep + i]) < std::numeric_limits<_Tp>::epsilon() )
+ if( std::abs(A[k*astep + i]) < eps )
return 0;
if( k != i )
int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n)
{
- return LUImpl(A, astep, m, b, bstep, n);
+ return LUImpl(A, astep, m, b, bstep, n, FLT_EPSILON*10);
}
int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n)
{
- return LUImpl(A, astep, m, b, bstep, n);
+ return LUImpl(A, astep, m, b, bstep, n, DBL_EPSILON*100);
}
}
}
+TEST(Imgproc_GetAffineTransform, singularity)
+{
+ Point2f A_sample[3];
+ A_sample[0] = cv::Point2f(8, 9);
+ A_sample[1] = cv::Point2f(40, 41);
+ A_sample[2] = cv::Point2f(47, 48);
+ Point2f B_sample[3];
+ B_sample[0] = cv::Point2f(7.37465, 11.8295);
+ B_sample[1] = cv::Point2f(15.0113, 12.8994);
+ B_sample[2] = cv::Point2f(38.9943, 9.56297);
+ Mat trans = cv::getAffineTransform(A_sample, B_sample);
+ ASSERT_EQ(0.0, norm(trans, NORM_INF));
+}
+
/* End of file. */