🤖 AIによる機械翻訳(非公式) — これは OpenCV 4.13.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。

クラス Dnn


  • public class Dnn
    extends java.lang.Object
    • コンストラクタの詳細

      • Dnn

        public Dnn()
    • メソッドの詳細

      • getAvailableTargets

        public static java.util.List<java.lang.Integer> getAvailableTargets​(int be)
      • readNetFromDarknet

        public static Net readNetFromDarknet​(java.lang.String cfgFile,
                                             java.lang.String darknetModel)
        Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
        引数:
        cfgFile - ネットワークアーキテクチャのテキスト記述を含む .cfg ファイルへのパス。
        darknetModel - 学習済みネットワークを含む .weights ファイルへのパス。
        戻り値:
        フォワード処理の準備が整ったネットワークオブジェクト。失敗時には例外をスローする。
      • readNetFromDarknet

        public static Net readNetFromDarknet​(java.lang.String cfgFile)
        Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
        引数:
        cfgFile - ネットワークアーキテクチャのテキスト記述を含む .cfg ファイルへのパス。
        戻り値:
        フォワード処理の準備が整ったネットワークオブジェクト。失敗時には例外をスローする。
      • readNetFromDarknet

        public static Net readNetFromDarknet​(MatOfByte bufferCfg,
                                             MatOfByte bufferModel)
        Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
        引数:
        bufferCfg - ネットワークアーキテクチャのテキスト記述を含む .cfg ファイルの内容を保持するバッファ。
        bufferModel - 学習済みネットワークを含む .weights ファイルの内容を保持するバッファ。
        戻り値:
        Net オブジェクト。
      • readNetFromDarknet

        public static Net readNetFromDarknet​(MatOfByte bufferCfg)
        Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
        引数:
        bufferCfg - ネットワークアーキテクチャのテキスト記述を含む .cfg ファイルの内容を保持するバッファ。
        戻り値:
        Net オブジェクト。
      • readNetFromCaffe

        public static Net readNetFromCaffe​(java.lang.String prototxt,
                                           java.lang.String caffeModel)
        Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
        引数:
        prototxt - ネットワークアーキテクチャのテキスト記述を含む .prototxt ファイルへのパス。
        caffeModel - 学習済みネットワークを含む .caffemodel ファイルへのパス。
        戻り値:
        Net オブジェクト。
      • readNetFromCaffe

        public static Net readNetFromCaffe​(java.lang.String prototxt)
        Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
        引数:
        prototxt - ネットワークアーキテクチャのテキスト記述を含む .prototxt ファイルへのパス。
        戻り値:
        Net オブジェクト。
      • readNetFromCaffe

        public static Net readNetFromCaffe​(MatOfByte bufferProto,
                                           MatOfByte bufferModel)
        Reads a network model stored in Caffe model in memory.
        引数:
        bufferProto - .prototxt ファイルの内容を保持するバッファ
        bufferModel - .caffemodel ファイルの内容を保持するバッファ
        戻り値:
        Net オブジェクト。
      • readNetFromCaffe

        public static Net readNetFromCaffe​(MatOfByte bufferProto)
        Reads a network model stored in Caffe model in memory.
        引数:
        bufferProto - .prototxt ファイルの内容を保持するバッファ
        戻り値:
        Net オブジェクト。
      • readNetFromTensorflow

        public static Net readNetFromTensorflow​(java.lang.String model,
                                                java.lang.String config)
        Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
        引数:
        model - ネットワークアーキテクチャのバイナリ protobuf 記述を含む .pb ファイルへのパス
        config - protobuf 形式のテキストグラフ定義を含む .pbtxt ファイルへのパス。結果として得られる Net オブジェクトは、バイナリ側の重みを用いてテキストグラフから構築され、より柔軟に扱えるようになる。
        戻り値:
        Net オブジェクト。
      • readNetFromTensorflow

        public static Net readNetFromTensorflow​(java.lang.String model)
        Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
        引数:
        model - ネットワークアーキテクチャのバイナリ protobuf 記述を含む .pb ファイルへのパス。結果として得られる Net オブジェクトは、バイナリ側の重みを用いてテキストグラフから構築され、より柔軟に扱えるようになる。
        戻り値:
        Net オブジェクト。
      • readNetFromTensorflow

        public static Net readNetFromTensorflow​(MatOfByte bufferModel,
                                                MatOfByte bufferConfig)
        Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
        引数:
        bufferModel - pb ファイルの内容を保持するバッファ
        bufferConfig - pbtxt ファイルの内容を保持するバッファ
        戻り値:
        Net オブジェクト。
      • readNetFromTensorflow

        public static Net readNetFromTensorflow​(MatOfByte bufferModel)
        Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
        引数:
        bufferModel - pb ファイルの内容を保持するバッファ
        戻り値:
        Net オブジェクト。
      • readNetFromTFLite

        public static Net readNetFromTFLite​(java.lang.String model)
        Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.
        引数:
        model - ネットワークアーキテクチャのバイナリ flatbuffers 記述を含む .tflite ファイルへのパス
        戻り値:
        Net オブジェクト。
      • readNetFromTFLite

        public static Net readNetFromTFLite​(MatOfByte bufferModel)
        Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.
        引数:
        bufferModel - tflite ファイルの内容を保持するバッファ
        戻り値:
        Net オブジェクト。
      • readNetFromTorch

        public static Net readNetFromTorch​(java.lang.String model,
                                           boolean isBinary,
                                           boolean evaluate)
        Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
        引数:
        model - torch.save() 関数を使って Torch からダンプしたファイルへのパス。
        isBinary - ネットワークが ascii モードとバイナリモードのどちらでシリアライズされたかを指定する。
        evaluate - ネットワークのテストフェーズを指定する。true の場合、Torch の evaluate() メソッドと同様の挙動になる。
        戻り値:
        Net オブジェクト。覚え書き: Torch シリアライザの ascii モードの方が望ましい。バイナリモードは C 言語の long 型を多用するが、この型はシステムによってビット長が異なるためである。読み込むファイルには、インポートするネットワークを含むシリアライズされた <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> オブジェクトが含まれていなければならない。インポートエラーを避けるため、シリアライズデータからカスタムオブジェクトを排除するとよい。サポートされているレイヤー(すなわち Torch nn.Module クラスから派生したオブジェクトインスタンス)の一覧: - nn.Sequential - nn.Parallel - nn.Concat - nn.Linear - nn.SpatialConvolution - nn.SpatialMaxPooling, nn.SpatialAveragePooling - nn.ReLU, nn.TanH, nn.Sigmoid - nn.Reshape - nn.SoftMax, nn.LogSoftMax また、cunn, cudnn, fbcunn の同等クラスの一部も正常にインポートできる場合がある。
      • readNetFromTorch

        public static Net readNetFromTorch​(java.lang.String model,
                                           boolean isBinary)
        Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
        引数:
        model - torch.save() 関数を使って Torch からダンプしたファイルへのパス。
        isBinary - ネットワークが ascii モードとバイナリモードのどちらでシリアライズされたかを指定する。
        戻り値:
        Net オブジェクト。覚え書き: Torch シリアライザの ascii モードの方が望ましい。バイナリモードは C 言語の long 型を多用するが、この型はシステムによってビット長が異なるためである。読み込むファイルには、インポートするネットワークを含むシリアライズされた <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> オブジェクトが含まれていなければならない。インポートエラーを避けるため、シリアライズデータからカスタムオブジェクトを排除するとよい。サポートされているレイヤー(すなわち Torch nn.Module クラスから派生したオブジェクトインスタンス)の一覧: - nn.Sequential - nn.Parallel - nn.Concat - nn.Linear - nn.SpatialConvolution - nn.SpatialMaxPooling, nn.SpatialAveragePooling - nn.ReLU, nn.TanH, nn.Sigmoid - nn.Reshape - nn.SoftMax, nn.LogSoftMax また、cunn, cudnn, fbcunn の同等クラスの一部も正常にインポートできる場合がある。
      • readNetFromTorch

        public static Net readNetFromTorch​(java.lang.String model)
        Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
        引数:
        model - torch.save() 関数を使って Torch からダンプしたファイルへのパス。
        戻り値:
        Net オブジェクト。覚え書き: Torch シリアライザの ascii モードの方が望ましい。バイナリモードは C 言語の long 型を多用するが、この型はシステムによってビット長が異なるためである。読み込むファイルには、インポートするネットワークを含むシリアライズされた <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> オブジェクトが含まれていなければならない。インポートエラーを避けるため、シリアライズデータからカスタムオブジェクトを排除するとよい。サポートされているレイヤー(すなわち Torch nn.Module クラスから派生したオブジェクトインスタンス)の一覧: - nn.Sequential - nn.Parallel - nn.Concat - nn.Linear - nn.SpatialConvolution - nn.SpatialMaxPooling, nn.SpatialAveragePooling - nn.ReLU, nn.TanH, nn.Sigmoid - nn.Reshape - nn.SoftMax, nn.LogSoftMax また、cunn, cudnn, fbcunn の同等クラスの一部も正常にインポートできる場合がある。
      • readNet

        public static Net readNet​(java.lang.String model,
                                  java.lang.String config,
                                  java.lang.String framework)
        Read deep learning network represented in one of the supported formats.
        引数:
        model - 学習済みの重みを含むバイナリファイル。フレームワークごとのモデルでは以下のファイル拡張子が想定される: * *.caffemodel (Caffe, http://caffe.berkeleyvision.org/) * *.pb (TensorFlow, https://www.tensorflow.org/) * *.t7 | *.net (Torch, http://torch.ch/) * *.weights (Darknet, https://pjreddie.com/darknet/) * *.bin | *.onnx (OpenVINO, https://software.intel.com/openvino-toolkit) * *.onnx (ONNX, https://onnx.ai/)
        config - ネットワーク構成を含むテキストファイル。以下の拡張子のファイルが該当する: * *.prototxt (Caffe, http://caffe.berkeleyvision.org/) * *.pbtxt (TensorFlow, https://www.tensorflow.org/) * *.cfg (Darknet, https://pjreddie.com/darknet/) * *.xml (OpenVINO, https://software.intel.com/openvino-toolkit)
        framework - フォーマットを判別するための明示的なフレームワーク名のタグ。
        戻り値:
        Net オブジェクト。この関数は学習済みモデルの元フレームワークを自動的に検出し、REF: readNetFromCaffe、REF: readNetFromTensorflow、REF: readNetFromTorch、REF: readNetFromDarknet などの適切な関数を呼び出す。model と config の引数の順序は問わない。
      • readNet

        public static Net readNet​(java.lang.String model,
                                  java.lang.String config)
        Read deep learning network represented in one of the supported formats.
        引数:
        model - 学習済みの重みを含むバイナリファイル。フレームワークごとのモデルでは以下のファイル拡張子が想定される: * *.caffemodel (Caffe, http://caffe.berkeleyvision.org/) * *.pb (TensorFlow, https://www.tensorflow.org/) * *.t7 | *.net (Torch, http://torch.ch/) * *.weights (Darknet, https://pjreddie.com/darknet/) * *.bin | *.onnx (OpenVINO, https://software.intel.com/openvino-toolkit) * *.onnx (ONNX, https://onnx.ai/)
        config - ネットワーク構成を含むテキストファイル。以下の拡張子のファイルが該当する: * *.prototxt (Caffe, http://caffe.berkeleyvision.org/) * *.pbtxt (TensorFlow, https://www.tensorflow.org/) * *.cfg (Darknet, https://pjreddie.com/darknet/) * *.xml (OpenVINO, https://software.intel.com/openvino-toolkit)
        戻り値:
        Net オブジェクト。この関数は学習済みモデルの元フレームワークを自動的に検出し、REF: readNetFromCaffe、REF: readNetFromTensorflow、REF: readNetFromTorch、REF: readNetFromDarknet などの適切な関数を呼び出す。model と config の引数の順序は問わない。
      • readNet

        public static Net readNet​(java.lang.String model)
        Read deep learning network represented in one of the supported formats.
        引数:
        model - 学習済みの重みを含むバイナリファイル。フレームワークごとのモデルでは以下のファイル拡張子が想定される: * *.caffemodel (Caffe, http://caffe.berkeleyvision.org/) * *.pb (TensorFlow, https://www.tensorflow.org/) * *.t7 | *.net (Torch, http://torch.ch/) * *.weights (Darknet, https://pjreddie.com/darknet/) * *.bin | *.onnx (OpenVINO, https://software.intel.com/openvino-toolkit) * *.onnx (ONNX, https://onnx.ai/) 以下の拡張子のファイル: * *.prototxt (Caffe, http://caffe.berkeleyvision.org/) * *.pbtxt (TensorFlow, https://www.tensorflow.org/) * *.cfg (Darknet, https://pjreddie.com/darknet/) * *.xml (OpenVINO, https://software.intel.com/openvino-toolkit)
        戻り値:
        Net オブジェクト。この関数は学習済みモデルの元フレームワークを自動的に検出し、REF: readNetFromCaffe、REF: readNetFromTensorflow、REF: readNetFromTorch、REF: readNetFromDarknet などの適切な関数を呼び出す。model と config の引数の順序は問わない。
      • readNet

        public static Net readNet​(java.lang.String framework,
                                  MatOfByte bufferModel,
                                  MatOfByte bufferConfig)
        Read deep learning network represented in one of the supported formats. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
        引数:
        framework - 元フレームワークの名前。
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク構成を含むテキストファイルの内容を格納したバッファ。
        戻り値:
        Net オブジェクト。
      • readNet

        public static Net readNet​(java.lang.String framework,
                                  MatOfByte bufferModel)
        Read deep learning network represented in one of the supported formats. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
        引数:
        framework - 元フレームワークの名前。
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        戻り値:
        Net オブジェクト。
      • readTorchBlob

        public static Mat readTorchBlob​(java.lang.String filename,
                                        boolean isBinary)
        Loads blob which was serialized as torch.Tensor object of Torch7 framework. WARNING: This function has the same limitations as readNetFromTorch().
        引数:
        filename - 自動生成
        isBinary - 自動生成
        戻り値:
        自動生成
      • readTorchBlob

        public static Mat readTorchBlob​(java.lang.String filename)
        Loads blob which was serialized as torch.Tensor object of Torch7 framework. WARNING: This function has the same limitations as readNetFromTorch().
        引数:
        filename - 自動生成
        戻り値:
        自動生成
      • readNetFromModelOptimizer

        public static Net readNetFromModelOptimizer​(java.lang.String xml,
                                                    java.lang.String bin)
        Load a network from Intel's Model Optimizer intermediate representation.
        引数:
        xml - ネットワークのトポロジーを記述した XML 構成ファイル。
        bin - 学習済みの重みを含むバイナリファイル。
        戻り値:
        Net オブジェクト。Intel の Model Optimizer からインポートされたネットワークは、Intel の Inference Engine バックエンドで実行される。
      • readNetFromModelOptimizer

        public static Net readNetFromModelOptimizer​(java.lang.String xml)
        Load a network from Intel's Model Optimizer intermediate representation.
        引数:
        xml - ネットワークのトポロジーを記述した XML 構成ファイル。
        戻り値:
        Net オブジェクト。Intel の Model Optimizer からインポートされたネットワークは、Intel の Inference Engine バックエンドで実行される。
      • readNetFromModelOptimizer

        public static Net readNetFromModelOptimizer​(MatOfByte bufferModelConfig,
                                                    MatOfByte bufferWeights)
        Load a network from Intel's Model Optimizer intermediate representation.
        引数:
        bufferModelConfig - ネットワークのトポロジーを記述した XML 構成を含むバッファ。
        bufferWeights - 学習済みの重みのバイナリデータを含むバッファ。
        戻り値:
        Net オブジェクト。Intel の Model Optimizer からインポートされたネットワークは、Intel の Inference Engine バックエンドで実行される。
      • readNetFromONNX

        public static Net readNetFromONNX​(java.lang.String onnxFile)
        Reads a network model <a href="https://onnx.ai/">ONNX</a>.
        引数:
        onnxFile - ネットワークアーキテクチャのテキスト記述を含む .onnx ファイルへのパス。
        戻り値:
        フォワード処理の準備が整ったネットワークオブジェクト。失敗時には例外をスローする。
      • readNetFromONNX

        public static Net readNetFromONNX​(MatOfByte buffer)
        Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.
        引数:
        buffer - ONNX モデルのバイト列を格納したメモリ上のバッファ。
        戻り値:
        フォワード処理の準備が整ったネットワークオブジェクト。失敗時には例外をスローする。
      • readTensorFromONNX

        public static Mat readTensorFromONNX​(java.lang.String path)
        Creates blob from .pb file.
        引数:
        path - 入力テンソルを含む .pb ファイルへのパス。
        戻り値:
        Mat。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor,
                                        Size size,
                                        Scalar mean,
                                        boolean swapRB,
                                        boolean crop,
                                        int ddepth)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。
        crop - リサイズ後に画像を切り抜くかどうかを示すフラグ。
        ddepth - 出力 blob のビット深度。CV_32F または CV_8U を選択する。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor,
                                        Size size,
                                        Scalar mean,
                                        boolean swapRB,
                                        boolean crop)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。
        crop - リサイズ後に画像を切り抜くかどうかを示すフラグ。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor,
                                        Size size,
                                        Scalar mean,
                                        boolean swapRB)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor,
                                        Size size,
                                        Scalar mean)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor,
                                        Size size)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。
        size - 出力画像の空間サイズ。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image,
                                        double scalefactor)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。
        scalefactor - images の値に対する乗数。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImage

        public static Mat blobFromImage​(Mat image)
        Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        image - 入力画像(1、3、または 4 チャンネル)。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor,
                                         Size size,
                                         Scalar mean,
                                         boolean swapRB,
                                         boolean crop,
                                         int ddepth)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。
        crop - リサイズ後に画像を切り抜くかどうかを示すフラグ。
        ddepth - 出力 blob のビット深度。CV_32F または CV_8U を選択する。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor,
                                         Size size,
                                         Scalar mean,
                                         boolean swapRB,
                                         boolean crop)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。
        crop - リサイズ後に画像を切り抜くかどうかを示すフラグ。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor,
                                         Size size,
                                         Scalar mean,
                                         boolean swapRB)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。
        swapRB - 3 チャンネル画像において最初と最後のチャンネルを入れ替える必要があることを示すフラグ。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor,
                                         Size size,
                                         Scalar mean)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。
        size - 出力画像の空間サイズ。
        mean - 各チャンネルから減算される平均値を表すスカラ。image が BGR 順で swapRB が true の場合、値は (mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor,
                                         Size size)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。
        size - 出力画像の空間サイズ。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images,
                                         double scalefactor)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。
        scalefactor - images の値に対する乗数。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImages

        public static Mat blobFromImages​(java.util.List<Mat> images)
        Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
        引数:
        images - 入力画像群(いずれも 1、3、または 4 チャンネル)。image が BGR 順で swapRB が true の場合、(mean-R, mean-G, mean-B) の順であることが想定される。3 チャンネル画像において必要となる。crop が true の場合、入力画像はリサイズ後の一辺が size の対応する次元と等しくなり、もう一辺がそれと等しいか大きくなるようにリサイズされる。その後、中央から切り抜きが行われる。crop が false の場合、切り抜きは行わず、アスペクト比を保持せずに直接リサイズが行われる。
        戻り値:
        NCHW の次元順序を持つ 4 次元の Mat。覚え書き: scalefactor と mean の順序および用法は (input - mean) * scalefactor である。
      • blobFromImageWithParams

        public static Mat blobFromImageWithParams​(Mat image,
                                                  Image2BlobParams param)
        Creates 4-dimensional blob from image with given params. This function is an extension of REF: blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.
        引数:
        image - 入力画像(いずれも 1、3、または 4 チャンネル)。
        param - Image2BlobParams 構造体。画像から blob への処理に必要なすべての引数を含む。
        戻り値:
        4 次元の Mat。
      • blobFromImageWithParams

        public static Mat blobFromImageWithParams​(Mat image)
        Creates 4-dimensional blob from image with given params. This function is an extension of REF: blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.
        引数:
        image - 入力画像(いずれも 1、3、または 4 チャンネル)。
        戻り値:
        4 次元の Mat。
      • blobFromImageWithParams

        public static void blobFromImageWithParams​(Mat image,
                                                   Mat blob,
                                                   Image2BlobParams param)
      • blobFromImageWithParams

        public static void blobFromImageWithParams​(Mat image,
                                                   Mat blob)
      • blobFromImagesWithParams

        public static Mat blobFromImagesWithParams​(java.util.List<Mat> images,
                                                   Image2BlobParams param)
        Creates 4-dimensional blob from series of images with given params. This function is an extension of REF: blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.
        引数:
        images - 入力画像(いずれも 1、3、または 4 チャンネル)。
        param - Image2BlobParams 構造体。画像から blob への処理に必要なすべての引数を含む。
        戻り値:
        4 次元の Mat。
      • blobFromImagesWithParams

        public static Mat blobFromImagesWithParams​(java.util.List<Mat> images)
        Creates 4-dimensional blob from series of images with given params. This function is an extension of REF: blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.
        引数:
        images - 入力画像(いずれも 1、3、または 4 チャンネル)。
        戻り値:
        4 次元の Mat。
      • blobFromImagesWithParams

        public static void blobFromImagesWithParams​(java.util.List<Mat> images,
                                                    Mat blob,
                                                    Image2BlobParams param)
      • blobFromImagesWithParams

        public static void blobFromImagesWithParams​(java.util.List<Mat> images,
                                                    Mat blob)
      • imagesFromBlob

        public static void imagesFromBlob​(Mat blob_,
                                          java.util.List<Mat> images_)
        Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
        引数:
        blob_ - 画像を抽出したい元となる、浮動小数点精度 (CV_32F) の 4 次元配列 (images, channels, height, width)。
        images_ - blob から抽出した画像を浮動小数点精度 (CV_32F) で格納した 2D Mat の配列。これらは正規化も平均加算もされていない。返される画像の数は blob の最初の次元(バッチサイズ)に等しい。各画像のチャンネル数は blob の 2 番目の次元(ビット深度)に等しい。
      • shrinkCaffeModel

        public static void shrinkCaffeModel​(java.lang.String src,
                                            java.lang.String dst,
                                            java.util.List<java.lang.String> layersTypes)
        Convert all weights of Caffe network to half precision floating point.
        引数:
        src - 単精度浮動小数点の重みを含む Caffe フレームワークの元モデルへのパス(通常は .caffemodel 拡張子を持つ)。
        dst - 更新された重みを持つ出力先モデルへのパス。
        layersTypes - 引数を変換するレイヤー型の集合。デフォルトでは、Convolutional レイヤーと Fully-Connected レイヤーの重みのみを変換する。覚え書き: 縮小されたモデルは元の float32 の重みを持たないため、元の Caffe フレームワークではもう使用できない。ただしデータ構造は NVidia の Caffe フォーク (https://github.com/NVIDIA/caffe) から取られているため、結果のモデルはそこで使用できる場合がある。
      • shrinkCaffeModel

        public static void shrinkCaffeModel​(java.lang.String src,
                                            java.lang.String dst)
        Convert all weights of Caffe network to half precision floating point.
        引数:
        src - 単精度浮動小数点の重みを含む Caffe フレームワークの元モデルへのパス(通常は .caffemodel 拡張子を持つ)。
        dst - 更新された重みを持つ出力先モデルへのパス。デフォルトでは、Convolutional レイヤーと Fully-Connected レイヤーの重みのみを変換する。覚え書き: 縮小されたモデルは元の float32 の重みを持たないため、元の Caffe フレームワークではもう使用できない。ただしデータ構造は NVidia の Caffe フォーク (https://github.com/NVIDIA/caffe) から取られているため、結果のモデルはそこで使用できる場合がある。
      • writeTextGraph

        public static void writeTextGraph​(java.lang.String model,
                                          java.lang.String output)
        Create a text representation for a binary network stored in protocol buffer format.
        引数:
        model - バイナリネットワークへのパス。
        output - 作成する出力テキストファイルへのパス。覚え書き: 出力ファイルサイズを削減するため、学習済みの重みは含まれない。
      • NMSBoxes

        public static void NMSBoxes​(MatOfRect2d bboxes,
                                    MatOfFloat scores,
                                    float score_threshold,
                                    float nms_threshold,
                                    MatOfInt indices,
                                    float eta,
                                    int top_k)
        Performs non maximum suppression given boxes and corresponding scores.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        eta - 適応的しきい値の式における係数: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\)。
        top_k - &gt;0 の場合、最大で top_k 個の選択されたインデックスを保持する。
      • NMSBoxes

        public static void NMSBoxes​(MatOfRect2d bboxes,
                                    MatOfFloat scores,
                                    float score_threshold,
                                    float nms_threshold,
                                    MatOfInt indices,
                                    float eta)
        Performs non maximum suppression given boxes and corresponding scores.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        eta - 適応的しきい値の式における係数: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\)。
      • NMSBoxes

        public static void NMSBoxes​(MatOfRect2d bboxes,
                                    MatOfFloat scores,
                                    float score_threshold,
                                    float nms_threshold,
                                    MatOfInt indices)
        Performs non maximum suppression given boxes and corresponding scores.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
      • NMSBoxesRotated

        public static void NMSBoxesRotated​(MatOfRotatedRect bboxes,
                                           MatOfFloat scores,
                                           float score_threshold,
                                           float nms_threshold,
                                           MatOfInt indices,
                                           float eta,
                                           int top_k)
      • NMSBoxesRotated

        public static void NMSBoxesRotated​(MatOfRotatedRect bboxes,
                                           MatOfFloat scores,
                                           float score_threshold,
                                           float nms_threshold,
                                           MatOfInt indices,
                                           float eta)
      • NMSBoxesBatched

        public static void NMSBoxesBatched​(MatOfRect2d bboxes,
                                           MatOfFloat scores,
                                           MatOfInt class_ids,
                                           float score_threshold,
                                           float nms_threshold,
                                           MatOfInt indices,
                                           float eta,
                                           int top_k)
        Performs batched non maximum suppression on given boxes and corresponding scores across different classes.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        class_ids - 対応するクラス ID の集合。ID は整数で、通常は 0 から始まる。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        eta - 適応的しきい値の式における係数: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\)。
        top_k - &gt;0 の場合、最大で top_k 個の選択されたインデックスを保持する。
      • NMSBoxesBatched

        public static void NMSBoxesBatched​(MatOfRect2d bboxes,
                                           MatOfFloat scores,
                                           MatOfInt class_ids,
                                           float score_threshold,
                                           float nms_threshold,
                                           MatOfInt indices,
                                           float eta)
        Performs batched non maximum suppression on given boxes and corresponding scores across different classes.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        class_ids - 対応するクラス ID の集合。ID は整数で、通常は 0 から始まる。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        eta - 適応的しきい値の式における係数: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\)。
      • NMSBoxesBatched

        public static void NMSBoxesBatched​(MatOfRect2d bboxes,
                                           MatOfFloat scores,
                                           MatOfInt class_ids,
                                           float score_threshold,
                                           float nms_threshold,
                                           MatOfInt indices)
        Performs batched non maximum suppression on given boxes and corresponding scores across different classes.
        引数:
        bboxes - NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        class_ids - 対応するクラス ID の集合。ID は整数で、通常は 0 から始まる。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
      • softNMSBoxes

        public static void softNMSBoxes​(MatOfRect bboxes,
                                        MatOfFloat scores,
                                        MatOfFloat updated_scores,
                                        float score_threshold,
                                        float nms_threshold,
                                        MatOfInt indices,
                                        long top_k,
                                        float sigma)
        Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
        引数:
        bboxes - Soft NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        updated_scores - 対応する更新後の確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        top_k - 最大で top_k 個の選択されたインデックスを保持する。
        sigma - ガウス重み付けのパラメータ。 SEE: SoftNMSMethod
      • softNMSBoxes

        public static void softNMSBoxes​(MatOfRect bboxes,
                                        MatOfFloat scores,
                                        MatOfFloat updated_scores,
                                        float score_threshold,
                                        float nms_threshold,
                                        MatOfInt indices,
                                        long top_k)
        Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
        引数:
        bboxes - Soft NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        updated_scores - 対応する更新後の確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS 後に保持された bboxes のインデックス。
        top_k - 選択するインデックスを最大で top_k 個に保持する。 SEE: SoftNMSMethod
      • softNMSBoxes

        public static void softNMSBoxes​(MatOfRect bboxes,
                                        MatOfFloat scores,
                                        MatOfFloat updated_scores,
                                        float score_threshold,
                                        float nms_threshold,
                                        MatOfInt indices)
        Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
        引数:
        bboxes - Soft NMS を適用するバウンディングボックスの集合。
        scores - 対応する確信度の集合。
        updated_scores - 対応する更新後の確信度の集合。
        score_threshold - スコアによってボックスをフィルタリングするために使用するしきい値。
        nms_threshold - non maximum suppression で使用するしきい値。
        indices - NMS適用後に保持されたバウンディングボックスのインデックス。 SEE: SoftNMSMethod
      • getInferenceEngineBackendType

        @Deprecated
        public static java.lang.String getInferenceEngineBackendType()
        Deprecated.
        Returns Inference Engine internal backend API. See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros. OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE runtime parameter (environment variable) is ignored since 4.6.0.
        戻り値:
        自動生成
      • setInferenceEngineBackendType

        @Deprecated
        public static java.lang.String setInferenceEngineBackendType​(java.lang.String newBackendType)
        Deprecated.
        Specify Inference Engine internal backend API. See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros.
        引数:
        newBackendType - 自動生成
        戻り値:
        内部バックエンド API の以前の値
      • resetMyriadDevice

        public static void resetMyriadDevice()
        Release a Myriad device (binded by OpenCV). Single Myriad device cannot be shared across multiple processes which uses Inference Engine's Myriad plugin.
      • getInferenceEngineVPUType

        public static java.lang.String getInferenceEngineVPUType()
        Returns Inference Engine VPU type. See values of CV_DNN_INFERENCE_ENGINE_VPU_TYPE_* macros.
        戻り値:
        自動生成
      • getInferenceEngineCPUType

        public static java.lang.String getInferenceEngineCPUType()
        Returns Inference Engine CPU type. Specify OpenVINO plugin: CPU or ARM.
        戻り値:
        自動生成
      • releaseHDDLPlugin

        public static void releaseHDDLPlugin()
        Release a HDDL plugin.