async Task DetectBitmapInBackgroundAsync(AnimeFaceDetector c, BitmapFrame bf, double factor, int min, int size) { c.LoadCascade(); var s = await c.DetectBitmap(bf, factor, min, new Size(size, size)); Rects = s.ToList(); }
async Task DetectBitmapInBackgroundAsync(BitmapFrame bf, double factor, int min, int size, ImageCropper parent) { AnimeFaceDetector c = new AnimeFaceDetector(); c.LoadCascade(); var s = await c.DetectBitmap(bf, factor, min, new Size(size, size)); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { parent.Rects = s.ToList(); }); //Rects = s.ToList(); }
async Task DetectBitmapInBackgroundAsync(IBuffer proxyResult, double factor, int min, int size, ImageCropper parent) { // Decode BitmapDecoder bd = await BitmapDecoder.CreateAsync(proxyResult.AsStream().AsRandomAccessStream()); BitmapFrame bf = await bd.GetFrameAsync(0); // Detect AnimeFaceDetector c = new AnimeFaceDetector(); c.LoadCascade(); var s = await c.DetectBitmap(bf, factor, min, new Size(size, size)); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { parent.Rects = s.ToList(); }); }
private async void ProxyImage_ImageOpened(object sender, RoutedEventArgs e) { // Download IBuffer proxyResult = null; HttpClient client = new HttpClient(); try { proxyResult = await client.GetBufferAsync(new Uri(ProxySource)); } catch (Exception ex) { return; } // Detect var factor = 1.05; var min = 3; var size = 25; AnimeFaceDetector c; c = new AnimeFaceDetector(); BitmapDecoder bd = await BitmapDecoder.CreateAsync(proxyResult.AsStream().AsRandomAccessStream()); BitmapFrame bf = await bd.GetFrameAsync(0); try { var s = await c.DetectBitmap(bf, factor, min, new Size(size, size)); Rects = s.ToList(); } catch (Exception ex) { } }