标签: qr-code

Android使用ZXing生成QR码

在尝试在Android编程中生成QR代码时遇到了一些问题.这是我遵循的教程.单击"生成"按钮时,我调用此方法:

private void generateQR(){
    String qrInputText = "test";

    //Find screen size
    WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    Point point = new Point();
    display.getSize(point);
    int width = point.x;
    int height = point.y;
    int smallerDimension = width < height ? width : height;
    smallerDimension = smallerDimension * 3/4;

    //Encode with a QR Code image
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(
        qrInputText, 
        null, 
        Contents.Type.TEXT,  
        BarcodeFormat.QR_CODE.toString(), 
        smallerDimension
    );
    try {
        Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
        ImageView myImage = (ImageView) findViewById(R.id.ivImage);
        myImage.setImageBitmap(bitmap); …
Run Code Online (Sandbox Code Playgroud)

java android qr-code zxing

23
推荐指数
3
解决办法
4万
查看次数

java中的QR码图像生成器(开源但没有GPL)

我正在寻找java(J2SE)中的开源QR码图像生成器组件,但开源许可证不能是GPL许可证(需要包含在一个密切的源项目中).

顺便说一句,我无法从项目访问网络,因此没有Google API.

java encode qr-code

22
推荐指数
2
解决办法
4万
查看次数

示例代码,用于检测图像中的QRCode

我在C#中使用此代码来解码(不检测)QRCode并且它可以工作:

LuminanceSource ls = new RGBLuminanceSource(image, image.Width, image.Height);
Result result = new QRCodeReader().decode(new BinaryBitmap(new HybridBinarizer(ls)));
Run Code Online (Sandbox Code Playgroud)

现在我想在一个更复杂的图像中检测一个QRCode,其中包含许多其他的东西,如图像和文本.我无法理解如何实现这一点,因为我找不到任何样本并将Bitmap(C#)转换为Bitmatrix for Detector(zxing)并不是那么直接.

有没有人有一段代码可以给我?

非常感谢


UPDATE


我尝试这个代码,但我得到一个ReaderException:

代码:

LuminanceSource ls = new RGBLuminanceSource(bitmap, bitmap.Width, bitmap.Height);            
QRCodeMultiReader multiReader = new QRCodeMultiReader();
Result[] rs = multiReader.decodeMultiple(new BinaryBitmap(new HybridBinarizer(ls)), hints);
 return rs[0].Text;
Run Code Online (Sandbox Code Playgroud)

例外

com.google.zxing.ReaderException:

in com.google.zxing.qrcode.detector.FinderPatternFinder.selectBestPatterns()
   in com.google.zxing.qrcode.detector.FinderPatternFinder.find(Hashtable hints)
   in com.google.zxing.qrcode.detector.Detector.detect(Hashtable hints)
   in com.google.zxing.qrcode.QRCodeReader.decode(BinaryBitmap image, Hashtable hints)
   in com.google.zxing.qrcode.QRCodeReader.decode(BinaryBitmap image)
   in ...Logic.BarCodeManager.QRCodeReader(Bitmap bitmap) in 
Run Code Online (Sandbox Code Playgroud)

更新02/12/2011


我刚刚尝试用我的iPhone上的应用程序扫描打印的QRCode(帖子顶部的代码片段),它运行良好!所以问题肯定在检测/解码阶段.

c# qr-code zxing

22
推荐指数
1
解决办法
1万
查看次数

如何为Google身份验证器生成正确显示OTP上方显示的颁发者的QR码?

所以,我知道这里的文档,在这里找到:Google Authenticator密钥URI格式

当我从该页面关注此示例时:

otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
Run Code Online (Sandbox Code Playgroud)

我将它拼接成Google Charts网址,因此:

https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
Run Code Online (Sandbox Code Playgroud)

它将显示有效的QR码,如果我在手机上使用我的Google身份验证器应用程序进行扫描,它将开始生成有效的OTP.

但是,在手机的显示屏上,对于QR码创建的条目,我获得了OTP,在其下面,我得到了"示例:alice@google.com".我想要的是在OTP 上方显示"示例" ,在OTP 下方显示"alice@google.com" .我不禁注意到,所有专业制作的应用程序都是这样做的.例如,Google,Wordpress,亚马逊等.公司名称位于OTP 之上,用户名显示在OTP 下方.是的,这纯粹是一个整容问题,但我想做对.

任何人都可以给我一个线索吗?

qr-code google-authenticator

22
推荐指数
3
解决办法
4万
查看次数

JavaScript QR Code Reader - 可以做到吗?或者,远程服务?

我正在对即将开展的项目进行一些初步研究,我有一个简短的问题,我想我会在其他地方看到这里,以防万一有任何经验.

问题很简单:是否可以使用JavaScript读取QR码?是否有一个远程服务,我可以从相机传递一个位图对象,并这样做?目前是否有任何图书馆允许这样做?

该项目将部署到各种移动设备,我们想尝试使用Appcelerator使其工作.我知道Appcelerator确实在其主机设备上公开了Camera API,但无论我们用它做什么都必须能够解析QR码.这是可以做到的吗?

提前致谢!MYK

javascript php qr-code augmented-reality appcelerator

20
推荐指数
2
解决办法
2万
查看次数

Google API - 使用PHP的URL Shortener

我的代码如下.URL缩短服务有效,但是当我插入我的时,它不会$POST.有谁知道如何修复这个我看代码?

// This is the URL you want to shorten
$longUrl = 'http://www.mysite.com/XXXXX/XX/$_POST['qrname']';

// Get API key from : http://code.google.com/apis/console/
$apiKey = 'MyAPIKey';

$postData = array('longUrl' => $longUrl, 'key' => $apiKey);
$jsonData = json_encode($postData);

$curlObj = curl_init();

curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url');
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json'));
curl_setopt($curlObj, CURLOPT_POST, 1);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData);

$response = curl_exec($curlObj);

// Change the response json string to object
$json = json_decode($response);

curl_close($curlObj);

echo 'Shortened URL is: '.$json->id;
Run Code Online (Sandbox Code Playgroud)

php url curl qr-code

20
推荐指数
4
解决办法
3万
查看次数

将WiFi设置共享为WPA2 Enterprise的QR码

我找到了几个描述字符串格式的源代码,用于描述以下形式的WiFi访问设置:

WIFI:T:WPA;S:mynetwork;P:mypass;;
Run Code Online (Sandbox Code Playgroud)

(例子来自zxing文档)

对于基本的WPA-连接,这个工作对我使用Android设备就好了斑马线,条形码扫描应用程序内.但是,我一直无法找到将WPA2/EAP-Connection设置(也称为WPA2 Enterprise)嵌入到可扫描的2D代码中的方法.正如我所料,在随机位置插入"L"(登录),"N"(名称)或"I"(识别)参数并没有真正带来任何进步.

有没有人在这里成功地"嵌入" WiFi的连接设置成2D可扫描代码使用Android设备来工作?

谢谢你的帮助!

android qr-code wifi

19
推荐指数
1
解决办法
7622
查看次数

使用PhoneGap的QR码扫描仪

我已经成功地遵循了这个主题
Phonegap 3.0.0:BarcodeScanner Plugin

但它似乎无法扫描Qr代码.这是从手机拍摄的屏幕:

在此输入图像描述

我试过扫描条形码图像,它工作正常.但不是QR图像.
任何的想法?

编辑

    var scanner = cordova.require("com.phonegap.plugins.barcodescanner.barcodescanner");

    scanner.scan(
        function (result) {
            alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
        },
        function (error) {
            alert("Scanning failed: " + error);
        }
    );  
Run Code Online (Sandbox Code Playgroud)

编辑2
DuuhhH !!! 问题是QR图像,它没有边际,肖恩欧文说.

qr-code barcode-scanner cordova

19
推荐指数
1
解决办法
2万
查看次数

在iOS上设置初始焦距

我正在开发一个iOS应用程序,其中一项功能是扫描QR码.为此,我使用了优秀的图书馆ZBar.扫描工作正常,通常很快.但是,当您使用较小的QR码时,扫描需要更长的时间,主要是因为自动对焦需要一些时间来调整.我正在尝试并注意到可以使用以下代码锁定焦点:

AVCaptureDevice *cameraDevice = readerView.device;
if ([cameraDevice lockForConfiguration:nil]) {
     [cameraDevice setFocusMode:AVCaptureFocusModeLocked];
     [cameraDevice unlockForConfiguration];
}
Run Code Online (Sandbox Code Playgroud)

在成功扫描后使用此代码时,即将进行的扫描非常快.这让我很奇怪,在扫描一个代码之前,我能以某种方式锁定焦点吗?该应用程序将只扫描相当小的QR码,因此永远不需要专注于远处的东西.当然,我可以实现像tap一样专注的东西,但最好是我想避免这个额外的步骤.有没有办法实现这个目标?或者,在处理较小的QR码时,是否有其他方法可以加快速度?

//亚历山大

camera focus qr-code ios

18
推荐指数
2
解决办法
8519
查看次数

Delphi QR Code组件/发生器?

我正在拼命寻找QR码组件来生成QR码.到目前为止,我发现的唯一方法是通过Google API图表,但我需要一个离线方法. http://theroadtodelphi.wordpress.com/2010/12/06/generating-qr-codes-with-delphi/

我找不到任何可以生成QR码的组件,无论是否免费.任何的想法?

谢谢!

delphi qr-code

17
推荐指数
3
解决办法
3万
查看次数