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

クラス SuperpixelSEEDS


  • public class SuperpixelSEEDS extends Algorithm
    CITE: VBRV14 で説明されているSEEDS (Superpixels Extracted via Energy-Driven Sampling) スーパーピクセルアルゴリズムを実装したクラス。このアルゴリズムは、効率的な山登り法 (hill-climbing) を用いて、色ヒストグラムと(省略可能な)境界項に基づくスーパーピクセルのエネルギー関数を最適化する。エネルギー関数はスーパーピクセルが同じ色になるよう促し、境界項が有効な場合はスーパーピクセルが滑らかな境界を持ち、形状が類似するようにする。実際には、スーパーピクセルの規則的なグリッドから開始し、境界上のピクセルやピクセルのブロックを移動させて解を洗練する。このアルゴリズムは単一のCPUを用いてリアルタイムで動作する。
    • フィールドの要約

    • コンストラクタの要約

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

      すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド
      Modifier and Type Method Description
      static SuperpixelSEEDS __fromPtr__​(long addr)  
      void getLabelContourMask​(Mat image)
      Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
      void getLabelContourMask​(Mat image, boolean thick_line)
      Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
      void getLabels​(Mat labels_out)
      Returns the segmentation labeling of the image.
      int getNumberOfSuperpixels()
      Calculates the superpixel segmentation on a given image stored in SuperpixelSEEDS object.
      void iterate​(Mat img)
      Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object.
      void iterate​(Mat img, int num_iterations)
      Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object.
      • クラス java.lang.Object から継承したメソッド

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • コンストラクタの詳細

      • SuperpixelSEEDS

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

      • getNumberOfSuperpixels

        public int getNumberOfSuperpixels()
        Calculates the superpixel segmentation on a given image stored in SuperpixelSEEDS object. The function computes the superpixels segmentation of an image with the parameters initialized with the function createSuperpixelSEEDS().
        戻り値:
        自動生成
      • iterate

        public void iterate​(Mat img,
                            int num_iterations)
        Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object. This function can be called again for other images without the need of initializing the algorithm with createSuperpixelSEEDS(). This save the computational cost of allocating memory for all the structures of the algorithm.
        引数:
        img - 入力画像。サポートされている形式: CV_8U, CV_16U, CV_32F。画像サイズとチャンネル数は、createSuperpixelSEEDS() 関数で初期化された画像サイズおよびチャンネルと一致しなければならない。HSVまたはLab色空間であること。Labの方がやや良いが、より低速である。
        num_iterations - ピクセルレベルの反復回数。数を増やすと結果が改善される。この関数は、createSuperpixelSEEDS() 関数で初期化された引数を用いて画像のスーパーピクセルセグメンテーションを計算する。アルゴリズムはスーパーピクセルのグリッドから開始し、境界上にあるピクセルブロックを大きいサイズから小さいサイズへと更新を提案して境界を洗練し、最後にピクセル単位の更新を提案して仕上げる。説明用の例を以下に示す。 ![image](pics/superpixels_blocks2.png)
      • iterate

        public void iterate​(Mat img)
        Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object. This function can be called again for other images without the need of initializing the algorithm with createSuperpixelSEEDS(). This save the computational cost of allocating memory for all the structures of the algorithm.
        引数:
        img - 入力画像。サポートされている形式: CV_8U, CV_16U, CV_32F。画像サイズとチャンネル数は、createSuperpixelSEEDS() 関数で初期化された画像サイズおよびチャンネルと一致しなければならない。HSVまたはLab色空間であること。Labの方がやや良いが、より低速である。この関数は、createSuperpixelSEEDS() 関数で初期化された引数を用いて画像のスーパーピクセルセグメンテーションを計算する。アルゴリズムはスーパーピクセルのグリッドから開始し、境界上にあるピクセルブロックを大きいサイズから小さいサイズへと更新を提案して境界を洗練し、最後にピクセル単位の更新を提案して仕上げる。説明用の例を以下に示す。 ![image](pics/superpixels_blocks2.png)
      • getLabels

        public void getLabels​(Mat labels_out)
        Returns the segmentation labeling of the image. Each label represents a superpixel, and each pixel is assigned to one superpixel label.
        引数:
        labels_out - 戻り値: スーパーピクセルセグメンテーションのラベルを格納したCV_32UC1整数配列。ラベルは [0, getNumberOfSuperpixels()] の範囲にある。この関数は、スーパーピクセルセグメンテーションのラベルを持つ画像を返す。ラベルは [0, getNumberOfSuperpixels()] の範囲にある。
      • getLabelContourMask

        public void getLabelContourMask​(Mat image,
                                        boolean thick_line)
        Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
        引数:
        image - 戻り値: CV_8UC1 の画像マスク。-1 はそのピクセルがスーパーピクセルの境界であることを示し、それ以外は 0 となる。
        thick_line - If false, the border is only one pixel wide, otherwise all pixels at the border are masked. The function return the boundaries of the superpixel segmentation. 覚え書き:
        • (Python) A demo on how to generate superpixels in images from the webcam can be found at opencv_source_code/samples/python2/seeds.py
          • (cpp) Webカメラの画像からスーパーピクセルを生成する方法のデモは opencv_source_code/modules/ximgproc/samples/seeds.cpp にある。コマンドライン引数として画像ファイルを追加すると、Webカメラの代わりにその静止画像が使用される。
          • Webカメラの映像にスーパーピクセルの境界が赤でマークされたウィンドウが表示される(下記参照)。Spaceキーで異なる出力モードを切り替えられる。ウィンドウ上部には4つのスライダーがあり、スーパーピクセルの数、ブロックレベルの数、形状を変える境界事前項の強さ、ピクセルレベルでの反復回数をリアルタイムに変更できる。これは引数を試行し、ユーザーの都合に合わせて設定するのに役立つ。コンソールにはアルゴリズムのフレームレートが表示される。
          ![image](pics/superpixels_demo.png)
      • getLabelContourMask

        public void getLabelContourMask​(Mat image)
        Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
        引数:
        image - Return: CV_8UC1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise. are masked. The function return the boundaries of the superpixel segmentation. 覚え書き:
        • (Python) A demo on how to generate superpixels in images from the webcam can be found at opencv_source_code/samples/python2/seeds.py
          • (cpp) Webカメラの画像からスーパーピクセルを生成する方法のデモは opencv_source_code/modules/ximgproc/samples/seeds.cpp にある。コマンドライン引数として画像ファイルを追加すると、Webカメラの代わりにその静止画像が使用される。
          • Webカメラの映像にスーパーピクセルの境界が赤でマークされたウィンドウが表示される(下記参照)。Spaceキーで異なる出力モードを切り替えられる。ウィンドウ上部には4つのスライダーがあり、スーパーピクセルの数、ブロックレベルの数、形状を変える境界事前項の強さ、ピクセルレベルでの反復回数をリアルタイムに変更できる。これは引数を試行し、ユーザーの都合に合わせて設定するのに役立つ。コンソールにはアルゴリズムのフレームレートが表示される。
          ![image](pics/superpixels_demo.png)