void OnStoppedPhotoMode(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result) { // Dispose from the object in memory and request the image analysis // to the VisionManager class photoCaptureObject.Dispose(); photoCaptureObject = null; StartCoroutine(VisionManager.instance.AnalyseLastImageCaptured()); }
void OnCapturedPhotoToDisk(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result) { if (result.success) { Debug.Log("Saved Photo to disk!"); photoCapture.StopPhotoModeAsync(OnStoppedPhotoMode); } else { Debug.Log("Failed to save Photo to disk"); } }
private static PhotoCapture.PhotoCaptureResult MakeCaptureResult(long hResult) { PhotoCapture.PhotoCaptureResult result = default(PhotoCapture.PhotoCaptureResult); bool flag = hResult == PhotoCapture.HR_SUCCESS; PhotoCapture.CaptureResultType resultType; if (flag) { resultType = PhotoCapture.CaptureResultType.Success; } else { resultType = PhotoCapture.CaptureResultType.UnknownError; } result.resultType = resultType; result.hResult = hResult; return(result); }
private void OnPhotoModeStarted(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result) { /* Load to Memory */ if (result.success) { try { photoCapture.TakePhotoAsync(OnCapturedPhotoToMemory); } catch (System.ArgumentException e) { Debug.LogError("System.ArgumentException:\n" + e.Message); } } else { Debug.LogError("Unable to start photo mode!"); } }
void OnCapturedPhotoToMemory(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result, UnityEngine.Windows.WebCam.PhotoCaptureFrame photoCaptureFrame) { if (result.success) { List <byte> imageBufferList = new List <byte>(); Debug.Log("OnCapturedPhotoToMemory Copy Started"); photoCaptureFrame.CopyRawImageDataIntoBuffer(imageBufferList); Debug.Log("OnCapturedPhotoToMemory " + imageBufferList.Count); //Execute OCR Coroutine ExecuteMCSComputerVisionOCR(imageBufferList); } else { Debug.Log("Failed to save Photo to memory"); } photoCapture.StopPhotoModeAsync(OnStoppedPhotoMode); }
/// <summary> /// Register the full execution of the Photo Capture. If successful, it will begin /// the Image Analysis process. /// </summary> void OnCapturedPhotoToDisk(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result) { // Call StopPhotoMode once the image has successfully captured photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode); }
private void OnStoppedPhotoMode(UnityEngine.Windows.WebCam.PhotoCapture.PhotoCaptureResult result) { photoCapture.Dispose(); photoCapture = null; }