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()); }
/// <summary> /// Used for enabling the image tracker without resetting the API. /// </summary> public static MLResult Enable() { #if PLATFORM_LUMIN _result = MLImageTracker.Enable(); #endif return(_result); }
private void StartTracking() { if (MLImageTracker.IsStarted) { MLImageTracker.Enable(); anchorPlacer.SetActive(true); } }
/// <summary> /// Handles the event for trigger down. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="triggerValue">The value of the trigger.</param> private void HandleOnTriggerDown(byte controllerId, float triggerValue) { if (_hasStarted && MLImageTracker.IsStarted && _controllerConnectionHandler.IsControllerValid(controllerId)) { if (MLImageTracker.GetTrackerStatus()) { MLImageTracker.Disable(); _trackerStatusLabel.text = "Tracker Status: Disabled"; } else { MLImageTracker.Enable(); _trackerStatusLabel.text = "Tracker Status: Enabled"; } } }
/// <summary> /// Used for enabling the image tracker without resetting the API. /// </summary> public static MLResult Enable() { #if PLATFORM_LUMIN if (MLImageTracker.IsStarted) { _result = MLImageTracker.Enable(); } else { _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLImageTracker was not started."); } #endif return(_result); }
/// <summary> /// Handles the event for trigger down. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="triggerValue">The value of the trigger.</param> private void HandleOnTriggerDown(byte controllerId, float triggerValue) { if (_hasStarted && MLImageTracker.IsStarted && _controllerConnectionHandler.IsControllerValid(controllerId)) { // The ImageTracker status before it is changed bool trackerStatus = MLImageTracker.GetTrackerStatus(); // Try to change the ImageTracker status MLResult result = trackerStatus ? MLImageTracker.Disable() : MLImageTracker.Enable(); if (!result.IsOk) { Debug.LogErrorFormat("Error: Failed to {0} the ImageTracker.", trackerStatus ? "disable" : "enable"); } else { _trackerStatusLabel.text = "Tracker Status: " + (trackerStatus ? "Disabled" : "Enabled"); } } }