All Projects → ftylitak → Qzxing

ftylitak / Qzxing

Licence: apache-2.0
Qt/QML wrapper library for the ZXing library. 1D/2D barcode image processing library

Projects that are alternatives of or similar to Qzxing

Scannermapp
A QR-code and barcode acanner app built in Delphi using ZXing and TFrameStand
Stars: ✭ 65 (-83.79%)
Mutual labels:  zxing, barcode-scanner, qrcode, barcode
Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+427.93%)
Mutual labels:  zxing, barcode-scanner, qrcode, barcode
Zxingview
👍 Lowest cost integration and most convenient customization zxing on android
Stars: ✭ 23 (-94.26%)
Mutual labels:  zxing, qrcode, barcode
Czxing
C++ port of ZXing and ZBar for Android.
Stars: ✭ 854 (+112.97%)
Mutual labels:  zxing, qrcode, barcode
Library
Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.
Stars: ✭ 1,006 (+150.87%)
Mutual labels:  zxing, qrcode, barcode
Barcodescanner.xf
Barcode Scanner using GoogleVision API for Xamarin Form
Stars: ✭ 82 (-79.55%)
Mutual labels:  barcode-scanner, qrcode, barcode
Code Scanner
Code scanner library for Android, based on ZXing
Stars: ✭ 543 (+35.41%)
Mutual labels:  zxing, barcode-scanner, barcode
barcode-server
Barcode Server for Barcode Client-Server android application
Stars: ✭ 40 (-90.02%)
Mutual labels:  qrcode, barcode, barcode-scanner
android-zbar-sdk
🔗 android-zbar-sdk, provide jni source, so file and jar file used alone, gradle/maven remote dependencies.
Stars: ✭ 311 (-22.44%)
Mutual labels:  qrcode, barcode, barcode-scanner
barcode-detector
Spec compliant polyfill of the Barcode Detection API 🤳
Stars: ✭ 31 (-92.27%)
Mutual labels:  qrcode, barcode, barcode-scanner
Qr Code Scanner
📠 A simple, fast and useful progressive web application
Stars: ✭ 982 (+144.89%)
Mutual labels:  barcode-scanner, qrcode, barcode
ZxingSupport
A Library based on Zxing, make you easy to develop 1D/2D barcode-scan App.
Stars: ✭ 15 (-96.26%)
Mutual labels:  qrcode, barcode, zxing
Efqrcode
A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.
Stars: ✭ 4,121 (+927.68%)
Mutual labels:  barcode-scanner, qrcode, barcode
Zxing
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
Stars: ✭ 28,795 (+7080.8%)
Mutual labels:  zxing, barcode-scanner, barcode
Nbzxing
🔥 2020年最好用的开源扫码,全方位优化,强烈推荐!! 支持多种常规zxing无法扫出的码,用就完了!! 🔥
Stars: ✭ 184 (-54.11%)
Mutual labels:  zxing, qrcode, barcode
BarcodeReader
Simple multi-format barcode reader for Windows
Stars: ✭ 26 (-93.52%)
Mutual labels:  qrcode, barcode, barcode-scanner
barcode scan2
[reborned barcode_scan] A flutter plugin for reading 2D barcodes and QR codes.
Stars: ✭ 43 (-89.28%)
Mutual labels:  qrcode, barcode, barcode-scanner
Quartz
Vulkan RTX path tracer with a declarative ES7-like scene description language.
Stars: ✭ 367 (-8.48%)
Mutual labels:  qt, qml
text
🚀 Material Design text editor
Stars: ✭ 73 (-81.8%)
Mutual labels:  qt, qml
tenplayer
Modern Music Player for Linux
Stars: ✭ 18 (-95.51%)
Mutual labels:  qt, qml

qzxing Build Status Build Status Total alerts Language grade: C/C++

Qt/QML wrapper library for the ZXing barcode image processing library.

