| 744 | } |
| 745 | |
| 746 | static Mat polygonMask(const Rect& rect, const std::vector<Point2f>& points, const int indices[], int length) |
| 747 | { |
| 748 | assert(indices != nullptr && length >= 3); |
| 749 | std::vector<Point> contour; |
| 750 | contour.reserve(length); |
| 751 | for(int j = 0; j < length; ++j) |
| 752 | { |
| 753 | const int& i = indices[j]; |
| 754 | float x = points[i].x - rect.x; // make it relative |
| 755 | float y = points[i].y - rect.y; |
| 756 | contour.push_back(Point(cvRound(x), cvRound(y))); |
| 757 | } |
| 758 | |
| 759 | const Point* polygons[1] = { contour.data() }; |
| 760 | const int num_points[] = { length }; |
| 761 | Mat mask(rect.size(), CV_8UC1, BACKGROUD_COLOR); |
| 762 | cv::fillPoly(mask, polygons, num_points, 1, FOREGROUD_COLOR); |
| 763 | return mask; |
| 764 | } |
| 765 | |
| 766 | RoiInfo calcuateFaceRegionInfo(const std::vector<cv::Point2f>& points) |
| 767 | { |
no outgoing calls
no test coverage detected