🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.features
クラス ANNIndex
- java.lang.Object
-
- org.opencv.features.ANNIndex
public class ANNIndex extends java.lang.Object*************************************************************************************\ 近似最近傍探索 (Approximate Nearest Neighbors) * \***************************************************************************************
-
-
フィールドの要約
フィールド Modifier and Type Field Description static intDIST_ANGULARstatic intDIST_DOTPRODUCTstatic intDIST_EUCLIDEANstatic intDIST_HAMMINGstatic intDIST_MANHATTANprotected longnativeObj
-
コンストラクタの要約
コンストラクタ Modifier Constructor Description protectedANNIndex​(long addr)
-
メソッドの要約
すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド Modifier and Type Method Description static ANNIndex__fromPtr__​(long addr)voidaddItems​(Mat features)Add feature vectors to index.voidbuild()Build the index.voidbuild​(int trees)Build the index.static ANNIndexcreate​(int dim)Creates an instance of annoy index class with given parametersstatic ANNIndexcreate​(int dim, int distType)Creates an instance of annoy index class with given parametersintgetItemNumber()Return the number of feature vectors in the index.longgetNativeObjAddr()intgetTreeNumber()Return the number of trees in the index.voidknnSearch​(Mat query, Mat indices, Mat dists, int knn)Performs a K-nearest neighbor search for given query vector(s) using the index.voidknnSearch​(Mat query, Mat indices, Mat dists, int knn, int search_k)Performs a K-nearest neighbor search for given query vector(s) using the index.voidload​(java.lang.String filename)Loads (mmaps) an index from disk.voidload​(java.lang.String filename, boolean prefault)Loads (mmaps) an index from disk.voidsave​(java.lang.String filename)Save the index to disk and loads it.voidsave​(java.lang.String filename, boolean prefault)Save the index to disk and loads it.booleansetOnDiskBuild​(java.lang.String filename)Prepare to build the index in the specified file instead of RAM (execute before adding items, no need to save after build)voidsetSeed​(int seed)Initialize the random number generator with the given seed.
-
-
-
フィールドの詳細
-
nativeObj
protected final long nativeObj
-
DIST_EUCLIDEAN
public static final int DIST_EUCLIDEAN
- 関連項目:
- 定数フィールドの値
-
DIST_MANHATTAN
public static final int DIST_MANHATTAN
- 関連項目:
- 定数フィールドの値
-
DIST_ANGULAR
public static final int DIST_ANGULAR
- 関連項目:
- 定数フィールドの値
-
DIST_HAMMING
public static final int DIST_HAMMING
- 関連項目:
- 定数フィールドの値
-
DIST_DOTPRODUCT
public static final int DIST_DOTPRODUCT
- 関連項目:
- 定数フィールドの値
-
-
メソッドの詳細
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static ANNIndex __fromPtr__​(long addr)
-
addItems
public void addItems​(Mat features)
Add feature vectors to index.- 引数:
features- インデックスに登録する特徴ベクトルを格納した行列。行列のサイズは num_features x feature_dimension。
-
build
public void build​(int trees)
Build the index.- 引数:
trees- インデックス内の木の本数。指定しない場合、特徴ベクトルが消費するメモリの最大 2 倍までしか使わないように本数が自動的に決定される。
-
build
public void build()
Build the index. in a way that at most 2x as much memory as the features vectors take is used.
-
knnSearch
public void knnSearch​(Mat query, Mat indices, Mat dists, int knn, int search_k)
Performs a K-nearest neighbor search for given query vector(s) using the index.- 引数:
query- クエリベクトル。indices- 見つかった K 近傍のインデックスを格納する行列。省略可能。dists- 見つかった K 近傍までの距離を格納する行列。省略可能。knn- 探索する最近傍の数。search_k- 調べるノード数の最大値。指定しない場合は trees x knn がデフォルトとなる。
-
knnSearch
public void knnSearch​(Mat query, Mat indices, Mat dists, int knn)
Performs a K-nearest neighbor search for given query vector(s) using the index.- 引数:
query- クエリベクトル。indices- 見つかった K 近傍のインデックスを格納する行列。省略可能。dists- 見つかった K 近傍までの距離を格納する行列。省略可能。knn- 探索する最近傍の数。
-
save
public void save​(java.lang.String filename, boolean prefault)Save the index to disk and loads it. After saving, no more vectors can be added.- 引数:
filename- 保存するインデックスのファイル名。prefault- prefault を true に設定すると、ファイル全体をあらかじめメモリに読み込む (MAP_POPULATE 付きの mmap を使用)。デフォルトは false。
-
save
public void save​(java.lang.String filename)
Save the index to disk and loads it. After saving, no more vectors can be added.- 引数:
filename- 保存するインデックスのファイル名。with MAP_POPULATE). Default is false.
-
load
public void load​(java.lang.String filename, boolean prefault)Loads (mmaps) an index from disk.- 引数:
filename- 読み込むインデックスのファイル名。prefault- prefault を true に設定すると、ファイル全体をあらかじめメモリに読み込む (MAP_POPULATE 付きの mmap を使用)。デフォルトは false。
-
load
public void load​(java.lang.String filename)
Loads (mmaps) an index from disk.- 引数:
filename- 読み込むインデックスのファイル名。with MAP_POPULATE). Default is false.
-
getTreeNumber
public int getTreeNumber()
Return the number of trees in the index.- 戻り値:
- 自動生成
-
getItemNumber
public int getItemNumber()
Return the number of feature vectors in the index.- 戻り値:
- 自動生成
-
setOnDiskBuild
public boolean setOnDiskBuild​(java.lang.String filename)
Prepare to build the index in the specified file instead of RAM (execute before adding items, no need to save after build)- 引数:
filename- 構築するインデックスのファイル名。- 戻り値:
- 自動生成
-
setSeed
public void setSeed​(int seed)
Initialize the random number generator with the given seed. Only necessary to pass this before adding the items. Will have no effect after calling build() or load().- 引数:
seed- 乱数生成器に与えるシード。値は uint32_t の範囲内である必要がある。
-
create
public static ANNIndex create​(int dim, int distType)
Creates an instance of annoy index class with given parameters- 引数:
dim- 特徴ベクトルの次元。distType- 2 つの特徴ベクトル間の距離を計算するための距離尺度。DIST_EUCLIDEAN, DIST_MANHATTAN, DIST_ANGULAR, DIST_HAMMING, DIST_DOTPRODUCT のいずれかを指定できる。- 戻り値:
- 自動生成
-
create
public static ANNIndex create​(int dim)
Creates an instance of annoy index class with given parameters- 引数:
dim- 特徴ベクトルの次元。DIST_MANHATTAN, DIST_ANGULAR, DIST_HAMMING, or DIST_DOTPRODUCT.- 戻り値:
- 自動生成
-
-