* Extract face ROI info from color image */
| 11 | * Extract face ROI info from color image |
| 12 | */ |
| 13 | class Extractor |
| 14 | { |
| 15 | public: |
| 16 | static const std::vector<cv::Vec3i> triangle_indices; |
| 17 | |
| 18 | private: |
| 19 | const cv::Mat image; |
| 20 | const std::vector<cv::Point2f>& points; |
| 21 | |
| 22 | |
| 23 | |
| 24 | public: |
| 25 | Extractor(const cv::Mat& image, const std::vector<cv::Point2f>& points); |
| 26 | // void setFeaturePoints(const std::vector<cv::Point>& points); |
| 27 | std::vector<cv::Point> getPolygon(int region); |
| 28 | |
| 29 | /** |
| 30 | * Generally speaking, the result is a vertical line. For skew faces, it's not coarsely calculated by two eyes, |
| 31 | * but use <a href="https://en.wikipedia.org/wiki/Least_squares">least squares</a> method for more accurate result. |
| 32 | * |
| 33 | * @param points the feature points detected from an image. |
| 34 | * @return Vec4f(vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and |
| 35 | * (x0, y0) is a point on the line, or to be more exact, center of the detected face. |
| 36 | */ |
| 37 | static cv::Vec4f getSymmetryAxis(const std::vector<cv::Point2f>& points); |
| 38 | cv::Vec4f getSymmetryAxis() const { return getSymmetryAxis(points); } |
| 39 | |
| 40 | cv::Mat maskHair() const; |
| 41 | protected: |
| 42 | void assignRegion(); |
| 43 | |
| 44 | std::vector<cv::Point> m_facePolygon; |
| 45 | std::vector<cv::Point> m_leftEyePolygon; |
| 46 | std::vector<cv::Point> m_rightEyePolygon; |
| 47 | std::vector<cv::Point> m_upperLipPolygon; |
| 48 | std::vector<cv::Point> m_lowerLipPolygon; |
| 49 | std::vector<cv::Point> m_mouthPolygon; |
| 50 | |
| 51 | std::vector<cv::Point> m_nosePolygon; |
| 52 | std::vector<cv::Point> m_leftEyeBrowPolygon; |
| 53 | std::vector<cv::Point> m_rightEyeBrowPolygon; |
| 54 | std::vector<cv::Point> m_leftBlusherPolygon; |
| 55 | std::vector<cv::Point> m_rightBlusherPolygon; |
| 56 | |
| 57 | cv::Point m_leftNoseHole; |
| 58 | cv::Point m_rightNoseHole; |
| 59 | |
| 60 | }; |
| 61 | |
| 62 | } /* namespace venus */ |
| 63 | #endif /* VENUS_EXTRACTOR_H_ */ |
nothing calls this directly
no outgoing calls
no test coverage detected