質問編集履歴
1
必要なコードだと判断したので追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -181,3 +181,63 @@
|
|
181
181
|
}
|
182
182
|
|
183
183
|
```
|
184
|
+
|
185
|
+
```ここに言語を入力
|
186
|
+
|
187
|
+
public void MarkDetected(bool drawSubItems = true)
|
188
|
+
|
189
|
+
{
|
190
|
+
|
191
|
+
// mark each found eye
|
192
|
+
|
193
|
+
foreach (DetectedFace face in Faces)
|
194
|
+
|
195
|
+
{
|
196
|
+
|
197
|
+
// face rect
|
198
|
+
|
199
|
+
Cv2.Rectangle((InputOutputArray)Image, face.Region, Scalar.FromRgb(255, 0, 0), 2);
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
// convex hull
|
204
|
+
|
205
|
+
//Cv2.Polylines(Image, new IEnumerable<Point>[] { face.Info.ConvexHull }, true, Scalar.FromRgb(255, 0, 0), 2);
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
// render face triangulation (should we have one)
|
210
|
+
|
211
|
+
if (face.Info != null)
|
212
|
+
|
213
|
+
{
|
214
|
+
|
215
|
+
foreach (DetectedFace.Triangle tr in face.Info.DelaunayTriangles)
|
216
|
+
|
217
|
+
Cv2.Polylines(Image, new IEnumerable<Point>[] { tr.ToArray() }, true, Scalar.FromRgb(0, 0, 255), 1);
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
// Sub-items
|
224
|
+
|
225
|
+
if (drawSubItems)
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
List<string> closedItems = new List<string>(new string[] { "Nose", "Eye", "Lip" });
|
230
|
+
|
231
|
+
foreach (DetectedObject sub in face.Elements)
|
232
|
+
|
233
|
+
if (sub.Marks != null)
|
234
|
+
|
235
|
+
Cv2.Polylines(Image, new IEnumerable<Point>[] { sub.Marks }, closedItems.Contains(sub.Name), Scalar.FromRgb(0, 255, 0), 1);
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
```
|