类 BarcodeDetector

    • 构造函数详情

      • BarcodeDetector

        protected BarcodeDetector​(long addr)
      • BarcodeDetector

        public BarcodeDetector()
        初始化 BarcodeDetector。
      • BarcodeDetector

        public BarcodeDetector​(java.lang.String prototxt_path,
                               java.lang.String model_path)
        初始化 BarcodeDetector。参数允许加载_可选的_超分辨率 DNN 模型以获得更好的质量。
        参数
        prototxt_path - 超分辨率模型的 prototxt 文件路径
        model_path - 超分辨率模型的模型文件路径
    • 方法详情

      • decodeWithType

        public boolean decodeWithType​(Mat img,
                                      Mat points,
                                      java.util.List<java.lang.String> decoded_info,
                                      java.util.List<java.lang.String> decoded_type)
        在通过 detect() 方法找到条形码后对其进行解码。
        参数
        img - 包含条形码的灰度或彩色 (BGR) 图像。
        points - 由 detect() 方法(或其他一些算法)找到的旋转矩形顶点的向量。对于 N 个检测到的条形码,此数组的维度应为 [N][4]。向量<Point2f>中四个点的顺序为左下、左上、右上、右下。
        decoded_info - UTF8 编码的字符串输出向量,如果无法解码代码,则为空字符串向量。
        decoded_type - 字符串向量,指定这些条形码的类型
        返回
        如果找到至少一个有效的条形码,则返回 true
      • detectAndDecodeWithType

        public boolean detectAndDecodeWithType​(Mat img,
                                               java.util.List<java.lang.String> decoded_info,
                                               java.util.List<java.lang.String> decoded_type,
                                               Mat points)
        同时检测和解码条形码
        参数
        img - 包含条形码的灰度或彩色 (BGR) 图像。
        decoded_info - UTF8 编码的字符串 (s) 输出向量,如果无法解码代码,则为空字符串向量。
        decoded_type - 字符串向量,指定这些条形码的类型
        points - 可选的已找到条形码矩形的顶点输出向量。如果未找到,则为空。
        返回
        如果找到至少一个有效的条形码,则返回 true
      • detectAndDecodeWithType

        public boolean detectAndDecodeWithType​(Mat img,
                                               java.util.List<java.lang.String> decoded_info,
                                               java.util.List<java.lang.String> decoded_type)
        同时检测和解码条形码
        参数
        img - 包含条形码的灰度或彩色 (BGR) 图像。
        decoded_info - UTF8 编码的字符串 (s) 输出向量,如果无法解码代码,则为空字符串向量。
        decoded_type - 字符串向量,指定这些条形码的类型
        返回
        如果找到至少一个有效的条形码,则返回 true
      • getDownsamplingThreshold

        public double getDownsamplingThreshold()
        获取检测器下采样阈值。
        返回
        检测器下采样阈值
      • setDownsamplingThreshold

        public BarcodeDetector setDownsamplingThreshold​(double thresh)
        设置检测器下采样阈值。默认情况下,如果最小图像尺寸大于阈值,则 detect 方法会将输入图像调整为此限制大小。增加此值可以提高检测精度和结果数量,但会牺牲性能。与检测器比例相关。将其设置为较大的值将禁用下采样。与检测器比例相关。将其设置为较大的值将禁用下采样。
        参数
        thresh - 要应用的下采样限制(默认值为 512)参见:setDetectorScales
        返回
        自动生成
      • getDetectorScales

        public void getDetectorScales​(MatOfFloat sizes)
        返回检测器盒滤波器尺寸。
        参数
        sizes - 用于返回尺寸的输出参数。
      • setDetectorScales

        public BarcodeDetector setDetectorScales​(MatOfFloat sizes)
        设置检测器盒滤波器尺寸。调整检测步骤中使用的盒滤波器的值和数量。滤波器尺寸直接与条形码的预期线宽相关。对应于预期的条形码距离。如果增加了下采样限制,则需要以反比例的方式调整滤波器尺寸。
        参数
        sizes - 箱式滤波器尺寸,相对于图像最小尺寸的比例 (默认值 [0.01, 0.03, 0.06, 0.08])
        返回
        自动生成
      • getGradientThreshold

        public double getGradientThreshold()
        获取检测器梯度幅度阈值。
        返回
        检测器梯度幅度阈值。
      • setGradientThreshold

        public BarcodeDetector setGradientThreshold​(double thresh)
        设置检测器梯度幅度阈值。设置检测到的边界框的相干性阈值。增加此值将生成更贴合的边界框宽度,并可以减少误报。通常情况下,16 到 1024 之间的值有效,而过高的值将去除有效的检测结果。
        参数
        thresh - 梯度幅度阈值 (默认值 64)。
        返回
        自动生成