Supports barcode decoding for the following types:

  • UPC-A
  • UPC-E
  • EAN-8
  • EAN-13
  • ITF
  • Code 39
  • Code 93
  • Code 128 (GS1)
  • Codabar
  • QR Code
  • Data Matrix
  • Aztec (beta)
  • PDF 417

Supports barcode encoding for the following types:

  • QR Code

Table of contents

  1. How to include
    1. Embed the source code
    2. Compile the project as an external library
    3. Control dependencies
      1. QZXing (core)
      2. QZXing (core + QML)
      3. QZXing + QZXingFilter
  2. How to use
    1. Decoding operation
      1. C++/Qt
      2. Qt Quick
    2. Encoding operation
      1. C++/Qt
      2. Qt Quick
    3. Encoded text format Information
  3. Unit test dependency
  4. Qt 6 limitations
  5. Contact

How to include

The project can be used in two ways:

Embed the source code.

Copy source code folder of QZXing to the root of your project. Add the following line to your .pro file. For more information see here.

include(QZXing/QZXing.pri)

Compile the project as an external library

Open QZXing project (QZXing.pro) and compile. If it is needed to compile as static library, uncomment the following line in the .pro file.

CONFIG += staticlib

Control dependencies

Project file config tags are now introduced to be able to control the dependencies of the library accoring to the needs. The core part requires only "core" and "gui" Qt modules. Though for backward compatibility "quick" Qt module is also required. The 3 level of dependencies are:

QZXing (core)

By including QZXing.pri or by building QZXing.pro you get the core functionality of QZXing which requires only QtCore and QtGui (because of QImage).

Warning! The initial default configuration till 20/03/2017 was including qzxing_qml. This tag could not be removed once added, so it was needed to be removed from the defaults.

QZXing (core + QML)

If an application is going to use QML functionality, it is now possible to add the dependency to it. This can be done by adding the folloing line to the .pro file of its project:

CONFIG += qzxing_qml

QZXing + QZXingFilter

QZXing includes QZXingFilter, a QAbstractVideoFilter implementation to provide a mean of providing live feed to the decoding library. It automatically includes QML implementation as well. This option requires "multimedia" Qt module this is why it is considered as a separate configuration. It can be used by adding the folloing line to the .pro file of a project:

CONFIG += qzxing_multimedia

How to use

Follows simple code snippets that brefly show the use of the library. For more details advise the examples included in the repository and the wiki.

Decoding operation

C++/Qt

#include "QZXing.h"

int main()
{
	QImage imageToDecode("file.png");
	QZXing decoder;
        //mandatory settings
	decoder.setDecoder( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 );

        //optional settings
        //decoder.setSourceFilterType(QZXing::SourceFilter_ImageNormal | QZXing::SourceFilter_ImageInverted);
        decoder.setSourceFilterType(QZXing::SourceFilter_ImageNormal);
        decoder.setTryHarderBehaviour(QZXing::TryHarderBehaviour_ThoroughScanning | QZXing::TryHarderBehaviour_Rotate);

        //trigger decode
	QString result = decoder.decodeImage(imageToDecode);
}

Qt Quick

First register QZXing type to the QML engine.

#include "QZXing.h"

int main()
{
	...
	QZXing::registerQMLTypes();
	...
}

The in the QML file

import QZXing 3.1

function decode(preview) {
	imageToDecode.source = preview
	decoder.decodeImageQML(imageToDecode);
}

Image{
	id:imageToDecode
}

QZXing{
	id: decoder

	enabledDecoders: QZXing.DecoderFormat_QR_CODE

        /////////////
        //optional
        tryHarderType: QZXing.TryHarderBehaviour_ThoroughScanning | QZXing.TryHarderBehaviour_Rotate

        imageSourceFilter: QZXing.SourceFilter_ImageNormal //| QZXing.SourceFilter_ImageInverted
        /////////////

	onDecodingStarted: console.log("Decoding of image started...")

	onTagFound: console.log("Barcode data: " + tag)

	onDecodingFinished: console.log("Decoding finished " + (succeeded==true ? "successfully" :    "unsuccessfully") )
}

