Skip to content

Commit 2e0b4f1

Browse files
committed
v2.3.1
Updated NatCam version to 2.3.1. Updated NatShare version to 1.2.1.
1 parent 4de8cde commit 2e0b4f1

File tree

9 files changed

+265
-172
lines changed

9 files changed

+265
-172
lines changed

Assets/NatCamWithOpenCVForUnityExample/IntegrationWithNatShareExample/ComicFilter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ public class ComicFilter
1919
Mat kernel_dilate;
2020
Mat kernel_erode;
2121
Size blurSize;
22-
int brackThresh;
22+
int blackThresh;
2323
bool drawMainLine;
2424
bool useNoiseFilter;
2525

2626

27-
public ComicFilter(int brackThresh = 60, int grayThresh = 120, int thickness = 5, bool useNoiseFilter = true)
27+
public ComicFilter(int blackThresh = 60, int grayThresh = 120, int thickness = 5, bool useNoiseFilter = true)
2828
{
29-
this.brackThresh = brackThresh;
29+
this.blackThresh = blackThresh;
3030
this.drawMainLine = (thickness != 0);
3131
this.useNoiseFilter = useNoiseFilter;
3232

3333
grayLUT = new Mat(1, 256, CvType.CV_8UC1);
3434
byte[] lutArray = new byte[256];
3535
for (int i = 0; i < lutArray.Length; i++)
3636
{
37-
if (brackThresh <= i && i < grayThresh)
37+
if (blackThresh <= i && i < grayThresh)
3838
lutArray[i] = 255;
3939
}
4040
Utils.copyToMat(lutArray, grayLUT);
@@ -108,7 +108,7 @@ public void Process(Mat src, Mat dst, bool isBGR = false)
108108

109109

110110
// binarize.
111-
Imgproc.threshold(grayMat, grayDstMat, brackThresh, 255.0, Imgproc.THRESH_BINARY);
111+
Imgproc.threshold(grayMat, grayDstMat, blackThresh, 255.0, Imgproc.THRESH_BINARY);
112112

113113
// draw striped screentone.
114114
Core.LUT(grayMat, grayLUT, maskMat);

Assets/NatCamWithOpenCVForUnityExample/IntegrationWithNatShareExample/IntegrationWithNatShareExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected override void Start()
3636
NatCamWithOpenCVForUnityExample.ExampleSceneConfiguration(out performImageProcessingEachTime);
3737
// Create camera source
3838
cameraSource = new NatCamSource(width, height, framerate, useFrontCamera);
39-
if (!cameraSource.activeCamera)
39+
if (cameraSource.activeCamera == null)
4040
cameraSource = new NatCamSource(width, height, framerate, !useFrontCamera);
4141
cameraSource.StartPreview(OnStart, OnFrame);
4242
// Create comic filter

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewOnlyExample/NatCamPreviewOnlyExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected override void Start()
2424
NatCamWithOpenCVForUnityExample.ExampleSceneConfiguration(out performImageProcessingEachTime);
2525
// Create camera source
2626
cameraSource = new NatCamSource(width, height, framerate, useFrontCamera);
27-
if (!cameraSource.activeCamera)
27+
if (cameraSource.activeCamera == null)
2828
cameraSource = new NatCamSource(width, height, framerate, !useFrontCamera);
2929
cameraSource.StartPreview(OnStart, OnFrame);
3030
// Update UI

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewToMatExample/NatCamPreviewToMatExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected override void Start()
4747
NatCamWithOpenCVForUnityExample.ExampleSceneConfiguration(out performImageProcessingEachTime);
4848
// Create camera source
4949
cameraSource = new NatCamSource(width, height, framerate, useFrontCamera);
50-
if (!cameraSource.activeCamera)
50+
if (cameraSource.activeCamera == null)
5151
cameraSource = new NatCamSource(width, height, framerate, !useFrontCamera);
5252
cameraSource.StartPreview(OnStart, OnFrame);
5353
// Update UI

Assets/NatCamWithOpenCVForUnityExample/NatCamWithOpenCVForUnityExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class NatCamWithOpenCVForUnityExample : MonoBehaviour
1111

1212
public static string GetNatCamVersion()
1313
{
14-
return "2.3.0";
14+
return "2.3.1";
1515
}
1616

1717
public enum FrameratePreset

Assets/NatCamWithOpenCVForUnityExample/Scripts/NatCamSource.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class NatCamSource : ICameraSource
3131

3232
public int height { get; private set; }
3333

34-
public bool isRunning { get { return activeCamera ? activeCamera.IsRunning : false; } }
34+
public bool isRunning { get { return activeCamera != null ? activeCamera.IsRunning : false; } }
3535

36-
public bool isFrontFacing { get { return activeCamera ? activeCamera.IsFrontFacing : false; } }
36+
public bool isFrontFacing { get { return activeCamera != null ? activeCamera.IsFrontFacing : false; } }
3737

3838
public Texture2D preview { get; private set; }
3939

@@ -64,7 +64,7 @@ public NatCamSource(int width, int height, int framerate, bool front)
6464
}
6565

6666
activeCamera = devices[cameraIndex];
67-
activeCamera.PreviewResolution = new Resolution { width = requestedWidth, height = requestedHeight };
67+
activeCamera.PreviewResolution = (width: requestedWidth, height: requestedHeight);
6868
activeCamera.Framerate = requestedFramerate;
6969
}
7070

@@ -184,7 +184,7 @@ public void SwitchCamera()
184184

185185
cameraIndex = ++cameraIndex % devices.Length;
186186
activeCamera = devices[cameraIndex];
187-
activeCamera.PreviewResolution = new Resolution { width = requestedWidth, height = requestedHeight };
187+
activeCamera.PreviewResolution = (width: requestedWidth, height: requestedHeight);
188188
activeCamera.Framerate = requestedFramerate;
189189
StartPreview(startCallback, frameCallback);
190190
}

Assets/NatCamWithOpenCVForUnityExample/Scripts/Utils/NatCamPreviewToMatHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace NatCamWithOpenCVForUnity.UnityUtils.Helper
1010
{
1111
/// <summary>
1212
/// NatCamPreview to mat helper.
13-
/// v 1.0.8
14-
/// Depends on NatCam version 2.3 or later.
13+
/// v 1.0.9
14+
/// Depends on NatCam version 2.3.1 or later.
1515
/// Depends on OpenCVForUnity version 2.3.7 or later.
1616
/// </summary>
1717
public class NatCamPreviewToMatHelper : WebCamTextureToMatHelper
@@ -191,7 +191,7 @@ protected override IEnumerator _Initialize()
191191
natCamCameraDevice.Framerate = (int)requestedFPS;
192192

193193
// Set the camera's preview resolution
194-
natCamCameraDevice.PreviewResolution = new Resolution { width = requestedWidth, height = requestedHeight };
194+
natCamCameraDevice.PreviewResolution = (width: requestedWidth, height: requestedHeight);
195195

196196
// Starts the camera
197197
// Register callback for when the preview starts

0 commit comments

Comments
 (0)