Skip to content

Commit d841873

Browse files
authored
Merge pull request #4 from olokobayusuf/master
Update to NatCam 2.1
2 parents 920c208 + f872fd2 commit d841873

File tree

70 files changed

+5723
-14097
lines changed

Some content is hidden

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

70 files changed

+5723
-14097
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Assets/OpenCVForUnity
2+
Assets/NatCam
3+
Assets/NatShare
4+
Assets/OpenCVForUnity.meta
5+
Assets/NatCam.meta
6+
Assets/NatShare.meta
7+
Library/
8+
Temp/
9+
.vs/
10+
.vscode/
11+
obj/

Assembly-CSharp-Editor.csproj

Lines changed: 391 additions & 0 deletions
Large diffs are not rendered by default.

Assembly-CSharp.csproj

Lines changed: 695 additions & 0 deletions
Large diffs are not rendered by default.

Assets/NatCamWithOpenCVForUnityExample/IntegrationWithNatShareExample/ComicFilter.cs

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using OpenCVForUnity;
22
using System;
33

4-
namespace NatCamWithOpenCVForUnityExample
5-
{
6-
public class ComicFilter
7-
{
4+
namespace NatCamWithOpenCVForUnityExample {
5+
6+
public class ComicFilter {
7+
88
Mat grayMat;
99
Mat lineMat;
1010
Mat maskMat;
@@ -13,11 +13,9 @@ public class ComicFilter
1313
byte[] grayPixels;
1414
byte[] maskPixels;
1515

16-
public void Process (Mat src, Mat dst)
17-
{
16+
public void Process (Mat src, Mat dst) {
1817
if (src == null)
1918
throw new ArgumentNullException ("src == null");
20-
2119
if (dst == null)
2220
throw new ArgumentNullException ("dst == null");
2321

@@ -80,30 +78,16 @@ public void Process (Mat src, Mat dst)
8078
Imgproc.cvtColor (grayDstMat, dst, Imgproc.COLOR_GRAY2RGBA);
8179
}
8280

83-
public void Dispose()
84-
{
85-
if (grayMat != null) {
86-
grayMat.Dispose ();
87-
grayMat = null;
88-
}
89-
if (lineMat != null) {
90-
lineMat.Dispose ();
91-
lineMat = null;
92-
}
93-
if (maskMat != null) {
94-
maskMat.Dispose ();
95-
maskMat = null;
96-
}
97-
if (bgMat != null) {
98-
bgMat.Dispose ();
99-
bgMat = null;
100-
}
101-
if (grayDstMat != null) {
102-
grayDstMat.Dispose ();
103-
grayDstMat = null;
104-
}
105-
106-
grayPixels = null;
81+
public void Dispose() {
82+
foreach (var mat in new [] { grayMat, lineMat, maskMat, bgMat, grayDstMat })
83+
if (mat != null)
84+
maskMat.Dispose();
85+
grayDstMat =
86+
bgMat =
87+
maskMat =
88+
lineMat =
89+
grayMat = null;
90+
grayPixels =
10791
maskPixels = null;
10892
}
10993
}

0 commit comments

Comments
 (0)