Skip to content

Commit 987600e

Browse files
author
satoo air
committed
Initial Version
0 parents  commit 987600e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3887
-0
lines changed

Materials.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Materials/quad_material.mat

4.13 KB
Binary file not shown.

Materials/quad_material.mat.meta

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenCVFaceSwapper.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenCVFaceSwapper/Scripts.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
3+
namespace OpenCVForUnity.FaceSwap
4+
{
5+
public class DlibFaceSwapper : FaceSwapper
6+
{
7+
// Finds facial landmarks on faces and extracts the useful points
8+
protected override void getFacePoints(Point[] landmark_points, Point[] points, Point[] affine_transform_keypoints)
9+
{
10+
if (landmark_points.Length != 68)
11+
throw new ArgumentNullException("Invalid landmark_points.");
12+
13+
//points(facial contour)
14+
points[0] = landmark_points[0];
15+
points[1] = landmark_points[3];
16+
points[2] = landmark_points[5];
17+
points[3] = landmark_points[8];
18+
points[4] = landmark_points[11];
19+
points[5] = landmark_points[13];
20+
points[6] = landmark_points[16];
21+
Point nose_length = new Point(landmark_points[27].x - landmark_points[30].x, landmark_points[27].y - landmark_points[30].y);
22+
points[7] = new Point(landmark_points[26].x + nose_length.x, landmark_points[26].y + nose_length.y);
23+
points[8] = new Point(landmark_points[17].x + nose_length.x, landmark_points[17].y + nose_length.y);
24+
25+
//affine_transform_keypoints(eyes and chin)
26+
affine_transform_keypoints[0] = points[3];
27+
affine_transform_keypoints[1] = landmark_points[36];
28+
affine_transform_keypoints[2] = landmark_points[45];
29+
}
30+
}
31+
}

OpenCVFaceSwapper/Scripts/DlibFaceSwapper.cs.meta

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)