KItinerary::BarcodeDecoder

Search for usage in LXR

#include <barcodedecoder.h>

Classes

class  Result
 

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 ()
 
Result decode (const QImage &img, BarcodeTypes hint) const
 
QByteArray decodeBinary (const QImage &img, BarcodeTypes hint) const
 
std::vector< ResultdecodeMulti (const QImage &img, BarcodeTypes hint) const
 
QString decodeString (const QImage &img, BarcodeTypes hint) const
 

Static Public Member Functions

static BarcodeTypes isPlausibleAspectRatio (int width, int height, BarcodeTypes hint)
 
static BarcodeTypes isPlausibleSize (int width, int height, BarcodeTypes hint)
 
static BarcodeTypes 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 Typedef Documentation

◆ BarcodeTypes

Member Enumeration Documentation

◆ BarcodeType

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

◆ clearCache()

void BarcodeDecoder::clearCache ( )

Clears the internal cache.

Definition at line 91 of file barcodedecoder.cpp.

◆ decode()

BarcodeDecoder::Result BarcodeDecoder::decode ( const QImage & img,
BarcodeDecoder::BarcodeTypes hint ) const

Decodes a barcode in img based on hint.

Parameters
hinthas to be validated by something of the likes of maybeBarcode() before.

Definition at line 52 of file barcodedecoder.cpp.

◆ decodeBinary()

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

Decodes a binary payload barcode in img of type hint.

Parameters
hinthas to be validated by something of the likes of maybeBarcode() before.

Definition at line 81 of file barcodedecoder.cpp.

◆ decodeMulti()

std::vector< BarcodeDecoder::Result > BarcodeDecoder::decodeMulti ( const QImage & img,
BarcodeDecoder::BarcodeTypes hint ) const

Decodes multiple barcodes in img based on hint.

Parameters
hintIgnoreAspectRatio is implied here

Definition at line 70 of file barcodedecoder.cpp.

◆ decodeString()

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

Decodes a textual payload barcode in img of type hint.

Parameters
hinthas to be validated by something of the likes of maybeBarcode() before.

Definition at line 86 of file barcodedecoder.cpp.

◆ isPlausibleAspectRatio()

BarcodeDecoder::BarcodeTypes 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 110 of file barcodedecoder.cpp.

◆ isPlausibleSize()

BarcodeDecoder::BarcodeTypes 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 96 of file barcodedecoder.cpp.

◆ maybeBarcode()

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

The combination of the above.

Definition at line 141 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.