Skip to content

Commit

Permalink
Unity components that rely on 3D points now ignore tracking data for …
Browse files Browse the repository at this point in the history
…frames with high 3D fitting error.
  • Loading branch information
emilianavt committed Mar 30, 2020
1 parent ea735ff commit cf49ba5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Examples/OpenSeeVRMDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,11 @@ void Start() {
}

void RunUpdates() {
if (openSeeExpression != null && openSeeExpression.openSee != null)
if (openSeeExpression != null && openSeeExpression.openSee != null) {
openSeeData = openSeeExpression.openSee.GetOpenSeeData(openSeeExpression.faceId);
if (openSeeData.fit3DError > openSeeExpression.openSee.maxFit3DError)
openSeeData = null;
}
if (initializeLipSync) {
InitializeLipSync();
initializeLipSync = false;
Expand Down
3 changes: 3 additions & 0 deletions Unity/OpenSee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class OpenSee : MonoBehaviour {
public int receivedPackets = 0;
[Tooltip("This contains the actual tracking data")]
public OpenSeeData[] trackingData = null;

[HideInInspector]
public float maxFit3DError = 100f;

[System.Serializable]
public class OpenSeeData {
Expand Down
2 changes: 1 addition & 1 deletion Unity/OpenSeeIKTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Vector3 MirrorTranslation(Vector3 v) {

void RunUpdate() {
var openSeeData = openSee.GetOpenSeeData(faceId);
if (openSeeData == null)
if (openSeeData == null || openSeeData.fit3DError > openSee.maxFit3DError)
return;
if (openSeeData.time > updated) {
updated = openSeeData.time;
Expand Down
5 changes: 3 additions & 2 deletions Unity/OpenSeeLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,16 @@ private string[] EscapiListCameras_x86() {
}

public string[] ListCameras() {
if (!CheckSetup(false))
return null;
if (usePinvoke || usePinvokeListCameras) {
if (Environment.Is64BitProcess)
return EscapiListCameras_x64();
else
return EscapiListCameras_x86();
}

if (!CheckSetup(false))
return null;

StringBuilder stringBuilder;
ProcessStartInfo processStartInfo;
Process process;
Expand Down
2 changes: 1 addition & 1 deletion Unity/OpenSeeShowPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void Update () {
if (openSeeData == null || openSeeData.Length < 1)
return;*/
openSeeData = openSee.GetOpenSeeData(faceId);
if (openSeeData == null)
if (openSeeData == null || (show3DPoints && openSeeData.fit3DError > openSee.maxFit3DError))
return;
if (openSeeData.time > updated) {
updated = openSeeData.time;
Expand Down
2 changes: 1 addition & 1 deletion facetracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
parser.add_argument("--video-out", help="Set this to the filename of an AVI file to save the tracking visualization as a video", default=None)
parser.add_argument("--raw-rgb", type=int, help="When this is set, raw RGB frames of the size given with \"-W\" and \"-H\" are read from standard input instead of reading a video", default=0)
parser.add_argument("--log-data", help="You can set a filename to which tracking data will be logged here", default="")
parser.add_argument("--model", type=int, help="This can be used to select the tracking model. Higher numbers are models with better tracking quality, but slower speed. The recommended models are 3 and 1.", default=3, choices=[0, 1, 2, 3])
parser.add_argument("--model", type=int, help="This can be used to select the tracking model. Higher numbers are models with better tracking quality, but slower speed. Models 1 and 0 tend to be too rigid for expression and blink detection.", default=3, choices=[0, 1, 2, 3])
parser.add_argument("--model-dir", help="This can be used to specify the path to the directory containing the .onnx model files", default=None)
parser.add_argument("--gaze-tracking", type=int, help="When set to 1, experimental blink detection and gaze tracking are enabled, which makes things slightly slower", default=1)
parser.add_argument("--face-id-offset", type=int, help="When set, this offset is added to all face ids, which can be useful for mixing tracking data from multiple network sources", default=0)
Expand Down

0 comments on commit cf49ba5

Please sign in to comment.