Skip to content

Commit a02fa06

Browse files
committed
Updated WebCamTextureToMatHelper.cs.
1 parent ff66ab2 commit a02fa06

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/OptimizationWebCamTextureToMatHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ public class OptimizationWebCamTextureToMatHelper : WebCamTextureToMatHelper
1414
/// The DOWNSAMPL e_ RATI.
1515
/// </summary>
1616
public float DOWNSCALE_RATIO = 2;
17-
17+
1818
/// <summary>
1919
/// The SKI p_ FRAME.
2020
/// </summary>
2121
public int SKIP_FRAMES = 2;
22-
22+
2323
/// <summary>
2424
/// The frame count.
2525
/// </summary>
2626
int frameCount;
27-
27+
2828
/// <summary>
2929
/// The rgba mat_downscale.
3030
/// </summary>

Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/WebCamTextureToMatHelper.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public enum ErrorCode :int
111111
[System.Serializable]
112112
public class ErrorUnityEvent : UnityEngine.Events.UnityEvent<ErrorCode>
113113
{
114-
114+
115115
}
116116

117117
// Update is called once per frame
@@ -229,20 +229,20 @@ private IEnumerator init ()
229229
else if (webCamTexture.width > 16 && webCamTexture.height > 16) {
230230
#else
231231
else if (webCamTexture.didUpdateThisFrame) {
232-
#if UNITY_IOS && !UNITY_EDITOR && UNITY_5_2
233-
while (webCamTexture.width <= 16) {
234-
if (initCount > timeoutFrameCount) {
235-
isTimeout = true;
236-
break;
237-
}else {
238-
initCount++;
239-
}
240-
webCamTexture.GetPixels32 ();
241-
yield return new WaitForEndOfFrame ();
242-
}
243-
if (isTimeout) break;
244-
#endif
245-
#endif
232+
#if UNITY_IOS && !UNITY_EDITOR && UNITY_5_2
233+
while (webCamTexture.width <= 16) {
234+
if (initCount > timeoutFrameCount) {
235+
isTimeout = true;
236+
break;
237+
}else {
238+
initCount++;
239+
}
240+
webCamTexture.GetPixels32 ();
241+
yield return new WaitForEndOfFrame ();
242+
}
243+
if (isTimeout) break;
244+
#endif
245+
#endif
246246

247247
Debug.Log ("name " + webCamTexture.name + " width " + webCamTexture.width + " height " + webCamTexture.height + " fps " + webCamTexture.requestedFPS);
248248
Debug.Log ("videoRotationAngle " + webCamTexture.videoRotationAngle + " videoVerticallyMirrored " + webCamTexture.videoVerticallyMirrored + " isFrongFacing " + webCamDevice.isFrontFacing);
@@ -256,7 +256,7 @@ private IEnumerator init ()
256256

257257
#if !UNITY_EDITOR && !(UNITY_STANDALONE || UNITY_WEBGL)
258258
if (screenOrientation == ScreenOrientation.Portrait || screenOrientation == ScreenOrientation.PortraitUpsideDown) {
259-
rotatedRgbaMat = new Mat (webCamTexture.width, webCamTexture.height, CvType.CV_8UC4);
259+
rotatedRgbaMat = new Mat (webCamTexture.width, webCamTexture.height, CvType.CV_8UC4);
260260
}
261261
#endif
262262

@@ -360,9 +360,9 @@ public bool DidUpdateThisFrame ()
360360

361361
#if UNITY_IOS && !UNITY_EDITOR && (UNITY_4_6_3 || UNITY_4_6_4 || UNITY_5_0_0 || UNITY_5_0_1)
362362
if (webCamTexture.width > 16 && webCamTexture.height > 16) {
363-
return true;
363+
return true;
364364
} else {
365-
return false;
365+
return false;
366366
}
367367
#else
368368
return webCamTexture.didUpdateThisFrame;
@@ -409,7 +409,7 @@ public Mat GetMat ()
409409
private void flipMat (Mat mat)
410410
{
411411
int flipCode = int.MinValue;
412-
412+
413413
if (webCamDevice.isFrontFacing) {
414414
if (webCamTexture.videoRotationAngle == 0) {
415415
flipCode = 1;
@@ -428,7 +428,7 @@ private void flipMat (Mat mat)
428428
flipCode = -1;
429429
}
430430
}
431-
431+
432432
if (flipVertical) {
433433
if (flipCode == int.MinValue) {
434434
flipCode = 0;
@@ -440,7 +440,7 @@ private void flipMat (Mat mat)
440440
flipCode = 1;
441441
}
442442
}
443-
443+
444444
if (flipHorizontal) {
445445
if (flipCode == int.MinValue) {
446446
flipCode = 1;
@@ -452,7 +452,7 @@ private void flipMat (Mat mat)
452452
flipCode = 0;
453453
}
454454
}
455-
455+
456456
if (flipCode > int.MinValue) {
457457
Core.flip (mat, mat, flipCode);
458458
}

0 commit comments

Comments
 (0)