Encoding operation

To begin with, make sure the Encoder feature is enabled. If QZXing.pri is used, then the feature is already enabled. If your project uses QZXing-compoents.pri instead, do add the following CONFIG in your .pro file:

CONFIG += enable_encoder_qr_code

include(QZXing/QZXing-components.pri)

C++/Qt

The encoding function has been written as static as it does not have any dependencies to data other than the ones provided by the arguments.

Use the encoding function with its default settings:

  • Format: QR Code
  • Size: 240x240
  • Error Correction Level: Low (L)
#include "QZXing.h"

int main()
{
    QString data = "text to be encoded";
    QImage barcode = QZXing::encodeData(data);
}

Or use the encoding function with custom settings:

QString data = "text to be encoded";
QImage barcode = QZXing::encodeData(data, QZXing::EncoderFormat_QR_CODE,
								QSize(width.toInt(), height.toInt()), QZXing::EncodeErrorCorrectionLevel_H);

Qt Quick

The encoding function can be easily used in QML through QZXing's Image Provider: "image://QZXing/encode/<data_to_be_encoded>". As with the C++ example, it can either be used with the default settings or with custom settings.

First register the custom Image Provider in the main.cpp:

QQmlApplicationEngine engine;

QZXing::registerQMLTypes();
QZXing::registerQMLImageProvider(engine);

Default settings:

import QZXing 3.1

TextField {
	id: inputField
	text: "Hello world!"
}

Image{
	source: "image://QZXing/encode/" + inputField.text;
	cache: false;
}

Or use the encoding function with the optional custom settings that are passed like URL query parameters:

attribute name value description
border true, false image has border (white 1px)
correctionLevel L, M, Q, H the error correction level
format qrcode the encode formatter. Currently only QR Code.
transparent true, false whether the black pixels are transparent

the size of the image can be adjusted by using the Image.sourceWidth and Image.sourceHeight properties of Image QML element.

import QZXing 3.1

TextField {
	id: inputField
	text: "Hello world!"
}

Image{
	source: "image://QZXing/encode/" + inputField.text +
					"?correctionLevel=M" +
					"&format=qrcode"
	sourceSize.width: 320
	sourceSize.height: 320
}

Encoded text format Information

Here is a list of contents that have been encoded and tested to be recognizable by the Android ZXing decoding application: QR Code encoding wiki page

Unit test dependency

In order to run Unit tests in /test folder, the git submodule containing the test resoucres needs to be initialized and/or updated:

cd qzxing
git submodule update --init --recursive

Qt 6 limitations

On Qt 6, a number of modules have been removed or not yet supported. The list of removed modules includes two important features that directly affect QZXing:

Text codecs

QZXing used QTextCodec to re-interpret the parsed strings into their proper encoding. In Qt6, QTextCodec has been moved to core5compat module. After testing, it seems that QTextCodec, if used through core5compat in Qt 6, it does not support many of the encoding that it did in Qt 5 (for instance, Shift-JIS encoding). To avoid the dependency of an extra module (that also does not work as supposed to), QTextCodec has been replaced by QStringDecoder only when building for Qt 6. If QZXing if build for Qt 5, QTextCodec is used as it was.

Multimedia (Video / Camera)

Qt Multimedia modules that includes the Camera item for QML and Video related operations for frame manipulation and live decoding are not supported in Qt 6 for the moment. To my knowledge, there is no specific replacement for this absent modules and I hope they get re-supported for Qt 6.

Thus, if building for Qt 5, everything works fine. If trying to used qzxing_multimedia configuration in your pro file, the project will fail (example: QZXingLive project).

Contact

In case of bug reports or feature requests feel free to open an issue.

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].