Skip to content

Commit bae79c0

Browse files
committed
update 2.6.2
1 parent cb16be8 commit bae79c0

File tree

40 files changed

+15166
-26
lines changed

40 files changed

+15166
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!84 &8400000
4+
RenderTexture:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_Name: CameraRenderTexture
10+
m_ImageContentsHash:
11+
serializedVersion: 2
12+
Hash: 00000000000000000000000000000000
13+
m_ForcedFallbackFormat: 4
14+
m_DownscaleFallback: 0
15+
m_IsAlphaChannelOptional: 0
16+
serializedVersion: 5
17+
m_Width: 512
18+
m_Height: 512
19+
m_AntiAliasing: 1
20+
m_MipCount: -1
21+
m_DepthStencilFormat: 0
22+
m_ColorFormat: 4
23+
m_MipMap: 0
24+
m_GenerateMips: 1
25+
m_SRGB: 1
26+
m_UseDynamicScale: 0
27+
m_BindMS: 0
28+
m_EnableCompatibleFormat: 1
29+
m_EnableRandomWrite: 0
30+
m_TextureSettings:
31+
serializedVersion: 2
32+
m_FilterMode: 1
33+
m_Aniso: 0
34+
m_MipBias: 0
35+
m_WrapU: 1
36+
m_WrapV: 1
37+
m_WrapW: 1
38+
m_Dimension: 2
39+
m_VolumeDepth: 1
40+
m_ShadowSamplingMode: 2

Assets/OpenCVForUnity/Examples/Basic/MultiSource2MatHelperExample/CameraRenderTexture.renderTexture.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 8
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: CubeMaterial
11+
m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
12+
m_ValidKeywords: []
13+
m_InvalidKeywords: []
14+
m_LightmapFlags: 4
15+
m_EnableInstancingVariants: 0
16+
m_DoubleSidedGI: 0
17+
m_CustomRenderQueue: -1
18+
stringTagMap: {}
19+
disabledShaderPasses: []
20+
m_SavedProperties:
21+
serializedVersion: 3
22+
m_TexEnvs:
23+
- _BumpMap:
24+
m_Texture: {fileID: 0}
25+
m_Scale: {x: 1, y: 1}
26+
m_Offset: {x: 0, y: 0}
27+
- _DetailAlbedoMap:
28+
m_Texture: {fileID: 0}
29+
m_Scale: {x: 1, y: 1}
30+
m_Offset: {x: 0, y: 0}
31+
- _DetailMask:
32+
m_Texture: {fileID: 0}
33+
m_Scale: {x: 1, y: 1}
34+
m_Offset: {x: 0, y: 0}
35+
- _DetailNormalMap:
36+
m_Texture: {fileID: 0}
37+
m_Scale: {x: 1, y: 1}
38+
m_Offset: {x: 0, y: 0}
39+
- _EmissionMap:
40+
m_Texture: {fileID: 0}
41+
m_Scale: {x: 1, y: 1}
42+
m_Offset: {x: 0, y: 0}
43+
- _MainTex:
44+
m_Texture: {fileID: 2800000, guid: ed80b0c1f3599ab4fb7e46d50500f5eb, type: 3}
45+
m_Scale: {x: 1, y: 1}
46+
m_Offset: {x: 0, y: 0}
47+
- _MetallicGlossMap:
48+
m_Texture: {fileID: 0}
49+
m_Scale: {x: 1, y: 1}
50+
m_Offset: {x: 0, y: 0}
51+
- _OcclusionMap:
52+
m_Texture: {fileID: 0}
53+
m_Scale: {x: 1, y: 1}
54+
m_Offset: {x: 0, y: 0}
55+
- _ParallaxMap:
56+
m_Texture: {fileID: 0}
57+
m_Scale: {x: 1, y: 1}
58+
m_Offset: {x: 0, y: 0}
59+
m_Ints: []
60+
m_Floats:
61+
- _BumpScale: 1
62+
- _ColorMask: 15
63+
- _Cutoff: 0.5
64+
- _DetailNormalMapScale: 1
65+
- _DstBlend: 0
66+
- _GlossMapScale: 1
67+
- _Glossiness: 0.5
68+
- _GlossyReflections: 1
69+
- _Metallic: 0
70+
- _Mode: 0
71+
- _OcclusionStrength: 1
72+
- _Parallax: 0.02
73+
- _SmoothnessTextureChannel: 0
74+
- _SpecularHighlights: 1
75+
- _SrcBlend: 1
76+
- _Stencil: 0
77+
- _StencilComp: 8
78+
- _StencilOp: 0
79+
- _StencilReadMask: 255
80+
- _StencilWriteMask: 255
81+
- _UVSec: 0
82+
- _UseUIAlphaClip: 0
83+
- _ZWrite: 1
84+
m_Colors:
85+
- _Color: {r: 1, g: 1, b: 1, a: 1}
86+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
87+
m_BuildTextureStacks: []

Assets/OpenCVForUnity/Examples/Basic/MultiSource2MatHelperExample/CubeMaterial.mat.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/OpenCVForUnity/Examples/Basic/MultiSource2MatHelperExample/MultiSource2MatHelperExample.cs

+36-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum Source2MatHelperClassNamePreset : int
2222
WebCamTexture2MatHelper = 0,
2323
VideoCapture2MatHelper,
2424
Image2MatHelper,
25+
AsyncGPUReadback2MatHelper,
2526
}
2627

2728
Source2MatHelperClassNamePreset requestedSource2MatHelperClassName = Source2MatHelperClassNamePreset.WebCamTexture2MatHelper;
@@ -36,6 +37,14 @@ enum Source2MatHelperClassNamePreset : int
3637
/// </summary>
3738
public Dropdown requestedSource2MatHelperClassNameDropdown;
3839

40+
//
41+
/// <summary>
42+
/// The cube.
43+
/// </summary>
44+
[Space(10)]
45+
public GameObject cube;
46+
//
47+
3948
/// <summary>
4049
/// The texture.
4150
/// </summary>
@@ -118,6 +127,9 @@ public void OnSourceToMatHelperInitialized()
118127
fpsMonitor.Add("image path", helper.requestedImageFilePath.ToString());
119128
fpsMonitor.Add("repeat", helper.repeat.ToString());
120129
break;
130+
case ITextureSource2MatHelper helper:
131+
fpsMonitor.Add("source texture", helper.sourceTexture.ToString());
132+
break;
121133
}
122134

123135
if (multiSourceToMatHelper.source2MatHelper is WebCamTexture2MatHelper webCamHelper)
@@ -192,12 +204,32 @@ void Update()
192204
// Retrieve the current frame as a Mat object
193205
Mat rgbaMat = multiSourceToMatHelper.GetMat();
194206

207+
switch (requestedSource2MatHelperClassName)
208+
{
209+
case Source2MatHelperClassNamePreset.WebCamTexture2MatHelper:
210+
Imgproc.putText(rgbaMat, "WebCamTexture => Mat", new Point(5, 30), Imgproc.FONT_HERSHEY_SIMPLEX, 0.7, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
211+
break;
212+
case Source2MatHelperClassNamePreset.VideoCapture2MatHelper:
213+
Imgproc.putText(rgbaMat, "Video File => Mat", new Point(5, 30), Imgproc.FONT_HERSHEY_SIMPLEX, 0.7, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
214+
break;
215+
case Source2MatHelperClassNamePreset.Image2MatHelper:
216+
Imgproc.putText(rgbaMat, "Image File => Mat", new Point(5, 30), Imgproc.FONT_HERSHEY_SIMPLEX, 0.7, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
217+
break;
218+
case Source2MatHelperClassNamePreset.AsyncGPUReadback2MatHelper:
219+
Imgproc.putText(rgbaMat, "Camera => RenderTexture => Mat", new Point(5, 30), Imgproc.FONT_HERSHEY_SIMPLEX, 0.7, new Scalar(255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
220+
break;
221+
}
222+
195223
// Add text overlay on the frame
196-
//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);
224+
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);
197225

198226
// Convert the Mat to a Texture2D to display it on a texture
199227
Utils.matToTexture2D(rgbaMat, texture);
200228
}
229+
230+
//
231+
cube.transform.Rotate(new Vector3(90, 90, 0) * Time.deltaTime, Space.Self);
232+
//
201233
}
202234

203235
/// <summary>
@@ -270,6 +302,9 @@ public void OnRequestedSource2MatHelperClassNameDropdownValueChanged(int result)
270302
case Source2MatHelperClassNamePreset.Image2MatHelper:
271303
multiSourceToMatHelper.requestedSource2MatHelperClassName = MultiSource2MatHelperClassName.Image2MatHelper;
272304
break;
305+
case Source2MatHelperClassNamePreset.AsyncGPUReadback2MatHelper:
306+
multiSourceToMatHelper.requestedSource2MatHelperClassName = MultiSource2MatHelperClassName.AsyncGPUReadback2MatHelper;
307+
break;
273308
}
274309

275310
// Way to perform different processing depending on the interface inherited by the helper class.

0 commit comments

Comments
 (0)