added tests for #1373, #2629, #2719; fixed another bug in determinant(Matx<T,n,n>)

This commit is contained in:
Vadim Pisarevsky 2013-01-28 17:27:08 +04:00
parent 1df10553bb
commit 146ca61a27
2 changed files with 18 additions and 1 deletions

View File

@ -721,7 +721,7 @@ template<typename _Tp, int m> struct CV_EXPORTS Matx_DetOp
return p;
for( int i = 0; i < m; i++ )
p *= temp(i, i);
return p;
return 1./p;
}
};

View File

@ -998,6 +998,23 @@ bool CV_OperationsTest::operations1()
add(Mat::zeros(6, 1, CV_64F), 1, c, noArray(), c.type());
CV_Assert( norm(Matx61f(1.f, 1.f, 1.f, 1.f, 1.f, 1.f), c, CV_C) == 0 );
vector<Point2f> pt2d(3);
vector<Point3d> pt3d(2);
CV_Assert( Mat(pt2d).checkVector(2) == 3 && Mat(pt2d).checkVector(3) < 0 &&
Mat(pt3d).checkVector(2) < 0 && Mat(pt3d).checkVector(3) == 2 );
Matx44f m44(0.8147f, 0.6324f, 0.9575f, 0.9572f,
0.9058f, 0.0975f, 0.9649f, 0.4854f,
0.1270f, 0.2785f, 0.1576f, 0.8003f,
0.9134f, 0.5469f, 0.9706f, 0.1419f);
double d = determinant(m44);
CV_Assert( fabs(d - (-0.0262)) <= 0.001 );
Cv32suf z;
z.i = 0x80000000;
CV_Assert( cvFloor(z.f) == 0 && cvCeil(z.f) == 0 && cvRound(z.f) == 0 );
}
catch(const test_excep&)
{