使用摄像机视图的一部分进行条码扫描 [英] Barcode scan using a portion of the camera view

查看:34
本文介绍了使用摄像机视图的一部分进行条码扫描的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想扫描条形码并全屏显示相机视图,但只想在条形码位于方形区域的中心时扫描,如下所示:

I want to scan a barcode and show the camera view in full screen but want to scan only when the barcode is in the centre of the square region as shown below:

这可以使用 Windows Phone 8 吗?

Is this possible using windows phone 8?

有什么技巧可以做到这一点吗?

Any tricks to do this?

推荐答案

如果您使用的是 8.1,则您尝试执行的操作可在名为 Bing Vision 的默认相机应用程序中使用.如果您使用的是 8.0,您只需单击搜索"按钮并点击视觉"图标,这基本上是相同的.如果你想自己编程这个功能,那么这真的取决于你想使用什么条码库.

If you're using 8.1 the thing you're trying to do is available in the default Camera App it's called Bing Vision. If you're using 8.0 you can just click on the Search button and Tap the Vision icon, which basically does the same thing. If you want to program this functionality yourself, then it really depends on what Barcode Library you want to use.

我会推荐 ZXing.网址:ZXing CodeProject

I would recommend ZXing. Website here: ZXing CodeProject

所以基本上你需要设置一个简单的相机应用程序并每隔几秒钟创建一次扫描操作.

So basically you need to setup a simple camera app and create a scanning operation every few seconds or so.

01) 像这样将相机的预览转换为可写位图

01) Get the preview of the camera into a Writeable Bitmap like so

cam.GetPreviewBufferArgb32(wbitmap.Pixels);    
wbitmap.Invalidate();
// crop your bitmap to whatever that RECT is

02) 解码您的位图

Result r = br.Decode(wbitmap);   // where br is your BarcodeReader

03) 用 r.Text 显示你的结果

03) Display your Result with r.Text

这篇关于使用摄像机视图的一部分进行条码扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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