View Source Evision.Barcode.BarcodeDetector (Evision v0.2.9)

Summary

Types

t()

Type that represents an Barcode.BarcodeDetector struct.

Functions

Initialize the BarcodeDetector.

Initialize the BarcodeDetector.

Decodes graphical code in image once it's found by the detect() method.

Decodes graphical code in image once it's found by the detect() method.

Decodes graphical codes in image once it's found by the detect() method.

Decodes graphical codes in image once it's found by the detect() method.

Decodes barcode in image once it's found by the detect() method.

Detects graphical code in image and returns the quadrangle containing the code.

Detects graphical code in image and returns the quadrangle containing the code.

Both detects and decodes graphical code

Both detects and decodes graphical code

Both detects and decodes graphical codes

Both detects and decodes graphical codes

Both detects and decodes barcode

Both detects and decodes barcode

Detects graphical codes in image and returns the vector of the quadrangles containing the codes.

Detects graphical codes in image and returns the vector of the quadrangles containing the codes.

Returns detector box filter sizes.

Get detector downsampling threshold.

Get detector gradient magnitude threshold.

Set detector box filter sizes.

Set detector downsampling threshold.

Set detector gradient magnitude threshold.

Types

@type t() :: %Evision.Barcode.BarcodeDetector{ref: reference()}

Type that represents an Barcode.BarcodeDetector struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec barcodeDetector() :: t() | {:error, String.t()}

Initialize the BarcodeDetector.

Return
  • self: BarcodeDetector

Python prototype (for reference only):

BarcodeDetector() -> <barcode_BarcodeDetector object>
Link to this function

barcodeDetector(named_args)

