资源简介

QR识别和译码matlab程序,运用图像校正、二值化、边缘检测等图像处理方法实现条码的预处理,并进行QR码的解码和纠错算法,充分利用面向对象的方法,结合图像处理技术,完成基于图像处理的QR码

资源截图

代码片段和文件信息

/**
 * 
 */
package com.b510.qrcode;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;

import javax.imageio.ImageIO;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.EncodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import com.google.zxing.Writer;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.oned.CodaBarWriter;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.oned.Code39Writer;
import com.google.zxing.oned.EAN13Writer;
import com.google.zxing.oned.EAN8Writer;
import com.google.zxing.oned.ITFWriter;
import com.google.zxing.oned.UPCAWriter;
import com.google.zxing.pdf417.encoder.PDF417Writer;
import com.google.zxing.qrcode.QRCodeWriter;

/**
 * 利用zxing开源工具生成二维码QRCode
 * 
 * @date 2012-10-26
 * @author xhw
 * 
 */
public class QRCode {
private static final int BLACK = 0xff000000;
private static final int WHITE = 0xFFFFFFFF;

/**
 * @param args
 */
public static void main(String[] args) {
QRCode test = new QRCode();

/**
 * 在com.google.zxing.MultiFormatWriter类中,定义了一些我们不知道的码二维码只是其中的一种

 * public BitMatrix encode(String contents
                          BarcodeFormat format
                          int width int height
                          Map hints) throws WriterException {
    Writer writer;
    switch (format) {
      case EAN_8:
        writer = new EAN8Writer();
        break;
      case EAN_13:
        writer = new EAN13Writer();
        break;
      case UPC_A:
        writer = new UPCAWriter();
        break;
      case QR_CODE:
        writer = new QRCodeWriter();
        break;
      case CODE_39:
        writer = new Code39Writer();
        break;
      case CODE_128:
        writer = new Code128Writer();
        break;
      case ITF:
        writer = new ITFWriter();
        break;
      case PDF_417:
        writer = new PDF417Writer();
        break;
      case CODABAR:
        writer = new CodaBarWriter();
        break;
      default:
        throw new IllegalArgumentException(“No encoder available for format “ + format);
    }
    return writer.encode(contents format width height hints);
  }

 */
String filePostfix=“png“;
File file = new File(“C://test_QR_CODE.“+filePostfix);
test.encode(“helloworldI‘m Hongten.welcome to my zone:http://www.cnblogs.com/hongtenhelloworldI‘m Hongte

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        510  2012-10-26 21:20  QRCodes\.classpath

     文件        383  2012-10-26 21:10  QRCodes\.project

     文件        598  2012-10-26 21:10  QRCodes\.settings\org.eclipse.jdt.core.prefs

     文件       7987  2012-10-27 09:25  QRCodes\bin\com\b510\qrcode\QRCode.class

     文件     449685  2012-10-26 21:10  QRCodes\core.jar

     文件      33443  2012-10-26 21:10  QRCodes\javase.jar

     文件       9265  2012-10-27 09:25  QRCodes\src\com\b510\qrcode\QRCode.java

     目录          0  2012-10-26 21:11  QRCodes\bin\com\b510\qrcode

     目录          0  2012-10-26 21:11  QRCodes\src\com\b510\qrcode

     目录          0  2012-10-26 21:11  QRCodes\bin\com\b510

     目录          0  2012-10-26 21:11  QRCodes\src\com\b510

     目录          0  2012-10-26 21:11  QRCodes\bin\com

     目录          0  2012-10-26 21:11  QRCodes\src\com

     目录          0  2012-10-26 21:10  QRCodes\.settings

     目录          0  2012-10-26 21:11  QRCodes\bin

     目录          0  2012-10-26 21:11  QRCodes\src

     目录          0  2012-10-26 21:10  QRCodes

----------- ---------  ---------- -----  ----

               501871                    17


评论

共有 条评论