diff --git a/apps/src/openni_klt.cpp b/apps/src/openni_klt.cpp index 164426ba396..504d40dd665 100644 --- a/apps/src/openni_klt.cpp +++ b/apps/src/openni_klt.cpp @@ -112,7 +112,7 @@ class OpenNIViewer { using CloudConstPtr = typename Cloud::ConstPtr; OpenNIViewer(pcl::Grabber& grabber) - : grabber_(grabber), rgb_data_(nullptr), rgb_data_size_(0) + : grabber_(grabber), rgb_data_(nullptr), rgb_data_size_(0), counter_(0) {} void diff --git a/common/include/pcl/conversions.h b/common/include/pcl/conversions.h index 652a1b41b67..6acb023e73b 100644 --- a/common/include/pcl/conversions.h +++ b/common/include/pcl/conversions.h @@ -198,10 +198,10 @@ namespace pcl else { // If not, memcpy each group of contiguous fields separately - for (uindex_t row = 0; row < msg.height; ++row) + for (std::size_t row = 0; row < msg.height; ++row) { const std::uint8_t* row_data = msg_data + row * msg.row_step; - for (uindex_t col = 0; col < msg.width; ++col) + for (std::size_t col = 0; col < msg.width; ++col) { const std::uint8_t* msg_data = row_data + col * msg.point_step; for (const detail::FieldMapping& mapping : field_map) diff --git a/filters/include/pcl/filters/voxel_grid_covariance.h b/filters/include/pcl/filters/voxel_grid_covariance.h index e2c815d3cb4..536d18aaba1 100644 --- a/filters/include/pcl/filters/voxel_grid_covariance.h +++ b/filters/include/pcl/filters/voxel_grid_covariance.h @@ -464,7 +464,7 @@ namespace pcl } // Find k-nearest neighbors in the occupied voxel centroid cloud - Indices k_indices; + Indices k_indices (k); k = kdtree_.nearestKSearch (point, k, k_indices, k_sqr_distances); // Find leaves corresponding to neighbors diff --git a/registration/include/pcl/registration/impl/gicp.hpp b/registration/include/pcl/registration/impl/gicp.hpp index 35bb8c1a9f9..b3ce37af2f3 100644 --- a/registration/include/pcl/registration/impl/gicp.hpp +++ b/registration/include/pcl/registration/impl/gicp.hpp @@ -62,10 +62,8 @@ GeneralizedIterativeClosestPoint::computeCovar } Eigen::Vector3d mean; - pcl::Indices nn_indices; - nn_indices.reserve(k_correspondences_); - std::vector nn_dist_sq; - nn_dist_sq.reserve(k_correspondences_); + pcl::Indices nn_indices(k_correspondences_); + std::vector nn_dist_sq(k_correspondences_); // We should never get there but who knows if (cloud_covariances.size() < cloud->size()) @@ -85,20 +83,23 @@ GeneralizedIterativeClosestPoint::computeCovar // Find the covariance matrix for (int j = 0; j < k_correspondences_; j++) { - const PointT& pt = (*cloud)[nn_indices[j]]; + // de-mean neighbourhood to avoid inaccuracies when far away from origin + const double ptx = (*cloud)[nn_indices[j]].x - query_point.x, + pty = (*cloud)[nn_indices[j]].y - query_point.y, + ptz = (*cloud)[nn_indices[j]].z - query_point.z; - mean[0] += pt.x; - mean[1] += pt.y; - mean[2] += pt.z; + mean[0] += ptx; + mean[1] += pty; + mean[2] += ptz; - cov(0, 0) += pt.x * pt.x; + cov(0, 0) += ptx * ptx; - cov(1, 0) += pt.y * pt.x; - cov(1, 1) += pt.y * pt.y; + cov(1, 0) += pty * ptx; + cov(1, 1) += pty * pty; - cov(2, 0) += pt.z * pt.x; - cov(2, 1) += pt.z * pt.y; - cov(2, 2) += pt.z * pt.z; + cov(2, 0) += ptz * ptx; + cov(2, 1) += ptz * pty; + cov(2, 2) += ptz * ptz; } mean /= static_cast(k_correspondences_); diff --git a/registration/include/pcl/registration/impl/ppf_registration.hpp b/registration/include/pcl/registration/impl/ppf_registration.hpp index 21cff70004c..18c5855605d 100644 --- a/registration/include/pcl/registration/impl/ppf_registration.hpp +++ b/registration/include/pcl/registration/impl/ppf_registration.hpp @@ -83,9 +83,9 @@ pcl::PPFRegistration::computeTransformation( const std::vector tmp_vec(aux_size, 0); std::vector> accumulator_array(input_->size(), tmp_vec); - PCL_INFO("Accumulator array size: %u x %u.\n", - accumulator_array.size(), - accumulator_array.back().size()); + PCL_DEBUG("Accumulator array size: %u x %u.\n", + accumulator_array.size(), + accumulator_array.back().size()); PoseWithVotesList voted_poses; // Consider every -th point as the reference @@ -232,7 +232,7 @@ pcl::PPFRegistration::clusterPoses( typename pcl::PPFRegistration::PoseWithVotesList& poses, typename pcl::PPFRegistration::PoseWithVotesList& result) { - PCL_INFO("Clustering poses ...\n"); + PCL_DEBUG("Clustering poses ...\n"); // Start off by sorting the poses by the number of votes sort(poses.begin(), poses.end(), poseWithVotesCompareFunction); @@ -268,9 +268,9 @@ pcl::PPFRegistration::clusterPoses( result.clear(); std::size_t max_clusters = (clusters.size() < 3) ? clusters.size() : 3; for (std::size_t cluster_i = 0; cluster_i < max_clusters; ++cluster_i) { - PCL_INFO("Winning cluster has #votes: %d and #poses voted: %d.\n", - cluster_votes[cluster_i].second, - clusters[cluster_votes[cluster_i].first].size()); + PCL_DEBUG("Winning cluster has #votes: %d and #poses voted: %d.\n", + cluster_votes[cluster_i].second, + clusters[cluster_votes[cluster_i].first].size()); Eigen::Vector3f translation_average(0.0, 0.0, 0.0); Eigen::Vector4f rotation_average(0.0, 0.0, 0.0, 0.0); for (typename PoseWithVotesList::iterator v_it = diff --git a/segmentation/include/pcl/segmentation/impl/region_growing.hpp b/segmentation/include/pcl/segmentation/impl/region_growing.hpp index 5ed4b03bc01..754ecb14e98 100644 --- a/segmentation/include/pcl/segmentation/impl/region_growing.hpp +++ b/segmentation/include/pcl/segmentation/impl/region_growing.hpp @@ -351,7 +351,7 @@ pcl::RegionGrowing::findPointNeighbours () { for (int i_point = 0; i_point < point_number; i_point++) { - int point_index = (*indices_)[i_point]; + const auto point_index = (*indices_)[i_point]; neighbours.clear (); search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances); point_neighbours_[point_index].swap (neighbours); @@ -362,7 +362,7 @@ pcl::RegionGrowing::findPointNeighbours () for (int i_point = 0; i_point < point_number; i_point++) { neighbours.clear (); - int point_index = (*indices_)[i_point]; + const auto point_index = (*indices_)[i_point]; if (!pcl::isFinite ((*input_)[point_index])) continue; search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances); @@ -386,7 +386,7 @@ pcl::RegionGrowing::applySmoothRegionGrowingAlgorithm () { for (int i_point = 0; i_point < num_of_pts; i_point++) { - int point_index = (*indices_)[i_point]; + const auto point_index = (*indices_)[i_point]; point_residual[i_point].first = (*normals_)[point_index].curvature; point_residual[i_point].second = point_index; } @@ -396,7 +396,7 @@ pcl::RegionGrowing::applySmoothRegionGrowingAlgorithm () { for (int i_point = 0; i_point < num_of_pts; i_point++) { - int point_index = (*indices_)[i_point]; + const auto point_index = (*indices_)[i_point]; point_residual[i_point].first = 0; point_residual[i_point].second = point_index; } diff --git a/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_system.h b/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_system.h index 384e7bac83e..cde07940121 100644 --- a/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_system.h +++ b/surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_system.h @@ -137,15 +137,15 @@ #if defined(_M_X64) && defined(WIN32) && defined(WIN64) // 23 August 2007 Dale Lear -#if defined(_INC_WINDOWS) +//#if defined(_INC_WINDOWS) // The user has included Microsoft's windows.h before opennurbs.h, // and windows.h has nested includes that unconditionally define WIN32. // Just undo the damage here or everybody that includes opennurbs.h after // windows.h has to fight with this Microsoft bug. #undef WIN32 -#else -#error do not define WIN32 for x64 builds -#endif +//#else +//#error do not define WIN32 for x64 builds +//#endif // NOTE _WIN32 is defined for any type of Windows build #endif diff --git a/tools/octree_viewer.cpp b/tools/octree_viewer.cpp index 7e09b0cb4e3..6381edbed0e 100644 --- a/tools/octree_viewer.cpp +++ b/tools/octree_viewer.cpp @@ -459,8 +459,8 @@ int main(int argc, char ** argv) { if (argc != 3) { - std::cerr << "ERROR: Syntax is octreeVisu " << std::endl; - std::cerr << "EXAMPLE: ./octreeVisu bun0.pcd 0.001" << std::endl; + std::cerr << "ERROR: Syntax is " << argv[0] << " " << std::endl; + std::cerr << "EXAMPLE: ./" << argv[0] << " bun0.pcd 0.001" << std::endl; return -1; } diff --git a/tools/openni2_viewer.cpp b/tools/openni2_viewer.cpp index 7296b4e54d4..24fd15cd79c 100644 --- a/tools/openni2_viewer.cpp +++ b/tools/openni2_viewer.cpp @@ -275,10 +275,6 @@ class OpenNI2Viewer unsigned rgb_data_size_; }; -// Create the PCLVisualizer object -pcl::visualization::PCLVisualizer::Ptr cld; -pcl::visualization::ImageViewer::Ptr img; - /* ---[ */ int main (int argc, char** argv)