Skip to content

Commit cde56f4

Browse files
committed
update 2.4.7
1 parent 87bcf43 commit cde56f4

File tree

205 files changed

+13055
-4525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+13055
-4525
lines changed

Assets/OpenCVForUnity/Examples.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Advanced.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Advanced/AlphaBlendingExample.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Advanced/ComicFilterExample.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Advanced/ComicFilterExample/ComicFilterExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void OnWebCamTextureToMatHelperInitialized()
6262
Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
6363

6464
texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGBA32, false);
65-
Utils.fastMatToTexture2D(webCamTextureMat, texture);
65+
Utils.matToTexture2D(webCamTextureMat, texture);
6666

6767
gameObject.GetComponent<Renderer>().material.mainTexture = texture;
6868

@@ -132,7 +132,7 @@ void Update()
132132

133133
//Imgproc.putText(rgbaMat, "W:" + rgbaMat.width() + " H:" + rgbaMat.height() + " SO:" + Screen.orientation, new Point(5, rgbaMat.rows() - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
134134

135-
Utils.fastMatToTexture2D(rgbaMat, texture);
135+
Utils.matToTexture2D(rgbaMat, texture);
136136
}
137137
}
138138

Assets/OpenCVForUnity/Examples/Advanced/DocumentScannerExample.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Advanced/DocumentScannerExample/DocumentScannerExample.cs

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OpenCVForUnityExample
1717
/// Document Scanner Example
1818
/// An example of document scanning (like receipts, business cards etc) using the Imgproc class.
1919
/// </summary>
20-
[RequireComponent (typeof(WebCamTextureToMatHelper))]
20+
[RequireComponent(typeof(WebCamTextureToMatHelper))]
2121
public class DocumentScannerExample : MonoBehaviour
2222
{
2323
/// <summary>
@@ -57,29 +57,29 @@ public class DocumentScannerExample : MonoBehaviour
5757
FpsMonitor fpsMonitor;
5858

5959
// Use this for initialization
60-
void Start ()
60+
void Start()
6161
{
62-
fpsMonitor = GetComponent<FpsMonitor> ();
63-
64-
webCamTextureToMatHelper = gameObject.GetComponent<WebCamTextureToMatHelper> ();
62+
fpsMonitor = GetComponent<FpsMonitor>();
6563

66-
#if UNITY_ANDROID && !UNITY_EDITOR
64+
webCamTextureToMatHelper = gameObject.GetComponent<WebCamTextureToMatHelper>();
65+
66+
#if UNITY_ANDROID && !UNITY_EDITOR
6767
// Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
6868
webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true;
69-
#endif
70-
webCamTextureToMatHelper.Initialize ();
71-
69+
#endif
70+
webCamTextureToMatHelper.Initialize();
71+
7272
isDebugModeToggle.isOn = isDebugMode;
7373
}
7474

7575
/// <summary>
7676
/// Raises the web cam texture to mat helper initialized event.
7777
/// </summary>
78-
public void OnWebCamTextureToMatHelperInitialized ()
78+
public void OnWebCamTextureToMatHelperInitialized()
7979
{
80-
Debug.Log ("OnWebCamTextureToMatHelperInitialized");
81-
82-
Mat webCamTextureMat = webCamTextureToMatHelper.GetMat ();
80+
Debug.Log("OnWebCamTextureToMatHelperInitialized");
81+
82+
Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
8383

8484
if (webCamTextureMat.width() < webCamTextureMat.height())
8585
{
@@ -144,12 +144,13 @@ public void OnWebCamTextureToMatHelperInitialized ()
144144
/// <summary>
145145
/// Raises the web cam texture to mat helper disposed event.
146146
/// </summary>
147-
public void OnWebCamTextureToMatHelperDisposed ()
147+
public void OnWebCamTextureToMatHelperDisposed()
148148
{
149-
Debug.Log ("OnWebCamTextureToMatHelperDisposed");
149+
Debug.Log("OnWebCamTextureToMatHelperDisposed");
150150

151-
if (texture != null) {
152-
Texture2D.Destroy (texture);
151+
if (texture != null)
152+
{
153+
Texture2D.Destroy(texture);
153154
texture = null;
154155
}
155156

@@ -167,17 +168,18 @@ public void OnWebCamTextureToMatHelperDisposed ()
167168
/// Raises the web cam texture to mat helper error occurred event.
168169
/// </summary>
169170
/// <param name="errorCode">Error code.</param>
170-
public void OnWebCamTextureToMatHelperErrorOccurred (WebCamTextureToMatHelper.ErrorCode errorCode)
171+
public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
171172
{
172-
Debug.Log ("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
173+
Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
173174
}
174175

175176
// Update is called once per frame
176-
void Update ()
177+
void Update()
177178
{
178-
if (webCamTextureToMatHelper.IsPlaying () && webCamTextureToMatHelper.DidUpdateThisFrame ()) {
179-
180-
Mat rgbaMat = webCamTextureToMatHelper.GetMat ();
179+
if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
180+
{
181+
182+
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
181183

182184
// change the color space to YUV.
183185
Imgproc.cvtColor(rgbaMat, yuvMat, Imgproc.COLOR_RGBA2RGB);
@@ -246,7 +248,7 @@ void Update ()
246248

247249
rgbaMat.copyTo(inputDisplayAreaMat);
248250

249-
Utils.fastMatToTexture2D(displayMat, texture, true, 0, true);
251+
Utils.matToTexture2D(displayMat, texture, true, 0, true);
250252
}
251253
}
252254

@@ -256,7 +258,7 @@ private void Find4PointContours(Mat image, List<MatOfPoint> contours)
256258
List<MatOfPoint> tmp_contours = new List<MatOfPoint>();
257259
Mat hierarchy = new Mat();
258260
Imgproc.findContours(image, tmp_contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
259-
261+
260262
foreach (var cnt in tmp_contours)
261263
{
262264
MatOfInt hull = new MatOfInt();
@@ -374,47 +376,47 @@ private Mat PerspectiveTransform(Mat image, MatOfPoint corners)
374376
/// <summary>
375377
/// Raises the destroy event.
376378
/// </summary>
377-
void OnDestroy ()
379+
void OnDestroy()
378380
{
379-
webCamTextureToMatHelper.Dispose ();
381+
webCamTextureToMatHelper.Dispose();
380382
}
381383

382384
/// <summary>
383385
/// Raises the back button click event.
384386
/// </summary>
385-
public void OnBackButtonClick ()
387+
public void OnBackButtonClick()
386388
{
387-
SceneManager.LoadScene ("OpenCVForUnityExample");
389+
SceneManager.LoadScene("OpenCVForUnityExample");
388390
}
389391

390392
/// <summary>
391393
/// Raises the play button click event.
392394
/// </summary>
393-
public void OnPlayButtonClick ()
395+
public void OnPlayButtonClick()
394396
{
395-
webCamTextureToMatHelper.Play ();
397+
webCamTextureToMatHelper.Play();
396398
}
397399

398400
/// <summary>
399401
/// Raises the pause button click event.
400402
/// </summary>
401-
public void OnPauseButtonClick ()
403+
public void OnPauseButtonClick()
402404
{
403-
webCamTextureToMatHelper.Pause ();
405+
webCamTextureToMatHelper.Pause();
404406
}
405407

406408
/// <summary>
407409
/// Raises the stop button click event.
408410
/// </summary>
409-
public void OnStopButtonClick ()
411+
public void OnStopButtonClick()
410412
{
411-
webCamTextureToMatHelper.Stop ();
413+
webCamTextureToMatHelper.Stop();
412414
}
413415

414416
/// <summary>
415417
/// Raises the change camera button click event.
416418
/// </summary>
417-
public void OnChangeCameraButtonClick ()
419+
public void OnChangeCameraButtonClick()
418420
{
419421
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.requestedIsFrontFacing;
420422
}

Assets/OpenCVForUnity/Examples/Advanced/GreenScreenExample.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)