void OnDestroy()
 {
     QrCodeTrackablesMap.Clear();
     CameraDevice.GetInstance().Stop();
     TrackerManager.GetInstance().StopTracker();
     TrackerManager.GetInstance().DestroyTracker();
 }
    void Start()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 60;
        goResultGuideVideo.GetComponent <VideoPlayer>().loopPointReached += CheckOver;

        imageTrackablesMap.Clear();
        ImageTrackableBehaviour[] imageTrackables = FindObjectsOfType <ImageTrackableBehaviour>();
        foreach (var trackable in imageTrackables)
        {
            imageTrackablesMap.Add(trackable.TrackableName, trackable);
            Debug.Log("Trackable add: " + trackable.TrackableName);
        }

        if (TrackerManager.GetInstance().IsFusionSupported())
        {
            CameraDevice.GetInstance().SetARCoreTexture();
            TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_IMAGE_FUSION);
            AddTrackerData();
        }
        else
        {
            TrackerManager.GetInstance().RequestARCoreApk();
        }
    }
예제 #3
0
 IEnumerator AutoFocusCoroutine()
 {
     while (true)
     {
         CameraDevice.GetInstance().SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_AUTO);
         yield return(new WaitForSeconds(3.0f));
     }
 }
예제 #4
0
 void OnDestroy()
 {
     imageTrackablesMap.Clear();
     CameraDevice.GetInstance().Stop();
     TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.NORMAL_TRACKING);
     TrackerManager.GetInstance().StopTracker();
     TrackerManager.GetInstance().DestroyTracker();
 }
 void StopCamera()
 {
     if (cameraStartDone)
     {
         Debug.Log("Unity StopCamera");
         CameraDevice.GetInstance().Stop();
         cameraStartDone = false;
     }
 }
예제 #6
0
 public void StopCamera()
 {
     if (cameraStartDone)
     {
         ResultCode result = CameraDevice.GetInstance().Stop();
         Debug.Log("Unity StopCamera. result : " + result);
         cameraStartDone = false;
     }
 }
예제 #7
0
 public void StartCamera()
 {
     if (!cameraStartDone)
     {
         ResultCode result = CameraDevice.GetInstance().Start();
         cameraStartDone = true;
         Debug.Log("Unity StartCamera. result : " + result);
     }
 }
    void OnDestroy()
    {
        CameraDevice.GetInstance().SetFlashLightMode(false);

        imageTrackablesMap.Clear();
        TrackerManager.GetInstance().SetTrackingOption(TrackerManager.TrackingOption.NORMAL_TRACKING);
        TrackerManager.GetInstance().StopTracker();
        TrackerManager.GetInstance().DestroyTracker();
        StopCamera();
    }
예제 #9
0
 private void StopCamera()
 {
     if (cameraStartDone)
     {
         Debug.Log("Unity StopCamera");
         CameraDevice.GetInstance().Stop();
         cameraStartDone = false;
         StopCoroutine(AutoFocusCoroutine());
     }
 }
 void StartCamera()
 {
     if (!cameraStartDone)
     {
         Debug.Log("Unity StartCamera");
         ResultCode result = CameraDevice.GetInstance().Start();
         if (result == ResultCode.Success)
         {
             cameraStartDone = true;
         }
     }
 }
 public void SetContinuousFocus()
 {
     focusContinuous = !focusContinuous;
     if (focusContinuous)
     {
         CameraDevice.GetInstance().SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
     }
     else
     {
         CameraDevice.GetInstance().SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_AUTO);
     }
 }
 void StartCamera()
 {
     if (!cameraStartDone)
     {
         Debug.Log("Unity StartCamera");
         ResultCode result = CameraDevice.GetInstance().Start();
         if (result == ResultCode.Success)
         {
             cameraStartDone = true;
             //CameraDevice.GetInstance().SetAutoWhiteBalanceLock(true);   // For ODG-R7 preventing camera flickering
         }
     }
 }
예제 #13
0
        private void OnNewFrame(VideoPlayer _, long frameIdx)
        {
            var rt = _player.targetTexture;

            // read frame data
            RenderTexture.active = rt;
            _frameTex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
            _frameTex.Apply();
            RenderTexture.active = null;

            // pass to AR camera API
            var data = _frameTex.GetRawTextureData();

            CameraDevice.GetInstance().SetNewFrame(data, data.Length, rt.width, rt.height, ColorFormat.RGBA8888);
        }
    public void ChangeCameraPosition()
    {
        AbstractConfigurationScriptableObject conf = ConfigurationScriptableObject.GetInstance();

        if (conf.CameraType == CameraDevice.CameraType.Face)
        {
            conf.CameraType = CameraDevice.CameraType.Rear;
            CameraDevice.GetInstance().Stop();
            CameraDevice.GetInstance().Start();
        }
        else
        {
            conf.CameraType = CameraDevice.CameraType.Face;
            CameraDevice.GetInstance().Stop();
            CameraDevice.GetInstance().Start();
        }
    }
