Skip to content

Commit 235a8b9

Browse files
committed
v1.0.5
Updated OpenCVForUnity version to 2.3.4. Updated NatCam version to 2.2.
1 parent a4fd21c commit 235a8b9

File tree

14 files changed

+323
-163
lines changed

14 files changed

+323
-163
lines changed

Assets/NatCamWithOpenCVForUnityExample/IntegrationWithNatShareExample/IntegrationWithNatShareExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Collections;
66
using System.Collections.Generic;
7-
using NatCamU.Core;
7+
using NatCam;
88
using NatShareU;
99
using OpenCVForUnity.CoreModule;
1010
using OpenCVForUnity.ImgprocModule;
@@ -69,7 +69,7 @@ protected override void OnStart ()
6969
);
7070
// Display preview
7171
rawImage.texture = texture;
72-
aspectFitter.aspectRatio = NatCam.Preview.width / (float)NatCam.Preview.height;
72+
aspectFitter.aspectRatio = cameraSource.width / (float)cameraSource.height;
7373
Debug.Log ("NatCam camera source started with resolution: " + cameraSource.width + "x" + cameraSource.height);
7474

7575
if (fpsMonitor != null) {

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewOnlyExample/NatCamPreviewOnlyExample.cs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Runtime.InteropServices;
7-
using NatCamU.Core;
7+
using NatCam;
88

99
namespace NatCamWithOpenCVForUnityExample
1010
{
@@ -61,27 +61,29 @@ protected override void OnStart ()
6161
);
6262
// Display preview
6363
rawImage.texture = texture;
64-
aspectFitter.aspectRatio = NatCam.Preview.width / (float)NatCam.Preview.height;
64+
aspectFitter.aspectRatio = cameraSource.width / (float)cameraSource.height;
6565
Debug.Log ("NatCam camera source started with resolution: " + cameraSource.width + "x" + cameraSource.height);
6666
// Log camera properties
6767
var cameraProps = new Dictionary<string, string> ();
68-
cameraProps.Add ("IsFrontFacing", NatCam.Camera.IsFrontFacing.ToString ());
69-
cameraProps.Add ("Framerate", NatCam.Camera.Framerate.ToString ());
70-
cameraProps.Add ("PreviewResolution", NatCam.Camera.PreviewResolution.x + "x" + NatCam.Camera.PreviewResolution.y);
71-
cameraProps.Add ("PhotoResolution", NatCam.Camera.PhotoResolution.x + "x" + NatCam.Camera.PhotoResolution.y);
72-
cameraProps.Add ("ExposureLock", NatCam.Camera.ExposureLock.ToString ());
73-
cameraProps.Add ("ExposureBias", NatCam.Camera.ExposureBias.ToString ());
74-
cameraProps.Add ("MinExposureBias", NatCam.Camera.MinExposureBias.ToString ());
75-
cameraProps.Add ("MaxExposureBias", NatCam.Camera.MaxExposureBias.ToString ());
76-
cameraProps.Add ("IsFlashSupported", NatCam.Camera.IsFlashSupported.ToString ());
77-
cameraProps.Add ("FlashMode", NatCam.Camera.FlashMode.ToString ());
78-
cameraProps.Add ("FocusLock", NatCam.Camera.FocusLock.ToString ());
79-
cameraProps.Add ("HorizontalFOV", NatCam.Camera.HorizontalFOV.ToString ());
80-
cameraProps.Add ("VerticalFOV", NatCam.Camera.VerticalFOV.ToString ());
81-
cameraProps.Add ("IsTorchSupported", NatCam.Camera.IsTorchSupported.ToString ());
82-
cameraProps.Add ("TorchEnabled", NatCam.Camera.TorchEnabled.ToString ());
83-
cameraProps.Add ("MaxZoomRatio", NatCam.Camera.MaxZoomRatio.ToString ());
84-
cameraProps.Add ("ZoomRatio", NatCam.Camera.ZoomRatio.ToString ());
68+
cameraProps.Add ("IsFrontFacing", cameraSource.activeCamera.IsFrontFacing.ToString ());
69+
cameraProps.Add ("Framerate", cameraSource.activeCamera.Framerate.ToString ());
70+
cameraProps.Add ("PreviewResolution", cameraSource.activeCamera.PreviewResolution.x + "x" + cameraSource.activeCamera.PreviewResolution.y);
71+
cameraProps.Add ("PhotoResolution", cameraSource.activeCamera.PhotoResolution.x + "x" + cameraSource.activeCamera.PhotoResolution.y);
72+
cameraProps.Add ("ExposureLock", cameraSource.activeCamera.ExposureLock.ToString ());
73+
cameraProps.Add ("ExposureBias", cameraSource.activeCamera.ExposureBias.ToString ());
74+
cameraProps.Add ("MinExposureBias", cameraSource.activeCamera.MinExposureBias.ToString ());
75+
cameraProps.Add ("MaxExposureBias", cameraSource.activeCamera.MaxExposureBias.ToString ());
76+
cameraProps.Add ("IsFlashSupported", cameraSource.activeCamera.IsFlashSupported.ToString ());
77+
cameraProps.Add ("FlashMode", cameraSource.activeCamera.FlashMode.ToString ());
78+
cameraProps.Add ("FocusLock", cameraSource.activeCamera.FocusLock.ToString ());
79+
cameraProps.Add ("HorizontalFOV", cameraSource.activeCamera.HorizontalFOV.ToString ());
80+
cameraProps.Add ("VerticalFOV", cameraSource.activeCamera.VerticalFOV.ToString ());
81+
cameraProps.Add ("IsTorchSupported", cameraSource.activeCamera.IsTorchSupported.ToString ());
82+
cameraProps.Add ("TorchEnabled", cameraSource.activeCamera.TorchEnabled.ToString ());
83+
cameraProps.Add ("MaxZoomRatio", cameraSource.activeCamera.MaxZoomRatio.ToString ());
84+
cameraProps.Add ("ZoomRatio", cameraSource.activeCamera.ZoomRatio.ToString ());
85+
cameraProps.Add ("UniqueID", cameraSource.activeCamera.UniqueID.ToString ());
86+
cameraProps.Add ("WhiteBalanceLock", cameraSource.activeCamera.WhiteBalanceLock.ToString ());
8587
Debug.Log ("# Active Camera Properties #####################");
8688
foreach (string key in cameraProps.Keys)
8789
Debug.Log (key + ": " + cameraProps [key]);
@@ -93,7 +95,7 @@ protected override void OnStart ()
9395
fpsMonitor.Add ("orientation", Screen.orientation.ToString ());
9496

9597
fpsMonitor.boxWidth = 200;
96-
fpsMonitor.boxHeight = 680;
98+
fpsMonitor.boxHeight = 760;
9799
fpsMonitor.LocateGUI ();
98100

99101
foreach (string key in cameraProps.Keys)

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewOnlyExample/NatCamPreviewOnlyExample.unity

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RenderSettings:
4242
--- !u!157 &3
4343
LightmapSettings:
4444
m_ObjectHideFlags: 0
45-
serializedVersion: 9
45+
serializedVersion: 11
4646
m_GIWorkflowMode: 1
4747
m_GISettings:
4848
serializedVersion: 2
@@ -54,7 +54,7 @@ LightmapSettings:
5454
m_EnableBakedLightmaps: 0
5555
m_EnableRealtimeLightmaps: 0
5656
m_LightmapEditorSettings:
57-
serializedVersion: 8
57+
serializedVersion: 9
5858
m_Resolution: 2
5959
m_BakeResolution: 40
6060
m_TextureWidth: 1024
@@ -88,8 +88,9 @@ LightmapSettings:
8888
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
8989
m_PVRFilteringAtrousPositionSigmaIndirect: 2
9090
m_PVRFilteringAtrousPositionSigmaAO: 1
91+
m_ShowResolutionOverlay: 1
9192
m_LightingDataAsset: {fileID: 0}
92-
m_ShadowMaskMode: 2
93+
m_UseShadowmask: 1
9394
--- !u!196 &4
9495
NavMeshSettings:
9596
serializedVersion: 2
@@ -109,6 +110,8 @@ NavMeshSettings:
109110
manualTileSize: 0
110111
tileSize: 256
111112
accuratePlacement: 0
113+
debug:
114+
m_Flags: 0
112115
m_NavMeshData: {fileID: 0}
113116
--- !u!1 &73853457
114117
GameObject:
@@ -166,6 +169,7 @@ MonoBehaviour:
166169
m_PreferredHeight: 40
167170
m_FlexibleWidth: -1
168171
m_FlexibleHeight: -1
172+
m_LayoutPriority: 1
169173
--- !u!114 &73853460
170174
MonoBehaviour:
171175
m_ObjectHideFlags: 0
@@ -592,6 +596,7 @@ MonoBehaviour:
592596
m_PreferredHeight: 40
593597
m_FlexibleWidth: -1
594598
m_FlexibleHeight: -1
599+
m_LayoutPriority: 1
595600
--- !u!114 &217695554
596601
MonoBehaviour:
597602
m_ObjectHideFlags: 0
@@ -814,6 +819,7 @@ MonoBehaviour:
814819
m_PreferredHeight: 40
815820
m_FlexibleWidth: -1
816821
m_FlexibleHeight: -1
822+
m_LayoutPriority: 1
817823
--- !u!114 &442587375
818824
MonoBehaviour:
819825
m_ObjectHideFlags: 0
@@ -955,6 +961,7 @@ MonoBehaviour:
955961
m_PreferredHeight: 40
956962
m_FlexibleWidth: -1
957963
m_FlexibleHeight: -1
964+
m_LayoutPriority: 1
958965
--- !u!114 &504087044
959966
MonoBehaviour:
960967
m_ObjectHideFlags: 0
@@ -1628,6 +1635,7 @@ MonoBehaviour:
16281635
m_PreferredHeight: 40
16291636
m_FlexibleWidth: -1
16301637
m_FlexibleHeight: -1
1638+
m_LayoutPriority: 1
16311639
--- !u!114 &1213656990
16321640
MonoBehaviour:
16331641
m_ObjectHideFlags: 0
@@ -1964,11 +1972,11 @@ Camera:
19641972
m_TargetEye: 3
19651973
m_HDR: 0
19661974
m_AllowMSAA: 1
1975+
m_AllowDynamicResolution: 0
19671976
m_ForceIntoRT: 0
19681977
m_OcclusionCulling: 1
19691978
m_StereoConvergence: 10
19701979
m_StereoSeparation: 0.022
1971-
m_StereoMirrorMode: 0
19721980
--- !u!4 &1475480617
19731981
Transform:
19741982
m_ObjectHideFlags: 0

Assets/NatCamWithOpenCVForUnityExample/NatCamPreviewToMatExample/NatCamPreviewToMatExample.cs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Collections;
66
using System.Collections.Generic;
7-
using NatCamU.Core;
7+
using NatCam;
88
using OpenCVForUnity.CoreModule;
99
using OpenCVForUnity.UnityUtils;
1010

@@ -83,27 +83,29 @@ protected override void OnStart ()
8383
);
8484
// Display preview
8585
rawImage.texture = texture;
86-
aspectFitter.aspectRatio = NatCam.Preview.width / (float)NatCam.Preview.height;
86+
aspectFitter.aspectRatio = cameraSource.width / (float)cameraSource.height;
8787
Debug.Log ("NatCam camera source started with resolution: " + cameraSource.width + "x" + cameraSource.height);
8888
// Log camera properties
8989
var cameraProps = new Dictionary<string, string> ();
90-
cameraProps.Add ("IsFrontFacing", NatCam.Camera.IsFrontFacing.ToString ());
91-
cameraProps.Add ("Framerate", NatCam.Camera.Framerate.ToString ());
92-
cameraProps.Add ("PreviewResolution", NatCam.Camera.PreviewResolution.x + "x" + NatCam.Camera.PreviewResolution.y);
93-
cameraProps.Add ("PhotoResolution", NatCam.Camera.PhotoResolution.x + "x" + NatCam.Camera.PhotoResolution.y);
94-
cameraProps.Add ("ExposureLock", NatCam.Camera.ExposureLock.ToString ());
95-
cameraProps.Add ("ExposureBias", NatCam.Camera.ExposureBias.ToString ());
96-
cameraProps.Add ("MinExposureBias", NatCam.Camera.MinExposureBias.ToString ());
97-
cameraProps.Add ("MaxExposureBias", NatCam.Camera.MaxExposureBias.ToString ());
98-
cameraProps.Add ("IsFlashSupported", NatCam.Camera.IsFlashSupported.ToString ());
99-
cameraProps.Add ("FlashMode", NatCam.Camera.FlashMode.ToString ());
100-
cameraProps.Add ("FocusLock", NatCam.Camera.FocusLock.ToString ());
101-
cameraProps.Add ("HorizontalFOV", NatCam.Camera.HorizontalFOV.ToString ());
102-
cameraProps.Add ("VerticalFOV", NatCam.Camera.VerticalFOV.ToString ());
103-
cameraProps.Add ("IsTorchSupported", NatCam.Camera.IsTorchSupported.ToString ());
104-
cameraProps.Add ("TorchEnabled", NatCam.Camera.TorchEnabled.ToString ());
105-
cameraProps.Add ("MaxZoomRatio", NatCam.Camera.MaxZoomRatio.ToString ());
106-
cameraProps.Add ("ZoomRatio", NatCam.Camera.ZoomRatio.ToString ());
90+
cameraProps.Add ("IsFrontFacing", cameraSource.activeCamera.IsFrontFacing.ToString ());
91+
cameraProps.Add ("Framerate", cameraSource.activeCamera.Framerate.ToString ());
92+
cameraProps.Add ("PreviewResolution", cameraSource.activeCamera.PreviewResolution.x + "x" + cameraSource.activeCamera.PreviewResolution.y);
93+
cameraProps.Add ("PhotoResolution", cameraSource.activeCamera.PhotoResolution.x + "x" + cameraSource.activeCamera.PhotoResolution.y);
94+
cameraProps.Add ("ExposureLock", cameraSource.activeCamera.ExposureLock.ToString ());
95+
cameraProps.Add ("ExposureBias", cameraSource.activeCamera.ExposureBias.ToString ());
96+
cameraProps.Add ("MinExposureBias", cameraSource.activeCamera.MinExposureBias.ToString ());
97+
cameraProps.Add ("MaxExposureBias", cameraSource.activeCamera.MaxExposureBias.ToString ());
98+
cameraProps.Add ("IsFlashSupported", cameraSource.activeCamera.IsFlashSupported.ToString ());
99+
cameraProps.Add ("FlashMode", cameraSource.activeCamera.FlashMode.ToString ());
100+
cameraProps.Add ("FocusLock", cameraSource.activeCamera.FocusLock.ToString ());
101+
cameraProps.Add ("HorizontalFOV", cameraSource.activeCamera.HorizontalFOV.ToString ());
102+
cameraProps.Add ("VerticalFOV", cameraSource.activeCamera.VerticalFOV.ToString ());
103+
cameraProps.Add ("IsTorchSupported", cameraSource.activeCamera.IsTorchSupported.ToString ());
104+
cameraProps.Add ("TorchEnabled", cameraSource.activeCamera.TorchEnabled.ToString ());
105+
cameraProps.Add ("MaxZoomRatio", cameraSource.activeCamera.MaxZoomRatio.ToString ());
106+
cameraProps.Add ("ZoomRatio", cameraSource.activeCamera.ZoomRatio.ToString ());
107+
cameraProps.Add ("UniqueID", cameraSource.activeCamera.UniqueID.ToString ());
108+
cameraProps.Add ("WhiteBalanceLock", cameraSource.activeCamera.WhiteBalanceLock.ToString ());
107109
Debug.Log ("# Active Camera Properties #####################");
108110
foreach (string key in cameraProps.Keys)
109111
Debug.Log (key + ": " + cameraProps [key]);
@@ -115,7 +117,7 @@ protected override void OnStart ()
115117
fpsMonitor.Add ("orientation", Screen.orientation.ToString ());
116118

