Class BarcodeDetector


  • public class BarcodeDetector
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long nativeObj  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        BarcodeDetector()
      Initialize the BarcodeDetector.
      protected BarcodeDetector​(long addr)  
        BarcodeDetector​(java.lang.String prototxt_path)
      Initialize the BarcodeDetector.
        BarcodeDetector​(java.lang.String prototxt_path, java.lang.String model_path)
      Initialize the BarcodeDetector.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BarcodeDetector __fromPtr__​(long addr)  
      boolean decode​(Mat img, Mat points, java.util.List<java.lang.String> decoded_info, java.util.List<java.lang.Integer> decoded_type)
      Decodes barcode in image once it's found by the detect() method.
      boolean detect​(Mat img, Mat points)
      Detects Barcode in image and returns the rectangle(s) containing the code.
      boolean detectAndDecode​(Mat img, java.util.List<java.lang.String> decoded_info, java.util.List<java.lang.Integer> decoded_type)
      Both detects and decodes barcode
      boolean detectAndDecode​(Mat img, java.util.List<java.lang.String> decoded_info, java.util.List<java.lang.Integer> decoded_type, Mat points)
      Both detects and decodes barcode
      protected void finalize()  
      long getNativeObjAddr()  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • nativeObj

        protected final long nativeObj
    • Constructor Detail

      • BarcodeDetector

        protected BarcodeDetector​(long addr)
      • BarcodeDetector

        public BarcodeDetector​(java.lang.String prototxt_path,
                               java.lang.String model_path)
        Initialize the BarcodeDetector.
        Parameters:
        prototxt_path - prototxt file path for the super resolution model
        model_path - model file path for the super resolution model
      • BarcodeDetector

        public BarcodeDetector​(java.lang.String prototxt_path)
        Initialize the BarcodeDetector.
        Parameters:
        prototxt_path - prototxt file path for the super resolution model
      • BarcodeDetector

        public BarcodeDetector()
        Initialize the BarcodeDetector.
    • Method Detail

      • getNativeObjAddr

        public long getNativeObjAddr()
      • detect

        public boolean detect​(Mat img,
                              Mat points)
        Detects Barcode in image and returns the rectangle(s) containing the code.
        Parameters:
        img - grayscale or color (BGR) image containing (or not) Barcode.
        points - Output vector of vector of vertices of the minimum-area rotated rectangle containing the codes. 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.
        Returns:
        automatically generated
      • decode

        public boolean decode​(Mat img,
                              Mat points,
                              java.util.List<java.lang.String> decoded_info,
                              java.util.List<java.lang.Integer> decoded_type)
        Decodes barcode in image once it's found by the detect() method.
        Parameters:
        img - grayscale or color (BGR) image containing bar code.
        points - 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.
        decoded_info - UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.
        decoded_type - vector of BarcodeType, specifies the type of these barcodes
        Returns:
        automatically generated
      • detectAndDecode

        public boolean detectAndDecode​(Mat img,
                                       java.util.List<java.lang.String> decoded_info,
                                       java.util.List<java.lang.Integer> decoded_type,
                                       Mat points)
        Both detects and decodes barcode
        Parameters:
        img - grayscale or color (BGR) image containing barcode.
        decoded_info - UTF8-encoded output vector of string(s) or empty vector of string if the codes cannot be decoded.
        decoded_type - vector of BarcodeType, specifies the type of these barcodes
        points - optional output vector of vertices of the found barcode rectangle. Will be empty if not found.
        Returns:
        automatically generated
      • detectAndDecode

        public boolean detectAndDecode​(Mat img,
                                       java.util.List<java.lang.String> decoded_info,
                                       java.util.List<java.lang.Integer> decoded_type)
        Both detects and decodes barcode
        Parameters:
        img - grayscale or color (BGR) image containing barcode.
        decoded_info - UTF8-encoded output vector of string(s) or empty vector of string if the codes cannot be decoded.
        decoded_type - vector of BarcodeType, specifies the type of these barcodes
        Returns:
        automatically generated
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable