All Projects → kangdp → StarBarcode

kangdp / StarBarcode

Licence: Apache-2.0 License
一个基于Zxing封装的条形码扫描库。支持多种条形码,可生成、解析带logo的二维码,自动放大镜头,设备移动时自动对焦、连续对焦,扫描UI自定义。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to StarBarcode

Ngx Scanner
Angular (2+) QR code, Barcode, DataMatrix, scanner component using ZXing.
Stars: ✭ 420 (+707.69%)
Mutual labels:  barcode, zxing
browser
ZXing for JS's browser layer with decoding implementations for browser.
Stars: ✭ 88 (+69.23%)
Mutual labels:  barcode, zxing
Code Scanner
Code scanner library for Android, based on ZXing
Stars: ✭ 543 (+944.23%)
Mutual labels:  barcode, zxing
Qzxing
Qt/QML wrapper library for the ZXing library. 1D/2D barcode image processing library
Stars: ✭ 401 (+671.15%)
Mutual labels:  barcode, zxing
Qrandbarcodescanner
An Android app for scanning QR codes and barcodes
Stars: ✭ 114 (+119.23%)
Mutual labels:  barcode, zxing
Zxing
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
Stars: ✭ 28,795 (+55275%)
Mutual labels:  barcode, zxing
Zxingview
👍 Lowest cost integration and most convenient customization zxing on android
Stars: ✭ 23 (-55.77%)
Mutual labels:  barcode, zxing
Czxing
C++ port of ZXing and ZBar for Android.
Stars: ✭ 854 (+1542.31%)
Mutual labels:  barcode, zxing
Scannermapp
A QR-code and barcode acanner app built in Delphi using ZXing and TFrameStand
Stars: ✭ 65 (+25%)
Mutual labels:  barcode, zxing
Library
Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.
Stars: ✭ 1,006 (+1834.62%)
Mutual labels:  barcode, zxing
Nbzxing
🔥 2020年最好用的开源扫码,全方位优化,强烈推荐!! 支持多种常规zxing无法扫出的码,用就完了!! 🔥
Stars: ✭ 184 (+253.85%)
Mutual labels:  barcode, zxing
Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+3971.15%)
Mutual labels:  barcode, zxing
ZxingSupport
A Library based on Zxing, make you easy to develop 1D/2D barcode-scan App.
Stars: ✭ 15 (-71.15%)
Mutual labels:  barcode, zxing
dart barcode
Barcode generation library
Stars: ✭ 79 (+51.92%)
Mutual labels:  barcode
r scan
📷🖨Flutter二维码&条形码扫描插件,支持相机、文件、链接、Uint8List类型扫描
Stars: ✭ 108 (+107.69%)
Mutual labels:  barcode
pola-ios
Pola pomoże Ci odnaleźć polskie wyroby. Zabierając Polę na zakupy odnajdujesz produkty “z duszą” i wspierasz polską gospodarkę.
Stars: ✭ 17 (-67.31%)
Mutual labels:  barcode
SwiftGS1Barcode
A GS1 Barcode Library and Parser in Swift
Stars: ✭ 22 (-57.69%)
Mutual labels:  barcode
ZxingSimplify
一个精简的安卓Zxing扫码库。(A Zxing simplify library for Android)
Stars: ✭ 36 (-30.77%)
Mutual labels:  zxing
ImageCropper
✂️ Detect and crop faces, barcodes, texts or rectangle in image with iOS 11 Vision (iOS 10 Core Image) api.(图片裁剪:支持人脸、二维码/条形码、文本、方框)
Stars: ✭ 17 (-67.31%)
Mutual labels:  barcode
glide-barcode
GlideBarcode is an open-source barcode loading extension for Android Glide that wraps barcode generating and displaying.
Stars: ✭ 24 (-53.85%)
Mutual labels:  barcode

StarBarcode

一个基于Zxing封装的条形码扫描库。支持多种条形码,可生成、解析带logo的二维码,自动放大镜头,设备移动时自动对焦、连续对焦,扫描UI自定义。

Demo下载

app-release.apk

截图

功能

  • 支持多种条形码格式
  • 支持移动对焦、连续对焦
  • 支持调节焦距
  • 支持当二维码较小时自动放大镜头(仅限二维码)
  • 支持闪光灯
  • 支持创建二维码,识别Bitmap二维码图片
  • 支持定制自己的条形码编解码器
  • 支持扫描UI自定义

添加依赖

 implementation 'com.kdp:starbarcode:1.0.6'

