我创建了一个简单的移动应用程序,它显示相机并用https://github.com/LazarSoft/jsqrcode解码https://github.com/LazarSoft/jsqrcode
因为我的相机是模糊的,这适用于大型QRCodes。有没有办法用Javascript对摄像机进行对焦?因此,这也适用于较小的图像,还是有另一种解决方案?
编辑我注意到如果我使用Android (而不是HTML5版本),它可以处理更多的色差,可以扫描我的代码,而jsqrcode不能。我用错图书馆了吗?
使用ZXING
我的工作代码:
public void scan() {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// On Scan result we get get to this part
try {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
// CODE
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}还需要将导入com.google.zxing.integration.android包添加到我的项目中。
发布于 2014-01-29 20:49:05
HTML5版本甚至可以在你的手机上工作吗?CanIUse建议,除了黑莓,它不应该在任何移动设备上工作。但它们有时并不是最新的。
无论哪种方式--怀疑是否有这样一个新的API的一刀切的解决方案。您能看到在手机上使用应用程序(本机代码)版本和桌面使用闪存版本的情况吗?您必须执行自己的设备嗅探:
if( user_has_flash ) {
// Load an HTML5/Flash solution
} else if( is_mobile_device) {
// defer to the native code
// zxing has a phonegap plugin - https://github.com/wildabeast/BarcodeScanner
} else {
alert("Your device does not have scanning capabilities");
}https://stackoverflow.com/questions/20219700
复制相似问题