IEnumerator Capture() { while (true) { MLCamera.CaptureRawImageAsync(); yield return(new WaitForSeconds(0.1f)); } }
/// <summary> /// Captures a still image using the device's camera and returns /// the data path where it is saved. /// </summary> /// <param name="fileName">The name of the file to be saved to.</param> public void TriggerAsyncCapture() { if (MLCamera.IsStarted && _isCameraConnected) { if (MLCamera.CaptureRawImageAsync()) { _isCapturing = true; } } }
private void CaptureThreadWorker() { if (MLCamera.IsStarted && isConnected) { MLResult result = MLCamera.CaptureRawImageAsync(); if (!result.IsOk) { Debug.Log("Error: Capture Failed."); } } }
/// <summary> /// Captures a still image using the device's camera and returns /// the data path where it is saved. /// </summary> /// <param name="fileName">The name of the file to be saved to.</param> public void TriggerAsyncCapture() { if (MLCamera.IsStarted && _isCameraConnected) { MLResult result = MLCamera.CaptureRawImageAsync(); if (result.IsOk) { _isCapturing = true; } } }
/// <summary> /// Worker function to call the API's Capture function /// </summary> private void CaptureThreadWorker() { #if PLATFORM_LUMIN lock (_cameraLockObject) { if (MLCamera.IsStarted && _isCameraConnected) { MLResult result = MLCamera.CaptureRawImageAsync(); if (result.IsOk) { _isCapturing = true; } } } #endif }
/// <summary> /// Worker function to call the API's Capture function /// </summary> private void CaptureThreadWorker() { lock (_cameraLockObject) { if (MLCamera.IsStarted && _isCameraConnected) { MLResult result = MLCamera.CaptureRawImageAsync(); if (result.IsOk) { _isCapturing = true; } else if (result.Code == MLResultCode.PrivilegeDenied) { _doPrivPopup = true; } } } }
public async UniTask <byte[]> Capture() { await UniTask.SwitchToThreadPool(); if (!MLCamera.IsStarted) { throw new Exception("MLCamera not running"); } UniTask <byte[]> receiveCapturedImage = Observable.FromEvent <byte[]>( h => MLCamera.OnRawImageAvailable += h, h => MLCamera.OnRawImageAvailable -= h) .ToUniTask(useFirstValue: true); MLCamera.CaptureRawImageAsync().ThrowIfFail(); return(await receiveCapturedImage); }