OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
cv::barcode::BarcodeDetector 类参考

#include <opencv2/objdetect/barcode.hpp>

cv::barcode::BarcodeDetector 的协作图

公共成员函数

 BarcodeDetector ()
 初始化 BarcodeDetector
 
 BarcodeDetector (CV_WRAP_FILE_PATH const std::string &prototxt_path, CV_WRAP_FILE_PATH const std::string &model_path)
 初始化 BarcodeDetector
 
 ~BarcodeDetector ()
 
bool decodeWithType (InputArray img, InputArray points, std::vector< std::string > &decoded_info, std::vector< std::string > &decoded_type) const
 一旦通过 detect() 方法找到条形码,就对其进行解码。
 
bool detectAndDecodeWithType (InputArray img, std::vector< std::string > &decoded_info, std::vector< std::string > &decoded_type, OutputArray points=noArray()) const
 同时检测和解码条形码。
 
void getDetectorScales (std::vector< float > &sizes) const
 返回检测器盒式滤波器尺寸。
 
double getDownsamplingThreshold () const
 获取检测器下采样阈值。
 
double getGradientThreshold () const
 获取检测器梯度幅值阈值。
 
BarcodeDetectorsetDetectorScales (const std::vector< float > &sizes)
 设置检测器盒式滤波器尺寸。
 
BarcodeDetectorsetDownsamplingThreshold (double thresh)
 设置检测器下采样阈值。
 
BarcodeDetectorsetGradientThreshold (double thresh)
 设置检测器梯度幅值阈值。
 
- 从 cv::GraphicalCodeDetector 继承的公共成员函数
 GraphicalCodeDetector ()
 
 GraphicalCodeDetector (const GraphicalCodeDetector &)=default
 
 GraphicalCodeDetector (GraphicalCodeDetector &&)=default
 
std::string decode (InputArray img, InputArray points, OutputArray straight_code=noArray()) const
 一旦通过 detect() 方法找到图像中的图形码,就对其进行解码。
 
bool decodeMulti (InputArray img, InputArray points, std::vector< std::string > &decoded_info, OutputArrayOfArrays straight_code=noArray()) const
 一旦通过 detect() 方法找到图像中的图形码,就对其进行解码。
 
bool detect (InputArray img, OutputArray points) const
 在图像中检测图形码并返回包含该码的四边形。
 
std::string detectAndDecode (InputArray img, OutputArray points=noArray(), OutputArray straight_code=noArray()) const
 同时检测和解码图形码。
 
bool detectAndDecodeMulti (InputArray img, std::vector< std::string > &decoded_info, OutputArray points=noArray(), OutputArrayOfArrays straight_code=noArray()) const
 同时检测和解码图形码。
 
bool detectMulti (InputArray img, OutputArray points) const
 在图像中检测图形码并返回包含这些码的四边形向量。
 
GraphicalCodeDetectoroperator= (const GraphicalCodeDetector &)=default
 
GraphicalCodeDetectoroperator= (GraphicalCodeDetector &&)=default
 

额外继承的成员

- 从 cv::GraphicalCodeDetector 继承的受保护属性
Ptr< Impl > p
 

构造函数 & 析构函数文档

◆ BarcodeDetector() [1/2]

cv::barcode::BarcodeDetector::BarcodeDetector ( )
Python
cv.barcode.BarcodeDetector() -> <barcode_BarcodeDetector 对象>
cv.barcode.BarcodeDetector(prototxt_path, model_path) -> <barcode_BarcodeDetector 对象>

初始化 BarcodeDetector

◆ BarcodeDetector() [2/2]

cv::barcode::BarcodeDetector::BarcodeDetector ( CV_WRAP_FILE_PATH const std::string & prototxt_path,
CV_WRAP_FILE_PATH const std::string & model_path )
Python
cv.barcode.BarcodeDetector() -> <barcode_BarcodeDetector 对象>
cv.barcode.BarcodeDetector(prototxt_path, model_path) -> <barcode_BarcodeDetector 对象>

初始化 BarcodeDetector

参数允许加载可选的超分辨率 DNN 模型以获得更好的质量。

参数
prototxt_path超分辨率模型的 prototxt 文件路径
model_path超分辨率模型的模型文件路径

◆ ~BarcodeDetector()

cv::barcode::BarcodeDetector::~BarcodeDetector ( )

成员函数文档

◆ decodeWithType()

