MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
nearest_neighbor.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 */
9
10#ifndef SFM_NEAREST_NEIGHBOR_HEADER
11#define SFM_NEAREST_NEIGHBOR_HEADER
12
13#include "sfm/defines.h"
14
15#define ENABLE_SSE2_NN_SEARCH 1
16#define ENABLE_SSE3_NN_SEARCH 1
17
19
45template <typename T>
47{
48public:
57
58public:
59 NearestNeighbor (void);
61 void set_elements (T const* elements);
63 void set_element_dimensions (int element_dimensions);
65 void set_num_elements (int num_elements);
67 void find (T const* query, Result* result) const;
68
69 int get_element_dimensions (void) const;
70
71private:
72 int dimensions;
73 int num_elements;
74 T const* elements;
75};
76
77/* ---------------------------------------------------------------- */
78
79template <typename T>
80inline
82 : dimensions(64)
83 , num_elements(0)
84 , elements(nullptr)
85{
86}
87
88template <typename T>
89inline void
91{
92 this->elements = elements;
93}
94
95template <typename T>
96inline void
98{
99 this->dimensions = element_dimensions;
100}
101
102template <typename T>
103inline void
105{
106 this->num_elements = num_elements;
107}
108
109template <typename T>
110inline int
112{
113 return this->dimensions;
114}
115
117
118#endif /* SFM_NEAREST_NEIGHBOR_HEADER */
Nearest (and second nearest) neighbor search for normalized vectors.
void set_element_dimensions(int element_dimensions)
For SfM, this is the descriptor length.
void find(T const *query, Result *result) const
Find the nearest neighbor of 'query'.
int get_element_dimensions(void) const
void set_elements(T const *elements)
For SfM, this is the descriptor memory block.
void set_num_elements(int num_elements)
For SfM, this is the number of descriptors.
#define SFM_NAMESPACE_END
Definition defines.h:14
#define SFM_NAMESPACE_BEGIN
Definition defines.h:13
Unlike the naming suggests, these are square distances.