Skip to content

Commit d49c8b7

Browse files
committed
update 3.0.2
1 parent 637d0e0 commit d49c8b7

File tree

63 files changed

+1112
-1379
lines changed

Some content is hidden

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

63 files changed

+1112
-1379
lines changed

Assets/OpenCVForUnity/Examples/Advanced/BallTrackingBasedOnColorExample/BallTrackingBasedOnColorExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
using OpenCVForUnity.UnityIntegration;
66
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
77
using UnityEngine;
8+
using UnityEngine.Rendering;
89
using UnityEngine.SceneManagement;
910
using UnityEngine.UI;
11+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
1012

1113
namespace OpenCVForUnityExample
1214
{
@@ -116,6 +118,14 @@ private void Start()
116118
}
117119

118120
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
121+
122+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
123+
#if UNITY_6000_0_OR_NEWER
124+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
125+
{
126+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
127+
}
128+
#endif
119129
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
120130
_multiSource2MatHelper.Initialize();
121131
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
using OpenCVForUnity.UnityIntegration;
33
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
44
using UnityEngine;
5+
using UnityEngine.Rendering;
56
using UnityEngine.SceneManagement;
67
using UnityEngine.UI;
8+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
79

810
namespace OpenCVForUnityExample
911
{
@@ -49,6 +51,14 @@ private void Start()
4951
_fpsMonitor = GetComponent<FpsMonitor>();
5052

5153
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
54+
55+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
56+
#if UNITY_6000_0_OR_NEWER
57+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
58+
{
59+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
60+
}
61+
#endif
5262
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
5363
_multiSource2MatHelper.Initialize();
5464
}

Assets/OpenCVForUnity/Examples/Advanced/CountFingersExample/CountFingersExample.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
using OpenCVForUnity.UnityIntegration;
55
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
66
using UnityEngine;
7+
using UnityEngine.Rendering;
78
using UnityEngine.SceneManagement;
89
using UnityEngine.UI;
10+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
911