117119
fpsMonitor.boxWidth = 200;
118-
fpsMonitor.boxHeight = 680;
120+
fpsMonitor.boxHeight = 760;
119121
fpsMonitor.LocateGUI ();
120122

121123
foreach (string key in cameraProps.Keys)
@@ -144,7 +146,7 @@ protected override void UpdateTexture ()
144146
cameraSource.CaptureFrame (frameMatrix);
145147
break;
146148
case MatCaptureMethod.BlitWithReadPixels:
147-
Utils.textureToTexture2D (cameraSource.Preview, texture);
149+
Utils.textureToTexture2D (cameraSource.preview, texture);
148150
Utils.copyToMat (texture.GetRawTextureData (), frameMatrix);
149151
Core.flip (frameMatrix, frameMatrix, 0);
150152
break;
@@ -153,7 +155,7 @@ protected override void UpdateTexture ()
153155
Debug.LogError ("This device does not support Graphics::CopyTexture");
154156
return;
155157
}
156-
Graphics.CopyTexture (NatCam.Preview, texture);
158+
Graphics.CopyTexture (cameraSource.preview, texture);
157159
Utils.copyToMat (texture.GetRawTextureData (), frameMatrix);
158160
Core.flip (frameMatrix, frameMatrix, 0);
159161
break;

0 commit comments

Comments
 (0)