예제 #15
0
    void OnNewFrame(VideoPlayer source, long frameIdx)
    {
        RenderTexture renderTexture = source.texture as RenderTexture;

        if (texture2D == null)
        {
            texture2D = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGBA32, false);
        }

        RenderTexture.active = renderTexture;
        texture2D.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
        texture2D.Apply();
        RenderTexture.active = null;


        CameraDevice.GetInstance().SetNewFrame(texture2D.GetRawTextureData(), texture2D.GetRawTextureData().Length, texture2D.width, texture2D.height, ColorFormat.RGBA8888);
    }
예제 #16
0
    void Start()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 60;

        MarkerTrackerBehaviour[] markerTrackables = FindObjectsOfType <MarkerTrackerBehaviour>();

        foreach (var trackable in markerTrackables)
        {
            trackable.SetMarkerTrackerFileName(trackable.MarkerID, trackable.MarkerSize);
            markerTrackableMap.Add(trackable.MarkerID, trackable);
            Debug.Log("Trackable id: " + trackable.MarkerID);
            Debug.Log(trackable.TrackerDataFileName);
        }

        if (TrackerManager.GetInstance().IsFusionSupported())
        {
            CameraDevice.GetInstance().SetARCoreTexture();
            CameraDevice.GetInstance().SetFusionEnable();
            CameraDevice.GetInstance().Start();
            TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_MARKER_FUSION);
            AddTrackerData();
        }
        else
        {
            TrackerManager.GetInstance().RequestARCoreApk();
        }

        // For see through smart glass setting
        if (ConfigurationScriptableObject.GetInstance().WearableType == WearableCalibration.WearableType.OpticalSeeThrough)
        {
            WearableManager.GetInstance().GetDeviceController().SetStereoMode(true);

            CameraBackgroundBehaviour cameraBackground = FindObjectOfType <CameraBackgroundBehaviour>();
            cameraBackground.gameObject.SetActive(false);

            WearableManager.GetInstance().GetCalibration().CreateWearableEye(Camera.main.transform);

            // BT-300 screen is splited in half size, but R-7 screen is doubled.
            if (WearableManager.GetInstance().GetDeviceController().IsSideBySideType() == true)
            {
                // Do something here. For example resize gui to fit ratio
            }
        }
    }
 void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         TrackerManager.GetInstance().StopTracker();
     }
     else
     {
         if (TrackerManager.GetInstance().IsFusionSupported())
         {
             CameraDevice.GetInstance().SetARCoreTexture();
             TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT_FUSION);
         }
         else
         {
             TrackerManager.GetInstance().RequestARCoreApk();
         }
     }
 }
예제 #18
0
    void Start()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 60;

        instantTrackable = FindObjectOfType <InstantTrackableBehaviour>();
        if (instantTrackable == null)
        {
            return;
        }

        instantTrackable.OnTrackFail();

        if (TrackerManager.GetInstance().IsFusionSupported())
        {
            CameraDevice.GetInstance().SetARCoreTexture();
            CameraDevice.GetInstance().SetFusionEnable();
            CameraDevice.GetInstance().Start();
            TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT_FUSION);
        }
        else
        {
            TrackerManager.GetInstance().RequestARCoreApk();
        }

        // For see through smart glass setting
        if (ConfigurationScriptableObject.GetInstance().WearableType == WearableCalibration.WearableType.OpticalSeeThrough)
        {
            WearableManager.GetInstance().GetDeviceController().SetStereoMode(true);

            CameraBackgroundBehaviour cameraBackground = FindObjectOfType <CameraBackgroundBehaviour>();
            cameraBackground.gameObject.SetActive(false);

            WearableManager.GetInstance().GetCalibration().CreateWearableEye(Camera.main.transform);

            // BT-300 screen is splited in half size, but R-7 screen is doubled.
            if (WearableManager.GetInstance().GetDeviceController().IsSideBySideType() == true)
            {
                // Do something here. For example resize gui to fit ratio
            }
        }
    }