bool cv::barcode::BarcodeDetector::decodeWithType ( InputArray img,
InputArray points,
std::vector< std::string > & decoded_info,
std::vector< std::string > & decoded_type ) const
Python
cv.barcode.BarcodeDetector.decodeWithType(img, points) -> retval, decoded_info, decoded_type

一旦通过 detect() 方法找到条形码,就对其进行解码。

参数
img包含条形码的灰度或彩色 (BGR) 图像。
points通过 detect() 方法(或其他算法)找到的旋转矩形顶点的向量。对于 N 个检测到的条形码,此数组的维度应为 [N][4]。vector<Point2f> 中四个点的顺序是 bottomLeft、topLeft、topRight、bottomRight。
decoded_infoUTF8 编码的字符串输出向量,如果无法解码则为空字符串向量。
decoded_type字符串向量,指定这些条形码的类型
返回
如果至少找到一个有效条形码则为 true

◆ detectAndDecodeWithType()

bool cv::barcode::BarcodeDetector::detectAndDecodeWithType ( InputArray img,
std::vector< std::string > & decoded_info,
std::vector< std::string > & decoded_type,
OutputArray points = noArray() ) const
Python
cv.barcode.BarcodeDetector.detectAndDecodeWithType(img[, points]) -> retval, decoded_info, decoded_type, points

同时检测和解码条形码。

参数
img包含条形码的灰度或彩色 (BGR) 图像。
decoded_infoUTF8 编码的字符串输出向量或空字符串向量(如果无法解码)。
decoded_type字符串向量,指定这些条形码的类型
points找到的条形码矩形顶点的可选输出向量。如果未找到则为空。
返回
如果至少找到一个有效条形码则为 true
此函数的调用图如下

◆ getDetectorScales()

void cv::barcode::BarcodeDetector::getDetectorScales ( std::vector< float > & sizes) const
Python
cv.barcode.BarcodeDetector.getDetectorScales() -> sizes

返回检测器盒式滤波器尺寸。

参数
sizes用于返回尺寸的输出参数。

◆ getDownsamplingThreshold()

double cv::barcode::BarcodeDetector::getDownsamplingThreshold ( ) const
Python
cv.barcode.BarcodeDetector.getDownsamplingThreshold() -> retval

获取检测器下采样阈值。

返回
检测器下采样阈值

◆ getGradientThreshold()

double cv::barcode::BarcodeDetector::getGradientThreshold ( ) const
Python
cv.barcode.BarcodeDetector.getGradientThreshold() -> retval

获取检测器梯度幅值阈值。

返回
检测器梯度幅值阈值。

◆ setDetectorScales()

BarcodeDetector & cv::barcode::BarcodeDetector::setDetectorScales ( const std::vector< float > & sizes)
Python
cv.barcode.BarcodeDetector.setDetectorScales(sizes) -> retval

设置检测器盒式滤波器尺寸。

调整检测步骤中使用的盒式滤波器值和数量。滤波器尺寸与条形码的预期线宽直接相关。对应于预期条形码距离。如果下采样限制增加,则需要以反比例方式调整滤波器尺寸。

参数
sizes盒式滤波器尺寸,相对于图像的最小维度(默认值 [0.01, 0.03, 0.06, 0.08])

◆ setDownsamplingThreshold()

BarcodeDetector & cv::barcode::BarcodeDetector::setDownsamplingThreshold ( double thresh)
Python
cv.barcode.BarcodeDetector.setDownsamplingThreshold(thresh) -> retval

设置检测器下采样阈值。

默认情况下,如果最小图像尺寸大于此阈值,则 detect 方法会将输入图像大小调整到此限制。增加此值可以提高检测精度和结果数量,但会牺牲性能。与检测器尺度相关。将其设置为大值将禁用下采样。

参数
thresh要应用的下采样限制(默认值 512)
另请参见
setDetectorScales

◆ setGradientThreshold()

BarcodeDetector & cv::barcode::BarcodeDetector::setGradientThreshold ( double thresh)
Python
cv.barcode.BarcodeDetector.setGradientThreshold(thresh) -> retval

设置检测器梯度幅值阈值。

设置检测到的边界框的相干性阈值。增加此值将生成更紧密的边界框宽度,并可以减少误报。值在 16 到 1024 之间通常有效,而过高的值将移除有效检测。

参数
thresh梯度幅值阈值(默认值 64)。

此类的文档是从以下文件生成的