Skip to content

Commit 3dac8f5

Browse files
author
surface
committed
v1.0.1 update OpenCVForUnity version to 2.5.0. update DlibLandmarkDetector version to 1.3.4.
1 parent 4baef07 commit 3dac8f5

File tree

6 files changed

+29
-27
lines changed

6 files changed

+29
-27
lines changed

Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/NrealARHeadExample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public class NrealARHeadExample : MonoBehaviour
292292
/// <summary>
293293
/// The dlib shape predictor file name.
294294
/// </summary>
295-
string dlibShapePredictorFileName = "sp_human_face_68.dat";
295+
string dlibShapePredictorFileName = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
296296

297297
/// <summary>
298298
/// The dlib shape predictor file path.
@@ -389,14 +389,14 @@ protected void Start()
389389
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
390390
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
391391
{
392-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
392+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
393393
}
394394
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
395395

396-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_6.dat");
396+
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("DlibFaceLandmarkDetector/sp_human_face_6.dat");
397397
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
398398
{
399-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
399+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
400400
}
401401
faceLandmarkDetector4Thread = new FaceLandmarkDetector(dlibShapePredictorFilePath);
402402

@@ -562,23 +562,23 @@ public void OnWebCamTextureToMatHelperInitialized()
562562

563563
//grayMat = new Mat();
564564
cascade = new CascadeClassifier();
565-
cascade.load(Utils.getFilePath("lbpcascade_frontalface.xml"));
565+
cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
566566
#if !UNITY_WSA_10_0 || UNITY_EDITOR
567567
// "empty" method is not working on the UWP platform.
568568
if (cascade.empty())
569569
{
570-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
570+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
571571
}
572572
#endif
573573

574574
grayMat4Thread = new Mat();
575575
cascade4Thread = new CascadeClassifier();
576-
cascade4Thread.load(Utils.getFilePath("haarcascade_frontalface_alt.xml"));
576+
cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml"));
577577
#if !UNITY_WSA_10_0 || UNITY_EDITOR
578578
// "empty" method is not working on the UWP platform.
579579
if (cascade4Thread.empty())
580580
{
581-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
581+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
582582
}
583583
#endif
584584
}

Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealFaceLandmarkDetectionExample/NrealFaceLandmarkDetectionExample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public class NrealFaceLandmarkDetectionExample : 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.
@@ -218,15 +218,15 @@ protected void Start()
218218
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
219219
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
220220
{
221-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
221+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
222222
}
223223
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
224224

225225

226-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_6.dat");
226+
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("DlibFaceLandmarkDetector/sp_human_face_6.dat");
227227
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
228228
{
229-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
229+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
230230
}
231231
faceLandmarkDetector4Thread = new FaceLandmarkDetector(dlibShapePredictorFilePath);
232232
}
@@ -259,23 +259,23 @@ public void OnWebCamTextureToMatHelperInitialized()
259259

260260

261261
cascade = new CascadeClassifier();
262-
cascade.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
262+
cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml"));
263263
#if !UNITY_WSA_10_0 || UNITY_EDITOR
264264
// "empty" method is not working on the UWP platform.
265265
if (cascade.empty())
266266
{
267-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
267+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
268268
}
269269
#endif
270270

271271
grayMat4Thread = new Mat();
272272
cascade4Thread = new CascadeClassifier();
273-
cascade4Thread.load(Utils.getFilePath("objdetect/haarcascade_frontalface_alt.xml"));
273+
cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml"));
274274
#if !UNITY_WSA_10_0 || UNITY_EDITOR
275275
// "empty" method is not working on the UWP platform.
276276
if (cascade4Thread.empty())
277277
{
278-
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
278+
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. ");
279279
}
280280
#endif
281281
}

Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealLightWithDlibFaceLandmarkDetectorExample.cs

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

Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealPhotoCaptureExample/NrealPhotoCaptureExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class NrealPhotoCaptureExample : MonoBehaviour
7171
/// <summary>
7272
/// The dlib shape predictor file name.
7373
/// </summary>
74-
string dlibShapePredictorFileName;// = "sp_human_face_68.dat";
74+
string dlibShapePredictorFileName;// = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
7575

7676
/// <summary>
7777
/// The dlib shape predictor file path.
@@ -202,7 +202,7 @@ void OnCapturedPhotoToMemory(NRPhotoCapture.PhotoCaptureResult result, PhotoCapt
202202
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
203203
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
204204
{
205-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
205+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
206206
}
207207
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
208208
}

ProjectAssets.jpg

34 KB
Loading

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@
1313
* Android (Galaxy S10+ SC-04L)
1414
* Nreal Light
1515
* Unity 2020.3.38f1+ (NRSDK supports the development environment of Unity 2018.4.X and above.)
16-
* [NRSDK](https://developer.nreal.ai/download) Unity SDK 1.9.5
17-
* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.4.8+
18-
* [Dlib FaceLandmarkDetector](https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314?aid=1011l4ehR) 1.3.3+
16+
* [NRSDK](https://developer.nreal.ai/download) Unity SDK 1.10.0
17+
* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.5.0+
18+
* [Dlib FaceLandmarkDetector](https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314?aid=1011l4ehR) 1.3.4+
1919

2020

2121
## Setup
2222
1. Download the latest release unitypackage. [NrealLightWithDlibFaceLandmarkDetectorExample.unitypackage](https://github.com/EnoxSoftware/NrealLightWithDlibFaceLandmarkDetectorExample/releases)
2323
1. Create a new project. (NrealLightWithDlibFaceLandmarkDetectorExample)
2424
* Change the platform to Android in the "Build Settings" window.
2525
1. Import the OpenCVForUnity.
26-
* Setup the OpenCVForUnity. (Tools > OpenCV for Unity > Set Plugin Import Settings)
27-
* Move the "OpenCVForUnity/StreamingAssets/objdetect" folder to the "Assets/StreamingAssets/" folder.
26+
* Select MenuItem[Tools/OpenCV for Unity/Open Setup Tools].
27+
* Click the [Move StreamingAssets Folder] button.
28+
* Leave the following files and delete the rest. ("StreamingAssets/OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", "lbpcascade_ frontalface.xml")
2829
1. Import the DlibFaceLandmarkDetector.
29-
* Setup the DlibFaceLandmarkDetector. (Tools > Dlib FaceLandmarkDetector > Set Plugin Import Settings)
30-
* 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" files to the "Assets/StreamingAssets/" folder.
30+
* Select MenuItem[Tools/Dlib FaceLandmark Detector/Open Setup Tools].
31+
* Click the [Move StreamingAssets Folder] button.
32+
* 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")
3133
1. Import the NRSDK.
32-
* Download the latest release NRSDK unitypackage. [NRSDKForUnity_Release_1.9.x.unitypackage](https://developer.nreal.ai/download)
34+
* Download the latest release NRSDK unitypackage. [NRSDKForUnity_Release_1.xx.x.unitypackage](https://developer.nreal.ai/download)
3335
* Setup the NRSDK. (See [Getting Started with NRSDK](https://nreal.gitbook.io/nrsdk/nrsdk-fundamentals/quickstart-for-android))
3436
1. Import the NrealLightWithDlibFaceLandmarkDetectorExample.unitypackage.
3537
1. Add the "Assets/NrealLightWithDlibFaceLandmarkDetectorExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.

0 commit comments

Comments
 (0)