@@ -307,11 +307,21 @@ \subsubsection{flann::Index}
307
307
typedef typename Distance::ElementType ElementType;
308
308
typedef typename Distance::ResultType DistanceType;
309
309
public:
310
- Index(const Matrix<ElementType>& features, const IndexParams& params);
310
+ Index(const IndexParams& params, Distance distance = Distance() );
311
+
312
+ Index(const Matrix<ElementType>& points, const IndexParams& params,
313
+ Distance distance = Distance() );
311
314
312
315
~Index();
313
316
314
- void buildIndex();
317
+ void buildIndex();
318
+
319
+ void buildIndex(const Matrix<ElementType>& points);
320
+
321
+ void addPoints(const Matrix<ElementType>& points,
322
+ float rebuild_threshold = 2);
323
+
324
+ void removePoint(size_t point_id);
315
325
316
326
int knnSearch(const Matrix<ElementType>& queries,
317
327
Matrix<int>& indices,
@@ -325,7 +335,6 @@ \subsubsection{flann::Index}
325
335
size_t knn,
326
336
const SearchParams& params);
327
337
328
-
329
338
int radiusSearch(const Matrix<ElementType>& queries,
330
339
Matrix<int>& indices,
331
340
Matrix<DistanceType>& dists,
@@ -406,7 +415,10 @@ \subsubsection{flann::Index}
406
415
\textbf {flann::Index::Index }
407
416
Constructs a nearest neighbor search index for a given dataset.
408
417
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
409
- Index(const Matrix<ElementType>& features, const IndexParams& params);
418
+ Index(const IndexParams& params, Distance distance = Distance() );
419
+
420
+ Index(const Matrix<ElementType>& points, const IndexParams& params,
421
+ Distance distance = Distance() );
410
422
\end {Verbatim }
411
423
\begin {description }
412
424
\item [features] Matrix containing the features(points) that should be indexed, stored in a row-major order (one point
@@ -597,12 +609,33 @@ \subsubsection{flann::Index}
597
609
\end {description }
598
610
599
611
\subsubsection {flann::Index::buildIndex }
600
- Constructs the nearest neighbor search index using the parameters provided to the constructor (with the
601
- exception of saved index type).
612
+ Builds the nearest neighbor search index. There are two versions of the \texttt {buildIndex } method, one that
613
+ uses the points provided as argument and one that uses the points provided to the constructor when the object was
614
+ constructed.
602
615
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
603
- void buildIndex();
616
+ void buildIndex();
617
+
618
+ void buildIndex(const Matrix<ElementType>& points);
604
619
\end {Verbatim }
605
620
621
+ \subsubsection {flann::Index::addPoints }
622
+ The \texttt {addPoints } method can be used to incrementally add points to the index after the index was build.
623
+ To avoid the index getting unbalanced, the \texttt {addPoints } method has the option of rebuilding the index after a
624
+ large number of points have been added. The \texttt {rebuild\_ threshold } parameter controls when the index is
625
+ rebuild, by default this is done when it doubles in size (\texttt {rebuild\_ threshold } = 2).
626
+
627
+ \begin {Verbatim }[fontsize=\footnotesize,frame=single]
628
+ void addPoints(const Matrix<ElementType>& points, float rebuild_threshold = 2);
629
+ \end {Verbatim }
630
+
631
+ \subsubsection {flann::Index::removePoint }
632
+ The \texttt {removePoint } method removes one point with the specified \texttt {point\_ id } from the index. The indices
633
+ (of the remaining points) returned by the nearest neighbor operations do not change when points are removed from the
634
+ index.
635
+
636
+ \begin {Verbatim }[fontsize=\footnotesize,frame=single]
637
+ void removePoint(size_t point_id);
638
+ \end {Verbatim }
606
639
607
640
608
641
\subsubsection {flann::Index::knnSearch }
@@ -662,7 +695,7 @@ \subsubsection{flann::Index::knnSearch}
662
695
FLANN\_ True, FLANN\_ Undefined). A heap is more efficient for a large number of neighbors and less efficient for a small
663
696
number of neighbors. Default value is FLANN\_ Undefined, which lets the code choose the best option depending on the
664
697
number of neighbors requested. Only used for KNN search.
665
- \item [cores] How many cores to assign to the search (specify -1 for automatic core selection).
698
+ \item [cores] How many cores to assign to the search (specify 0 for automatic core selection).
666
699
\item [matrices\_ in\_ gpu\_ ram] for GPU search indicates if matrices are already in GPU ram.
667
700
\end {description }
668
701
\end {description }
@@ -804,7 +837,7 @@ \subsubsection{flann::KdTreeCuda3dIndex}
804
837
\subsection {Using FLANN from C }
805
838
806
839
FLANN can be used in C programs through the C bindings provided
807
- with the library. Because there is not template support in C, there
840
+ with the library. Because there is no template support in C, there
808
841
are bindings provided for the following data types: \texttt {unsigned char },
809
842
\texttt {int }, \texttt {float } and \texttt {double }. For each of the functions
810
843
below there is a corresponding version for each of the for data types, for example
0 commit comments