@@ -384,15 +384,15 @@ void CirclesGridClusterFinder::rectifyPatternPoints(const std::vector<cv::Point2
384
384
{
385
385
// indices of corner points in pattern
386
386
std::vector<Point> trueIndices;
387
- trueIndices.push_back ( Point ( 0 , 0 ) );
388
- trueIndices.push_back ( Point ( patternSize.width - 1 , 0 ) );
387
+ trueIndices.emplace_back ( 0 , 0 );
388
+ trueIndices.emplace_back ( patternSize.width - 1 , 0 );
389
389
if (isAsymmetricGrid)
390
390
{
391
- trueIndices.push_back ( Point ( patternSize.width - 1 , 1 ) );
392
- trueIndices.push_back ( Point ( patternSize.width - 1 , patternSize.height - 2 ) );
391
+ trueIndices.emplace_back ( patternSize.width - 1 , 1 );
392
+ trueIndices.emplace_back ( patternSize.width - 1 , patternSize.height - 2 );
393
393
}
394
- trueIndices.push_back ( Point ( patternSize.width - 1 , patternSize.height - 1 ) );
395
- trueIndices.push_back ( Point ( 0 , patternSize.height - 1 ) );
394
+ trueIndices.emplace_back ( patternSize.width - 1 , patternSize.height - 1 );
395
+ trueIndices.emplace_back ( 0 , patternSize.height - 1 );
396
396
397
397
std::vector<Point2f> idealPoints;
398
398
for (size_t idx=0 ; idx<trueIndices.size (); idx++)
@@ -401,11 +401,11 @@ void CirclesGridClusterFinder::rectifyPatternPoints(const std::vector<cv::Point2
401
401
int j = trueIndices[idx].x ;
402
402
if (isAsymmetricGrid)
403
403
{
404
- idealPoints.push_back ( Point2f (( 2 *j + i % 2 )*squareSize, i*squareSize) );
404
+ idealPoints.emplace_back (( 2 *j + i % 2 )*squareSize, i*squareSize);
405
405
}
406
406
else
407
407
{
408
- idealPoints.push_back ( Point2f ( j*squareSize, i*squareSize) );
408
+ idealPoints.emplace_back ( j*squareSize, i*squareSize);
409
409
}
410
410
}
411
411
@@ -477,7 +477,7 @@ void Graph::addVertex(size_t id)
477
477
{
478
478
CV_Assert ( !doesVertexExist ( id ) );
479
479
480
- vertices.insert (std::pair< size_t , Vertex> ( id, Vertex () ));
480
+ vertices.emplace ( id, Vertex ());
481
481
}
482
482
483
483
void Graph::addEdge (size_t id1, size_t id2)
@@ -887,10 +887,9 @@ Mat CirclesGridFinder::rectifyGrid(Size detectedGridSize, const std::vector<Poin
887
887
convertPointsFromHomogeneous (dstKeypointsMat, dstKeypoints);
888
888
889
889
warpedKeypoints.clear ();
890
- for (size_t i = 0 ; i < dstKeypoints. size (); i++ )
890
+ for (auto &pt: dstKeypoints)
891
891
{
892
- Point2f pt = dstKeypoints[i];
893
- warpedKeypoints.push_back (pt);
892
+ warpedKeypoints.emplace_back (std::move (pt));
894
893
}
895
894
896
895
return H;
@@ -1526,35 +1525,35 @@ void CirclesGridFinder::getCornerSegments(const std::vector<std::vector<size_t>
1526
1525
1527
1526
// all 8 segments with one end in a corner
1528
1527
std::vector<Segment> corner;
1529
- corner.push_back ( Segment ( keypoints[points[1 ][0 ]], keypoints[points[0 ][0 ]]) );
1530
- corner.push_back ( Segment ( keypoints[points[0 ][0 ]], keypoints[points[0 ][1 ]]) );
1528
+ corner.emplace_back ( keypoints[points[1 ][0 ]], keypoints[points[0 ][0 ]]);
1529
+ corner.emplace_back ( keypoints[points[0 ][0 ]], keypoints[points[0 ][1 ]]);
1531
1530
segments.push_back (corner);
1532
- cornerIndices.push_back ( Point ( 0 , 0 ) );
1533
- firstSteps.push_back ( Point ( 1 , 0 ) );
1534
- secondSteps.push_back ( Point ( 0 , 1 ) );
1531
+ cornerIndices.emplace_back ( 0 , 0 );
1532
+ firstSteps.emplace_back ( 1 , 0 );
1533
+ secondSteps.emplace_back ( 0 , 1 );
1535
1534
corner.clear ();
1536
1535
1537
- corner.push_back ( Segment ( keypoints[points[0 ][w - 2 ]], keypoints[points[0 ][w - 1 ]]) );
1538
- corner.push_back ( Segment ( keypoints[points[0 ][w - 1 ]], keypoints[points[1 ][w - 1 ]]) );
1536
+ corner.emplace_back ( keypoints[points[0 ][w - 2 ]], keypoints[points[0 ][w - 1 ]]);
1537
+ corner.emplace_back ( keypoints[points[0 ][w - 1 ]], keypoints[points[1 ][w - 1 ]]);
1539
1538
segments.push_back (corner);
1540
- cornerIndices.push_back ( Point ( w - 1 , 0 ) );
1541
- firstSteps.push_back ( Point ( 0 , 1 ) );
1542
- secondSteps.push_back ( Point ( -1 , 0 ) );
1539
+ cornerIndices.emplace_back ( w - 1 , 0 );
1540
+ firstSteps.emplace_back ( 0 , 1 );
1541
+ secondSteps.emplace_back ( -1 , 0 );
1543
1542
corner.clear ();
1544
1543
1545
- corner.push_back ( Segment ( keypoints[points[h - 2 ][w - 1 ]], keypoints[points[h - 1 ][w - 1 ]]) );
1546
- corner.push_back ( Segment ( keypoints[points[h - 1 ][w - 1 ]], keypoints[points[h - 1 ][w - 2 ]]) );
1544
+ corner.emplace_back ( keypoints[points[h - 2 ][w - 1 ]], keypoints[points[h - 1 ][w - 1 ]]);
1545
+ corner.emplace_back ( keypoints[points[h - 1 ][w - 1 ]], keypoints[points[h - 1 ][w - 2 ]]);
1547
1546
segments.push_back (corner);
1548
- cornerIndices.push_back ( Point ( w - 1 , h - 1 ) );
1549
- firstSteps.push_back ( Point ( -1 , 0 ) );
1550
- secondSteps.push_back ( Point ( 0 , -1 ) );
1547
+ cornerIndices.emplace_back ( w - 1 , h - 1 );
1548
+ firstSteps.emplace_back ( -1 , 0 );
1549
+ secondSteps.emplace_back ( 0 , -1 );
1551
1550
corner.clear ();
1552
1551
1553
- corner.push_back ( Segment ( keypoints[points[h - 1 ][1 ]], keypoints[points[h - 1 ][0 ]]) );
1554
- corner.push_back ( Segment ( keypoints[points[h - 1 ][0 ]], keypoints[points[h - 2 ][0 ]]) );
1555
- cornerIndices.push_back ( Point ( 0 , h - 1 ) );
1556
- firstSteps.push_back ( Point ( 0 , -1 ) );
1557
- secondSteps.push_back ( Point ( 1 , 0 ) );
1552
+ corner.emplace_back ( keypoints[points[h - 1 ][1 ]], keypoints[points[h - 1 ][0 ]]);
1553
+ corner.emplace_back ( keypoints[points[h - 1 ][0 ]], keypoints[points[h - 2 ][0 ]]);
1554
+ cornerIndices.emplace_back ( 0 , h - 1 );
1555
+ firstSteps.emplace_back ( 0 , -1 );
1556
+ secondSteps.emplace_back ( 1 , 0 );
1558
1557
segments.push_back (corner);
1559
1558
corner.clear ();
1560
1559
0 commit comments