Exemplo n.º 1
0
 public static void Initialize(PreviewType previewType, bool metadataDetection)
 {
     mReadablePreview   = previewType == PreviewType.Readable;
     mPhotoSaveMode     = (int)SaveMode.DoNotSave;
     mMetadataDetection = metadataDetection;
     listener           = new GameObject("NatCamHelper").AddComponent <NatCamHelper>();
     Dispatch           = NatCamDispatch.Prepare(DispatchMode.Synchronous, listener);
     RegisterCallbacks(Render, Update, UpdatePhoto, UpdateCode, UpdateFace);
     InspectDeviceCameras();
     isInitialized = true;
     Ext.LogVerbose("Initialized native interface");
 }
Exemplo n.º 2
0
 public static void Release()
 {
     #if !ALLOCATE_NEW_FRAME_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (Photo != null)
     {
         MonoBehaviour.Destroy(Photo);
     }
     Photo = null;
     #endif
     #if !ALLOCATE_NEW_PHOTO_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (mPreviewFrame != null)
     {
         MonoBehaviour.Destroy(mPreviewFrame);
     }
     mPreviewFrame = null;
     #endif
     if (Preview != null)
     {
         MonoBehaviour.Destroy(Preview);
     }
     Preview = null;
     #if OPENCV_DEVELOPER_MODE
     if (PreviewMatrix != null)
     {
         PreviewMatrix.release();
     }
     PreviewMatrix = null;
     #endif
     mActiveCamera  = -1;
     mPhotoSaveMode = 0;
     if (listener != null)
     {
         listener.WillDestroyMe();
         MonoBehaviour.Destroy(listener.gameObject);
     }
     listener = null;
     #if UNITY_IOS
     TerminateOperations();
     NatCamDispatch.Release(Dispatch);
     Dispatch = null;
     #elif UNITY_ANDROID
     A.Call("TerminateOperations");
     NCNA = null;
     #endif
     FirstFrameReceived =
         isInitialized  =
             isPlaying  = false;
 }