Force ROI for Facemark to be square

This seems to help with Facemark accuracy.
This commit is contained in:
Epicalert 2021-03-31 22:08:52 +08:00
parent 6429ff82cd
commit a58e7d9428
No known key found for this signature in database
GPG key ID: CAA46F858D0979BD
2 changed files with 12 additions and 3 deletions

View file

@ -4,7 +4,8 @@
- smoothing - smoothing
## docs ## docs
- model format documentation - getting started guide
- demo video?
## vision ## models
- fix worse facemark on dnn mode (maybe due to non-square roi?) - better default model

View file

@ -84,9 +84,17 @@ void cvFrame() {
biggestArea = iArea; biggestArea = iArea;
} }
//force ROI to be square
faces[i] = cv::Rect(faces[i].x + faces[i].width / 2 - faces[i].height / 2,
faces[i].y,
faces[i].height,
faces[i].height);
cv::rectangle (frame, faces[i], cv::Scalar (255, 255, 0)); cv::rectangle (frame, faces[i], cv::Scalar (255, 255, 0));
} }
//TODO: make a pointer to faces[biggestFace] and use that
std::vector<std::vector<cv::Point2f>> landmarks; std::vector<std::vector<cv::Point2f>> landmarks;
if (facemark->fit (frame, faces, landmarks)) { if (facemark->fit (frame, faces, landmarks)) {