示例#1
0
        #pragma warning restore 649

        /// <summary>
        /// Starts up MLImageTracker.
        /// Invokes the callback after privleges have been succesfully requested and MLImageTracker is started.
        /// </summary>
        public static MLResult Start()
        {
            #if PLATFORM_LUMIN
            _result = MLPrivilegesStarterKit.Start();
            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed when calling MLPrivilegesStarterKit.Start. Reason: {0}", _result);
                return(_result);
            }

            _result = MLPrivilegesStarterKit.RequestPrivileges(MLPrivileges.Id.CameraCapture);
            if (_result.Result != MLResult.Code.PrivilegeGranted)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed requesting privileges. Reason: {0}", _result);
                return(_result);
            }
            MLPrivilegesStarterKit.Stop();

            _result = MLImageTracker.Start();
            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed starting MLImageTracker. Reason: {0}", _result);
            }
            #endif

            return(_result);
        }
示例#2
0
    void Start()
    {
        StartCoroutine(HttpLongPollNotification("http://vcm-12481.vm.duke.edu/push/"));

        MLImageTracker.Start();
        MLImageTracker.Enable();
        MLImageTracker.AddTarget("sea", imageTarget, 0.279f, (target, result) =>
        {
            if (!_imageObjectAdded && result.Status == MLImageTargetTrackingStatus.Tracked)
            {
                Debug.Log("Image recognized.");

                DisplayAssets();

                _imageObjectAdded = true;
            }
        }, true);

        MLResult camera = MLCamera.Start();

        if (camera.IsOk)
        {
            MLCamera.Connect();
            Debug.Log("Camera Enabled");
        }

//        MLCamera.OnRawImageAvailable += delegate(byte[] jpegBytes) { StartCoroutine(Upload(jpegBytes)); };
//        StartCoroutine(Capture());
    }