41 #pragma GCC system_header
44 #include <pcl/memory.h>
70 Neighbors(
int n1 = 0,
int n2 = 0) : n1(n1), n2(n2) {}
79 init(
const std::vector<float>& feature,
const int feature_dimension,
const int N);
82 compute(std::vector<float>& out,
83 const std::vector<float>& in,
88 int out_size = -1)
const;
91 initOLD(
const std::vector<float>& feature,
const int feature_dimension,
const int N);
95 const std::vector<float>& in,
100 int out_size = -1)
const;
110 for (
int i = 0; i <
d_; i++) {
161 std::cout <<
"GROW" << std::endl;
164 short* old_keys =
keys_;
166 int old_capacity =
static_cast<int>(
capacity_);
169 keys_ =
new short[(old_capacity + 10) * key_size_]{};
171 std::fill(table_, table_ + capacity_, -1);
172 std::copy(old_keys, old_keys + filled_ * key_size_, keys_);
175 for (
int i = 0; i < old_capacity; i++)
176 if (old_table[i] >= 0) {
177 int e = old_table[i];
179 for (; table_[h] >= 0; h = h < capacity_ - 1 ? h + 1 : 0) {
192 for (std::size_t i = 0; i <
key_size_; i++) {
201 : key_size_(key_size), filled_(0), capacity_(2 * n_elements)
204 keys_ =
new short[(capacity_ / 2 + 10) * key_size_]{};
205 std::fill(table_, table_ + capacity_, -1);
217 return static_cast<int>(
filled_);
224 std::fill(table_, table_ + capacity_, -1);
228 find(
const short* k,
bool create =
false)
230 if (2 * filled_ >= capacity_)
240 for (std::size_t i = 0; i <
key_size_; i++)
241 keys_[filled_ * key_size_ + i] = k[i];
242 return table_[h] =
static_cast<int>(filled_++);
249 for (std::size_t i = 0; i < key_size_ && good; i++)
250 if (keys_[e * key_size_ + i] != k[i])
Implementation of a high-dimensional gaussian filtering using the permutohedral lattice.
void computeOLD(std::vector< float > &out, const std::vector< float > &in, int value_size, int in_offset=0, int out_offset=0, int in_size=-1, int out_size=-1) const
std::vector< Neighbors > blur_neighbors_
void initOLD(const std::vector< float > &feature, const int feature_dimension, const int N)
std::vector< float > offset_
HashTableOLD(int key_size, int n_elements)
Permutohedral()
Constructor for Permutohedral class.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
int find(const short *k, bool create=false)
std::vector< float > baryOLD_
int N_
Number of variables.
void init(const std::vector< float > &feature, const int feature_dimension, const int N)
Initialization.
std::vector< float > offsetTMP_
void compute(std::vector< float > &out, const std::vector< float > &in, int value_size, int in_offset=0, int out_offset=0, int in_size=-1, int out_size=-1) const
std::size_t hash(const short *k)
std::size_t generateHashKey(const std::vector< short > &k)
Pseudo random generator.
std::vector< float > barycentric_
Neighbors(int n1=0, int n2=0)
const short * getKey(int i) const
int d_
Dimension of feature.
Neighbors * blur_neighborsOLD_
int M_
Size of sparse discretized space.