Skip to content

Replace '->points.' with just '->' #4218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ColorSHOTLocalEstimation : public LocalEstimator<PointInT, FeatureT> {
// compute keypoints
computeKeypoints(processed, keypoints, normals);

if (keypoints->points.size() == 0) {
if (keypoints->size() == 0) {
PCL_WARN("ColorSHOTLocalEstimation :: No keypoints were found\n");
return false;
}
Expand All @@ -73,13 +73,13 @@ class ColorSHOTLocalEstimation : public LocalEstimator<PointInT, FeatureT> {
shot_estimate.setSearchSurface(processed);
shot_estimate.setRadiusSearch(support_radius_);
shot_estimate.compute(*shots);
signatures->resize(shots->points.size());
signatures->width = static_cast<int>(shots->points.size());
signatures->resize(shots->size());
signatures->width = static_cast<int>(shots->size());
signatures->height = 1;

int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float);

for (std::size_t k = 0; k < shots->points.size(); k++)
for (std::size_t k = 0; k < shots->size(); k++)
for (int i = 0; i < size_feat; i++)
signatures->points[k].histogram[i] = shots->points[k].descriptor[i];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ class FPFHLocalEstimation : public LocalEstimator<PointInT, FeatureT> {
normal_estimator_->estimate(in, processed, normals);

this->computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size()
<< std::endl;
std::cout << " " << normals->size() << " " << processed->size() << std::endl;

if (keypoints->points.empty()) {
if (keypoints->empty()) {
PCL_WARN("FPFHLocalEstimation :: No keypoints were found\n");
return false;
}

assert(processed->points.size() == normals->points.size());
assert(processed->size() == normals->size());

// compute signatures
using FPFHEstimator =
Expand All @@ -75,12 +74,12 @@ class FPFHLocalEstimation : public LocalEstimator<PointInT, FeatureT> {
fpfh_estimate.setRadiusSearch(support_radius_);
fpfh_estimate.compute(*fpfhs);

signatures->resize(fpfhs->points.size());
signatures->width = static_cast<int>(fpfhs->points.size());
signatures->resize(fpfhs->size());
signatures->width = static_cast<int>(fpfhs->size());
signatures->height = 1;

int size_feat = 33;
for (std::size_t k = 0; k < fpfhs->points.size(); k++)
for (std::size_t k = 0; k < fpfhs->size(); k++)
for (int i = 0; i < size_feat; i++)
signatures->points[k].histogram[i] = fpfhs->points[k].histogram[i];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ class FPFHLocalEstimationOMP : public LocalEstimator<PointInT, FeatureT> {

// compute keypoints
computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size()
<< std::endl;
std::cout << " " << normals->size() << " " << processed->size() << std::endl;

if (keypoints->points.size() == 0) {
if (keypoints->size() == 0) {
PCL_WARN("FPFHLocalEstimation :: No keypoints were found\n");
return false;
}

assert(processed->points.size() == normals->points.size());
assert(processed->size() == normals->size());

// compute signatures
using FPFHEstimator =
Expand All @@ -77,12 +76,12 @@ class FPFHLocalEstimationOMP : public LocalEstimator<PointInT, FeatureT> {
fpfh_estimate.setRadiusSearch(support_radius_);
fpfh_estimate.compute(*fpfhs);

signatures->resize(fpfhs->points.size());
signatures->width = static_cast<int>(fpfhs->points.size());
signatures->resize(fpfhs->size());
signatures->width = static_cast<int>(fpfhs->size());
signatures->height = 1;

int size_feat = 33;
for (std::size_t k = 0; k < fpfhs->points.size(); k++)
for (std::size_t k = 0; k < fpfhs->size(); k++)
for (int i = 0; i < size_feat; i++)
signatures->points[k].histogram[i] = fpfhs->points[k].histogram[i];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ class UniformSamplingExtractor : public KeypointExtractor<PointInT> {
tree->setInputCloud(input);

neighborhood_indices_.reset(new std::vector<std::vector<int>>);
neighborhood_indices_->resize(keypoints_cloud->points.size());
neighborhood_indices_->resize(keypoints_cloud->size());
neighborhood_dist_.reset(new std::vector<std::vector<float>>);
neighborhood_dist_->resize(keypoints_cloud->points.size());
neighborhood_dist_->resize(keypoints_cloud->size());

filtered_keypoints.points.resize(keypoints_cloud->points.size());
filtered_keypoints.points.resize(keypoints_cloud->size());
int good = 0;

for (std::size_t i = 0; i < keypoints_cloud->points.size(); i++) {
for (std::size_t i = 0; i < keypoints_cloud->size(); i++) {

if (tree->radiusSearch(keypoints_cloud->points[i],
radius_,
Expand Down Expand Up @@ -133,7 +133,7 @@ class UniformSamplingExtractor : public KeypointExtractor<PointInT> {

neighborhood_indices_->resize(good);
neighborhood_dist_->resize(good);
keypoints_cloud->points.resize(good);
keypoints_cloud->resize(good);

neighborhood_indices_->clear();
neighborhood_dist_->clear();
Expand Down Expand Up @@ -215,7 +215,7 @@ class SIFTSurfaceKeypointExtractor : public KeypointExtractor<PointInT> {
void
compute(PointInTPtr& keypoints)
{
if (normals_ == 0 || (normals_->points.size() != input_->points.size()))
if (normals_ == 0 || (normals_->size() != input_->size()))
PCL_WARN("SIFTSurfaceKeypointExtractor -- Normals are not valid\n");

keypoints.reset(new pcl::PointCloud<PointInT>);
Expand All @@ -224,8 +224,8 @@ class SIFTSurfaceKeypointExtractor : public KeypointExtractor<PointInT> {
new pcl::PointCloud<pcl::PointNormal>);
input_cloud->width = input_->width;
input_cloud->height = input_->height;
input_cloud->points.resize(input_->width * input_->height);
for (std::size_t i = 0; i < input_->points.size(); i++) {
input_cloud->resize(input_->width * input_->height);
for (std::size_t i = 0; i < input_->size(); i++) {
input_cloud->points[i].getVector3fMap() = input_->points[i].getVector3fMap();
input_cloud->points[i].getNormalVector3fMap() =
normals_->points[i].getNormalVector3fMap();
Expand Down Expand Up @@ -298,7 +298,7 @@ class HarrisKeypointExtractor : public KeypointExtractor<PointInT> {
{
keypoints.reset(new pcl::PointCloud<PointInT>);

if (normals_ == 0 || (normals_->points.size() != input_->points.size()))
if (normals_ == 0 || (normals_->size() != input_->size()))
PCL_WARN("HarrisKeypointExtractor -- Normals are not valid\n");

typename pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_keypoints(
Expand Down Expand Up @@ -347,7 +347,7 @@ class SUSANKeypointExtractor : public KeypointExtractor<PointInT> {
{
keypoints.reset(new pcl::PointCloud<PointInT>);

if (normals_ == 0 || (normals_->points.size() != input_->points.size()))
if (normals_ == 0 || (normals_->size() != input_->size()))
PCL_WARN("SUSANKeypointExtractor -- Normals are not valid\n");

typename pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_keypoints(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ class SHOTLocalEstimation : public LocalEstimator<PointInT, FeatureT> {

// compute keypoints
this->computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size()
<< std::endl;
std::cout << " " << normals->size() << " " << processed->size() << std::endl;

if (keypoints->points.empty()) {
if (keypoints->empty()) {
PCL_WARN("SHOTLocalEstimation :: No keypoints were found\n");
return false;
}

std::cout << keypoints->points.size() << " " << normals->points.size() << " "
<< processed->points.size() << std::endl;
std::cout << keypoints->size() << " " << normals->size() << " " << processed->size()
<< std::endl;
// compute signatures
using SHOTEstimator = pcl::SHOTEstimation<PointInT, pcl::Normal, pcl::SHOT352>;
typename pcl::search::KdTree<PointInT>::Ptr tree(new pcl::search::KdTree<PointInT>);
Expand All @@ -107,13 +106,13 @@ class SHOTLocalEstimation : public LocalEstimator<PointInT, FeatureT> {
shot_estimate.setInputNormals(normals);
shot_estimate.setRadiusSearch(support_radius_);
shot_estimate.compute(*shots);
signatures->resize(shots->points.size());
signatures->width = static_cast<int>(shots->points.size());
signatures->resize(shots->size());
signatures->width = static_cast<int>(shots->size());
signatures->height = 1;

int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float);

for (std::size_t k = 0; k < shots->points.size(); k++)
for (std::size_t k = 0; k < shots->size(); k++)
for (int i = 0; i < size_feat; i++)
signatures->points[k].histogram[i] = shots->points[k].descriptor[i];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ class SHOTLocalEstimationOMP : public LocalEstimator<PointInT, FeatureT> {
}

this->computeKeypoints(processed, keypoints, normals);
std::cout << " " << normals->points.size() << " " << processed->points.size()
<< std::endl;
std::cout << " " << normals->size() << " " << processed->size() << std::endl;

if (keypoints->points.empty()) {
if (keypoints->empty()) {
PCL_WARN("SHOTLocalEstimationOMP :: No keypoints were found\n");
return false;
}
Expand All @@ -112,8 +111,8 @@ class SHOTLocalEstimationOMP : public LocalEstimator<PointInT, FeatureT> {
shot_estimate.compute(*shots);
}

signatures->resize(shots->points.size());
signatures->width = static_cast<int>(shots->points.size());
signatures->resize(shots->size());
signatures->width = static_cast<int>(shots->size());
signatures->height = 1;

int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class PreProcessorAndNormalEstimator {
std::vector<int> src_indices;

float sum_distances = 0.0;
std::vector<float> avg_distances(input->points.size());
std::vector<float> avg_distances(input->size());
// Iterate through the source data set
for (std::size_t i = 0; i < input->points.size(); ++i) {
for (std::size_t i = 0; i < input->size(); ++i) {
tree->nearestKSearch(input->points[i], 9, nn_indices, nn_distances);

float avg_dist_neighbours = 0.0;
Expand Down Expand Up @@ -132,7 +132,7 @@ class PreProcessorAndNormalEstimator {
out = in;
}

if (out->points.empty()) {
if (out->empty()) {
PCL_WARN("NORMAL estimator: Cloud has no points after voxel grid, "
"won't be able to compute normals!\n");
return;
Expand All @@ -159,7 +159,7 @@ class PreProcessorAndNormalEstimator {
out = out2;
}

if (out->points.empty()) {
if (out->empty()) {
PCL_WARN("NORMAL estimator: Cloud has no points after removing outliers...!\n");
return;
}
Expand Down Expand Up @@ -188,7 +188,7 @@ class PreProcessorAndNormalEstimator {
{
pcl::ScopeTime t("check nans...");
int j = 0;
for (std::size_t i = 0; i < out->points.size(); ++i) {
for (std::size_t i = 0; i < out->size(); ++i) {
if (!std::isfinite(out->points[i].x) || !std::isfinite(out->points[i].y) ||
!std::isfinite(out->points[i].z))
continue;
Expand All @@ -197,11 +197,11 @@ class PreProcessorAndNormalEstimator {
j++;
}

if (j != static_cast<int>(out->points.size())) {
if (j != static_cast<int>(out->size())) {
PCL_ERROR("Contain nans...");
}

out->points.resize(j);
out->resize(j);
out->width = j;
out->height = 1;
}
Expand All @@ -223,7 +223,7 @@ class PreProcessorAndNormalEstimator {
if (!out->isOrganized()) {
pcl::ScopeTime t("check nans...");
int j = 0;
for (std::size_t i = 0; i < normals->points.size(); ++i) {
for (std::size_t i = 0; i < normals->size(); ++i) {
if (!std::isfinite(normals->points[i].normal_x) ||
!std::isfinite(normals->points[i].normal_y) ||
!std::isfinite(normals->points[i].normal_z))
Expand All @@ -234,19 +234,19 @@ class PreProcessorAndNormalEstimator {
j++;
}

normals->points.resize(j);
normals->resize(j);
normals->width = j;
normals->height = 1;

out->points.resize(j);
out->resize(j);
out->width = j;
out->height = 1;
}
else {
// is is organized, we set the xyz points to NaN
pcl::ScopeTime t("check nans organized...");
bool NaNs = false;
for (std::size_t i = 0; i < normals->points.size(); ++i) {
for (std::size_t i = 0; i < normals->size(); ++i) {
if (std::isfinite(normals->points[i].normal_x) &&
std::isfinite(normals->points[i].normal_y) &&
std::isfinite(normals->points[i].normal_z))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer<Distance, PointInT, FeatureT>::init
std::mt19937 rng(rd());
std::normal_distribution<float> nd(0.0f, noise_);
// Noisify each point in the dataset
for (std::size_t cp = 0; cp < view->points.size(); ++cp)
for (std::size_t cp = 0; cp < view->size(); ++cp)
view->points[cp].z += nd(rng);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,15 +583,15 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer<Distance, PointInT, FeatureT>::ini
PointInTPtr processed(new pcl::PointCloud<PointInT>);
PointInTPtr view = models->at(i).views_->at(v);

if (view->points.empty())
if (view->empty())
PCL_WARN("View has no points!!!\n");

if (noisify_) {
std::random_device rd;
std::mt19937 rng(rd());
std::normal_distribution<float> nd(0.0f, noise_);
// Noisify each point in the dataset
for (std::size_t cp = 0; cp < view->points.size(); ++cp)
for (std::size_t cp = 0; cp < view->size(); ++cp)
view->points[cp].z += nd(rng);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::

int size_feat = sizeof(signature->points[0].histogram) / sizeof(float);

for (std::size_t dd = 0; dd < signature->points.size(); dd++) {
for (std::size_t dd = 0; dd < signature->size(); dd++) {
descr_model.keypoint_id = static_cast<int>(dd);
descr_model.descr.resize(size_feat);

Expand Down Expand Up @@ -208,7 +208,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::
PointInTPtr keypoints_pointcloud;

if (signatures_ != nullptr && processed_ != nullptr &&
(signatures_->size() == keypoints_pointcloud->points.size())) {
(signatures_->size() == keypoints_pointcloud->size())) {
keypoints_pointcloud = keypoints_input_;
signatures = signatures_;
processed = processed_;
Expand All @@ -228,15 +228,14 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::
processed_ = processed;
}

std::cout << "Number of keypoints:" << keypoints_pointcloud->points.size()
<< std::endl;
std::cout << "Number of keypoints:" << keypoints_pointcloud->size() << std::endl;

int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float);

// feature matching and object hypotheses
std::map<std::string, ObjectHypothesis> object_hypotheses;
{
for (std::size_t idx = 0; idx < signatures->points.size(); idx++) {
for (std::size_t idx = 0; idx < signatures->size(); idx++) {
float* hist = signatures->points[idx].histogram;
std::vector<float> std_hist(hist, hist + size_feat);
flann_model histogram;
Expand Down Expand Up @@ -269,9 +268,9 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::
flann_models_.at(indices[0][0]).model.id_)) != object_hypotheses.end()) {
// if the object hypothesis already exists, then add information
ObjectHypothesis oh = (*it_map).second;
oh.correspondences_pointcloud->points.push_back(model_keypoint);
oh.correspondences_pointcloud->push_back(model_keypoint);
oh.correspondences_to_inputcloud->push_back(pcl::Correspondence(
static_cast<int>(oh.correspondences_pointcloud->points.size() - 1),
static_cast<int>(oh.correspondences_pointcloud->size() - 1),
static_cast<int>(idx),
distances[0][0]));
oh.feature_distances_->push_back(distances[0][0]);
Expand All @@ -282,7 +281,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::

typename pcl::PointCloud<PointInT>::Ptr correspondences_pointcloud(
new pcl::PointCloud<PointInT>());
correspondences_pointcloud->points.push_back(model_keypoint);
correspondences_pointcloud->push_back(model_keypoint);

oh.model_ = flann_models_.at(indices[0][0]).model;
oh.correspondences_pointcloud = correspondences_pointcloud;
Expand Down
Loading