50 : rotation_invariance_enabled_ (
true)
51 , scale_invariance_enabled_ (
true)
52 , pattern_scale_ (1.0f)
53 , input_cloud_ (), keypoints_ (), scale_range_ (), pattern_points_ (), points_ ()
58 , strings_ (0), d_max_ (0.0f), d_min_ (0.0f), short_pairs_ (), long_pairs_ ()
59 , no_short_pairs_ (0), no_long_pairs_ (0)
61 , name_ (
"BRISK2Destimation")
71 const float f = 0.85f * pattern_scale_;
117 pattern_points_ =
new BriskPatternPoint[points_*scales_*n_rot_];
121 static const float lb_scale = std::log (scalerange_) / std::log (2.0);
124 scale_list_ =
new float[scales_];
125 size_list_ =
new unsigned int[scales_];
129 for (
unsigned int scale = 0; scale < scales_; ++scale)
131 scale_list_[scale] =
static_cast<float> (
pow (
double (2.0),
static_cast<double> (
float (scale) *
lb_scale_step)));
132 size_list_[scale] = 0;
135 for (std::size_t
rot = 0;
rot < n_rot_; ++
rot)
158 if (size_list_[scale] <
size)
159 size_list_[scale] =
size;
169 short_pairs_ =
new BriskShortPair[points_ * (points_ - 1) / 2];
170 long_pairs_ =
new BriskLongPair[points_ * (points_ - 1) / 2];
181 const float d_min_sq = d_min_ * d_min_;
182 const float d_max_sq = d_max_ * d_max_;
183 for (
unsigned int i = 1; i < points_; i++)
185 for (
unsigned int j = 0; j < i; j++)
188 const float dx = pattern_points_[j].x - pattern_points_[i].x;
189 const float dy = pattern_points_[j].y - pattern_points_[i].y;
194 BriskLongPair&
longPair = long_pairs_[no_long_pairs_];
214 strings_ =
int (std::ceil ((
float (no_short_pairs_)) / 128.0)) * 4 * 4;
449 if (!input_cloud_->isOrganized ())
451 PCL_ERROR (
"[pcl::%s::initCompute] %s doesn't support non organized clouds!\n", name_.c_str ());
457 const index_t height =
static_cast<index_t>(input_cloud_->height);
460 std::vector<unsigned char>
image_data (width*height);
463 image_data[i] =
static_cast<unsigned char> (intensity_ ((*input_cloud_)[i]));
473 typename std::vector<KeypointT, Eigen::aligned_allocator<KeypointT> >::iterator
beginning = keypoints_->points.begin ();
479 if (!scale_invariance_enabled_)
482 for (std::size_t k = 0; k <
ksize; k++)
485 if (scale_invariance_enabled_)
489 if (scale >= scales_) scale = scales_ - 1;
498 const int border = size_list_[scale];
505 keypoints_->points.erase (
beginning + k);
517 keypoints_->width = keypoints_->
size ();
518 keypoints_->height = 1;
522 std::vector<int> integral ((width+1)*(height+1), 0);
532 - integral[
index2-1-(width+1)]
533 + integral[
index2-(width+1)]
538 int* values =
new int[points_];
556 for (std::size_t k = 0; k <
ksize; k++)
558 unsigned char* ptr = &
output[k].descriptor[0];
569 if (!rotation_invariance_enabled_)
575 for (
unsigned int i = 0; i < points_; i++)
576 *(
pvalues++) = smoothedIntensity (
image_data, width, height, integral, x, y, scale, 0, i);
581 const BriskLongPair* max = long_pairs_ + no_long_pairs_;
583 for (BriskLongPair* iter = long_pairs_; iter < max; ++iter)
585 t1 = *(values + iter->i);
586 t2 = *(values + iter->j);
590 const int tmp0 =
delta_t * (iter->weighted_dx) / 1024;
591 const int tmp1 =
delta_t * (iter->weighted_dy) / 1024;
596 theta =
static_cast<int> ((
float (n_rot_) *
kp.angle) / (360.0f) + 0.5f);
599 if (
theta >=
int (n_rot_))
607 if (!rotation_invariance_enabled_)
611 theta =
static_cast<int> (n_rot_ * (
kp.angle / (360.0)) + 0.5);
614 if (
theta >=
int (n_rot_))
626 for (
unsigned int i = 0; i < points_; i++)
634 #define UCHAR_ALIAS std::uint32_t
635 #define UINT32_ALIAS std::uint32_t
640 const BriskShortPair* max = short_pairs_ + no_short_pairs_;
642 for (BriskShortPair* iter = short_pairs_; iter < max; ++iter)
644 t1 = *(values + iter->i);
645 t2 = *(values + iter->j);
void generateKernel(std::vector< float > &radius_list, std::vector< int > &number_list, float d_max=5.85f, float d_min=8.2f, std::vector< int > index_change=std::vector< int >())
Call this to generate the kernel: circle of radius r (pixels), with n points; short pairings with dMa...
int smoothedIntensity(const std::vector< unsigned char > &image, int image_width, int image_height, const std::vector< int > &integral_image, const float key_x, const float key_y, const unsigned int scale, const unsigned int rot, const unsigned int point) const
Compute the smoothed intensity for a given x/y position in the image.