Skip to content

Commit ff66ab2

Browse files
committed
Fixed problems with the UWP platform. ("empty" method)
1 parent 23747fa commit ff66ab2

3 files changed

Lines changed: 33 additions & 18 deletions

File tree

Assets/HoloLensWithOpenCVForUnityExample/Scripts/HoloLensAnonymousFaceExample.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,12 @@ public void OnWebCamTextureToMatHelperInited ()
176176
grayMat = new Mat (webCamTextureMat.rows (), webCamTextureMat.cols (), CvType.CV_8UC1);
177177
regionCascade = new CascadeClassifier ();
178178
regionCascade.load (Utils.getFilePath ("lbpcascade_frontalface.xml"));
179-
if (regionCascade.empty ()) {
180-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
181-
}
179+
180+
// "empty" method is not working on the UWP platform.
181+
// if (regionCascade.empty ()) {
182+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
183+
// }
184+
182185
initThread ();
183186
#endif
184187
}
@@ -376,9 +379,11 @@ private void initThread ()
376379

377380
cascade = new CascadeClassifier ();
378381
cascade.load(Utils.getFilePath ("haarcascade_frontalface_alt.xml"));
379-
if (cascade.empty ()) {
380-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
381-
}
382+
383+
// "empty" method is not working on the UWP platform.
384+
// if (cascade.empty ()) {
385+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
386+
// }
382387

383388
threadComm.shouldDetectInMultiThread = false;
384389

Assets/HoloLensWithOpenCVForUnityExample/Scripts/HoloLensWebCamTextureAsyncDetectFaceExample.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,12 @@ public void OnWebCamTextureToMatHelperInited ()
193193
grayMat = new Mat (webCamTextureMat.rows (), webCamTextureMat.cols (), CvType.CV_8UC1);
194194
regionCascade = new CascadeClassifier ();
195195
regionCascade.load (Utils.getFilePath ("lbpcascade_frontalface.xml"));
196-
if (regionCascade.empty ()) {
197-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
198-
}
196+
197+
// "empty" method is not working on the UWP platform.
198+
// if (regionCascade.empty ()) {
199+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
200+
// }
201+
199202
initThread ();
200203
#endif
201204
}
@@ -379,9 +382,11 @@ private void initThread ()
379382

380383
cascade = new CascadeClassifier ();
381384
cascade.load(Utils.getFilePath ("haarcascade_frontalface_alt.xml"));
382-
if (cascade.empty ()) {
383-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
384-
}
385+
386+
// "empty" method is not working on the UWP platform.
387+
// if (cascade.empty ()) {
388+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
389+
// }
385390

386391
threadComm.shouldDetectInMultiThread = false;
387392

Assets/HoloLensWithOpenCVForUnityExample/Scripts/HoloLensWebCamTextureAsyncDetectFaceOverlayExample.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,12 @@ public void OnWebCamTextureToMatHelperInited ()
197197
grayMat = new Mat (webCamTextureMat.rows (), webCamTextureMat.cols (), CvType.CV_8UC1);
198198
regionCascade = new CascadeClassifier ();
199199
regionCascade.load (Utils.getFilePath ("lbpcascade_frontalface.xml"));
200-
if (regionCascade.empty ()) {
201-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
202-
}
200+
201+
// "empty" method is not working on the UWP platform.
202+
// if (regionCascade.empty ()) {
203+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
204+
// }
205+
203206
initThread ();
204207
#endif
205208
}
@@ -425,9 +428,11 @@ private void initThread ()
425428

426429
cascade = new CascadeClassifier ();
427430
cascade.load(Utils.getFilePath ("haarcascade_frontalface_alt.xml"));
428-
if (cascade.empty ()) {
429-
Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
430-
}
431+
432+
// "empty" method is not working on the UWP platform.
433+
// if (cascade.empty ()) {
434+
// Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
435+
// }
431436

432437
threadComm.shouldDetectInMultiThread = false;
433438

0 commit comments

Comments
 (0)