KItinerary::BarcodeDecoder

Search for usage in LXR

#include <barcodedecoder.h>

Public Types

enum  BarcodeType {
  Aztec = 1, QRCode = 2, PDF417 = 4, DataMatrix = 8,
  Code39 = 16, Code93 = 32, Code128 = 64, IgnoreAspectRatio = 128,
  AnySquare = Aztec | QRCode | DataMatrix, Any2D = AnySquare | PDF417, Any1D = Code39 | Code93 | Code128, Any = Any1D | Any2D,
  None = 0
}
 
typedef QFlags< BarcodeTypeBarcodeTypes
 

Public Member Functions

void clearCache ()
 
QByteArray decodeBinary (const QImage &img, BarcodeTypes hint=Any2D) const
 
QString decodeString (const QImage &img, BarcodeTypes hint=Any2D) const
 
bool isBarcode (const QImage &img, BarcodeTypes hint=Any2D) const
 

Static Public Member Functions

static bool isPlausibleAspectRatio (int width, int height, BarcodeTypes hint)
 
static bool isPlausibleSize (int width, int height, BarcodeTypes hint)
 
static bool maybeBarcode (int width, int height, BarcodeTypes hint)
 

Detailed Description

Barcode decoding with result caching.

All non-static functions are using heuristics and cached results before actually performing an expensive barcode decoding operation, so repreated calls or calls with implausible arguments are cheap-ish.

Note
This is only functional if zxing is available.

Only exported for unit tests and KItinerary Workbench.

Definition at line 30 of file barcodedecoder.h.

Member Enumeration Documentation

Enumerator
AnySquare 

search for barcodes anywhere in the image, rather than assuming the image is primarily containing the barcode

Definition at line 36 of file barcodedecoder.h.

Member Function Documentation

void BarcodeDecoder::clearCache ( )

Clears the internal cache.

Definition at line 88 of file barcodedecoder.cpp.

QByteArray BarcodeDecoder::decodeBinary ( const QImage img,
BarcodeDecoder::BarcodeTypes  hint = Any2D 
) const

Decodes a binary payload barcode in img of type hint.

Definition at line 58 of file barcodedecoder.cpp.

QString BarcodeDecoder::decodeString ( const QImage img,
BarcodeDecoder::BarcodeTypes  hint = Any2D 
) const

Decodes a textual payload barcode in img of type hint.

Definition at line 73 of file barcodedecoder.cpp.

bool BarcodeDecoder::isBarcode ( const QImage img,
BarcodeDecoder::BarcodeTypes  hint = Any2D 
) const

Checks if img contains a barcode of type hint.

Definition at line 47 of file barcodedecoder.cpp.

bool BarcodeDecoder::isPlausibleAspectRatio ( int  width,
int  height,
BarcodeDecoder::BarcodeTypes  hint 
)
static

Checks if the given image dimensions are a barcode of type hint.

See above.

Definition at line 104 of file barcodedecoder.cpp.

bool BarcodeDecoder::isPlausibleSize ( int  width,
int  height,
BarcodeDecoder::BarcodeTypes  hint 
)
static

Checks if the given image dimensions are plausible for a barcode.

These checks are done first by BarcodeDecoder, it might however useful to perform them manually if a cheaper way to obtain the image dimension exists that does not require a full QImage creation.

Definition at line 93 of file barcodedecoder.cpp.

bool BarcodeDecoder::maybeBarcode ( int  width,
int  height,
BarcodeDecoder::BarcodeTypes  hint 
)
static

The combination of the above.

Definition at line 135 of file barcodedecoder.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:06:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.