简体   繁体   English

具有Google视觉的QR码扫描仪的自动缩放功能

[英]Auto-zoom feature for QR Code scanner with Google vision

I want to build auto-zoom feature for QR scanner app. 我想为QR扫描仪应用程序建立自动缩放功能。 I'm using android google vision library. 我正在使用android Google视觉库。

When user align camera to QR code, if distance from camera to QR code is so far, library cannot decode it, I want camera auto zoom-in into QR code to it can decode. 当用户将相机对准QR码时,如果从相机到QR码的距离太远,则库无法对其进行解码,我希望相机自动放大到QR码即可对其进行解码。 I think camera need to know objects similar with QR. 我认为相机需要知道与QR类似的物体。 Are there any way to do it? 有什么办法吗? Following this sample https://github.com/googlesamples/android-vision 遵循此示例https://github.com/googlesamples/android-vision

I tried to work with Google Vision, but it just hasn't worked out for me. 我曾尝试使用Google Vision,但对我来说还没有成功。 My use case was simply to read a QR code. 我的用例只是读取QR码。

I ended up using Zxing library , and it was really painless if I may add. 我最终使用了Zxing库 ,如果可以添加的话,真的很轻松

I should only mention that, afaik, if you want to read QR code that is perhaps too small, zooming might not help. 我只应该提到afaik,如果您想读取的QR码可能太小,缩放可能无济于事。

[ How can I add zoom in/out gesture in Android vision CameraSource ] [ 如何在Android vision CameraSource中添加放大/缩小手势 ]

This question might have what you are looking for. 这个问题可能有您想要的。 They recommend making a call to startSmoothZoom(int) that zooms the physical camera for (int) seconds. 他们建议致电startSmoothZoom(int) ,以将物理摄像头缩放(int)秒。 You will probably have to modify the CameraSource.cs script in android-vision. 您可能必须在android-vision中修改CameraSource.cs脚本。

Note: This was depcrecated in API level 21. If this affects you, use the Camera2 api. 注意:API级别21中不建议使用此方法。如果这影响到您,请使用Camera2 api。 This is discussed here: [ android camera2 handle zoom ]. 这里讨论:[ android camera2手柄缩放 ]。 Camera2 is recommended for new applications. 建议将Camera2用于新应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM