private async void Analyze() { this.analyzer = MLSceneDetectionAnalyzerFactory.Instance.SceneDetectionAnalyzer; // Create an MLFrame by using android.graphics.Bitmap. Recommended image size: large than 224*224. Bitmap originBitmap = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.superresolution_image); MLFrame frame = new MLFrame.Creator() .SetBitmap(originBitmap) .Create(); Task <IList <MLSceneDetection> > task = this.analyzer.AnalyseFrameAsync(frame); try { await task; if (task.IsCompleted && task.Result != null && task.Result.Count != 0) { // Analyze success IList <MLSceneDetection> sceneInfos = task.Result; DisplaySuccess(sceneInfos); } else { // Analyze failed Log.Debug(Tag, "Analyze Failed"); DisplayFailure(); } } catch (Exception ex) { // Operation failed Log.Error(Tag, ex.Message); } }
private void CreateSegmentAnalyzer() { this.analyzer = MLSceneDetectionAnalyzerFactory.Instance.SceneDetectionAnalyzer; this.analyzer.SetTransactor(this); }