我想构建一个Web应用程序(Html5 + Javascript,没有闪存),使用智能手机相机,扫描QR码,并将结果发送到服务器.那可能吗?
谢谢!
我目前正在开发一种扫描仪,可以读取一张图像中的多个QR码.我设法读取图像中的QR码,但它给了我不一致的结果.假设图像中有4个QR码,有时我可以读取2个,有时3个或仅1个.与原始扫描仪(ZXing扫描仪)不同,它可以快速解码.在我的情况下,我必须确保有足够的光线,图像不会模糊解码.
我正在使用它QRCodeMultiReader
来解码图像.目前正在使用ZXing
Library来创建应用程序.
以下是我的代码片段:
public void onPictureTaken(byte[] data, Camera camera) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inMutable = true;
Bitmap bitmap = BitmapFactory
.decodeByteArray(data, 0, data.length, opt);
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
LuminanceSource source = new RGBLuminanceSource(bitmap);
QRCodeMultiReader multiReader = new QRCodeMultiReader();
Result[] results = multiReader.decodeMultiple(new BinaryBitmap(
new HybridBinarizer(source)), hints);
}
Run Code Online (Sandbox Code Playgroud) 快速的谷歌搜索结果,QR码可以容纳近3kb(8位)的数据.但是,它不只是使用黑/白点来表示位吗?如果是这样,代码上就不会有超过20,000个点.
所以我显然是误会.有人能解释它是如何工作的吗?
我的理解是,QR码包含正在读取的数据,并且它不需要互联网连接来解释代码.如果是这种情况,为什么每次重新创建具有相同数据的新QR时都会获得不同的QR码?
如果我使用两个不同的生成器来创建相同的代码,我会看到明确的差异.例如,创建指向http://www.yahoo.com的URL链接会在这些网站上创建两个不同的QR:
我希望在基于PhoneGap的移动应用程序中使用QR码.有几种方法可以使用javascript生成QR码.我正在使用Jerome Etienne的基于jquery的解决方案.
我正在为支持摄像头的平台寻找纯Javascript解决方案或一组PhoneGap插件,这些平台将读取图像中的QR编码数据.
到目前为止,我发现的只是LazarSoft的一个演示.还有其他解决方案吗?
您好我有QR码图像,我想调整大小,当我尝试使用此代码将其调整为小图像时,我总是得到一个blury图像,当我扫描它时QR码不再有效,但是当我使用相同的代码调整大尺寸图像时,它工作正常:
public BufferedImage getScaledInstance(BufferedImage img,
int targetWidth,
int targetHeight,
Object hint,
boolean higherQuality)
{
int type = (img.getTransparency() == Transparency.OPAQUE) ?
BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage ret = (BufferedImage)img;
int w, h;
if (higherQuality) {
// Use multi-step technique: start with original size, then
// scale down in multiple passes with drawImage()
// until the target size is reached
w = img.getWidth();
h = img.getHeight();
} else {
// Use one-step technique: scale directly from original
// size to target size …
Run Code Online (Sandbox Code Playgroud) 当应用程序的主视图在屏幕上时,我需要在我的Android应用程序中连续扫描QR码.主视图应包含带摄像头预览的窗口,但不包含全屏摄像头预览.
用法示例:包含扫描的QR码列表和相机预览的主视图.扫描新的QR码时,会将其添加到列表中.
可能吗?
关于使用Zxing的一些问题......
我编写以下代码来从图像中读取条形码:
public class BarCodeDecode
{
/**
* @param args
*/
public static void main(String[] args)
{
try
{
String tmpImgFile = "D:\\FormCode128.TIF";
Map<DecodeHintType,Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class));
tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);
File tmpFile = new File(tmpImgFile);
String tmpRetString = BarCodeUtil.decode(tmpFile, tmpHintsMap);
//String tmpRetString = BarCodeUtil.decode(tmpFile, null);
System.out.println(tmpRetString);
}
catch (Exception tmpExpt)
{
System.out.println("main: " + "Excpt err! (" + tmpExpt.getMessage() + ")");
}
System.out.println("main: " + "Program end.");
}
}
public class BarCodeUtil
{
private static …
Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个应用程序,它将使用票证给用户验证它们的能力.我想知道为什么我应该选择Aztec条形码,因为许多公司已经选择了而不是QR码.Aztec条形码的优点是什么?
到目前为止,我发现的良好比较是:http: //www.tec-it.com/en/support/knowbase/barcode-overview/2d-barcodes/Default.aspx
在这里:http:http://en.wikipedia.org/wiki/Aztec_Code on Usage部分你可以看到它经常被使用.
我按照本教程学习如何构建可以扫描QR码的Android应用程序.
这是完整的代码.我使用等级添加了Google Play服务compile 'com.google.android.gms:play-services:7.8.0'
.
AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bitinvent.io.qrscanner" >
<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<SurfaceView
android:id="@+id/cameraView"
android:layout_width="640px"
android:layout_height="480px"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/infoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/cameraView"
android:layout_marginLeft="16dp"
android:text="Nothing to read"
android:textSize="20sp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
MainActivity.java
package bitinvent.io.qrscanner;
import …
Run Code Online (Sandbox Code Playgroud)