[UWP] [VB]从MediaCapture重复图像捕获 [英] [UWP][VB]Repeating Image Capture From MediaCapture

查看:63
本文介绍了[UWP] [VB]从MediaCapture重复图像捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MediaCapture,我将从中获取我将要分析的图像。我想要做的基本过程是:


1。扫描图像

2.分析图像

3.根据结果更新显示


我想不断重复这个过程,直到我停止它,但我还需要继续听其他事件。我的第一个想法是使用DispatchTimer,但因为我不知道这个过程需要多长时间,所以这不起作用。我还想过
创建一个递归方法来执行此操作(调用自身重复该过程),但我不确定这是否会干扰页面上的其他事件(例如按钮点击会阻止它) 。有什么想法?




Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

Nathan Sokalski,


如果递归方法包含一些异步方法,我认为递归方法可能会中断其他事件。我的建议是在调用递归方法时添加一个CancellationTokenSource。所以你可以随时取消
方法。在屏幕上制作一个遮罩并捕捉遮罩的触摸事件以触发取消操作。您可以在蒙版上添加一些注释,告诉用户它正在捕获图像,您可以触摸以停止该过程。当然,你
可以尝试其他类似的方法来实现这一点。 


祝你好运,


Roy


I have a MediaCapture from which I will be getting images that I will be analyzing. The basic process I want to do is:

1. Scan Image
2. Analyze Image
3. Update Display Based On Results

I want to continuously repeat this process until I stop it, but I also need to continue listening for other events. My first thought was to use a DispatchTimer, but because I don't know how long the process will take, this will not work. I also thought about creating a recursive method that does this (calls itself to repeat the process), but I was not sure if this would interfere with other events on the page (such as the button clicks that would stop it). Any ideas?


Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

Hi Nathan Sokalski,

I think it is possible that the recursive method will interrupt other events if the recursive method contains some asynchronous methods. My suggestion is that add a CancellationTokenSource when you are calling the recursive method. So you could cancel the method whenever you want. Make a mask in the screen and capture the touch event of the mask to trigger the cancel operation. You could add some note on the mask to tell users it is capturing the image and you could touch to stop the process. Of course, you could try other similar methods to implement this. 

Best regards,

Roy


这篇关于[UWP] [VB]从MediaCapture重复图像捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