Skip to content

Commit 2883183

Browse files
committed
v1.0.6 update OpenCVForUnity version to 2.5.0. update DlibLandmarkDetector version to 1.3.4.
1 parent 97364a1 commit 2883183

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

Assets/HoloLensWithDlibFaceLandmarkDetectorExample/HLARHeadExample/HLARHeadExample.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public class HLARHeadExample : MonoBehaviour
295295
/// <summary>
296296
/// The dlib shape predictor file name.
297297
/// </summary>
298-
string dlibShapePredictorFileName = "sp_human_face_68.dat";
298+
string dlibShapePredictorFileName = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
299299

300300
/// <summary>
301301
/// The dlib shape predictor file path.
@@ -413,14 +413,14 @@ protected void Start()
413413
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
414414
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
415415
{
416-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
416+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
417417
}
418418
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
419419

420-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_6.dat");
420+
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("DlibFaceLandmarkDetector/sp_human_face_6.dat");
421421
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
422422
{
423-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
423+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
424424
}
425425
faceLandmarkDetector4Thread = new FaceLandmarkDetector(dlibShapePredictorFilePath);
426426

@@ -587,24 +587,24 @@ public void OnWebCamTextureToMatHelperInitialized()
587587

588588
//grayMat = new Mat();
589589
cascade = new CascadeClassifier();
590-
cascade.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
590+
cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
591591
#if !WINDOWS_UWP || UNITY_EDITOR
592592
// "empty" method is not working on the UWP platform.
593593
if (cascade.empty())
594594
{
595-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/objdetect/” to “Assets/StreamingAssets/objdetect/” folder. ");
595+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
596596
}
597597
#endif
598598

599599
grayMat4Thread = new Mat();
600600
cascade4Thread = new CascadeClassifier();
601-
//cascade4Thread.load(Utils.getFilePath("objdetect/haarcascade_frontalface_alt.xml"));
602-
cascade4Thread.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
601+
//cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml"));
602+
cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
603603
#if !WINDOWS_UWP || UNITY_EDITOR
604604
// "empty" method is not working on the UWP platform.
605605
if (cascade4Thread.empty())
606606
{
607-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/objdetect/” to “Assets/StreamingAssets/objdetect/” folder. ");
607+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
608608
}
609609
#endif
610610
}
@@ -1583,7 +1583,7 @@ public void OnStopButtonClick()
15831583
/// </summary>
15841584
public void OnChangeCameraButtonClick()
15851585
{
1586-
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
1586+
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.requestedIsFrontFacing;
15871587
}
15881588

15891589
/// <summary>

Assets/HoloLensWithDlibFaceLandmarkDetectorExample/HLFaceLandmarkDetectionExample/HLFaceLandmarkDetectionExample.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public class HLFaceLandmarkDetectionExample : MonoBehaviour
124124
/// <summary>
125125
/// The dlib shape predictor file name.
126126
/// </summary>
127-
string dlibShapePredictorFileName = "sp_human_face_68.dat";
127+
string dlibShapePredictorFileName = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
128128

129129
/// <summary>
130130
/// The dlib shape predictor file path.
@@ -239,15 +239,15 @@ protected void Start()
239239
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
240240
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
241241
{
242-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
242+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
243243
}
244244
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
245245

246246

247-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_6.dat");
247+
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("DlibFaceLandmarkDetector/sp_human_face_6.dat");
248248
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
249249
{
250-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
250+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
251251
}
252252
faceLandmarkDetector4Thread = new FaceLandmarkDetector(dlibShapePredictorFilePath);
253253
}
@@ -307,24 +307,24 @@ public void OnWebCamTextureToMatHelperInitialized()
307307

308308

309309
cascade = new CascadeClassifier();
310-
cascade.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
310+
cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
311311
#if !WINDOWS_UWP || UNITY_EDITOR
312312
// "empty" method is not working on the UWP platform.
313313
if (cascade.empty())
314314
{
315-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/objdetect/” to “Assets/StreamingAssets/objdetect/” folder. ");
315+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
316316
}
317317
#endif
318318

319319
grayMat4Thread = new Mat();
320320
cascade4Thread = new CascadeClassifier();
321-
//cascade4Thread.load(Utils.getFilePath("objdetect/haarcascade_frontalface_alt.xml"));
322-
cascade4Thread.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
321+
//cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml"));
322+
cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
323323
#if !WINDOWS_UWP || UNITY_EDITOR
324324
// "empty" method is not working on the UWP platform.
325325
if (cascade4Thread.empty())
326326
{
327-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/objdetect/” to “Assets/StreamingAssets/objdetect/” folder. ");
327+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
328328
}
329329
#endif
330330
}
@@ -1131,7 +1131,7 @@ public void OnStopButtonClick()
11311131
/// </summary>
11321132
public void OnChangeCameraButtonClick()
11331133
{
1134-
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
1134+
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.requestedIsFrontFacing;
11351135
}
11361136