View Source
@spec barcodeDetector(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

barcodeDetector(prototxt_path, model_path)

View Source
@spec barcodeDetector(binary(), binary()) :: t() | {:error, String.t()}

Initialize the BarcodeDetector.

Positional Arguments
  • prototxt_path: string.

    prototxt file path for the super resolution model

  • model_path: string.

    model file path for the super resolution model

Return
  • self: BarcodeDetector

Parameters allow to load optional Super Resolution DNN model for better quality.

Python prototype (for reference only):

BarcodeDetector(prototxt_path, model_path) -> <barcode_BarcodeDetector object>
@spec decode(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

decode(self, img, points)

View Source
@spec decode(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  {binary(), Evision.Mat.t()} | {:error, String.t()}

Decodes graphical code in image once it's found by the detect() method.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical code.

  • points: Evision.Mat.

    Quadrangle vertices found by detect() method (or some other algorithm).

Return
  • retval: string

  • straight_code: Evision.Mat.t().

    The optional output image containing binarized code, will be empty if not found.

Returns UTF8-encoded output string or empty string if the code cannot be decoded.

Python prototype (for reference only):

decode(img, points[, straight_code]) -> retval, straight_code
Link to this function

decode(self, img, points, opts)

View Source
@spec decode(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  {binary(), Evision.Mat.t()} | {:error, String.t()}

Decodes graphical code in image once it's found by the detect() method.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical code.

  • points: Evision.Mat.

    Quadrangle vertices found by detect() method (or some other algorithm).

Return
  • retval: string

  • straight_code: Evision.Mat.t().

    The optional output image containing binarized code, will be empty if not found.

Returns UTF8-encoded output string or empty string if the code cannot be decoded.

Python prototype (for reference only):

decode(img, points[, straight_code]) -> retval, straight_code
@spec decodeMulti(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

decodeMulti(self, img, points)

View Source
@spec decodeMulti(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  {[binary()], [Evision.Mat.t()]} | false | {:error, String.t()}

Decodes graphical codes in image once it's found by the detect() method.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical codes.

  • points: Evision.Mat.

    vector of Quadrangle vertices found by detect() method (or some other algorithm).

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

  • straight_code: [Evision.Mat].

    The optional output vector of images containing binarized codes

Python prototype (for reference only):

decodeMulti(img, points[, straight_code]) -> retval, decoded_info, straight_code
Link to this function

decodeMulti(self, img, points, opts)

View Source
@spec decodeMulti(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) :: {[binary()], [Evision.Mat.t()]} | false | {:error, String.t()}

Decodes graphical codes in image once it's found by the detect() method.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical codes.

  • points: Evision.Mat.

    vector of Quadrangle vertices found by detect() method (or some other algorithm).

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

  • straight_code: [Evision.Mat].

    The optional output vector of images containing binarized codes

Python prototype (for reference only):

decodeMulti(img, points[, straight_code]) -> retval, decoded_info, straight_code
Link to this function

decodeWithType(named_args)

View Source
@spec decodeWithType(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

decodeWithType(self, img, points)

View Source
@spec decodeWithType(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  {[binary()], [binary()]} | false | {:error, String.t()}

Decodes barcode in image once it's found by the detect() method.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing bar code.

  • points: Evision.Mat.

    vector of rotated rectangle vertices found by detect() method (or some other algorithm). For N detected barcodes, the dimensions of this array should be [N][4]. Order of four points in vector<Point2f> is bottomLeft, topLeft, topRight, bottomRight.

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

  • decoded_type: [string].

    vector strings, specifies the type of these barcodes

@return true if at least one valid barcode have been found

Python prototype (for reference only):

decodeWithType(img, points) -> retval, decoded_info, decoded_type
@spec detect(Keyword.t()) :: any() | {:error, String.t()}
@spec detect(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | false | {:error, String.t()}

Detects graphical code in image and returns the quadrangle containing the code.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing (or not) graphical code.

Return
  • retval: bool

  • points: Evision.Mat.t().

    Output vector of vertices of the minimum-area quadrangle containing the code.

Python prototype (for reference only):

detect(img[, points]) -> retval, points
@spec detect(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  Evision.Mat.t() | false | {:error, String.t()}

Detects graphical code in image and returns the quadrangle containing the code.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing (or not) graphical code.

Return
  • retval: bool

  • points: Evision.Mat.t().

    Output vector of vertices of the minimum-area quadrangle containing the code.

Python prototype (for reference only):

detect(img[, points]) -> retval, points
Link to this function

detectAndDecode(named_args)

View Source
@spec detectAndDecode(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

detectAndDecode(self, img)

View Source
@spec detectAndDecode(t(), Evision.Mat.maybe_mat_in()) ::
  {binary(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

Both detects and decodes graphical code

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical code.

Return
  • retval: string

  • points: Evision.Mat.t().

    optional output array of vertices of the found graphical code quadrangle, will be empty if not found.

  • straight_code: Evision.Mat.t().

    The optional output image containing binarized code

Python prototype (for reference only):

detectAndDecode(img[, points[, straight_code]]) -> retval, points, straight_code
Link to this function

detectAndDecode(self, img, opts)

View Source
@spec detectAndDecode(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  {binary(), Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

Both detects and decodes graphical code

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical code.

Return
  • retval: string

  • points: Evision.Mat.t().

    optional output array of vertices of the found graphical code quadrangle, will be empty if not found.

  • straight_code: Evision.Mat.t().

    The optional output image containing binarized code

Python prototype (for reference only):

detectAndDecode(img[, points[, straight_code]]) -> retval, points, straight_code
Link to this function

detectAndDecodeMulti(named_args)

View Source
@spec detectAndDecodeMulti(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

detectAndDecodeMulti(self, img)

View Source
@spec detectAndDecodeMulti(t(), Evision.Mat.maybe_mat_in()) ::
  {[binary()], Evision.Mat.t(), [Evision.Mat.t()]}
  | false
  | {:error, String.t()}

Both detects and decodes graphical codes

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical codes.

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

  • points: Evision.Mat.t().

    optional output vector of vertices of the found graphical code quadrangles. Will be empty if not found.

  • straight_code: [Evision.Mat].

    The optional vector of images containing binarized codes

  • If there are QR codes encoded with a Structured Append mode on the image and all of them detected and decoded correctly, method writes a full message to position corresponds to 0-th code in a sequence. The rest of QR codes from the same sequence have empty string.

Python prototype (for reference only):

detectAndDecodeMulti(img[, points[, straight_code]]) -> retval, decoded_info, points, straight_code
Link to this function

detectAndDecodeMulti(self, img, opts)

View Source
@spec detectAndDecodeMulti(
  t(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  {[binary()], Evision.Mat.t(), [Evision.Mat.t()]}
  | false
  | {:error, String.t()}

Both detects and decodes graphical codes

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing graphical codes.

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

  • points: Evision.Mat.t().

    optional output vector of vertices of the found graphical code quadrangles. Will be empty if not found.

  • straight_code: [Evision.Mat].

    The optional vector of images containing binarized codes

  • If there are QR codes encoded with a Structured Append mode on the image and all of them detected and decoded correctly, method writes a full message to position corresponds to 0-th code in a sequence. The rest of QR codes from the same sequence have empty string.

Python prototype (for reference only):

detectAndDecodeMulti(img[, points[, straight_code]]) -> retval, decoded_info, points, straight_code
Link to this function

detectAndDecodeWithType(named_args)

View Source
@spec detectAndDecodeWithType(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

detectAndDecodeWithType(self, img)

View Source
@spec detectAndDecodeWithType(t(), Evision.Mat.maybe_mat_in()) ::
  {[binary()], [binary()], Evision.Mat.t()} | false | {:error, String.t()}

Both detects and decodes barcode

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing barcode.

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string(s) or empty vector of string if the codes cannot be decoded.

  • decoded_type: [string].

    vector of strings, specifies the type of these barcodes

  • points: Evision.Mat.t().

    optional output vector of vertices of the found barcode rectangle. Will be empty if not found.

@return true if at least one valid barcode have been found

Python prototype (for reference only):

detectAndDecodeWithType(img[, points]) -> retval, decoded_info, decoded_type, points
Link to this function

detectAndDecodeWithType(self, img, opts)

View Source
@spec detectAndDecodeWithType(
  t(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  {[binary()], [binary()], Evision.Mat.t()} | false | {:error, String.t()}

Both detects and decodes barcode

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing barcode.

Return
  • retval: bool

  • decoded_info: [string].

    UTF8-encoded output vector of string(s) or empty vector of string if the codes cannot be decoded.

  • decoded_type: [string].

    vector of strings, specifies the type of these barcodes

  • points: Evision.Mat.t().

    optional output vector of vertices of the found barcode rectangle. Will be empty if not found.

@return true if at least one valid barcode have been found

Python prototype (for reference only):

detectAndDecodeWithType(img[, points]) -> retval, decoded_info, decoded_type, points
@spec detectMulti(Keyword.t()) :: any() | {:error, String.t()}
@spec detectMulti(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | false | {:error, String.t()}

Detects graphical codes in image and returns the vector of the quadrangles containing the codes.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing (or not) graphical codes.

Return
  • retval: bool

  • points: Evision.Mat.t().

    Output vector of vector of vertices of the minimum-area quadrangle containing the codes.

Python prototype (for reference only):

detectMulti(img[, points]) -> retval, points
Link to this function

detectMulti(self, img, opts)

View Source
@spec detectMulti(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  Evision.Mat.t() | false | {:error, String.t()}

Detects graphical codes in image and returns the vector of the quadrangles containing the codes.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • img: Evision.Mat.

    grayscale or color (BGR) image containing (or not) graphical codes.

Return
  • retval: bool

  • points: Evision.Mat.t().

    Output vector of vector of vertices of the minimum-area quadrangle containing the codes.

Python prototype (for reference only):

detectMulti(img[, points]) -> retval, points
Link to this function

getDetectorScales(named_args)

View Source
@spec getDetectorScales(Keyword.t()) :: any() | {:error, String.t()}
@spec getDetectorScales(t()) :: [number()] | {:error, String.t()}

Returns detector box filter sizes.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()
Return
  • sizes: [float].

    output parameter for returning the sizes.

Python prototype (for reference only):

getDetectorScales() -> sizes
Link to this function

getDownsamplingThreshold(named_args)

View Source
@spec getDownsamplingThreshold(Keyword.t()) :: any() | {:error, String.t()}
@spec getDownsamplingThreshold(t()) :: number() | {:error, String.t()}

Get detector downsampling threshold.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()
Return
  • retval: double

@return detector downsampling threshold

Python prototype (for reference only):

getDownsamplingThreshold() -> retval
Link to this function

getGradientThreshold(named_args)

View Source
@spec getGradientThreshold(Keyword.t()) :: any() | {:error, String.t()}
@spec getGradientThreshold(t()) :: number() | {:error, String.t()}

Get detector gradient magnitude threshold.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()
Return
  • retval: double

@return detector gradient magnitude threshold.

Python prototype (for reference only):

getGradientThreshold() -> retval
Link to this function

setDetectorScales(named_args)

View Source
@spec setDetectorScales(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setDetectorScales(self, sizes)

View Source
@spec setDetectorScales(t(), [number()]) :: t() | {:error, String.t()}

Set detector box filter sizes.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • sizes: [float].

    box filter sizes, relative to minimum dimension of the image (default [0.01, 0.03, 0.06, 0.08])

Return
  • retval: BarcodeDetector

Adjusts the value and the number of box filters used in the detect step. The filter sizes directly correlate with the expected line widths for a barcode. Corresponds to expected barcode distance. If the downsampling limit is increased, filter sizes need to be adjusted in an inversely proportional way.

Python prototype (for reference only):

setDetectorScales(sizes) -> retval
Link to this function

setDownsamplingThreshold(named_args)

View Source
@spec setDownsamplingThreshold(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setDownsamplingThreshold(self, thresh)

View Source
@spec setDownsamplingThreshold(t(), number()) :: t() | {:error, String.t()}

Set detector downsampling threshold.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • thresh: double.

    downsampling limit to apply (default 512)

Return
  • retval: BarcodeDetector

By default, the detect method resizes the input image to this limit if the smallest image size is is greater than the threshold. Increasing this value can improve detection accuracy and the number of results at the expense of performance. Correlates with detector scales. Setting this to a large value will disable downsampling. @see setDetectorScales/2

Python prototype (for reference only):

setDownsamplingThreshold(thresh) -> retval
Link to this function

setGradientThreshold(named_args)

View Source
@spec setGradientThreshold(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setGradientThreshold(self, thresh)

View Source
@spec setGradientThreshold(t(), number()) :: t() | {:error, String.t()}

Set detector gradient magnitude threshold.

Positional Arguments
  • self: Evision.Barcode.BarcodeDetector.t()

  • thresh: double.

    gradient magnitude threshold (default 64).

Return
  • retval: BarcodeDetector

Sets the coherence threshold for detected bounding boxes. Increasing this value will generate a closer fitted bounding box width and can reduce false-positives. Values between 16 and 1024 generally work, while too high of a value will remove valid detections.

Python prototype (for reference only):

setGradientThreshold(thresh) -> retval