Zivid C++ API 2.17.1+7516d437-1
Zivid::Experimental::Toolbox::BarcodeDetector Class Reference

Class for enabling the detection of barcodes. More...

#include <Zivid/Experimental/Toolbox/Barcode.h>

Public Member Functions

ZIVID_CORE_EXPORT BarcodeDetector ()
 Constructor.
ZIVID_CORE_EXPORT Settings2D suggestSettings (Camera &camera) const
 Get 2D capture settings that are ideal for barcode reading with the given camera.
ZIVID_CORE_EXPORT std::vector< LinearBarcodeDetectionResultreadLinearCodes (const Frame2D &frame2d, const LinearBarcodeFormatFilter &formatFilter=LinearBarcodeFormatFilter::all()) const
 Detect and decode linear (1D) barcodes based on the result of a 2D capture.
ZIVID_CORE_EXPORT std::vector< MatrixBarcodeDetectionResultreadMatrixCodes (const Frame2D &frame2d, const MatrixBarcodeFormatFilter &formatFilter=MatrixBarcodeFormatFilter::all()) const
 Detect and decode matrix (2D) barcodes based on the result of a 2D capture.
ZIVID_CORE_EXPORT std::string toString () const
 Get string representation of the object.

Detailed Description

Class for enabling the detection of barcodes.

Constructing an instance of this class initializes the resources needed for efficient barcode detection. For repeated detection it is recommended to keep and re-use an instance of this class and not create a new one every time.

The recommended workflow for detecting barcodes with an instance of this class is:

  1. Call BarcodeDetector::suggestSettings once to get a suitable Settings2D for your camera. Alternatively, create or load your own Settings2D optimized for your use-case.
  2. Whenever you want to capture an image for barcode detection, call Camera::capture2D using the Settings2D. This will yield a Frame2D instance.
  3. Running the algorithm to detect and decode barcodes in the image can then be done immediately or later by passing the Frame2D to BarcodeDetector::readLinearCodes or BarcodeDetector::readMatrixCodes.

Constructor & Destructor Documentation

◆ BarcodeDetector()

ZIVID_CORE_EXPORT Zivid::Experimental::Toolbox::BarcodeDetector::BarcodeDetector ( )

Constructor.

Member Function Documentation

◆ readLinearCodes()

ZIVID_CORE_EXPORT std::vector< LinearBarcodeDetectionResult > Zivid::Experimental::Toolbox::BarcodeDetector::readLinearCodes ( const Frame2D & frame2d,
const LinearBarcodeFormatFilter & formatFilter = LinearBarcodeFormatFilter::all() ) const

Detect and decode linear (1D) barcodes based on the result of a 2D capture.

By default this function will attempt to detect and decode all supported barcode formats. Users can achieve increased detection speed and reliability by using the formatFilter argument to specify a subset of formats, for example LinearBarcodeFormat::ean13 | LinearBarcodeFormat::ean8.

Parameters
frame2dA Frame2D instance from a 2D or 2D+3D capture
formatFilterA filter defining which barcode formats to look for.
Returns
A sequence of LinearBarcodeDetectionResult (one per successfully decoded barcode)

◆ readMatrixCodes()

ZIVID_CORE_EXPORT std::vector< MatrixBarcodeDetectionResult > Zivid::Experimental::Toolbox::BarcodeDetector::readMatrixCodes ( const Frame2D & frame2d,
const MatrixBarcodeFormatFilter & formatFilter = MatrixBarcodeFormatFilter::all() ) const

Detect and decode matrix (2D) barcodes based on the result of a 2D capture.

By default this function will attempt to detect and decode all supported barcode formats. Users can achieve increased detection speed and reliability by using the formatFilter argument to specify a subset of formats, for example MatrixBarcodeFormat::qrcode | MatrixBarcodeFormat::dataMatrix.

Parameters
frame2dA Frame2D instance from a 2D or 2D+3D capture
formatFilterA filter defining which barcode formats to look for.
Returns
A sequence of MatrixBarcodeDetectionResult (one per successfully decoded barcode)

◆ suggestSettings()

ZIVID_CORE_EXPORT Settings2D Zivid::Experimental::Toolbox::BarcodeDetector::suggestSettings ( Camera & camera) const

Get 2D capture settings that are ideal for barcode reading with the given camera.

Parameters
cameraThe camera to find barcode settings for.
Returns
A Settings2D instance

◆ toString()

ZIVID_CORE_EXPORT std::string Zivid::Experimental::Toolbox::BarcodeDetector::toString ( ) const

Get string representation of the object.

Returns
BarcodeDetector as a string

The documentation for this class was generated from the following file: