diff --git a/tests/cv/src/adetectordescriptor_evaluation.cpp b/tests/cv/src/adetectordescriptor_evaluation.cpp index 987bded75d..42dfbe6e1f 100644 --- a/tests/cv/src/adetectordescriptor_evaluation.cpp +++ b/tests/cv/src/adetectordescriptor_evaluation.cpp @@ -87,6 +87,9 @@ public: EllipticKeyPoint(); EllipticKeyPoint( const Point2f& _center, const Scalar& _ellipse ); + static void convert( const vector& src, vector& dst ); + static void convert( const vector& src, vector& dst ); + static Mat_ getSecondMomentsMatrix( const Scalar& _ellipse ); Mat_ getSecondMomentsMatrix() const; @@ -95,7 +98,7 @@ public: Point2f center; Scalar ellipse; // 3 elements a, b, c: ax^2+2bxy+cy^2=1 Size_ axes; // half lenght of elipse axes - Size_ boundingBox; // half sizes of bounding box + Size_ boundingBox; // half sizes of bounding box which sides are parallel to the coordinate axes }; EllipticKeyPoint::EllipticKeyPoint() @@ -144,20 +147,7 @@ void EllipticKeyPoint::calcProjection( const Mat_& H, EllipticKeyPoint& projection = EllipticKeyPoint( dstCenter, Scalar(dstM(0,0), dstM(0,1), dstM(1,1)) ); } -void calcEllipticKeyPointProjections( const vector& src, const Mat_& H, vector& dst ) -{ - if( !src.empty() ) - { - assert( !H.empty() && H.cols == 3 && H.rows == 3); - dst.resize(src.size()); - vector::const_iterator srcIt = src.begin(); - vector::iterator dstIt = dst.begin(); - for( ; srcIt != src.end(); ++srcIt, ++dstIt ) - srcIt->calcProjection(H, *dstIt); - } -} - -void transformToEllipticKeyPoints( const vector& src, vector& dst ) +void EllipticKeyPoint::convert( const vector& src, vector& dst ) { if( !src.empty() ) { @@ -172,7 +162,7 @@ void transformToEllipticKeyPoints( const vector& src, vector& src, vector& dst ) +void EllipticKeyPoint::convert( const vector& src, vector& dst ) { if( !src.empty() ) { @@ -186,6 +176,19 @@ void transformToKeyPoints( const vector& src, vector } } +void calcEllipticKeyPointProjections( const vector& src, const Mat_& H, vector& dst ) +{ + if( !src.empty() ) + { + assert( !H.empty() && H.cols == 3 && H.rows == 3); + dst.resize(src.size()); + vector::const_iterator srcIt = src.begin(); + vector::iterator dstIt = dst.begin(); + for( ; srcIt != src.end(); ++srcIt, ++dstIt ) + srcIt->calcProjection(H, *dstIt); + } +} + void calcKeyPointProjections( const vector& src, const Mat_& H, vector& dst ) { if( !src.empty() ) @@ -251,7 +254,7 @@ void overlap( const vector& keypoints1, const vector &imgs, const vector< detector->detect( imgs[0], keypoints1 ); writeKeypoints( keypontsFS, keypoints1, 0); - transformToEllipticKeyPoints( keypoints1, ekeypoints1 ); + EllipticKeyPoint::convert( keypoints1, ekeypoints1 ); int progressCount = DATASETS_COUNT*TEST_CASE_COUNT; for( int ci = 0; ci < TEST_CASE_COUNT; ci++ ) { @@ -1073,7 +1076,7 @@ void DetectorQualityTest::runDatasetTest (const vector &imgs, const vector< detector->detect( imgs[ci+1], keypoints2 ); writeKeypoints( keypontsFS, keypoints2, ci+1); vector ekeypoints2; - transformToEllipticKeyPoints( keypoints2, ekeypoints2 ); + EllipticKeyPoint::convert( keypoints2, ekeypoints2 ); evaluateDetectors( ekeypoints1, ekeypoints2, imgs[0], imgs[ci], Hs[ci], calcQuality[di][ci].repeatability, calcQuality[di][ci].correspondenceCount ); } @@ -1406,7 +1409,7 @@ void DescriptorQualityTest::runDatasetTest (const vector &imgs, const vecto vector keypoints1; vector ekeypoints1; readKeypoints( keypontsFS, keypoints1, 0); - transformToEllipticKeyPoints( keypoints1, ekeypoints1 ); + EllipticKeyPoint::convert( keypoints1, ekeypoints1 ); int progressCount = DATASETS_COUNT*TEST_CASE_COUNT; vector allMatches; @@ -1426,7 +1429,7 @@ void DescriptorQualityTest::runDatasetTest (const vector &imgs, const vecto } else readKeypoints( keypontsFS, keypoints2, ci+1 ); - transformToEllipticKeyPoints( keypoints2, ekeypoints2 ); + EllipticKeyPoint::convert( keypoints2, ekeypoints2 ); descMatch->add( imgs[ci+1], keypoints2 ); vector > matches1to2; //TODO: use more sophisticated strategy to choose threshold