OpenCV 5.0.0
Open Source Computer Vision
読み込み中...
検索中...
見つかりません
🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
cv::barcode::BarcodeDetector クラス

#include <opencv2/objdetect/barcode.hpp>

Collaboration diagram for cv::barcode::BarcodeDetector:

公開メンバ関数

 BarcodeDetector ()
 BarcodeDetector を初期化する。超解像は無効。
 
 BarcodeDetector (CV_WRAP_FILE_PATH const std::string &super_resolution_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)
 検出器の勾配の大きさのしきい値を設定する。
 
- Public Member Functions inherited from 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
 

Additional Inherited Members

- Protected Attributes inherited from cv::GraphicalCodeDetector
Ptr< Impl > p
 

構築子と解体子の詳解

◆ BarcodeDetector() [1/2]

cv::barcode::BarcodeDetector::BarcodeDetector ( )
Python:
cv.barcode.BarcodeDetector() -> <barcode_BarcodeDetector object>
cv.barcode.BarcodeDetector(super_resolution_model_path) -> <barcode_BarcodeDetector object>

BarcodeDetector を初期化する。超解像は無効。

◆ BarcodeDetector() [2/2]

cv::barcode::BarcodeDetector::BarcodeDetector ( CV_WRAP_FILE_PATH const std::string & super_resolution_model_path)
Python:
cv.barcode.BarcodeDetector() -> <barcode_BarcodeDetector object>
cv.barcode.BarcodeDetector(super_resolution_model_path) -> <barcode_BarcodeDetector object>

超解像モデルを用いて BarcodeDetector を初期化する。

ONNX 形式の超解像 DNN モデルを読み込む。デコード前に小さい/低品質なバーコードの切り出し領域を拡大し、品質を向上させるために使用する。

覚え書き
Caffe モデル (sr.prototxt / sr.caffemodel) はサポートされなくなった。モデルを ONNX に変換すること(変換済みの sr.onnxhttps://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode から入手できる)。
引数
super_resolution_model_path単一ファイルの ONNX 超解像モデルへのパス。

◆ ~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)の画像。
pointsdetect() メソッド(または他のアルゴリズム)で見つかった回転矩形の頂点のベクトル。検出されたバーコードが N 個の場合、この配列の次元は [N][4] であるべきである。vector<Point2f> における4点の順序は bottomLeft, topLeft, topRight, bottomRight である。
decoded_infoUTF8エンコードされた出力文字列ベクトル。コードが復号できない場合は空の文字列ベクトル。
decoded_typeこれらのバーコードの種類を指定する文字列のベクトル
戻り値
少なくとも1つの有効なバーコードが見つかった場合に 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見つかったバーコード矩形の頂点を返す省略可能な出力ベクトル。見つからない場合は空となる。
戻り値
少なくとも1つの有効なバーコードが見つかった場合に 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)。

このクラス詳解は次のファイルから抽出されました: