Skip to content

Commit e567884

Browse files
committed
v0.0.2
Added the function to convert the camera frame image to the correct direction to WebCamTextureOnlyExample. Updated OpenCVForUnity version to 2.2.8.
1 parent 40b07e2 commit e567884

File tree

10 files changed

+2457
-2272
lines changed

10 files changed

+2457
-2272
lines changed

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewOnlyExample/NatCamPreviewOnlyExample.cs

+375-357
Large diffs are not rendered by default.

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewToMatExample/NatCamPreviewToMatExample.cs

+401-388
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,119 @@
1-
using UnityEngine;
2-
using System.Collections;
3-
using UnityEngine.UI;
4-
5-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
6-
using UnityEngine.SceneManagement;
7-
#endif
8-
9-
namespace NatCamWithOpenCVForUnityExample
10-
{
11-
public class NatCamWithOpenCVForUnityExample : MonoBehaviour
12-
{
13-
public Text versionInfo;
14-
public ScrollRect scrollRect;
15-
static float verticalNormalizedPosition = 1f;
16-
17-
// Use this for initialization
18-
void Start ()
19-
{
20-
versionInfo.text = OpenCVForUnity.Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.Utils.getVersion () + " (" + OpenCVForUnity.Core.VERSION + ")";
21-
versionInfo.text += " / UnityEditor " + Application.unityVersion;
22-
versionInfo.text += " / ";
23-
24-
#if UNITY_EDITOR
25-
versionInfo.text += "Editor";
26-
#elif UNITY_STANDALONE_WIN
27-
versionInfo.text += "Windows";
28-
#elif UNITY_STANDALONE_OSX
29-
versionInfo.text += "Mac OSX";
30-
#elif UNITY_STANDALONE_LINUX
31-
versionInfo.text += "Linux";
32-
#elif UNITY_ANDROID
33-
versionInfo.text += "Android";
34-
#elif UNITY_IOS
35-
versionInfo.text += "iOS";
36-
#elif UNITY_WSA
37-
versionInfo.text += "WSA";
38-
#elif UNITY_WEBGL
39-
versionInfo.text += "WebGL";
40-
#endif
41-
versionInfo.text += " ";
42-
#if ENABLE_MONO
43-
versionInfo.text += "Mono";
44-
#elif ENABLE_IL2CPP
45-
versionInfo.text += "IL2CPP";
46-
#elif ENABLE_DOTNET
47-
versionInfo.text += ".NET";
48-
#endif
49-
50-
scrollRect.verticalNormalizedPosition = verticalNormalizedPosition;
51-
}
52-
53-
// Update is called once per frame
54-
void Update ()
55-
{
56-
57-
}
58-
59-
public void OnScrollRectValueChanged ()
60-
{
61-
verticalNormalizedPosition = scrollRect.verticalNormalizedPosition;
62-
}
63-
64-
65-
public void OnShowSystemInfoButtonClick ()
66-
{
67-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
68-
SceneManager.LoadScene ("ShowSystemInfo");
69-
#else
70-
Application.LoadLevel ("ShowSystemInfo");
71-
#endif
72-
}
73-
74-
public void OnShowLicenseButtonClick ()
75-
{
76-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
77-
SceneManager.LoadScene ("ShowLicense");
78-
#else
79-
Application.LoadLevel ("ShowLicense");
80-
#endif
81-
}
82-
83-
public void OnNatCamPreviewOnlyExampleButtonClick ()
84-
{
85-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
86-
SceneManager.LoadScene ("NatCamPreviewOnlyExample");
87-
#else
88-
Application.LoadLevel ("NatCamPreviewOnlyExample");
89-
#endif
90-
}
91-
92-
public void OnWebCamTextureOnlyExampleButtonClick ()
93-
{
94-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
95-
SceneManager.LoadScene ("WebCamTextureOnlyExample");
96-
#else
97-
Application.LoadLevel ("WebCamTextureOnlyExample");
98-
#endif
99-
}
100-
101-
public void OnNatCamPreviewToMatExampleButtonClick ()
102-
{
103-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
104-
SceneManager.LoadScene ("NatCamPreviewToMatExample");
105-
#else
106-
Application.LoadLevel ("NatCamPreviewToMatExample");
107-
#endif
108-
}
109-
110-
public void OnWebCamTextureToMatExampleButtonClick ()
111-
{
112-
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
113-
SceneManager.LoadScene ("WebCamTextureToMatExample");
114-
#else
115-
Application.LoadLevel ("WebCamTextureToMatExample");
116-
#endif
117-
}
118-
}
119-
}
1+
using UnityEngine;
2+
using System.Collections;
3+
using UnityEngine.UI;
4+
5+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
6+
using UnityEngine.SceneManagement;
7+
#endif
8+
9+
namespace NatCamWithOpenCVForUnityExample
10+
{
11+
public class NatCamWithOpenCVForUnityExample : MonoBehaviour
12+
{
13+
public Text versionInfo;
14+
public ScrollRect scrollRect;
15+
static float verticalNormalizedPosition = 1f;
16+
17+
// Use this for initialization
18+
void Start ()
19+
{
20+
versionInfo.text = OpenCVForUnity.Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.Utils.getVersion () + " (" + OpenCVForUnity.Core.VERSION + ")";
21+
versionInfo.text += " / UnityEditor " + Application.unityVersion;
22+
versionInfo.text += " / ";
23+
24+
#if UNITY_EDITOR
25+
versionInfo.text += "Editor";
26+
#elif UNITY_STANDALONE_WIN
27+
versionInfo.text += "Windows";
28+
#elif UNITY_STANDALONE_OSX
29+
versionInfo.text += "Mac OSX";
30+
#elif UNITY_STANDALONE_LINUX
31+
versionInfo.text += "Linux";
32+
#elif UNITY_ANDROID
33+
versionInfo.text += "Android";
34+
#elif UNITY_IOS
35+
versionInfo.text += "iOS";
36+
#elif UNITY_WSA
37+
versionInfo.text += "WSA";
38+
#elif UNITY_WEBGL
39+
versionInfo.text += "WebGL";
40+
#endif
41+
versionInfo.text += " ";
42+
#if ENABLE_MONO
43+
versionInfo.text += "Mono";
44+
#elif ENABLE_IL2CPP
45+
versionInfo.text += "IL2CPP";
46+
#elif ENABLE_DOTNET
47+
versionInfo.text += ".NET";
48+
#endif
49+
50+
scrollRect.verticalNormalizedPosition = verticalNormalizedPosition;
51+
}
52+
53+
// Update is called once per frame
54+
void Update ()
55+
{
56+
57+
}
58+
59+
public void OnScrollRectValueChanged ()
60+
{
61+
verticalNormalizedPosition = scrollRect.verticalNormalizedPosition;
62+
}
63+
64+
65+
public void OnShowSystemInfoButtonClick ()
66+
{
67+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
68+
SceneManager.LoadScene ("ShowSystemInfo");
69+
#else
70+
Application.LoadLevel ("ShowSystemInfo");
71+
#endif
72+
}
73+
74+
public void OnShowLicenseButtonClick ()
75+
{
76+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
77+
SceneManager.LoadScene ("ShowLicense");
78+
#else
79+
Application.LoadLevel ("ShowLicense");
80+
#endif
81+
}
82+
83+
public void OnNatCamPreviewOnlyExampleButtonClick ()
84+
{
85+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
86+
SceneManager.LoadScene ("NatCamPreviewOnlyExample");
87+
#else
88+
Application.LoadLevel ("NatCamPreviewOnlyExample");
89+
#endif
90+
}
91+
92+
public void OnWebCamTextureOnlyExampleButtonClick ()
93+
{
94+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
95+
SceneManager.LoadScene ("WebCamTextureOnlyExample");
96+
#else
97+
Application.LoadLevel ("WebCamTextureOnlyExample");
98+
#endif
99+
}
100+
101+
public void OnNatCamPreviewToMatExampleButtonClick ()
102+
{
103+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
104+
SceneManager.LoadScene ("NatCamPreviewToMatExample");
105+
#else
106+
Application.LoadLevel ("NatCamPreviewToMatExample");
107+
#endif
108+
}
109+
110+
public void OnWebCamTextureToMatExampleButtonClick ()
111+
{
112+
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
113+
SceneManager.LoadScene ("WebCamTextureToMatExample");
114+
#else
115+
Application.LoadLevel ("WebCamTextureToMatExample");
116+
#endif
117+
}
118+
}
119+
}