1012
namespace OpenCVForUnityExample
1113
{
@@ -114,6 +116,14 @@ private void Start()
114116
_fpsMonitor = GetComponent<FpsMonitor>();
115117

116118
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
119+
120+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
121+
#if UNITY_6000_0_OR_NEWER
122+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
123+
{
124+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
125+
}
126+
#endif
117127
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
118128
_multiSource2MatHelper.Initialize();
119129
}
@@ -269,7 +279,7 @@ public void OnTextureSelectionStateChanged(GameObject touchedObject, TextureSele
269279
case TextureSelector.TextureSelectionState.POINT_SELECTION_COMPLETED:
270280
_shouldUpdateColorFromPoint = true;
271281
break;
272-
case TextureSelector.TextureSelectionState.OUTSIDE_TEXTURE_SELECTED:
282+
case TextureSelector.TextureSelectionState.POINT_SELECTION_CANCELLED:
273283
_isColorSelected = false;
274284
NumberOfFingersText.gameObject.SetActive(false);
275285
ThreasholdSlider.gameObject.SetActive(false);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
using OpenCVForUnity.UnityIntegration;
66
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
77
using UnityEngine;
8+
using UnityEngine.Rendering;
89
using UnityEngine.SceneManagement;
910
using UnityEngine.UI;
11+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
1012

1113
namespace OpenCVForUnityExample
1214
{
@@ -67,6 +69,14 @@ private void Start()
6769
_fpsMonitor = GetComponent<FpsMonitor>();
6870

6971
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
72+
73+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
74+
#if UNITY_6000_0_OR_NEWER
75+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
76+
{
77+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
78+
}
79+
#endif
7080
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
7181
_multiSource2MatHelper.Initialize();
7282

Assets/OpenCVForUnity/Examples/Advanced/ImageCorrectionExample/ImageCorrectionExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
using OpenCVForUnity.UnityIntegration;
44
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
55
using UnityEngine;
6+
using UnityEngine.Rendering;
67
using UnityEngine.SceneManagement;
78
using UnityEngine.UI;
9+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
810

911
namespace OpenCVForUnityExample
1012
{
@@ -51,6 +53,14 @@ public class ImageCorrectionExample : MonoBehaviour
5153
private void Start()
5254
{
5355
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
56+
57+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
58+
#if UNITY_6000_0_OR_NEWER
59+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
60+
{
61+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
62+
}
63+
#endif
5464
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGB;
5565
_multiSource2MatHelper.Initialize();
5666

Assets/OpenCVForUnity/Examples/Advanced/KeyFrameGreenScreenExample/KeyFrameGreenScreenExample.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
using OpenCVForUnity.UnityIntegration;
44
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
55
using UnityEngine;
6+
using UnityEngine.Rendering;
67
using UnityEngine.SceneManagement;
78
using UnityEngine.UI;
9+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
810

911
namespace OpenCVForUnityExample
1012
{
@@ -98,6 +100,14 @@ private void Start()
98100
_fpsMonitor = GetComponent<FpsMonitor>();
99101

100102
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
103+
104+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
105+
#if UNITY_6000_0_OR_NEWER
106+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
107+
{
108+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
109+
}
110+
#endif
101111
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
102112

103113
_multiSource2MatHelper.Initialize();
@@ -260,7 +270,7 @@ public void OnTextureSelectionStateChanged(GameObject touchedObject, TextureSele
260270
case TextureSelector.TextureSelectionState.POINT_SELECTION_STARTED:
261271
_shouldUpdateBackgroundFromPoint = true;
262272
break;
263-
case TextureSelector.TextureSelectionState.OUTSIDE_TEXTURE_SELECTED:
273+
case TextureSelector.TextureSelectionState.POINT_SELECTION_CANCELLED:
264274
ResetBackgroundToWhite();
265275
break;
266276
}

Assets/OpenCVForUnity/Examples/Advanced/MultiObjectTrackingBasedOnColorExample/MultiObjectTrackingBasedOnColorExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
using OpenCVForUnity.UnityIntegration;
55
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
66
using UnityEngine;
7+
using UnityEngine.Rendering;
78
using UnityEngine.SceneManagement;
89
using UnityEngine.UI;
10+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
911

1012
namespace OpenCVForUnityExample
1113
{
@@ -78,6 +80,14 @@ private void Start()
7880
_fpsMonitor = GetComponent<FpsMonitor>();
7981

8082
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
83+
84+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
85+
#if UNITY_6000_0_OR_NEWER
86+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
87+
{
88+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
89+
}
90+
#endif
8191
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
8292
_multiSource2MatHelper.Initialize();
8393
}

Assets/OpenCVForUnity/Examples/Advanced/MultiObjectTrackingExample/MultiObjectTrackingExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
using OpenCVForUnity.UnityIntegration.MOT;
88
using OpenCVForUnity.UnityIntegration.MOT.ByteTrack;
99
using UnityEngine;
10+
using UnityEngine.Rendering;
1011
using UnityEngine.SceneManagement;
1112
using UnityEngine.UI;
13+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
1214

1315
#if !UNITY_WSA_10_0
1416
using OpenCVForUnity.UnityIntegration.Worker.DnnModule;
@@ -85,6 +87,14 @@ private async void Start()
8587

8688
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
8789

90+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
91+
#if UNITY_6000_0_OR_NEWER
92+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
93+
{
94+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
95+
}
96+
#endif
97+
8898
// Update GUI state
8999
ShowObjectDetectorResultToggle.isOn = ShowObjectDetectorResult;
90100
EnableByteTrackToggle.isOn = EnableByteTrack;

Assets/OpenCVForUnity/Examples/Advanced/PhysicalGreenScreenExample/PhysicalGreenScreenExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
using OpenCVForUnity.UnityIntegration;
44
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
55
using UnityEngine;
6+
using UnityEngine.Rendering;
67
using UnityEngine.SceneManagement;
78
using UnityEngine.UI;
9+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
810

911
namespace OpenCVForUnityExample
1012
{
@@ -113,6 +115,14 @@ private void Start()
113115
_fpsMonitor = GetComponent<FpsMonitor>();
114116

115117
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
118+
119+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
120+
#if UNITY_6000_0_OR_NEWER
121+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
122+
{
123+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
124+
}
125+
#endif
116126
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
117127
_multiSource2MatHelper.Initialize();
118128
}

Assets/OpenCVForUnity/Examples/Advanced/PolygonFilterExample/PolygonFilterExample.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
using OpenCVForUnity.UnityIntegration.Helper.Optimization;
66
using OpenCVForUnity.UnityIntegration.Helper.Source2Mat;
77
using UnityEngine;
8+
using UnityEngine.Rendering;
89
using UnityEngine.SceneManagement;
910
using UnityEngine.UI;
11+
using static OpenCVForUnity.UnityIntegration.Helper.Source2Mat.MultiSource2MatHelper;
1012

1113
namespace OpenCVForUnityExample
1214
{
@@ -96,6 +98,14 @@ private void Start()
9698
_imageOptimizationHelper = gameObject.GetComponent<ImageOptimizationHelper>();
9799

98100
_multiSource2MatHelper = gameObject.GetComponent<MultiSource2MatHelper>();
101+
102+
// WebCamTexture2MatHelper does not work on WebGPU, so use WebCamTexture2MatAsyncGPUHelper instead.
103+
#if UNITY_6000_0_OR_NEWER
104+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU && _multiSource2MatHelper.RequestedSource2MatHelperClassName == MultiSource2MatHelperClassName.WebCamTexture2MatHelper)
105+
{
106+
_multiSource2MatHelper.RequestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatAsyncGPUHelper;
107+
}
108+
#endif
99109
_multiSource2MatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA;
100110
_multiSource2MatHelper.Initialize();
101111
}

0 commit comments

Comments
 (0)