1313namespace NrealLightWithOpenCVForUnityExample
1414{
1515 /// <summary>
16- /// NRCamTextureToMatHelper Example
16+ /// NRCamTexture2MatHelper Example
1717 /// An example of image processing (comic filter) using OpenCVForUnity on NrealLight.
1818 /// </summary>
19- [ RequireComponent ( typeof ( NRCamTextureToMatHelper ) ) ]
20- public class NRCamTextureToMatHelperExample : MonoBehaviour
19+ [ RequireComponent ( typeof ( NRCamTexture2MatHelper ) ) ]
20+ public class NRCamTexture2MatHelperExample : MonoBehaviour
2121 {
2222
2323 /// <summary>
@@ -43,7 +43,7 @@ public class NRCamTextureToMatHelperExample : MonoBehaviour
4343 /// <summary>
4444 /// The webcam texture to mat helper.
4545 /// </summary>
46- NRCamTextureToMatHelper webCamTextureToMatHelper ;
46+ NRCamTexture2MatHelper webCamTextureToMatHelper ;
4747
4848 /// <summary>
4949 /// The quad renderer.
@@ -76,8 +76,8 @@ public class NRCamTextureToMatHelperExample : MonoBehaviour
7676 // Use this for initialization
7777 void Start ( )
7878 {
79- webCamTextureToMatHelper = gameObject . GetComponent < NRCamTextureToMatHelper > ( ) ;
80- webCamTextureToMatHelper . outputColorFormat = WebCamTextureToMatHelper . ColorFormat . RGB ;
79+ webCamTextureToMatHelper = gameObject . GetComponent < NRCamTexture2MatHelper > ( ) ;
80+ webCamTextureToMatHelper . outputColorFormat = Source2MatHelperColorFormat . RGB ;
8181 webCamTextureToMatHelper . Initialize ( ) ;
8282
8383 // Update GUI state
@@ -94,10 +94,10 @@ public void OnWebCamTextureToMatHelperInitialized()
9494 {
9595 Debug . Log ( "OnWebCamTextureToMatHelperInitialized" ) ;
9696
97- Mat webCamTextureMat = webCamTextureToMatHelper . GetMat ( ) ;
97+ Mat rgbMat = webCamTextureToMatHelper . GetMat ( ) ;
9898
99- texture = new Texture2D ( webCamTextureMat . cols ( ) , webCamTextureMat . rows ( ) , TextureFormat . RGB24 , false ) ;
100- Utils . matToTexture2D ( webCamTextureMat , texture ) ;
99+ texture = new Texture2D ( rgbMat . cols ( ) , rgbMat . rows ( ) , TextureFormat . RGB24 , false ) ;
100+ Utils . matToTexture2D ( rgbMat , texture ) ;
101101
102102 gameObject . GetComponent < Renderer > ( ) . material . mainTexture = texture ;
103103
@@ -136,9 +136,10 @@ public void OnWebCamTextureToMatHelperDisposed()
136136 /// Raises the webcam texture to mat helper error occurred event.
137137 /// </summary>
138138 /// <param name="errorCode">Error code.</param>
139- public void OnWebCamTextureToMatHelperErrorOccurred ( WebCamTextureToMatHelper . ErrorCode errorCode )
139+ /// <param name="message">Message.</param>
140+ public void OnWebCamTextureToMatHelperErrorOccurred ( Source2MatHelperErrorCode errorCode , string message )
140141 {
141- Debug . Log ( "OnWebCamTextureToMatHelperErrorOccurred " + errorCode ) ;
142+ Debug . Log ( "OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message ) ;
142143 }
143144
144145 // Update is called once per frame
@@ -157,7 +158,7 @@ void Update()
157158 Imgproc . putText ( rgbMat , "W:" + rgbMat . width ( ) + " H:" + rgbMat . height ( ) + " SO:" + Screen . orientation , new Point ( 5 , rgbMat . rows ( ) - 10 ) , Imgproc . FONT_HERSHEY_SIMPLEX , 1.0 , new Scalar ( 255 , 255 , 255 , 255 ) , 2 , Imgproc . LINE_AA , false ) ;
158159 }
159160
160- Utils . fastMatToTexture2D ( rgbMat , texture ) ;
161+ Utils . matToTexture2D ( rgbMat , texture ) ;
161162 }
162163
163164 if ( webCamTextureToMatHelper . IsPlaying ( ) )
0 commit comments