Assets/NatCamWithOpenCVForUnityExample/NatCamWithOpenCVForUnityExample.unity

+3-22
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ GameObject:
811811
- component: {fileID: 743992500}
812812
- component: {fileID: 743992499}
813813
- component: {fileID: 743992498}
814-
- component: {fileID: 743992497}
815814
m_Layer: 5
816815
m_Name: ShowSystemInfoButton
817816
m_TagString: Untagged
@@ -831,31 +830,13 @@ RectTransform:
831830
m_Children:
832831
- {fileID: 304459245}
833832
m_Father: {fileID: 1810133384}
834-
m_RootOrder: 0
833+
m_RootOrder: 1
835834
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
836835
m_AnchorMin: {x: 1, y: 1}
837836
m_AnchorMax: {x: 1, y: 1}
838837
m_AnchoredPosition: {x: -9.999878, y: -9.999939}
839838
m_SizeDelta: {x: 100, y: 50}
840839
m_Pivot: {x: 1, y: 1}
841-
--- !u!114 &743992497
842-
MonoBehaviour:
843-
m_ObjectHideFlags: 0
844-
m_PrefabParentObject: {fileID: 0}
845-
m_PrefabInternal: {fileID: 0}
846-
m_GameObject: {fileID: 743992495}
847-
m_Enabled: 0
848-
m_EditorHideFlags: 0
849-
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
850-
m_Name:
851-
m_EditorClassIdentifier:
852-
m_IgnoreLayout: 1
853-
m_MinWidth: 780
854-
m_MinHeight: 60
855-
m_PreferredWidth: -1
856-
m_PreferredHeight: -1
857-
m_FlexibleWidth: -1
858-
m_FlexibleHeight: -1
859840
--- !u!114 &743992498
860841
MonoBehaviour:
861842
m_ObjectHideFlags: 0
@@ -2294,7 +2275,7 @@ RectTransform:
22942275
- {fileID: 595830808}
22952276
- {fileID: 398629471}
22962277
m_Father: {fileID: 1810133384}
2297-
m_RootOrder: 1
2278+
m_RootOrder: 0
22982279
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
22992280
m_AnchorMin: {x: 0, y: 0}
23002281
m_AnchorMax: {x: 1, y: 1}
@@ -2408,8 +2389,8 @@ RectTransform:
24082389
m_LocalPosition: {x: 0, y: 0, z: 0}
24092390
m_LocalScale: {x: 0, y: 0, z: 0}
24102391
m_Children:
2411-
- {fileID: 743992496}
24122392
- {fileID: 1800755751}
2393+
- {fileID: 743992496}
24132394
m_Father: {fileID: 0}
24142395
m_RootOrder: 2
24152396
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

0 commit comments

Comments
 (0)