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

Function ImgDetParToRoiFrame

jni/stasm/faceroi.cpp:69–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static DetectorParameter ImgDetParToRoiFrame(
70 const DetectorParameter& detpar, // in
71 const Rect& rect_roi) // in
72{
73 DetectorParameter detpar_roi(detpar);
74 detpar_roi.x -= rect_roi.x;
75 detpar_roi.y -= rect_roi.y;
76 Shape eyemouth_shape(5, 2, 0.);
77 if (Valid(detpar_roi.lex))
78 {
79 eyemouth_shape(0, IX) -= rect_roi.x;
80 eyemouth_shape(0, IY) -= rect_roi.y;
81 }
82 if (Valid(detpar_roi.rex))
83 {
84 eyemouth_shape(1, IX) -= rect_roi.x;
85 eyemouth_shape(1, IY) -= rect_roi.y;
86 }
87 if (Valid(detpar_roi.mouthx))
88 {
89 eyemouth_shape(2, IX) -= rect_roi.x;
90 eyemouth_shape(2, IY) -= rect_roi.y;
91 }
92 if (Valid(detpar.rot) && detpar.rot)
93 {
94 // rotate eyes and mouth
95 const MAT rotmat = getRotationMatrix2D(cv::Point2f(float(detpar_roi.x),
96 float(detpar_roi.y)),
97 -detpar.rot, 1.);
98 TransformShapeInPlace(eyemouth_shape, rotmat);
99 }
100 if (Valid(detpar.lex))
101 {
102 detpar_roi.lex = eyemouth_shape(0, IX);
103 detpar_roi.ley = eyemouth_shape(0, IY);
104 }
105 if (Valid(detpar.rex))
106 {
107 detpar_roi.rex = eyemouth_shape(1, IX);
108 detpar_roi.rey = eyemouth_shape(1, IY);
109 }
110 if (Valid(detpar.mouthx))
111 {
112 detpar_roi.mouthx = eyemouth_shape(2, IX);
113 detpar_roi.mouthy = eyemouth_shape(2, IY);
114 }
115 return detpar_roi;
116}
117
118Shape ImgShapeToRoiFrame( // return shape in ROI frame
119 const Shape& shape, // in: shape in image frame

Callers 1

Calls 2

ValidFunction · 0.85
TransformShapeInPlaceFunction · 0.85

Tested by

no test coverage detected