@@ -459,7 +459,7 @@ void drawLines(Mat image, Mat landmarks, Mat keeplandmarks, bool isDrawPoint = t
459
459
if (isDrawPoint)
460
460
for (int idxRow = 0 ; idxRow < landmarks.rows ; idxRow++)
461
461
if (keeplandmarks.at <uchar>(idxRow))
462
- circle (image, Point (landmarks.row (idxRow)), thickness, (0 , 0 , 255 ), -1 );
462
+ circle (image, Point (landmarks.row (idxRow)), thickness, Scalar (0 , 0 , 255 ), -1 );
463
463
}
464
464
465
465
@@ -514,49 +514,48 @@ pair<Mat, Mat> visualize(Mat image, vector<tuple<Mat, Mat, Mat, Mat, Mat, float>
514
514
for (int idxRow = 0 ; idxRow < landmarksScreen.rows ; idxRow++)
515
515
{
516
516
Mat landmark;// p in enumerate(landmarks_screen[:, 0 : 3].astype(np.int32))
517
- landmarksScreen.colRange ( 0 , 3 ).convertTo (landmark, CV_32S);
517
+ landmarksScreen.row (idxRow ).convertTo (landmark, CV_32S);
518
518
if (keepLandmarks.at <uchar>(idxRow))
519
519
circle (displayScreen, Point (landmark.at <int >(0 ), landmark.at <int >(1 )), 2 , Scalar (0 , 0 , 255 ), -1 );
520
+ }
520
521
522
+ if (!isDraw)
523
+ {
524
+ isDraw = true ;
525
+ // Main view
526
+ Mat landmarksXY = landmarksWord.colRange (0 , 2 ).clone ();
527
+ Mat x = landmarksXY * 100 + 100 ;
528
+ x.convertTo (landmarksXY, CV_32S);
529
+ drawLines (display3d, landmarksXY, keepLandmarks, 2 );
521
530
522
- if (!isDraw)
523
- {
524
- isDraw = true ;
525
- // Main view
526
- Mat landmarksXY = landmarksWord.colRange (0 , 2 ).clone ();
527
- Mat x = landmarksXY * 100 + 100 ;
528
- x.convertTo (landmarksXY, CV_32S);
529
- drawLines (display3d, landmarksXY, keepLandmarks, 2 );
530
-
531
- // Top view
532
- Mat landmarksXZ;
533
- hconcat (landmarksWord.col (0 ), landmarksWord.col (2 ), landmarksXZ);
534
- landmarksXZ.col (1 ) = -landmarksXZ.col (1 );
535
- x = landmarksXZ * 100 ;
536
- x.col (0 ) += 300 ;
537
- x.col (1 ) += 100 ;
538
- x.convertTo (landmarksXZ, CV_32S);
539
- drawLines (display3d, landmarksXZ, keepLandmarks, 2 );
531
+ // Top view
532
+ Mat landmarksXZ;
533
+ hconcat (landmarksWord.col (0 ), landmarksWord.col (2 ), landmarksXZ);
534
+ landmarksXZ.col (1 ) = -landmarksXZ.col (1 );
535
+ x = landmarksXZ * 100 ;
536
+ x.col (0 ) += 300 ;
537
+ x.col (1 ) += 100 ;
538
+ x.convertTo (landmarksXZ, CV_32S);
539
+ drawLines (display3d, landmarksXZ, keepLandmarks, 2 );
540
540
541
- // Left view
542
- Mat landmarksYZ;
543
- hconcat (landmarksWord.col (2 ), landmarksWord.col (1 ), landmarksYZ);
544
- landmarksYZ.col (0 ) = -landmarksYZ.col (0 );
545
- x = landmarksYZ * 100 ;
546
- x.col (0 ) += 100 ;
547
- x.col (1 ) += 300 ;
548
- x.convertTo (landmarksYZ, CV_32S);
549
- drawLines (display3d, landmarksYZ, keepLandmarks, 2 );
541
+ // Left view
542
+ Mat landmarksYZ;
543
+ hconcat (landmarksWord.col (2 ), landmarksWord.col (1 ), landmarksYZ);
544
+ landmarksYZ.col (0 ) = -landmarksYZ.col (0 );
545
+ x = landmarksYZ * 100 ;
546
+ x.col (0 ) += 100 ;
547
+ x.col (1 ) += 300 ;
548
+ x.convertTo (landmarksYZ, CV_32S);
549
+ drawLines (display3d, landmarksYZ, keepLandmarks, 2 );
550
550
551
- // Right view
552
- Mat landmarksZY;
553
- hconcat (landmarksWord.col (2 ), landmarksWord.col (1 ), landmarksZY);
554
- x = landmarksZY * 100 ;
555
- x.col (0 ) += 300 ;
556
- x.col (1 ) += 300 ;
557
- x.convertTo (landmarksZY, CV_32S);
558
- drawLines (display3d, landmarksZY, keepLandmarks, 2 );
559
- }
551
+ // Right view
552
+ Mat landmarksZY;
553
+ hconcat (landmarksWord.col (2 ), landmarksWord.col (1 ), landmarksZY);
554
+ x = landmarksZY * 100 ;
555
+ x.col (0 ) += 300 ;
556
+ x.col (1 ) += 300 ;
557
+ x.convertTo (landmarksZY, CV_32S);
558
+ drawLines (display3d, landmarksZY, keepLandmarks, 2 );
560
559
}
561
560
}
562
561
return pair<Mat, Mat>(displayScreen, display3d);
0 commit comments