44using System ;
55using System . Collections ;
66using System . Collections . Generic ;
7- using NatCamU . Core ;
7+ using NatCam ;
88using OpenCVForUnity . CoreModule ;
99using 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