首先,我閱讀了所有這些主題,瞭解如何在Java中使用Zxing,但總是在com.google.zxing.client.j2se丟失時出錯。 zxing core-3.2.1.jar在eclipse和所有其他zxing軟件包工作除非j2se)或剛剛找到創建qr圖像的解決方案...查找圖像中的QR碼並使用Zxing對其進行解碼
我的目標是編寫一個單一的方法,獲取圖像文件找到qr在此圖像中碼,解碼QR碼,並返回字符串,基本上就應該是這樣的:
import com.google.zxing.*;
public class QRCode {
/*
* ...
*/
public String getDecodedString(SomeStandardImageType photo){
// detect the qr code in a photo
// create qr image from detected area in photo
// decode the new created qr image and return the string
return "This is the decoded dataString from the qr code in the photo";
}
}
綜上所述方法應該得到的圖像文件,如後續荷蘭國際集團
,而應返回的URL,或者如果只是失敗 「」。
該代碼應該與Zxing 3.2.1兼容。
編輯:問題已解決。對於對此感興趣的其他人,我想說,將外部罐子core-3.2.1.jar
和javase-3.2.1.jar
添加到外部罐子是很重要的。我的答案沒有後者,但取決於Android圖像庫。
什麼你的問題? –
問題是我怎樣才能使用Zxing 3.2.1的算法;另一個方向顯示在這裏:http://crunchify.com/java-simple-qr-code-generator-example/ – Tim