MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / polygonMask

Function polygonMask

jni/venus/region_operation.cpp:746–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

744}
745
746static 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
766RoiInfo calcuateFaceRegionInfo(const std::vector<cv::Point2f>& points)
767{

Callers 2

calcuateEyeRegionInfo_rFunction · 0.85
calcuateEyeRegionInfo_lFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected