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

クラス FaceDetectorYN


  • public class FaceDetectorYN extends java.lang.Object
    DNNベースの顔検出器。モデルのダウンロードリンク: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
    • フィールドの要約

      フィールド
      Modifier and Type Field Description
      protected long nativeObj  
    • コンストラクタの要約

      コンストラクタ
      Modifier Constructor Description
      protected FaceDetectorYN​(long addr)  
    • メソッドの要約

      すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド
      Modifier and Type Method Description
      static FaceDetectorYN __fromPtr__​(long addr)  
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size, float score_threshold)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
      Creates an instance of face detector class with given parameters
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size)  
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold)  
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold)  
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k)  
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)  
      static FaceDetectorYN create​(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)  
      int detect​(Mat image, Mat faces)
      Detects faces in the input image.
      Size getInputSize()  
      long getNativeObjAddr()  
      float getNMSThreshold()  
      float getScoreThreshold()  
      int getTopK()  
      void setInputSize​(Size input_size)
      Set the size for the network input, which overwrites the input size of creating model.
      void setNMSThreshold​(float nms_threshold)
      Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
      void setScoreThreshold​(float score_threshold)
      Set the score threshold to filter out bounding boxes of score less than the given value
      void setTopK​(int top_k)
      Set the number of bounding boxes preserved before NMS
      • クラス java.lang.Object から継承したメソッド

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • フィールドの詳細

      • nativeObj

        protected final long nativeObj
    • コンストラクタの詳細

      • FaceDetectorYN

        protected FaceDetectorYN​(long addr)
    • メソッドの詳細

      • getNativeObjAddr

        public long getNativeObjAddr()
      • __fromPtr__

        public static FaceDetectorYN __fromPtr__​(long addr)
      • setInputSize

        public void setInputSize​(Size input_size)
        Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model
        引数:
        input_size - 入力画像のサイズ
      • getInputSize

        public Size getInputSize()
      • setScoreThreshold

        public void setScoreThreshold​(float score_threshold)
        Set the score threshold to filter out bounding boxes of score less than the given value
        引数:
        score_threshold - バウンディングボックスをフィルタリングするためのしきい値
      • getScoreThreshold

        public float getScoreThreshold()
      • setNMSThreshold

        public void setNMSThreshold​(float nms_threshold)
        Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
        引数:
        nms_threshold - NMS処理のためのしきい値
      • getNMSThreshold

        public float getNMSThreshold()
      • setTopK

        public void setTopK​(int top_k)
        Set the number of bounding boxes preserved before NMS
        引数:
        top_k - スコアに基づく上位ランクから保持するバウンディングボックスの数
      • getTopK

        public int getTopK()
      • detect

        public int detect​(Mat image,
                          Mat faces)
        Detects faces in the input image. Following is an example output. ![image](pics/lena-face-detection.jpg)
        引数:
        image - 検出対象の画像
        faces - 検出結果。形状 [num_faces, 15] の2次元 cv::Mat に格納される - 0-1: bboxの左上隅の x, y - 2-3: bboxの幅と高さ - 4-5: 右目の x, y (サンプル画像の青い点) - 6-7: 左目の x, y (サンプル画像の赤い点) - 8-9: 鼻先の x, y (サンプル画像の緑の点) - 10-11: 口の右端の x, y (サンプル画像のピンクの点) - 12-13: 口の左端の x, y (サンプル画像の黄色の点) - 14: 顔のスコア
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k,
                                            int backend_id,
                                            int target_id)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        backend_id - バックエンドのID
        target_id - ターゲットデバイスのID
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k,
                                            int backend_id)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        backend_id - バックエンドのID
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size,
                                            float score_threshold)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String model,
                                            java.lang.String config,
                                            Size input_size)
        Creates an instance of face detector class with given parameters
        引数:
        model - 要求するモデルへのパス
        config - 互換性のための設定ファイルへのパス。ONNXモデルでは不要
        input_size - 入力画像のサイズ
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k,
                                            int backend_id,
                                            int target_id)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        backend_id - バックエンドのID
        target_id - ターゲットデバイスのID
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k,
                                            int backend_id)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        backend_id - バックエンドのID
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold,
                                            int top_k)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        top_k - NMSの前に保持する上位K個のbbox
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size,
                                            float score_threshold,
                                            float nms_threshold)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        nms_threshold - 指定した値より大きいIoUのバウンディングボックスを抑制するためのしきい値
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size,
                                            float score_threshold)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        score_threshold - 指定した値より小さいスコアのバウンディングボックスを除外するためのしきい値
        戻り値:
        自動生成
      • create

        public static FaceDetectorYN create​(java.lang.String framework,
                                            MatOfByte bufferModel,
                                            MatOfByte bufferConfig,
                                            Size input_size)
        引数:
        framework - 由来となるフレームワークの名前
        bufferModel - 重みを含むバイナリファイルの内容を格納したバッファ。
        bufferConfig - ネットワーク設定を含むテキストファイルの内容を持つバッファ
        input_size - 入力画像のサイズ
        戻り値:
        自動生成