41 #pragma GCC system_header
44 #include <pcl/common/eigen.h>
45 #include <pcl/memory.h>
46 #include <pcl/pcl_macros.h>
48 #include <boost/intrusive/hashtable.hpp>
78 Neighbors(
int n1 = 0,
int n2 = 0) : n1(n1), n2(n2) {}
90 init(
const std::vector<float>& feature,
const int feature_dimension,
const int N);
93 compute(std::vector<float>& out,
94 const std::vector<float>& in,
99 int out_size = -1)
const;
102 initOLD(
const std::vector<float>& feature,
const int feature_dimension,
const int N);
106 const std::vector<float>& in,
111 int out_size = -1)
const;
121 for (
int i = 0; i <
d_; i++) {
172 std::cout <<
"GROW" << std::endl;
175 short* old_keys =
keys_;
177 int old_capacity =
static_cast<int>(
capacity_);
180 keys_ =
new short[(old_capacity + 10) * key_size_];
182 memset(table_, -1, capacity_ *
sizeof(
int));
183 memcpy(keys_, old_keys, filled_ * key_size_ *
sizeof(
short));
186 for (
int i = 0; i < old_capacity; i++)
187 if (old_table[i] >= 0) {
188 int e = old_table[i];
190 for (; table_[h] >= 0; h = h < capacity_ - 1 ? h + 1 : 0) {
203 for (std::size_t i = 0; i <
key_size_; i++) {
212 : key_size_(key_size), filled_(0), capacity_(2 * n_elements)
215 keys_ =
new short[(capacity_ / 2 + 10) * key_size_];
216 memset(table_, -1, capacity_ *
sizeof(
int));
228 return static_cast<int>(
filled_);
235 memset(table_, -1, capacity_ *
sizeof(
int));
239 find(
const short* k,
bool create =
false)
241 if (2 * filled_ >= capacity_)
251 for (std::size_t i = 0; i <
key_size_; i++)
252 keys_[filled_ * key_size_ + i] = k[i];
253 return table_[h] =
static_cast<int>(filled_++);
260 for (std::size_t i = 0; i < key_size_ && good; i++)
261 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.
~Permutohedral()
Deconstructor for Permutohedral class.
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 radnom 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.