diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 63fc23c3b52592b95a6cf983b8aacfa947f2e572..1ee96bb09ff8a81b062199433966f36b2e37f53e 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -721,7 +721,7 @@ template struct CV_EXPORTS Matx_DetOp return p; for( int i = 0; i < m; i++ ) p *= temp(i, i); - return p; + return 1./p; } }; diff --git a/modules/core/test/test_operations.cpp b/modules/core/test/test_operations.cpp index ad201ea0ca72d60edbf150170d533708e0b08c58..6b36883cfeb5de194a77d2dd78228d6ef70f7155 100644 --- a/modules/core/test/test_operations.cpp +++ b/modules/core/test/test_operations.cpp @@ -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 pt2d(3); + vector 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&) {