11371137
/// <summary>

Assets/HoloLensWithDlibFaceLandmarkDetectorExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class HLPhotoCaptureExample : MonoBehaviour
3838
private uint numPhotos = 0;
3939

4040
private FaceLandmarkDetector faceLandmarkDetector;
41-
private string dlibShapePredictorFileName = "sp_human_face_68.dat";
41+
private string dlibShapePredictorFileName = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
4242
private string dlibShapePredictorFilePath;
4343

4444
private IEnumerator Start()
@@ -48,7 +48,7 @@ private IEnumerator Start()
4848
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
4949
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
5050
{
51-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
51+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
5252
}
5353
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
5454

Assets/HoloLensWithDlibFaceLandmarkDetectorExample/HoloLensWithDlibFaceLandmarkDetectorExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static string dlibShapePredictorFileName
3535
{
3636
get
3737
{
38-
return dlibShapePredictorName.ToString() + ".dat";
38+
return "DlibFaceLandmarkDetector/" + dlibShapePredictorName.ToString() + ".dat";
3939
}
4040
}
4141

ProjectAssets.jpg

7.29 KB
Loading

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* Visual Studio 2019
1616
* Unity 2019.4.31f1 / 2020.3.38f1
1717
* [Microsoft Mixed Reality Toolkit](https://github.com/Microsoft/MixedRealityToolkit-Unity/releases) v2.8.2
18-
* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.4.9+
19-
* [Dlib FaceLandmarkDetector](https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314?aid=1011l4ehR) 1.3.3+
18+
* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.5.0+
19+
* [Dlib FaceLandmarkDetector](https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314?aid=1011l4ehR) 1.3.4+
2020
* [EnoxSoftware/HoloLensCameraStream](https://github.com/EnoxSoftware/HoloLensCameraStream)
2121

2222

@@ -25,11 +25,13 @@
2525
1. Create a new project. (`HoloLensWithDlibFaceLandmarkDetectorExample`)
2626
* Change the platform to `UWP` in the "Build Settings" window.
2727
1. Import the OpenCVForUnity.
28-
* Setup the OpenCVForUnity. (Tools > OpenCV for Unity > Set Plugin Import Settings)
29-
* Move the "OpenCVForUnity/StreamingAssets/objdetect/haarcascade_frontalface_alt.xml" and "OpenCVForUnity/StreamingAssets/objdetect/lbpcascade_frontalface.xml" to the "Assets/StreamingAssets/objdetect/" folder.
28+
* Select MenuItem[Tools/OpenCV for Unity/Open Setup Tools].
29+
* Click the [Move StreamingAssets Folder] button.
30+
* Leave the following files and delete the rest. ("StreamingAssets/OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", "lbpcascade_ frontalface.xml")
3031
1. Import the DlibFaceLandmarkDetector.
31-
* Setup the OpenCVForUnity. (Tools > Dlib FaceLandmarkDetector > Set Plugin Import Settings)
32-
* Move the "DlibFaceLandmarkDetector/StreamingAssets/sp_human_face_68.dat", "sp_human_face_68_for_mobile.dat", "sp_human_face_17.dat", "sp_human_face_17_for_mobile.dat" and "sp_human_face_6.dat" to the "Assets/StreamingAssets/" folder.
32+
* Select MenuItem[Tools/Dlib FaceLandmark Detector/Open Setup Tools].
33+
* Click the [Move StreamingAssets Folder] button.
34+
* Leave the following files and delete the rest. ("StreamingAssets/DlibFaceLandmarkDetector/sp_human_face_68.dat", "sp_human_face_68_for_mobile.dat", "sp_human_face_17.dat", "sp_human_face_17_for_mobile.dat" and "sp_human_face_6.dat")
3335
1. Clone HoloLensCameraStream repository.
3436
* Copy the "HoloLensCameraStream/HoloLensVideoCaptureExample/Assets/CamStream/" folder to the "Assets/" folder.
3537
1. Import the Microsoft Mixed Reality Toolkit. (Recommend using [MixedRealityFeatureTool](https://www.microsoft.com/en-us/download/details.aspx?id=102778))

0 commit comments

Comments
 (0)