@@ -236,8 +236,8 @@ class MPPose {
236
236
// pad to square
237
237
int top = personBox.at <int >(1 , 0 ) - fullBox.at <float >(1 , 0 );
238
238
int left = personBox.at <int >(0 , 0 ) - fullBox.at <float >(0 , 0 );
239
- int right = fullBox.at <float >(1 , 1 ) - personBox.at <int >(1 , 1 );
240
- int bottom = fullBox.at <float >(0 , 1 ) - personBox.at <int >(0 , 1 );
239
+ int bottom = fullBox.at <float >(1 , 1 ) - personBox.at <int >(1 , 1 );
240
+ int right = fullBox.at <float >(0 , 1 ) - personBox.at <int >(0 , 1 );
241
241
copyMakeBorder (image, image, top, bottom, left, right, BORDER_CONSTANT, Scalar (0 , 0 , 0 ));
242
242
padBias = Point (padBias) + Point (personBox.col (0 )) - Point (left, top);
243
243
// compute rotation
@@ -315,16 +315,17 @@ class MPPose {
315
315
scaleFactor.col (1 ) /= this ->inputSize .height ;
316
316
landmarks.col (0 ) = (landmarks.col (0 ) - this ->inputSize .width / 2 ) * scaleFactor.at <float >(0 );
317
317
landmarks.col (1 ) = (landmarks.col (1 ) - this ->inputSize .height / 2 ) * scaleFactor.at <float >(1 );
318
+ landmarks.col (2 ) = landmarks.col (2 ) * max (scaleFactor.at <float >(1 ), scaleFactor.at <float >(0 ));
318
319
Mat coordsRotationMatrix;
319
320
getRotationMatrix2D (Point (0 , 0 ), angle, 1.0 ).convertTo (coordsRotationMatrix, CV_32F);
320
321
Mat rotatedLandmarks = landmarks.colRange (0 , 2 ) * coordsRotationMatrix.colRange (0 , 2 );
321
322
hconcat (rotatedLandmarks, landmarks.colRange (2 , landmarks.cols ), rotatedLandmarks);
322
323
Mat rotatedLandmarksWorld = landmarksWorld.colRange (0 , 2 ) * coordsRotationMatrix.colRange (0 , 2 );
323
324
hconcat (rotatedLandmarksWorld, landmarksWorld.col (2 ), rotatedLandmarksWorld);
324
325
// invert rotation
325
- Mat rotationComponent = rotationMatrix ( Rect ( 0 , 0 , 2 , 2 )). clone ( );
326
+ Mat rotationComponent = (Mat_< double >( 2 , 2 ) <<rotationMatrix. at < double >( 0 , 0 ), rotationMatrix. at < double >( 1 , 0 ), rotationMatrix. at < double >( 0 , 1 ), rotationMatrix. at < double >( 1 , 1 ) );
326
327
Mat translationComponent = rotationMatrix (Rect (2 , 0 , 1 , 2 )).clone ();
327
- Mat invertedTranslation = rotationComponent * translationComponent;
328
+ Mat invertedTranslation = - rotationComponent * translationComponent;
328
329
Mat inverseRotationMatrix;
329
330
hconcat (rotationComponent, invertedTranslation, inverseRotationMatrix);
330
331
Mat center, rc;
0 commit comments