예제 #19
0
    private void Update()
    {
        if (Input.touchCount == 2)
        {
            touchZero = Input.GetTouch(0);
            touchOne  = Input.GetTouch(1);

            touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
            touchOnePrevPos  = touchOne.position - touchOne.deltaPosition;

            prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
            touchDeltaMag     = (touchZero.position - touchOne.position).magnitude;

            deltaMagnitudediff = touchDeltaMag - prevTouchDeltaMag;

            CurrentCameraZoom += deltaMagnitudediff * CameraZoomSpeed;

            CurrentCameraZoom = Mathf.Clamp(CurrentCameraZoom, 0.0f, CameraDevice.GetInstance().getMaxZoomValue());

            CameraDevice.GetInstance().SetZoom((int)CurrentCameraZoom);
        }
    }
 public void SetFlashLightMode()
 {
     flashOn = !flashOn;
     CameraDevice.GetInstance().SetFlashLightMode(flashOn);
 }
예제 #21
0
 private void Awake()
 {
     _tracker = TrackerManager.GetInstance();
     _camera  = CameraDevice.GetInstance();
 }
 public void FlipHorizontal()
 {
     horizontalFlip = !horizontalFlip;
     CameraDevice.GetInstance().FlipVideo(CameraDevice.FlipDirection.HORIZONTAL, horizontalFlip);
 }
 public void FlipVertical()
 {
     verticalFlip = !verticalFlip;
     CameraDevice.GetInstance().FlipVideo(CameraDevice.FlipDirection.VERTICAL, verticalFlip);
 }
 public void WhiteBalanceLock()
 {
     whiteBalanceLock = !whiteBalanceLock;
     CameraDevice.GetInstance().SetAutoWhiteBalanceLock(whiteBalanceLock);
 }
    void Start()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 60;

        QrCodeTrackablesMap.Clear();
        QrCodeTrackableBehaviour[] QrCodeTrackables = FindObjectsOfType <QrCodeTrackableBehaviour>();

        if (QrCodeTrackables.Length > 0)
        {
            if (QrCodeTrackables[0].QrCodeSearchingWords.Length < 1)
            {
                List <QrCodeTrackableBehaviour> qrCodeList = new List <QrCodeTrackableBehaviour>();

                qrCodeList.Add(QrCodeTrackables[0]);
                QrCodeTrackablesMap.Add(defaultSearchingWords, qrCodeList);
            }
        }

        foreach (var trackable in QrCodeTrackables)
        {
            string key = trackable.QrCodeSearchingWords;

            if (key.Length < 1)
            {
                key = defaultSearchingWords;
            }

            if (QrCodeTrackablesMap.ContainsKey(key))
            {
                bool isNew = true;

                foreach (var QrCodeTrackableList in QrCodeTrackablesMap[key])
                {
                    if (trackable.name.Equals(QrCodeTrackableList.name))
                    {
                        isNew = false;
                        break;
                    }
                }

                if (isNew)
                {
                    QrCodeTrackablesMap[defaultSearchingWords].Add(trackable);
                }
            }
            else
            {
                List <QrCodeTrackableBehaviour> qrCodeList = new List <QrCodeTrackableBehaviour>();

                qrCodeList.Add(trackable);
                QrCodeTrackablesMap.Add(key, qrCodeList);
            }

            Debug.Log("Trackable add: " + trackable.TrackableName);
        }

        if (TrackerManager.GetInstance().IsFusionSupported())
        {
            CameraDevice.GetInstance().SetARCoreTexture();
            TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_QR_FUSION);
            AddTrackerData();
        }
        else
        {
            TrackerManager.GetInstance().RequestARCoreApk();
        }

        // For see through smart glass setting
        if (ConfigurationScriptableObject.GetInstance().WearableType == WearableCalibration.WearableType.OpticalSeeThrough)
        {
            WearableManager.GetInstance().GetDeviceController().SetStereoMode(true);

            CameraBackgroundBehaviour cameraBackground = FindObjectOfType <CameraBackgroundBehaviour>();
            cameraBackground.gameObject.SetActive(false);

            WearableManager.GetInstance().GetCalibration().CreateWearableEye(Camera.main.transform);

            // BT-300 screen is splited in half size, but R-7 screen is doubled.
            if (WearableManager.GetInstance().GetDeviceController().IsSideBySideType() == true)
            {
                // Do something here. For example resize gui to fit ratio
            }
        }
    }
예제 #26
0
 void OnDestroy()
 {
     CameraDevice.GetInstance().Stop();
     TrackerManager.GetInstance().StopTracker();
     TrackerManager.GetInstance().DestroyTracker();
 }