简单使用

  • 在布局xml中加入BarCodePreview

    <com.kdp.starbarcode.view.BarCodePreview
       android:id="@+id/barcodepreview"
       android:layout_width="match_parent"
       android:layout_height="match_parent"/>
    
  • 在Java中这样使用

    配置扫描参数

     Rect rect = new Rect(left,top,right,bottom);
     BarCodeScanConfig barCodeScanConfig = new BarCodeScanConfig.Builder()
              .setROI(rect)//识别区域
              .setBarCodeType(BarCodeType.ALL)//可识别所有的条形码
              .build();
     barCodePreview.setBarCodeScanConfig(barCodeScanConfig);
     
     //结果回调
     barCodePreview.setOnBarCodeScanResultListener(new OnBarCodeScanResultListener() {
          @Override
          public void onSuccess(String result) {
              //识别成功后再次识别
              barCodePreview.startRecognize();
             ...
          }
          @Override
          public void onFailure() {
             //失败
             ...
          }
      });
    

    打开摄像头,开始识别

      @Override
      protected void onStart() {
          super.onStart();
          barCodePreview.openCamera();
          barCodePreview.startRecognize();
        }
    

    关闭摄像头,停止识别

       @Override
       protected void onStop() {
           super.onStop();
           barCodePreview.stopRecognize();
           barCodePreview.closeCamera();
        }
    

API

  • BarCodeScanConfig

       BarCodeScanConfig barCodeScanConfig = new BarCodeScanConfig.Builder()
              .setROI(rect) //识别区域
              .setAutofocus(true) //自动对焦,默认为true
              .setZoom(30)//焦距
              .setDisableContinuous(false) //是否禁用连续对焦,必须在Autofocus为true的前提下,该参数才有效;默认为true
              .setBarCodeType(BarCodeType.ALL) //识别所有的条形码
              .setBarCodeType(BarCodeType.ONE_D_CODE) //仅识别所有的一维条形码
              .setBarCodeType(BarCodeType.TWO_D_CODE) //仅识别所有的二维条形码
              .setBarCodeType(BarCodeType.QR_CODE) //仅识别二维码,可提升识别速度
              .setBarCodeType(BarCodeType.CODE_128) //仅识别CODE 128码,可提升识别速度
              .setBarCodeType(BarCodeType.CUSTOME) //自定义条码类型,必须指定识别的条形码格式
              .setBarcodeFormats(EnumSet.of(BarcodeFormat.QR_CODE,BarcodeFormat.CODE_128)) //自定义识别的条形码格式
              .setSupportAutoZoom(true) //当二维码图片较小时自动放大镜头(仅支持QR_CODE)
              .build();
    

    注意

    • 该库内部并没有提供扫描框的实现,需要开发者自己去定制,而识别区域需要通过setROI(...)参数去设置,并且该参数不能为空。
    • 当多次设置BarCodeType时,只有最后一次才会生效;而当BarCodeType设置为CUSTOME时,必须要使用setBarcodeFormats(...)来指定要识别的条形码格式;若没有配置此参数,默认会识别所有的条形码。
  • BarCodePreview

       barCodePreview.openCamera() //打开摄像头开始预览
             ...      closeCamera() 关闭摄像头结束预览
             ...      startRecognize() //开始识别
             ...      stopRecognize() //停止识别
             ...      turnOnFlashLight() //打开闪光灯,注意:在此之前必须先打开摄像头
             ...      turnOffFlashLight() //关闭闪光灯
             ...      openCamera() //打开摄像头
             ...      closeCamera() //关闭摄像头
             ...      startPreview() //开始预览
             ...      stopPreview() //停止预览
             ...      setZoom(...) //设置焦距
    
  • 创建/解析 二维码图片

           //实例化QRCode编解码器
            QRCodeCodec  qrCodeCodec = new QRCodeCodec();
            //解析二维码图片,返回String
            String content = qrCodeCodec.decodeQRCode(Bitmap bitmap); //参数:要解析二维码图片
            //创建二维码图片,返回Bitmap
            Bitmap bitmap = qrCodeCodec.encodeQRCode(String content,int pixelSize); //参数:要创建的二维码内容和尺寸
            //创建带logo的二维码图片,返回Bitmap
            Bitmap bitmap = qrCodeCodec.encodeQRCode(String content,int pixelSize,Bitmap logo); //参数:要创建的二维码的内容、尺寸和logo
    
  • 自定义条形码编解码器,定制自己的条形码(可参考库中已实现的QRCodeCodec类)

感谢

LICENSE

Copyright 2019 kangdongpu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].