From 67c12632788b7e7b257d8b8c24dc237594cc307a Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Tue, 23 Apr 2019 16:22:13 +0200 Subject: [PATCH] Changes are done by run-clang-tidy -header-filter='.*' -checks='-*,readability-container-size-empty' -fix --- .../local/fpfh_local_estimator.h | 4 ++-- .../local/shot_local_estimator.h | 4 ++-- .../local/shot_local_estimator_omp.h | 4 ++-- .../feature_wrapper/normal_estimator.h | 4 ++-- .../pipeline/impl/global_nn_classifier.hpp | 4 ++-- .../impl/global_nn_recognizer_crh.hpp | 4 ++-- .../impl/global_nn_recognizer_cvfh.hpp | 8 +++---- .../pipeline/impl/local_recognizer.hpp | 2 +- .../tools/impl/organized_segmentation.hpp | 2 +- apps/cloud_composer/src/commands.cpp | 14 ++++++------ apps/cloud_composer/src/merge_selection.cpp | 2 +- apps/cloud_composer/src/project_model.cpp | 18 +++++++-------- apps/cloud_composer/src/properties_model.cpp | 4 ++-- apps/cloud_composer/src/toolbox_model.cpp | 4 ++-- .../tools/euclidean_clustering.cpp | 4 ++-- apps/cloud_composer/tools/fpfh_estimation.cpp | 4 ++-- .../tools/normal_estimation.cpp | 2 +- apps/cloud_composer/tools/sanitize_cloud.cpp | 2 +- .../tools/statistical_outlier_removal.cpp | 2 +- .../tools/voxel_grid_downsample.cpp | 2 +- .../src/offline_integration.cpp | 2 +- .../apps/impl/dominant_plane_segmentation.hpp | 12 +++++----- apps/include/pcl/apps/nn_classification.h | 2 +- apps/include/pcl/apps/vfh_nn_classifier.h | 2 +- apps/point_cloud_editor/src/selection.cpp | 2 +- apps/src/feature_matching.cpp | 2 +- apps/src/openni_tracking.cpp | 2 +- apps/src/organized_segmentation_demo.cpp | 2 +- apps/src/stereo_ground_segmentation.cpp | 4 ++-- common/include/pcl/common/impl/io.hpp | 2 +- common/src/parse.cpp | 12 +++++----- features/include/pcl/features/impl/cvfh.hpp | 2 +- features/include/pcl/features/impl/gfpfh.hpp | 2 +- .../impl/moment_of_inertia_estimation.hpp | 2 +- .../features/impl/normal_based_signature.hpp | 2 +- .../include/pcl/features/impl/our_cvfh.hpp | 6 ++--- .../pcl/features/impl/rops_estimation.hpp | 2 +- .../pcl/filters/impl/median_filter.hpp | 2 +- .../pcl/filters/impl/morphological_filter.hpp | 6 ++--- .../pcl/filters/voxel_grid_covariance.h | 4 ++-- gpu/kinfu/tools/kinfu_app.cpp | 2 +- .../kinfu_large_scale/impl/world_model.hpp | 6 ++--- .../pcl/gpu/kinfu_large_scale/world_model.h | 2 +- gpu/kinfu_large_scale/src/cyclical_buffer.cpp | 4 ++-- .../tools/standalone_texture_mapping.cpp | 6 ++--- .../include/pcl/gpu/people/label_tree.h | 22 +++++++++---------- gpu/people/src/people_detector.cpp | 8 +++---- .../impl/organized_pointcloud_compression.hpp | 4 ++-- .../organized_pointcloud_conversion.h | 4 ++-- io/src/hdl_grabber.cpp | 2 +- io/src/image_grabber.cpp | 20 ++++++++--------- io/src/libpng_wrapper.cpp | 4 ++-- io/src/obj_io.cpp | 2 +- io/src/openni2/openni2_timer_filter.cpp | 4 ++-- io/src/ply_io.cpp | 4 ++-- io/src/vlp_grabber.cpp | 2 +- .../impl/smoothed_surfaces_keypoint.hpp | 2 +- .../ml/impl/dt/decision_tree_evaluator.hpp | 2 +- .../pcl/ml/impl/dt/decision_tree_trainer.hpp | 2 +- ml/src/permutohedral.cpp | 6 ++--- ml/src/svm_wrapper.cpp | 2 +- .../pcl/outofcore/impl/octree_base_node.hpp | 2 +- .../outofcore/impl/octree_disk_container.hpp | 2 +- .../impl/outofcore_breadth_first_iterator.hpp | 4 ++-- .../impl/outofcore_depth_first_iterator.hpp | 2 +- outofcore/tools/outofcore_process.cpp | 2 +- .../pcl/people/impl/head_based_subcluster.hpp | 2 +- .../pcl/people/impl/person_classifier.hpp | 4 ++-- .../recognition/face_detection/face_common.h | 2 +- .../include/pcl/recognition/impl/hv/hv_go.hpp | 4 ++-- .../recognition/impl/implicit_shape_model.hpp | 10 ++++----- .../pcl/recognition/ransac_based/bvh.h | 2 +- .../rf_face_detector_trainer.cpp | 2 +- .../include/pcl/registration/impl/ia_fpcs.hpp | 10 ++++----- .../impl/pyramid_feature_matching.hpp | 4 ++-- .../impl/sample_consensus_prerejective.hpp | 2 +- .../segmentation/impl/cpc_segmentation.hpp | 2 +- .../segmentation/impl/crf_segmentation.hpp | 8 +++---- .../impl/min_cut_segmentation.hpp | 2 +- .../organized_multi_plane_segmentation.hpp | 2 +- .../pcl/segmentation/impl/random_walker.hpp | 4 ++-- .../pcl/segmentation/impl/region_growing.hpp | 2 +- .../segmentation/impl/region_growing_rgb.hpp | 2 +- .../impl/supervoxel_clustering.hpp | 8 +++---- .../segmentation/impl/unary_classifier.hpp | 2 +- simulation/tools/sim_terminal_demo.cpp | 2 +- simulation/tools/sim_viewer.cpp | 18 +++++++-------- .../pcl/surface/impl/texture_mapping.hpp | 2 +- surface/src/on_nurbs/sequential_fitter.cpp | 16 +++++++------- .../simplification_remove_unused_vertices.cpp | 2 +- test/geometry/test_mesh.cpp | 2 +- test/kdtree/test_kdtree.cpp | 2 +- test/octree/test_octree.cpp | 4 ++-- test/search/test_octree.cpp | 4 ++-- test/search/test_organized.cpp | 2 +- test/search/test_search.cpp | 8 +++---- tools/crop_to_hull.cpp | 2 +- tools/obj_rec_ransac_hash_table.cpp | 4 ++-- tools/obj_rec_ransac_orr_octree.cpp | 6 ++--- tools/obj_rec_ransac_result.cpp | 2 +- tools/pcd_viewer.cpp | 22 +++++++++---------- tools/pclzf2pcd.cpp | 2 +- .../pcl/tracking/impl/particle_filter.hpp | 2 +- .../pcl/visualization/impl/pcl_visualizer.hpp | 6 ++--- visualization/src/image_viewer.cpp | 4 ++-- visualization/src/pcl_plotter.cpp | 4 ++-- visualization/src/pcl_visualizer.cpp | 10 ++++----- 107 files changed, 244 insertions(+), 244 deletions(-) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h index 5afd83bb905..aa82ce0c470 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h @@ -38,7 +38,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("FPFHLocalEstimation :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -51,7 +51,7 @@ namespace pcl this->computeKeypoints(processed, keypoints, normals); std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl; - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("FPFHLocalEstimation :: No keypoints were found\n"); return false; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h index 14a6d4745cb..4c54667f3eb 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h @@ -39,7 +39,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("SHOTLocalEstimation :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -99,7 +99,7 @@ namespace pcl keypoint_extractor_->setSupportRadius(support_radius_); keypoint_extractor_->compute (keypoints);*/ - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("SHOTLocalEstimation :: No keypoints were found\n"); return false; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h index fff02f28cda..ef67fe18c19 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h @@ -41,7 +41,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("SHOTLocalEstimationOMP :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -88,7 +88,7 @@ namespace pcl this->computeKeypoints(processed, keypoints, normals); std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl; - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("SHOTLocalEstimationOMP :: No keypoints were found\n"); return false; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h index 504c11fe827..cab856fba87 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h @@ -137,7 +137,7 @@ namespace pcl out = in; } - if (out->points.size () == 0) + if (out->points.empty ()) { PCL_WARN("NORMAL estimator: Cloud has no points after voxel grid, won't be able to compute normals!\n"); return; @@ -167,7 +167,7 @@ namespace pcl } - if (out->points.size () == 0) + if (out->points.empty ()) { PCL_WARN("NORMAL estimator: Cloud has no points after removing outliers...!\n"); return; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp index 831fc696991..726f061ade1 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp @@ -81,7 +81,7 @@ template class Distance, typename PointInT, typename FeatureT> typename pcl::PointCloud::CloudVectorType signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) { pcl::copyPointCloud (*input_, indices_, *in); } @@ -93,7 +93,7 @@ template class Distance, typename PointInT, typename FeatureT> estimator_->estimate (in, processed, signatures, centroids); std::vector indices_scores; - if (signatures.size () > 0) + if (!signatures.empty ()) { for (size_t idx = 0; idx < signatures.size (); idx++) { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index 07af21190db..32a3ccc9e67 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -170,7 +170,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector, Eigen::aligned_allocator > > signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) pcl::copyPointCloud (*input_, indices_, *in); else in = input_; @@ -184,7 +184,7 @@ template class Distance, typename PointInT, typename FeatureT> crh_estimator_->getCRHHistograms (crh_histograms); std::vector indices_scores; - if (signatures.size () > 0) + if (!signatures.empty ()) { { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp index 08f546dac4a..7448dcdf274 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp @@ -232,7 +232,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector, Eigen::aligned_allocator > > signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) pcl::copyPointCloud (*input_, indices_, *in); else in = input_; @@ -245,13 +245,13 @@ template class Distance, typename PointInT, typename FeatureT> std::vector indices_scores; descriptor_distances_.clear (); - if (signatures.size () > 0) + if (!signatures.empty ()) { { pcl::ScopeTime t_matching ("Matching and roll..."); - if (use_single_categories_ && (categories_to_be_searched_.size () > 0)) + if (use_single_categories_ && (!categories_to_be_searched_.empty ())) { //perform search of the different signatures in the categories_to_be_searched_ @@ -643,7 +643,7 @@ template class Distance, typename PointInT, typename FeatureT> PointInTPtr processed (new pcl::PointCloud); PointInTPtr view = models->at (i).views_->at (v); - if (view->points.size () == 0) + if (view->points.empty ()) PCL_WARN("View has no points!!!\n"); if (noisify_) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp index 3f9c525d7cb..9c5387e2ea6 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp @@ -216,7 +216,7 @@ template class Distance, typename PointInT, typename FeatureT> else { processed.reset( (new pcl::PointCloud)); - if (indices_.size () > 0) + if (!indices_.empty ()) { PointInTPtr sub_input (new pcl::PointCloud); pcl::copyPointCloud (*input_, indices_, *sub_input); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp index 8f0ec204788..b963e0209ac 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp @@ -153,7 +153,7 @@ } } typename PointCloud::Ptr leftovers = boost::shared_ptr > (new PointCloud); - if (extracted_indices->size () == 0) + if (extracted_indices->empty ()) pcl::copyPointCloud (*input_cloud,*leftovers); else { diff --git a/apps/cloud_composer/src/commands.cpp b/apps/cloud_composer/src/commands.cpp index bed9e6526f3..0a20cf20e62 100644 --- a/apps/cloud_composer/src/commands.cpp +++ b/apps/cloud_composer/src/commands.cpp @@ -51,7 +51,7 @@ bool pcl::cloud_composer::CloudCommand::canUseTemplates (ConstItemList &input_data) { //Make sure the input list isn't empty - if (input_data.size () == 0) + if (input_data.empty ()) { qCritical () << "Cannot call a templated tool on an empty input in CloudCommand::executeToolOnTemplateCloud!"; template_type_ = -2; @@ -118,7 +118,7 @@ bool pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (QList originals, QList new_items) { //Find the input item's parent - if (originals.size () < 1) + if (originals.empty ()) { qCritical () << "No items to replace specified!"; return false; @@ -225,7 +225,7 @@ pcl::cloud_composer::ModifyItemCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a ModifyItemCommand"; else { @@ -304,7 +304,7 @@ pcl::cloud_composer::NewItemCloudCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a NewItemCloudCommand"; else { @@ -412,7 +412,7 @@ pcl::cloud_composer::SplitCloudCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a SplitCloudCommand"; else { @@ -489,7 +489,7 @@ pcl::cloud_composer::DeleteItemCommand::runCommand (AbstractTool*) output_data_.append (output_pair); this->setText ("Delete "+item->text ()); } - if (original_data_.size () > 0) + if (!original_data_.empty ()) this->setText ("Delete multiple items"); return true; } @@ -553,7 +553,7 @@ pcl::cloud_composer::MergeCloudCommand::runCommand (AbstractTool* tool) OutputPair output_pair = {original_data_, output_items}; output_data_.append (output_pair); - if (output_items.size () == 0) + if (output_items.empty ()) { qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a MergeCloudCommand"; return false; diff --git a/apps/cloud_composer/src/merge_selection.cpp b/apps/cloud_composer/src/merge_selection.cpp index eb870d32349..5b709651792 100644 --- a/apps/cloud_composer/src/merge_selection.cpp +++ b/apps/cloud_composer/src/merge_selection.cpp @@ -37,7 +37,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po QList output; // Check input data length - if ( input_data.size () == 0 && selected_item_index_map_.isEmpty() ) + if ( input_data.empty () && selected_item_index_map_.isEmpty() ) { qCritical () << "Empty input in MergeSelection!"; return output; diff --git a/apps/cloud_composer/src/project_model.cpp b/apps/cloud_composer/src/project_model.cpp index f0c9afc7e35..aece1d8b70f 100644 --- a/apps/cloud_composer/src/project_model.cpp +++ b/apps/cloud_composer/src/project_model.cpp @@ -112,7 +112,7 @@ pcl::cloud_composer::ProjectModel::setPointSelection (boost::shared_ptr(); selected_event->findIndicesInItem (cloud_item, found_indices); - if (found_indices->indices.size () > 0) + if (!found_indices->indices.empty ()) { qDebug () << "Found "<indices.size ()<<" points in "<text (); selected_item_index_map_. insert (cloud_item, found_indices); @@ -195,11 +195,11 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromFile () QString short_filename = file_info.baseName (); //Check if this name already exists in the project - if so, append digit QList items = findItems (short_filename); - if (items.size () > 0) + if (!items.empty ()) { int k = 2; items = findItems (short_filename+ tr ("-%1").arg (k)); - while (items.size () > 0) + while (!items.empty ()) { ++k; items = findItems (short_filename+ tr ("-%1").arg (k)); @@ -232,7 +232,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () depth_filter << base_name.split("_").at(0) + "_depth.*"; last_directory_.setNameFilters (depth_filter); QFileInfoList depth_info_list = last_directory_.entryInfoList (); - if (depth_info_list.size () == 0) + if (depth_info_list.empty ()) { qCritical () << "Could not find depth file in format (rgb file base name)_depth.*"; return; @@ -328,11 +328,11 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () QString short_filename = file_info.baseName (); //Check if this name already exists in the project - if so, append digit QList items = findItems (short_filename); - if (items.size () > 0) + if (!items.empty ()) { int k = 2; items = findItems (short_filename+ tr ("-%1").arg (k)); - while (items.size () > 0) + while (!items.empty ()) { ++k; items = findItems (short_filename+ tr ("-%1").arg (k)); @@ -350,7 +350,7 @@ pcl::cloud_composer::ProjectModel::saveSelectedCloudToFile () { qDebug () << "Saving cloud to file..."; QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Cloud Selected", "Cannot save, no cloud is selected in the browser or cloud view"); return; @@ -395,7 +395,7 @@ pcl::cloud_composer::ProjectModel::enqueueToolAction (AbstractTool* tool) //Get the currently selected item(s), put them in a list, and create the command ConstItemList input_data; QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Items Selected", "Cannot use tool, no item is selected in the browser or cloud view"); return; @@ -458,7 +458,7 @@ pcl::cloud_composer::ProjectModel::deleteSelectedItems () { QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Items Selected", "Cannot execute delete command, no item is selected in the browser or cloud view"); return; diff --git a/apps/cloud_composer/src/properties_model.cpp b/apps/cloud_composer/src/properties_model.cpp index c7a7fbd1885..86279970bfa 100644 --- a/apps/cloud_composer/src/properties_model.cpp +++ b/apps/cloud_composer/src/properties_model.cpp @@ -49,7 +49,7 @@ pcl::cloud_composer::PropertiesModel::addProperty (const QString prop_name, QVar if (category.size () > 0) { QList items = findItems (category); - if (items.size () == 0) + if (items.empty ()) qWarning () << "No category named "<text ()<<" adding to root"; else if (items.size () > 1) qCritical () << "Multiple categories with same name found!! This is not good..."; @@ -82,7 +82,7 @@ pcl::cloud_composer::PropertiesModel::getProperty (const QString prop_name) cons { //qDebug () << "Searching for property " << prop_name; QList items = findItems (prop_name, Qt::MatchExactly | Qt::MatchRecursive, 0); - if (items.size () == 0) + if (items.empty ()) { qWarning () << "No property named "<text (); return QVariant (); diff --git a/apps/cloud_composer/src/toolbox_model.cpp b/apps/cloud_composer/src/toolbox_model.cpp index f672152cb67..7eb18f7b2dd 100644 --- a/apps/cloud_composer/src/toolbox_model.cpp +++ b/apps/cloud_composer/src/toolbox_model.cpp @@ -55,7 +55,7 @@ QStandardItem* pcl::cloud_composer::ToolBoxModel::addToolGroup (QString tool_group_name) { QList matches_name = findItems (tool_group_name); - if (matches_name.size () == 0) + if (matches_name.empty ()) { QStandardItem* new_group_item = new QStandardItem (tool_group_name); appendRow (new_group_item); @@ -190,7 +190,7 @@ pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection& cur disabled_tools.insert (tool_item, tr("Tool Requires item type %1 selected").arg (ITEM_TYPES_STRINGS.value (input_type - QStandardItem::UserType))); } //Check if any of selected items have required children - else if ( required_children_types.size () > 0) + else if ( !required_children_types.empty ()) { QList matching_selected_items = type_items_map.values (input_type); bool found_valid_items = false; diff --git a/apps/cloud_composer/tools/euclidean_clustering.cpp b/apps/cloud_composer/tools/euclidean_clustering.cpp index 4a34c87b433..480b60b9fb5 100644 --- a/apps/cloud_composer/tools/euclidean_clustering.cpp +++ b/apps/cloud_composer/tools/euclidean_clustering.cpp @@ -25,7 +25,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in Euclidean Clustering Tool!"; return output; @@ -95,7 +95,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input } //We copy input cloud over for special case that no clusters found, since ExtractIndices doesn't work for 0 length vectors pcl::PCLPointCloud2::Ptr remainder_cloud (new pcl::PCLPointCloud2(*input_cloud)); - if (cluster_indices.size () > 0) + if (!cluster_indices.empty ()) { //make a cloud containing all the remaining points filter.setIndices (extracted_indices); diff --git a/apps/cloud_composer/tools/fpfh_estimation.cpp b/apps/cloud_composer/tools/fpfh_estimation.cpp index 3e606a4e923..de9b2143d4e 100644 --- a/apps/cloud_composer/tools/fpfh_estimation.cpp +++ b/apps/cloud_composer/tools/fpfh_estimation.cpp @@ -27,7 +27,7 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in FPFH Estimation Tool!"; return output; @@ -43,7 +43,7 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data { //Check if this cloud has normals computed! QList normals_list = input_item->getChildren (CloudComposerItem::NORMALS_ITEM); - if ( normals_list.size () == 0 ) + if ( normals_list.empty () ) { qCritical () << "No normals item child found in this cloud item"; return output; diff --git a/apps/cloud_composer/tools/normal_estimation.cpp b/apps/cloud_composer/tools/normal_estimation.cpp index 4c621b1668c..1140a0deebe 100644 --- a/apps/cloud_composer/tools/normal_estimation.cpp +++ b/apps/cloud_composer/tools/normal_estimation.cpp @@ -24,7 +24,7 @@ pcl::cloud_composer::NormalEstimationTool::performAction (ConstItemList input_da QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in Normal Estimation Tool!"; return output; diff --git a/apps/cloud_composer/tools/sanitize_cloud.cpp b/apps/cloud_composer/tools/sanitize_cloud.cpp index 390c89f9de8..f606ff4fdd2 100644 --- a/apps/cloud_composer/tools/sanitize_cloud.cpp +++ b/apps/cloud_composer/tools/sanitize_cloud.cpp @@ -22,7 +22,7 @@ pcl::cloud_composer::SanitizeCloudTool::performAction (ConstItemList input_data, QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in SanitizeCloudTool!"; return output; diff --git a/apps/cloud_composer/tools/statistical_outlier_removal.cpp b/apps/cloud_composer/tools/statistical_outlier_removal.cpp index e95c42aadeb..97cef1305f2 100644 --- a/apps/cloud_composer/tools/statistical_outlier_removal.cpp +++ b/apps/cloud_composer/tools/statistical_outlier_removal.cpp @@ -24,7 +24,7 @@ pcl::cloud_composer::StatisticalOutlierRemovalTool::performAction (ConstItemList QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in StatisticalOutlierRemovalTool!"; return output; diff --git a/apps/cloud_composer/tools/voxel_grid_downsample.cpp b/apps/cloud_composer/tools/voxel_grid_downsample.cpp index 38b69bff57b..63c0abd47f1 100644 --- a/apps/cloud_composer/tools/voxel_grid_downsample.cpp +++ b/apps/cloud_composer/tools/voxel_grid_downsample.cpp @@ -25,7 +25,7 @@ pcl::cloud_composer::VoxelGridDownsampleTool::performAction (ConstItemList input QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in VoxelGridDownsampleTool!"; return output; diff --git a/apps/in_hand_scanner/src/offline_integration.cpp b/apps/in_hand_scanner/src/offline_integration.cpp index c412746466a..39dc165e333 100644 --- a/apps/in_hand_scanner/src/offline_integration.cpp +++ b/apps/in_hand_scanner/src/offline_integration.cpp @@ -141,7 +141,7 @@ pcl::ihs::OfflineIntegration::computationThread () Base::setPivot ("model"); Base::addMesh (mesh_model_, "model"); - if (filenames.size () < 1) + if (filenames.empty ()) { return; } diff --git a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp index 9c2f5f43576..876d6c630e3 100644 --- a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp +++ b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp @@ -103,7 +103,7 @@ pcl::apps::DominantPlaneSegmentation::compute_table_plane () seg_.setInputNormals (cloud_normals_); seg_.segment (*table_inliers_, *table_coefficients_); - if (table_inliers_->indices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -233,7 +233,7 @@ pcl::apps::DominantPlaneSegmentation::compute_fast (std::vectorindices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -606,7 +606,7 @@ pcl::apps::DominantPlaneSegmentation::compute (std::vector seg_.setInputNormals (cloud_normals_); seg_.segment (*table_inliers_, *table_coefficients_); - if (table_inliers_->indices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -663,7 +663,7 @@ pcl::apps::DominantPlaneSegmentation::compute (std::vector extract_object_indices.setIndices (boost::make_shared (cloud_object_indices)); extract_object_indices.filter (*cloud_objects_); - if (cloud_objects_->points.size () == 0) + if (cloud_objects_->points.empty ()) return; //down_.reset(new Cloud(*cloud_downsampled_)); @@ -769,7 +769,7 @@ pcl::apps::DominantPlaneSegmentation::compute_full (std::vectorindices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -826,7 +826,7 @@ pcl::apps::DominantPlaneSegmentation::compute_full (std::vector (cloud_object_indices)); extract_object_indices.filter (*cloud_objects_); - if (cloud_objects_->points.size () == 0) + if (cloud_objects_->points.empty ()) return; // ---[ Split the objects into Euclidean clusters diff --git a/apps/include/pcl/apps/nn_classification.h b/apps/include/pcl/apps/nn_classification.h index 70bce1748e7..0cb84f4af9e 100644 --- a/apps/include/pcl/apps/nn_classification.h +++ b/apps/include/pcl/apps/nn_classification.h @@ -142,7 +142,7 @@ namespace pcl std::ifstream f (labels_file_name.c_str ()); std::string label; while (getline (f, label)) - if (label.size () > 0) + if (!label.empty ()) labels.push_back(label); if (labels.size () != cloud->points.size ()) return (false); diff --git a/apps/include/pcl/apps/vfh_nn_classifier.h b/apps/include/pcl/apps/vfh_nn_classifier.h index ca106fb091c..4a406cfac2f 100644 --- a/apps/include/pcl/apps/vfh_nn_classifier.h +++ b/apps/include/pcl/apps/vfh_nn_classifier.h @@ -198,7 +198,7 @@ namespace pcl std::ifstream f (labels_file_name.c_str ()); std::string label; while (getline (f, label)) - if (label.size () > 0) + if (!label.empty ()) labels.push_back(label); return addTrainingFeatures (cloud, labels); } diff --git a/apps/point_cloud_editor/src/selection.cpp b/apps/point_cloud_editor/src/selection.cpp index c1c60af74dd..b91ecb63798 100644 --- a/apps/point_cloud_editor/src/selection.cpp +++ b/apps/point_cloud_editor/src/selection.cpp @@ -117,7 +117,7 @@ Selection::invertSelect () std::string Selection::getStat () const { - if (selected_indices_.size() == 0) + if (selected_indices_.empty ()) return (""); std::string title = "Total number of selected points: "; std::string num_str; diff --git a/apps/src/feature_matching.cpp b/apps/src/feature_matching.cpp index d7f1bfc1daa..b3cd276e2f1 100644 --- a/apps/src/feature_matching.cpp +++ b/apps/src/feature_matching.cpp @@ -212,7 +212,7 @@ void ICCVTutorial::segmentation (typename pcl::PointCloud 0)//use largest cluster + if (!cluster_indices.empty ())//use largest cluster { cout << cluster_indices.size() << " clusters found"; if (cluster_indices.size() > 1) diff --git a/apps/src/openni_tracking.cpp b/apps/src/openni_tracking.cpp index e405c604a6b..82fc36a3903 100644 --- a/apps/src/openni_tracking.cpp +++ b/apps/src/openni_tracking.cpp @@ -573,7 +573,7 @@ class OpenNISegmentTracking PCL_INFO ("segmentation, please wait...\n"); std::vector cluster_indices; euclideanSegment (target_cloud, cluster_indices); - if (cluster_indices.size () > 0) + if (!cluster_indices.empty ()) { // select the cluster to track CloudPtr temp_cloud (new Cloud); diff --git a/apps/src/organized_segmentation_demo.cpp b/apps/src/organized_segmentation_demo.cpp index b81a16bb05c..e8e34127578 100644 --- a/apps/src/organized_segmentation_demo.cpp +++ b/apps/src/organized_segmentation_demo.cpp @@ -307,7 +307,7 @@ OrganizedSegmentationDemo::cloud_cb (const CloudConstPtr& cloud) //Segment Objects pcl::PointCloud::CloudVectorType clusters; - if (use_clustering_ && regions.size () > 0) + if (use_clustering_ && !regions.empty ()) { boost::shared_ptr > plane_labels = boost::make_shared > (); for (size_t i = 0; i < label_indices.size (); ++i) diff --git a/apps/src/stereo_ground_segmentation.cpp b/apps/src/stereo_ground_segmentation.cpp index c2cf5851174..41b6588deec 100755 --- a/apps/src/stereo_ground_segmentation.cpp +++ b/apps/src/stereo_ground_segmentation.cpp @@ -382,7 +382,7 @@ class HRCSSegmentation Eigen::Vector4f ground_plane_params (1.0, 0.0, 0.0, 1.0); Eigen::Vector4f ground_centroid (0.0, 0.0, 0.0, 0.0); - if (ground_cloud->points.size () > 0) + if (!ground_cloud->points.empty ()) { ground_centroid = centroids[0]; ground_plane_params = Eigen::Vector4f (model_coefficients[0].values[0], model_coefficients[0].values[1], model_coefficients[0].values[2], model_coefficients[0].values[3]); @@ -391,7 +391,7 @@ class HRCSSegmentation if (detect_obstacles) { pcl::PointCloud::CloudVectorType clusters; - if (ground_cloud->points.size () > 0) + if (!ground_cloud->points.empty ()) { boost::shared_ptr > plane_labels = boost::make_shared > (); for (size_t i = 0; i < region_indices.size (); ++i) diff --git a/common/include/pcl/common/impl/io.hpp b/common/include/pcl/common/impl/io.hpp index c4c35daa08b..ac157e6e01b 100644 --- a/common/include/pcl/common/impl/io.hpp +++ b/common/include/pcl/common/impl/io.hpp @@ -120,7 +120,7 @@ pcl::copyPointCloud (const pcl::PointCloud &cloud_in, cloud_out.sensor_origin_ = cloud_in.sensor_origin_; cloud_out.points.resize (cloud_in.points.size ()); - if (cloud_in.points.size () == 0) + if (cloud_in.points.empty ()) return; if (isSamePointType ()) diff --git a/common/src/parse.cpp b/common/src/parse.cpp index 007a9bf017b..9e115f26339 100644 --- a/common/src/parse.cpp +++ b/common/src/parse.cpp @@ -427,7 +427,7 @@ pcl::console::parse_multiple_arguments (int argc, const char * const * argv, con values.push_back (val); } } - if (values.size () == 0) + if (values.empty ()) return (false); else return (true); @@ -446,7 +446,7 @@ pcl::console::parse_multiple_arguments (int argc, const char * const * argv, con values.push_back (val); } } - if (values.size () == 0) + if (values.empty ()) return (false); else return (true); @@ -465,7 +465,7 @@ pcl::console::parse_multiple_arguments (int argc, const char * const * argv, con values.push_back (val); } } - if (values.size () == 0) + if (values.empty ()) return (false); else return (true); @@ -483,7 +483,7 @@ pcl::console::parse_multiple_arguments (int argc, const char * const * argv, con values.emplace_back(argv[i]); } } - if (values.size () == 0) + if (values.empty ()) return (false); else return (true); @@ -513,7 +513,7 @@ pcl::console::parse_multiple_2x_arguments (int argc, const char * const * argv, values_s.push_back (s); } } - if (values_f.size () == 0) + if (values_f.empty ()) return (false); else return (true); @@ -548,7 +548,7 @@ pcl::console::parse_multiple_3x_arguments (int argc, const char * const * argv, values_t.push_back (t); } } - if (values_f.size () == 0) + if (values_f.empty ()) return (false); else return (true); diff --git a/features/include/pcl/features/impl/cvfh.hpp b/features/include/pcl/features/impl/cvfh.hpp index 027b762789b..565e7eb63f2 100644 --- a/features/include/pcl/features/impl/cvfh.hpp +++ b/features/include/pcl/features/impl/cvfh.hpp @@ -270,7 +270,7 @@ pcl::CVFHEstimation::computeFeature (PointCloudOut output.height = 1; // ---[ Step 1b : check if any dominant cluster was found - if (clusters.size () > 0) + if (!clusters.empty ()) { // ---[ Step 1b.1 : If yes, compute CVFH using the cluster information for (const auto &cluster : clusters) //for each cluster diff --git a/features/include/pcl/features/impl/gfpfh.hpp b/features/include/pcl/features/impl/gfpfh.hpp index efe5620ebbd..cc612afd906 100644 --- a/features/include/pcl/features/impl/gfpfh.hpp +++ b/features/include/pcl/features/impl/gfpfh.hpp @@ -106,7 +106,7 @@ pcl::GFPFHEstimation::computeFeature (PointCloudOu std::vector indices; octree.voxelSearch (intersected_cells[k], indices); int label = emptyLabel (); - if (indices.size () != 0) + if (!indices.empty ()) { label = getDominantLabel (indices); } diff --git a/features/include/pcl/features/impl/moment_of_inertia_estimation.hpp b/features/include/pcl/features/impl/moment_of_inertia_estimation.hpp index 1494cadcd48..3b34da0c28a 100644 --- a/features/include/pcl/features/impl/moment_of_inertia_estimation.hpp +++ b/features/include/pcl/features/impl/moment_of_inertia_estimation.hpp @@ -144,7 +144,7 @@ pcl::MomentOfInertiaEstimation::compute () if (normalize_) { - if (indices_->size () > 0) + if (!indices_->empty ()) point_mass_ = 1.0f / static_cast (indices_->size () * indices_->size ()); else point_mass_ = 1.0f; diff --git a/features/include/pcl/features/impl/normal_based_signature.hpp b/features/include/pcl/features/impl/normal_based_signature.hpp index 15cd4bcba16..839c585b872 100644 --- a/features/include/pcl/features/impl/normal_based_signature.hpp +++ b/features/include/pcl/features/impl/normal_based_signature.hpp @@ -113,7 +113,7 @@ pcl::NormalBasedSignatureEstimation::computeFeatu tree_->radiusSearch (zeta_point_pcl, search_radius_, k_indices, k_sqr_distances); // Do k nearest search if there are no neighbors nearby - if (k_indices.size () == 0) + if (k_indices.empty ()) { k_indices.resize (5); k_sqr_distances.resize (5); diff --git a/features/include/pcl/features/impl/our_cvfh.hpp b/features/include/pcl/features/impl/our_cvfh.hpp index a63e9ef19f0..e8cf64cd194 100644 --- a/features/include/pcl/features/impl/our_cvfh.hpp +++ b/features/include/pcl/features/impl/our_cvfh.hpp @@ -531,7 +531,7 @@ pcl::OURCVFHEstimation::computeRFAndShapeDistribut } } - if (ourcvfh_output.points.size ()) + if (!ourcvfh_output.points.empty ()) { ourcvfh_output.height = 1; } @@ -649,7 +649,7 @@ pcl::OURCVFHEstimation::computeFeature (PointCloud } //remove last cluster if no points found... - if (clusters_[cluster_filtered_idx].indices.size () == 0) + if (clusters_[cluster_filtered_idx].indices.empty ()) { clusters_.pop_back (); clusters_filtered.pop_back (); @@ -673,7 +673,7 @@ pcl::OURCVFHEstimation::computeFeature (PointCloud output.height = 1; // ---[ Step 1b : check if any dominant cluster was found - if (clusters.size () > 0) + if (!clusters.empty ()) { // ---[ Step 1b.1 : If yes, compute CVFH using the cluster information for (const auto &cluster : clusters) //for each cluster { diff --git a/features/include/pcl/features/impl/rops_estimation.hpp b/features/include/pcl/features/impl/rops_estimation.hpp index 4765a15ee5a..0880461577c 100644 --- a/features/include/pcl/features/impl/rops_estimation.hpp +++ b/features/include/pcl/features/impl/rops_estimation.hpp @@ -134,7 +134,7 @@ pcl::ROPSEstimation ::getTriangles (std::vector void pcl::ROPSEstimation ::computeFeature (PointCloudOut &output) { - if (triangles_.size () == 0) + if (triangles_.empty ()) { output.points.clear (); return; diff --git a/filters/include/pcl/filters/impl/median_filter.hpp b/filters/include/pcl/filters/impl/median_filter.hpp index 4d8a27cee68..a125f903def 100644 --- a/filters/include/pcl/filters/impl/median_filter.hpp +++ b/filters/include/pcl/filters/impl/median_filter.hpp @@ -73,7 +73,7 @@ pcl::MedianFilter::applyFilter (PointCloud &output) vals.push_back ((*input_)(x+x_dev, y+y_dev).z); } - if (vals.size () == 0) + if (vals.empty ()) continue; // The output depth will be the median of all the depths in the window diff --git a/filters/include/pcl/filters/impl/morphological_filter.hpp b/filters/include/pcl/filters/impl/morphological_filter.hpp index 8c12fc48871..d21cf5b6cc1 100644 --- a/filters/include/pcl/filters/impl/morphological_filter.hpp +++ b/filters/include/pcl/filters/impl/morphological_filter.hpp @@ -89,7 +89,7 @@ pcl::applyMorphologicalOperator (const typename pcl::PointCloud::ConstPt bbox_max = Eigen::Vector3f (maxx, maxy, maxz); tree.boxSearch (bbox_min, bbox_max, pt_indices); - if (pt_indices.size () > 0) + if (!pt_indices.empty ()) { Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D (*cloud_in, pt_indices, min_pt, max_pt); @@ -132,7 +132,7 @@ pcl::applyMorphologicalOperator (const typename pcl::PointCloud::ConstPt bbox_max = Eigen::Vector3f (maxx, maxy, maxz); tree.boxSearch (bbox_min, bbox_max, pt_indices); - if (pt_indices.size () > 0) + if (!pt_indices.empty ()) { Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D (cloud_temp, pt_indices, min_pt, max_pt); @@ -169,7 +169,7 @@ pcl::applyMorphologicalOperator (const typename pcl::PointCloud::ConstPt bbox_max = Eigen::Vector3f (maxx, maxy, maxz); tree.boxSearch (bbox_min, bbox_max, pt_indices); - if (pt_indices.size () > 0) + if (!pt_indices.empty ()) { Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D (cloud_temp, pt_indices, min_pt, max_pt); diff --git a/filters/include/pcl/filters/voxel_grid_covariance.h b/filters/include/pcl/filters/voxel_grid_covariance.h index 92d5fb47d0f..8ae71043005 100644 --- a/filters/include/pcl/filters/voxel_grid_covariance.h +++ b/filters/include/pcl/filters/voxel_grid_covariance.h @@ -270,7 +270,7 @@ namespace pcl voxel_centroids_ = PointCloudPtr (new PointCloud (output)); - if (searchable_ && voxel_centroids_->size() > 0) + if (searchable_ && !voxel_centroids_->empty ()) { // Initiates kdtree of the centroids of voxels containing a sufficient number of points kdtree_.setInputCloud (voxel_centroids_); @@ -287,7 +287,7 @@ namespace pcl voxel_centroids_ = PointCloudPtr (new PointCloud); applyFilter (*voxel_centroids_); - if (searchable_ && voxel_centroids_->size() > 0) + if (searchable_ && !voxel_centroids_->empty ()) { // Initiates kdtree of the centroids of voxels containing a sufficient number of points kdtree_.setInputCloud (voxel_centroids_); diff --git a/gpu/kinfu/tools/kinfu_app.cpp b/gpu/kinfu/tools/kinfu_app.cpp index 67cfd3831d5..61f94895f08 100644 --- a/gpu/kinfu/tools/kinfu_app.cpp +++ b/gpu/kinfu/tools/kinfu_app.cpp @@ -1294,7 +1294,7 @@ main (int argc, char* argv[]) std::string camera_pose_file; boost::shared_ptr pose_processor; - if (pc::parse_argument (argc, argv, "-save_pose", camera_pose_file) && camera_pose_file.size () > 0) + if (pc::parse_argument (argc, argv, "-save_pose", camera_pose_file) && !camera_pose_file.empty ()) { pose_processor.reset (new CameraPoseWriter (camera_pose_file)); } diff --git a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/world_model.hpp b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/world_model.hpp index 1bc0c203c95..dc55221c351 100644 --- a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/world_model.hpp +++ b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/world_model.hpp @@ -112,7 +112,7 @@ pcl::kinfuLS::WorldModel::getExistingData(const double previous_origin_x // apply filter condrem.filter (existing_slice); - if(existing_slice.points.size () != 0) + if(!existing_slice.points.empty ()) { //transform the slice in new cube coordinates Eigen::Affine3f transformation; @@ -133,7 +133,7 @@ void pcl::kinfuLS::WorldModel::getWorldAsCubes (const double size, std::vector::PointCloudPtr> &cubes, std::vector > &transforms, double overlap) { - if(world_->points.size () == 0) + if(world_->points.empty ()) { PCL_INFO("The world is empty, returning nothing\n"); return; @@ -219,7 +219,7 @@ pcl::kinfuLS::WorldModel::getWorldAsCubes (const double size, std::vecto condrem.filter (*box); // also push transform along with points. - if(box->points.size() > 0) + if(!box->points.empty ()) { Eigen::Vector3f transform; transform[0] = origin.x, transform[1] = origin.y, transform[2] = origin.z; diff --git a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h index 012b04ae511..afe0afc8bcc 100644 --- a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h +++ b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h @@ -89,7 +89,7 @@ namespace pcl */ void reset() { - if(world_->points.size () != 0) + if(!world_->points.empty ()) { PCL_WARN("Clearing world model\n"); world_->points.clear (); diff --git a/gpu/kinfu_large_scale/src/cyclical_buffer.cpp b/gpu/kinfu_large_scale/src/cyclical_buffer.cpp index c2ae10b40ea..9b0e99fd492 100644 --- a/gpu/kinfu_large_scale/src/cyclical_buffer.cpp +++ b/gpu/kinfu_large_scale/src/cyclical_buffer.cpp @@ -151,7 +151,7 @@ pcl::gpu::kinfuLS::CyclicalBuffer::performShift (const TsdfVolume::Ptr volume, c pcl::device::kinfuLS::clearTSDFSlice (volume->data (), &buffer_, offset_x, offset_y, offset_z); // insert current slice in the world if it contains any points - if (current_slice->points.size () != 0) { + if (!current_slice->points.empty ()) { world_model_.addSlice(current_slice); } @@ -159,7 +159,7 @@ pcl::gpu::kinfuLS::CyclicalBuffer::performShift (const TsdfVolume::Ptr volume, c shiftOrigin (volume, offset_x, offset_y, offset_z); // push existing data in the TSDF buffer - if (previously_existing_slice->points.size () != 0 ) { + if (!previously_existing_slice->points.empty () ) { volume->pushSlice(previously_existing_slice, getBuffer () ); } } diff --git a/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp b/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp index 7cf3e804a55..15b292d72ea 100644 --- a/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp +++ b/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp @@ -177,7 +177,7 @@ saveOBJFile (const std::string &file_name, for (int m = 0; m < nr_meshes; ++m) { - if(tex_mesh.tex_coordinates.size() == 0) + if(tex_mesh.tex_coordinates.empty ()) continue; PCL_INFO ("%d vertex textures in submesh %d\n", tex_mesh.tex_coordinates[m].size (), m); @@ -198,7 +198,7 @@ saveOBJFile (const std::string &file_name, if (m > 0) f_idx += tex_mesh.tex_polygons[m-1].size (); - if(tex_mesh.tex_materials.size() !=0) + if(!tex_mesh.tex_materials.empty ()) { fs << "# The material will be used for mesh " << m << std::endl; //TODO pbl here with multi texture and unseen faces @@ -233,7 +233,7 @@ saveOBJFile (const std::string &file_name, // Open file PCL_INFO ("Writing material files\n"); //don't do it if no material to write - if(tex_mesh.tex_materials.size() ==0) + if(tex_mesh.tex_materials.empty ()) return (0); std::ofstream m_fs; diff --git a/gpu/people/include/pcl/gpu/people/label_tree.h b/gpu/people/include/pcl/gpu/people/label_tree.h index b2054354b19..4f25df23f01 100644 --- a/gpu/people/include/pcl/gpu/people/label_tree.h +++ b/gpu/people/include/pcl/gpu/people/label_tree.h @@ -122,7 +122,7 @@ namespace pcl leafBlobVector( std::vector > >& sorted, int label ) { - if(sorted[label].size() == 0) + if(sorted[label].empty ()) return 0; for(auto &blob : sorted[label]) { @@ -144,7 +144,7 @@ namespace pcl int label, int child_number) { - if(sorted[label].size() == 0) + if(sorted[label].empty ()) return 0; for(auto &blob : sorted[label]){ blob.child_id[child_number] = NO_CHILD; @@ -161,7 +161,7 @@ namespace pcl part_t label, int child_number) { - if(sorted[label].size() == 0) + if(sorted[label].empty ()) return false; for(const auto &blob : sorted[label]) if((blob.child_id[child_number] != NO_CHILD) && (blob.child_id[child_number] != LEAF)) @@ -236,10 +236,10 @@ namespace pcl assert(child_number >= 0); assert(child_number < MAX_CHILD); - if(sorted[parent_label].size() == 0){ + if(sorted[parent_label].empty ()){ return 0; //if my size is 0, this is solved by my parent in his iteration } - if(sorted[child_label].size() == 0){ + if(sorted[child_label].empty ()){ noChildBlobVector(sorted, parent_label, child_number); return 0; } @@ -296,10 +296,10 @@ namespace pcl assert(child_number >= 0); assert(child_number < MAX_CHILD); - if(sorted[parent_label].size() == 0){ + if(sorted[parent_label].empty ()){ return 0; //if my size is 0, this is solved by my parent in his iteration } - if(sorted[child_label].size() == 0){ + if(sorted[child_label].empty ()){ noChildBlobVector(sorted, parent_label, child_number); return 0; } @@ -344,7 +344,7 @@ namespace pcl buildRelations( std::vector > >& sorted) { PCL_VERBOSE("[pcl::gpu::people::buildRelations] : (I) : buildRelations : regular version\n"); - if(sorted.size() == 0){ + if(sorted.empty ()){ std::cout << "(E) : Damn you, you gave me an empty matrix!" << std::endl; return (-1); } @@ -448,7 +448,7 @@ namespace pcl PersonAttribs::Ptr person_attribs) { PCL_DEBUG("[pcl::gpu::people::buildRelations] : (D) : person specific version\n"); - if(sorted.size() == 0){ + if(sorted.empty ()){ PCL_ERROR("[pcl::gpu::people::buildRelations] : (E) : Damn you, you gave me an empty matrix!\n"); return (-1); } @@ -610,7 +610,7 @@ namespace pcl int part_lid, Tree2& tree) { - if(sorted.size() <= 0) + if(sorted.empty ()) { std::cout << "(E) : buildTree(): hey man, don't fool me, you gave me an empty blob matrix" << std::endl; return -1; @@ -640,7 +640,7 @@ namespace pcl Tree2& tree, PersonAttribs::Ptr person_attribs) { - if(sorted.size() <= 0) + if(sorted.empty ()) { std::cout << "(E) : buildTree(): hey man, don't fool me, you gave me an empty blob matrix" << std::endl; return -1; diff --git a/gpu/people/src/people_detector.cpp b/gpu/people/src/people_detector.cpp index 4049dfa5238..50f1035bf58 100644 --- a/gpu/people/src/people_detector.cpp +++ b/gpu/people/src/people_detector.cpp @@ -188,7 +188,7 @@ pcl::gpu::people::PeopleDetector::process () ////////////////////////////////////////////////////////////////////////////////////////////////// // if we found a neck display the tree, and continue with processing - if(sorted[Neck].size() != 0) + if(!sorted[Neck].empty ()) { int c = 0; Tree2 t; @@ -215,7 +215,7 @@ pcl::gpu::people::PeopleDetector::process () const RDFBodyPartsDetector::BlobMatrix& sorted2 = rdf_detector_->getBlobMatrix(); //brief Test if the second tree is build up correctly - if(sorted2[Neck].size() != 0) + if(!sorted2[Neck].empty ()) { Tree2 t2; buildTree(sorted2, cloud_host_, Neck, c, t2); @@ -327,7 +327,7 @@ pcl::gpu::people::PeopleDetector::processProb () ////////////////////////////////////////////////////////////////////////////////////////////////// // if we found a neck display the tree, and continue with processing - if(sorted[Neck].size() != 0) + if(!sorted[Neck].empty ()) { int c = 0; Tree2 t; @@ -366,7 +366,7 @@ pcl::gpu::people::PeopleDetector::processProb () const RDFBodyPartsDetector::BlobMatrix& sorted2 = rdf_detector_->getBlobMatrix(); //brief Test if the second tree is build up correctly - if(sorted2[Neck].size() != 0) + if(!sorted2[Neck].empty ()) { Tree2 t2; buildTree(sorted2, cloud_host_, Neck, c, t2, person_attribs_); diff --git a/io/include/pcl/compression/impl/organized_pointcloud_compression.hpp b/io/include/pcl/compression/impl/organized_pointcloud_compression.hpp index f5879090a20..e7e582a8f6e 100644 --- a/io/include/pcl/compression/impl/organized_pointcloud_compression.hpp +++ b/io/include/pcl/compression/impl/organized_pointcloud_compression.hpp @@ -173,7 +173,7 @@ namespace pcl size_t cloud_size = width_arg*height_arg; assert (disparityMap_arg.size()==cloud_size); - if (colorImage_arg.size()) + if (!colorImage_arg.empty ()) { assert (colorImage_arg.size()==cloud_size*3); } @@ -220,7 +220,7 @@ namespace pcl compressedDataOut_arg.write (reinterpret_cast (&compressedDisparity[0]), compressedDisparity.size () * sizeof(uint8_t)); // Compress color information - if (colorImage_arg.size() && doColorEncoding) + if (!colorImage_arg.empty () && doColorEncoding) { if (convertToMono) { diff --git a/io/include/pcl/compression/organized_pointcloud_conversion.h b/io/include/pcl/compression/organized_pointcloud_conversion.h index a32e73c996a..a64ab328dd1 100644 --- a/io/include/pcl/compression/organized_pointcloud_conversion.h +++ b/io/include/pcl/compression/organized_pointcloud_conversion.h @@ -379,7 +379,7 @@ namespace pcl pcl::PointCloud& cloud_arg) { size_t cloud_size = width_arg*height_arg; - bool hasColor = (rgbData_arg.size () > 0); + bool hasColor = (!rgbData_arg.empty ()); // Check size of input data assert (disparityData_arg.size()==cloud_size); @@ -481,7 +481,7 @@ namespace pcl pcl::PointCloud& cloud_arg) { size_t cloud_size = width_arg*height_arg; - bool hasColor = (rgbData_arg.size () > 0); + bool hasColor = (!rgbData_arg.empty ()); // Check size of input data assert (depthData_arg.size()==cloud_size); diff --git a/io/src/hdl_grabber.cpp b/io/src/hdl_grabber.cpp index 0585d24a3ae..a8ad47623a5 100644 --- a/io/src/hdl_grabber.cpp +++ b/io/src/hdl_grabber.cpp @@ -345,7 +345,7 @@ pcl::HDLGrabber::toPointClouds (HDLDataPacket *dataPacket) { if (firing_data.rotationalPosition < last_azimuth_) { - if (current_sweep_xyzrgba_->size () > 0) + if (!current_sweep_xyzrgba_->empty ()) { current_sweep_xyz_->is_dense = current_sweep_xyzrgba_->is_dense = current_sweep_xyzi_->is_dense = false; current_sweep_xyz_->header.stamp = velodyne_time; diff --git a/io/src/image_grabber.cpp b/io/src/image_grabber.cpp index 8d1074dfe65..457548e9bee 100644 --- a/io/src/image_grabber.cpp +++ b/io/src/image_grabber.cpp @@ -329,7 +329,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles (const std::string } } sort (depth_image_files_.begin (), depth_image_files_.end ()); - if (rgb_image_files_.size () > 0) + if (!rgb_image_files_.empty ()) sort (rgb_image_files_.begin (), rgb_image_files_.end ()); } @@ -384,11 +384,11 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles (const std::string } if (depth_image_files_.size () != rgb_image_files_.size () ) PCL_WARN ("[pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles] : Watch out not same amount of depth and rgb images"); - if (depth_image_files_.size () > 0) + if (!depth_image_files_.empty ()) sort (depth_image_files_.begin (), depth_image_files_.end ()); else PCL_ERROR ("[pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles] : no depth images added"); - if (rgb_image_files_.size () > 0) + if (!rgb_image_files_.empty ()) sort (rgb_image_files_.begin (), rgb_image_files_.end ()); else PCL_ERROR ("[pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles] : no rgb images added"); @@ -427,7 +427,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadPCLZFFiles (const std::string &dir) } } sort (depth_pclzf_files_.begin (), depth_pclzf_files_.end ()); - if (rgb_pclzf_files_.size () > 0) + if (!rgb_pclzf_files_.empty ()) sort (rgb_pclzf_files_.begin (), rgb_pclzf_files_.end ()); sort (xml_files_.begin(), xml_files_.end()); if (depth_pclzf_files_.size() != xml_files_.size()) @@ -435,7 +435,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadPCLZFFiles (const std::string &dir) PCL_ERROR("[pcl::ImageGrabber::loadPCLZFFiles] # depth clouds != # xml files\n"); return; } - if (depth_pclzf_files_.size() != rgb_pclzf_files_.size() && rgb_pclzf_files_.size() > 0) + if (depth_pclzf_files_.size() != rgb_pclzf_files_.size() && !rgb_pclzf_files_.empty ()) { PCL_ERROR("[pcl::ImageGrabber::loadPCLZFFiles] # depth clouds != # rgb clouds\n"); return; @@ -500,7 +500,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getCloudAt (size_t idx, double &cx, double &cy) const { - if (depth_image_files_.size () > 0) + if (!depth_image_files_.empty ()) { fx = focal_length_x_; fy = focal_length_y_; @@ -508,7 +508,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getCloudAt (size_t idx, cy = principal_point_y_; return (getCloudVTK (idx, blob, origin, orientation) ); } - else if (depth_pclzf_files_.size () > 0) + else if (!depth_pclzf_files_.empty ()) return (getCloudPCLZF (idx, blob, origin, orientation, fx, fy, cx, cy) ); else { @@ -534,7 +534,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getCloudVTK (size_t idx, vtkSmartPointer rgb_image; const std::string &depth_image_file = depth_image_files_[idx]; // If there are RGB files, load an rgb image - if (rgb_image_files_.size () != 0) + if (!rgb_image_files_.empty ()) { const std::string &rgb_image_file = rgb_image_files_[idx]; // If we were unable to pull a Vtk image, throw an error @@ -570,7 +570,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getCloudVTK (size_t idx, centerY = ((float)dims[1] - 1.f)/2.f; } - if(rgb_image_files_.size() > 0) + if(!rgb_image_files_.empty ()) { pcl::PointCloud cloud_color; cloud_color.width = dims[0]; @@ -669,7 +669,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getCloudPCLZF (size_t idx, // Get the proper files const std::string &depth_pclzf_file = depth_pclzf_files_[idx]; const std::string &xml_file = xml_files_[idx]; - if (rgb_pclzf_files_.size () > 0) + if (!rgb_pclzf_files_.empty ()) { pcl::PointCloud cloud_color; const std::string &rgb_pclzf_file = rgb_pclzf_files_[idx]; diff --git a/io/src/libpng_wrapper.cpp b/io/src/libpng_wrapper.cpp index d764b3e869f..2ace1c9c590 100644 --- a/io/src/libpng_wrapper.cpp +++ b/io/src/libpng_wrapper.cpp @@ -92,7 +92,7 @@ namespace pcl png_infop info_ptr; volatile int channels; - if (image_arg.size () ==0) + if (image_arg.empty ()) return; // Get amount of channels @@ -187,7 +187,7 @@ namespace pcl png_bytep * row_pointers; - if (pngData_arg.size () == 0) + if (pngData_arg.empty ()) return; png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); diff --git a/io/src/obj_io.cpp b/io/src/obj_io.cpp index 3e174096098..6f3d3ec1dd2 100644 --- a/io/src/obj_io.cpp +++ b/io/src/obj_io.cpp @@ -465,7 +465,7 @@ pcl::OBJReader::readHeader (const std::string &file_name, pcl::PCLPointCloud2 &c } } - if (material_files.size () > 0) + if (!material_files.empty ()) { for (const auto &material_file : material_files) { diff --git a/io/src/openni2/openni2_timer_filter.cpp b/io/src/openni2/openni2_timer_filter.cpp index 43fbe6c8c9d..5b52370efb4 100644 --- a/io/src/openni2/openni2_timer_filter.cpp +++ b/io/src/openni2/openni2_timer_filter.cpp @@ -56,7 +56,7 @@ namespace pcl double OpenNI2TimerFilter::getMedian () { - if (buffer_.size ()>0) + if (!buffer_.empty ()) { std::deque sort_buffer = buffer_; @@ -70,7 +70,7 @@ namespace pcl double OpenNI2TimerFilter::getMovingAvg () { - if (buffer_.size () > 0) + if (!buffer_.empty ()) { double sum = 0; diff --git a/io/src/ply_io.cpp b/io/src/ply_io.cpp index 6523ef6b2fc..12b9c9fdc5f 100644 --- a/io/src/ply_io.cpp +++ b/io/src/ply_io.cpp @@ -618,7 +618,7 @@ pcl::PLYReader::read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, const static double d_nan = std::numeric_limits ::quiet_NaN (); for (size_t r = 0; r < r_size; ++r) { - if ((*range_grid_)[r].size () == 0) + if ((*range_grid_)[r].empty ()) { for (const auto &field : cloud_->fields) if (field.datatype == ::pcl::PCLPointField::FLOAT32) @@ -678,7 +678,7 @@ pcl::PLYReader::read (const std::string &file_name, pcl::PolygonMesh &mesh, const static double d_nan = std::numeric_limits ::quiet_NaN (); for (size_t r = 0; r < r_size; ++r) { - if ((*range_grid_)[r].size () == 0) + if ((*range_grid_)[r].empty ()) { for (const auto &field : cloud_->fields) if (field.datatype == ::pcl::PCLPointField::FLOAT32) diff --git a/io/src/vlp_grabber.cpp b/io/src/vlp_grabber.cpp index 911cfc28906..e9c6a9e4db8 100644 --- a/io/src/vlp_grabber.cpp +++ b/io/src/vlp_grabber.cpp @@ -142,7 +142,7 @@ pcl::VLPGrabber::toPointClouds (HDLDataPacket *dataPacket) } if (current_azimuth < HDLGrabber::last_azimuth_) { - if (current_sweep_xyz_->size () > 0) + if (!current_sweep_xyz_->empty ()) { current_sweep_xyz_->is_dense = current_sweep_xyzrgba_->is_dense = current_sweep_xyzi_->is_dense = false; current_sweep_xyz_->header.stamp = velodyne_time; diff --git a/keypoints/include/pcl/keypoints/impl/smoothed_surfaces_keypoint.hpp b/keypoints/include/pcl/keypoints/impl/smoothed_surfaces_keypoint.hpp index 5c9cbfd99a5..1f5fed37e71 100644 --- a/keypoints/include/pcl/keypoints/impl/smoothed_surfaces_keypoint.hpp +++ b/keypoints/include/pcl/keypoints/impl/smoothed_surfaces_keypoint.hpp @@ -193,7 +193,7 @@ pcl::SmoothedSurfacesKeypoint::initCompute () PCL_ERROR ("[pcl::SmoothedSurfacesKeypoints::initCompute] Input normals were not set\n"); return false; } - if (clouds_.size () == 0) + if (clouds_.empty ()) { PCL_ERROR ("[pcl::SmoothedSurfacesKeypoints::initCompute] No other clouds were set apart from the input\n"); return false; diff --git a/ml/include/pcl/ml/impl/dt/decision_tree_evaluator.hpp b/ml/include/pcl/ml/impl/dt/decision_tree_evaluator.hpp index ad0791988fc..ab22f308b49 100644 --- a/ml/include/pcl/ml/impl/dt/decision_tree_evaluator.hpp +++ b/ml/include/pcl/ml/impl/dt/decision_tree_evaluator.hpp @@ -136,7 +136,7 @@ pcl::DecisionTreeEvaluatorsub_nodes.size () != 0) + while (!node->sub_nodes.empty ()) { float feature_result = 0.0f; unsigned char flag = 0; diff --git a/ml/include/pcl/ml/impl/dt/decision_tree_trainer.hpp b/ml/include/pcl/ml/impl/dt/decision_tree_trainer.hpp index 2127c1dffa3..50d96879868 100644 --- a/ml/include/pcl/ml/impl/dt/decision_tree_trainer.hpp +++ b/ml/include/pcl/ml/impl/dt/decision_tree_trainer.hpp @@ -150,7 +150,7 @@ pcl::DecisionTreeTrainer 0) + if (!thresholds_.empty ()) { // compute information gain for each threshold and store threshold with highest information gain for (size_t threshold_index = 0; threshold_index < thresholds_.size (); ++threshold_index) diff --git a/ml/src/permutohedral.cpp b/ml/src/permutohedral.cpp index 5eb02715c4e..ab0a61a79f4 100644 --- a/ml/src/permutohedral.cpp +++ b/ml/src/permutohedral.cpp @@ -56,11 +56,11 @@ pcl::Permutohedral::init (const std::vector &feature, const int feature_d std::multimap hash_table; // reserve class memory - if (offset_.size () > 0) + if (!offset_.empty ()) offset_.clear (); offset_.resize ((d_ + 1) * N_); - if (barycentric_.size () > 0) + if (!barycentric_.empty ()) barycentric_.clear (); barycentric_.resize ((d_ + 1) * N_); @@ -219,7 +219,7 @@ pcl::Permutohedral::init (const std::vector &feature, const int feature_d M_ = static_cast (hash_table.size()); // Create the neighborhood structure - if (blur_neighbors_.size () > 0) + if (!blur_neighbors_.empty ()) blur_neighbors_.clear (); blur_neighbors_.resize ((d_+1)*M_); diff --git a/ml/src/svm_wrapper.cpp b/ml/src/svm_wrapper.cpp index 9e90fb74824..a38765ff8e5 100755 --- a/ml/src/svm_wrapper.cpp +++ b/ml/src/svm_wrapper.cpp @@ -241,7 +241,7 @@ pcl::SVM::adaptInputToLibSVM (std::vector training_set, svm_problem &pr bool pcl::SVMTrain::trainClassifier () { - if (training_set_.size() == 0) + if (training_set_.empty ()) { // to be sure to have loaded the training set PCL_ERROR ("[pcl::%s::trainClassifier] Training data not set!\n", getClassName ().c_str ()); diff --git a/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp b/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp index 7c663e5eadd..41679cd21fc 100644 --- a/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp +++ b/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp @@ -1477,7 +1477,7 @@ namespace pcl PCL_DEBUG ( "[pcl::outofcore::OutofcoreOctreeBaseNode::%s] Points in box: %d\n", __FUNCTION__, indices.size () ); PCL_DEBUG ( "[pcl::outofcore::OutofcoreOctreeBaseNode::%s] Points remaining: %d\n", __FUNCTION__, tmp_cloud->width*tmp_cloud->height - indices.size () ); - if ( indices.size () > 0 ) + if ( !indices.empty () ) { if( dst_blob->width*dst_blob->height > 0 ) { diff --git a/outofcore/include/pcl/outofcore/impl/octree_disk_container.hpp b/outofcore/include/pcl/outofcore/impl/octree_disk_container.hpp index ac0476a0e4f..58d540189c4 100644 --- a/outofcore/include/pcl/outofcore/impl/octree_disk_container.hpp +++ b/outofcore/include/pcl/outofcore/impl/octree_disk_container.hpp @@ -169,7 +169,7 @@ namespace pcl template void OutofcoreOctreeDiskContainer::flushWritebuff (const bool force_cache_dealloc) { - if (writebuff_.size () > 0) + if (!writebuff_.empty ()) { //construct the point cloud for this node typename pcl::PointCloud::Ptr cloud (new pcl::PointCloud); diff --git a/outofcore/include/pcl/outofcore/impl/outofcore_breadth_first_iterator.hpp b/outofcore/include/pcl/outofcore/impl/outofcore_breadth_first_iterator.hpp index 41900ad953d..880cd2d3b8e 100644 --- a/outofcore/include/pcl/outofcore/impl/outofcore_breadth_first_iterator.hpp +++ b/outofcore/include/pcl/outofcore/impl/outofcore_breadth_first_iterator.hpp @@ -64,7 +64,7 @@ namespace pcl OutofcoreBreadthFirstIterator& OutofcoreBreadthFirstIterator::operator++ () { - if (FIFO_.size ()) + if (!FIFO_.empty ()) { // Get the first entry from the FIFO queue OctreeDiskNode *node = FIFO_.front (); @@ -94,7 +94,7 @@ namespace pcl skip_child_voxels_ = false; // If there's a queue, set the current node to the first entry - if (FIFO_.size ()) + if (!FIFO_.empty ()) { this->currentNode_ = FIFO_.front (); } diff --git a/outofcore/include/pcl/outofcore/impl/outofcore_depth_first_iterator.hpp b/outofcore/include/pcl/outofcore/impl/outofcore_depth_first_iterator.hpp index 6330466f6ed..c3608ffaaa4 100644 --- a/outofcore/include/pcl/outofcore/impl/outofcore_depth_first_iterator.hpp +++ b/outofcore/include/pcl/outofcore/impl/outofcore_depth_first_iterator.hpp @@ -106,7 +106,7 @@ namespace pcl if (bTreeUp) { - if (stack_.size () > 0) + if (!stack_.empty ()) { std::pair*, unsigned char>& stackEntry = stack_.back (); stack_.pop_back (); diff --git a/outofcore/tools/outofcore_process.cpp b/outofcore/tools/outofcore_process.cpp index ca0a88ebbea..83df78d29f9 100644 --- a/outofcore/tools/outofcore_process.cpp +++ b/outofcore/tools/outofcore_process.cpp @@ -316,7 +316,7 @@ main (int argc, char* argv[]) } // Check if we should process any files - if (pcd_paths.size () < 1) + if (pcd_paths.empty ()) { PCL_ERROR ("No .pcd files specified\n"); return -1; diff --git a/people/include/pcl/people/impl/head_based_subcluster.hpp b/people/include/pcl/people/impl/head_based_subcluster.hpp index fcad6bb9757..6ec64748a2d 100644 --- a/people/include/pcl/people/impl/head_based_subcluster.hpp +++ b/people/include/pcl/people/impl/head_based_subcluster.hpp @@ -260,7 +260,7 @@ pcl::people::HeadBasedSubclustering::subcluster (std::vector::loadSVMFromFile (std::string svm_filename } SVM_file.close(); - if (SVM_weights_.size() == 0) + if (SVM_weights_.empty ()) { PCL_ERROR ("[pcl::people::PersonClassifier::loadSVMFromFile] Invalid SVM file!\n"); return (false); @@ -218,7 +218,7 @@ pcl::people::PersonClassifier::evaluate (float height_person, float yc, PointCloudPtr& image) { - if (SVM_weights_.size() == 0) + if (SVM_weights_.empty ()) { PCL_ERROR ("[pcl::people::PersonClassifier::evaluate] SVM has not been set!\n"); return (-1000); diff --git a/recognition/include/pcl/recognition/face_detection/face_common.h b/recognition/include/pcl/recognition/face_detection/face_common.h index 9c4a0dd5218..bd154fc317b 100644 --- a/recognition/include/pcl/recognition/face_detection/face_common.h +++ b/recognition/include/pcl/recognition/face_detection/face_common.h @@ -92,7 +92,7 @@ namespace pcl const int num_of_sub_nodes = static_cast (sub_nodes.size ()); stream.write (reinterpret_cast (&num_of_sub_nodes), sizeof(num_of_sub_nodes)); - if (sub_nodes.size () > 0) + if (!sub_nodes.empty ()) { feature.serialize (stream); stream.write (reinterpret_cast (&threshold), sizeof(threshold)); diff --git a/recognition/include/pcl/recognition/impl/hv/hv_go.hpp b/recognition/include/pcl/recognition/impl/hv/hv_go.hpp index ec39e3ebd2a..59f16386baf 100644 --- a/recognition/include/pcl/recognition/impl/hv/hv_go.hpp +++ b/recognition/include/pcl/recognition/impl/hv/hv_go.hpp @@ -522,7 +522,7 @@ bool pcl::GlobalHypothesesVerification::addModel(typename pcl::P recog_model->cloud_->height = 1; } - if (recog_model->cloud_->points.size () <= 0) + if (recog_model->cloud_->points.empty ()) { PCL_WARN("The model cloud has no points..\n"); return false; @@ -604,7 +604,7 @@ bool pcl::GlobalHypothesesVerification::addModel(typename pcl::P recog_model->outlier_indices_.resize (o); recog_model->outliers_weight_ = (std::accumulate (outliers_weight.begin (), outliers_weight.end (), 0.f) / static_cast (outliers_weight.size ())); - if (outliers_weight.size () == 0) + if (outliers_weight.empty ()) recog_model->outliers_weight_ = 1.f; pcl::IndicesPtr indices_scene (new std::vector); diff --git a/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp b/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp index 8eb5d81d76c..67a71999738 100644 --- a/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp +++ b/recognition/include/pcl/recognition/impl/implicit_shape_model.hpp @@ -758,13 +758,13 @@ pcl::ism::ImplicitShapeModelEstimation::findObject { typename pcl::features::ISMVoteList::Ptr out_votes (new pcl::features::ISMVoteList ()); - if (in_cloud->points.size () == 0) + if (in_cloud->points.empty ()) return (out_votes); typename pcl::PointCloud::Ptr sampled_point_cloud (new pcl::PointCloud ()); typename pcl::PointCloud::Ptr sampled_normal_cloud (new pcl::PointCloud ()); simplifyCloud (in_cloud, in_normals, sampled_point_cloud, sampled_normal_cloud); - if (sampled_point_cloud->points.size () == 0) + if (sampled_point_cloud->points.empty ()) return (out_votes); typename pcl::PointCloud >::Ptr feature_cloud (new pcl::PointCloud > ()); @@ -854,7 +854,7 @@ pcl::ism::ImplicitShapeModelEstimation::extractDes int n_key_points = 0; - if (training_clouds_.size () == 0 || training_classes_.size () == 0 || feature_estimator_ == nullptr) + if (training_clouds_.empty () || training_classes_.empty () || feature_estimator_ == nullptr) return (false); for (size_t i_cloud = 0; i_cloud < training_clouds_.size (); i_cloud++) @@ -870,7 +870,7 @@ pcl::ism::ImplicitShapeModelEstimation::extractDes typename pcl::PointCloud::Ptr sampled_point_cloud (new pcl::PointCloud ()); typename pcl::PointCloud::Ptr sampled_normal_cloud (new pcl::PointCloud ()); simplifyCloud (training_clouds_[i_cloud], training_normals_[i_cloud], sampled_point_cloud, sampled_normal_cloud); - if (sampled_point_cloud->points.size () == 0) + if (sampled_point_cloud->points.empty ()) continue; shiftCloud (training_clouds_[i_cloud], models_center); @@ -938,7 +938,7 @@ pcl::ism::ImplicitShapeModelEstimation::clusterDes template void pcl::ism::ImplicitShapeModelEstimation::calculateSigmas (std::vector& sigmas) { - if (training_sigmas_.size () != 0) + if (!training_sigmas_.empty ()) { sigmas.resize (training_sigmas_.size (), 0.0f); for (size_t i_sigma = 0; i_sigma < training_sigmas_.size (); i_sigma++) diff --git a/recognition/include/pcl/recognition/ransac_based/bvh.h b/recognition/include/pcl/recognition/ransac_based/bvh.h index 8084e61b597..fd9e054ee10 100644 --- a/recognition/include/pcl/recognition/ransac_based/bvh.h +++ b/recognition/include/pcl/recognition/ransac_based/bvh.h @@ -234,7 +234,7 @@ namespace pcl { this->clear(); - if ( objects.size () == 0 ) + if ( objects.empty () ) return; sorted_objects_ = &objects; diff --git a/recognition/src/face_detection/rf_face_detector_trainer.cpp b/recognition/src/face_detection/rf_face_detector_trainer.cpp index bdcc0961246..8bfdfbd67c1 100644 --- a/recognition/src/face_detection/rf_face_detector_trainer.cpp +++ b/recognition/src/face_detection/rf_face_detector_trainer.cpp @@ -426,7 +426,7 @@ void pcl::RFFaceDetectorTrainer::detectFaces() faceVotesClustering (); - if (pose_refinement_ && (head_clusters_centers_.size () > 0)) + if (pose_refinement_ && (!head_clusters_centers_.empty ())) { Eigen::Matrix4f icp_trans; float max_distance = 0.015f; diff --git a/registration/include/pcl/registration/impl/ia_fpcs.hpp b/registration/include/pcl/registration/impl/ia_fpcs.hpp index e105feb4e82..37f7f41f58a 100644 --- a/registration/include/pcl/registration/impl/ia_fpcs.hpp +++ b/registration/include/pcl/registration/impl/ia_fpcs.hpp @@ -198,14 +198,14 @@ pcl::registration::FPCSInitialAlignment 0 ? candidates[0].fitness_score < score_threshold_ : abort); + abort = (!candidates.empty () ? candidates[0].fitness_score < score_threshold_ : abort); abort = (abort ? abort : timer.getTimeSeconds () > max_runtime_); @@ -244,7 +244,7 @@ pcl::registration::FPCSInitialAlignment size () == 0) + if (!target_indices_ || target_indices_->empty ()) { target_indices_.reset (new std::vector (static_cast (target_->size ()))); int index = 0; @@ -618,7 +618,7 @@ pcl::registration::FPCSInitialAlignment 0 ? 0 : -1); + return (!matches.empty () ? 0 : -1); } diff --git a/registration/include/pcl/registration/impl/pyramid_feature_matching.hpp b/registration/include/pcl/registration/impl/pyramid_feature_matching.hpp index cac27893f87..dc51263c87f 100644 --- a/registration/include/pcl/registration/impl/pyramid_feature_matching.hpp +++ b/registration/include/pcl/registration/impl/pyramid_feature_matching.hpp @@ -147,13 +147,13 @@ pcl::PyramidFeatureHistogram::initializeHistogram () return false; } - if (dimension_range_input_.size () == 0) + if (dimension_range_input_.empty ()) { PCL_ERROR ("[pcl::PyramidFeatureHistogram::initializeHistogram] Input dimension range was not set\n"); return false; } - if (dimension_range_target_.size () == 0) + if (dimension_range_target_.empty ()) { PCL_ERROR ("[pcl::PyramidFeatureHistogram::initializeHistogram] Target dimension range was not set\n"); return false; diff --git a/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp b/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp index 94f7b34f463..843e20d05e3 100644 --- a/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp +++ b/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp @@ -326,7 +326,7 @@ pcl::SampleConsensusPrerejective::getFitness } // Calculate MSE - if (inliers.size () > 0) + if (!inliers.empty ()) fitness_score /= static_cast (inliers.size ()); else fitness_score = std::numeric_limits::max (); diff --git a/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp index dc73ee6ef00..70b0bebc7aa 100644 --- a/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp @@ -220,7 +220,7 @@ pcl::CPCSegmentation::applyCuttingPlane (uint32_t depth_levels_left) cut_support_indices.insert (cut_support_indices.end (), cluster_index.indices.begin (), cluster_index.indices.end ()); } } - if (cut_support_indices.size () == 0) + if (cut_support_indices.empty ()) { // std::cout << "Could not find planes which exceed required minimum score (threshold " << min_cut_score_ << "), not cutting" << std::endl; continue; diff --git a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp index 1c8603222e1..966bac564d0 100644 --- a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp @@ -165,7 +165,7 @@ pcl::CrfSegmentation::createVoxelGrid () voxel_grid_.filter (*filtered_cloud_); // Filter the annotated cloud - if (anno_cloud_->points.size () > 0) + if (!anno_cloud_->points.empty ()) { pcl::VoxelGridLabel vg; @@ -181,7 +181,7 @@ pcl::CrfSegmentation::createVoxelGrid () } // Filter the annotated cloud - if (normal_cloud_->points.size () > 0) + if (!normal_cloud_->points.empty ()) { pcl::VoxelGrid vg; vg.setInputCloud (normal_cloud_); @@ -342,7 +342,7 @@ pcl::CrfSegmentation::createUnaryPotentials (std::vector &unary, { int label = filtered_anno_->points[k].label; - if (labels.size () == 0 && label > 0) + if (labels.empty () && label > 0) labels.push_back (label); // add color to the color vector if not added yet @@ -408,7 +408,7 @@ pcl::CrfSegmentation::segmentPoints (pcl::PointCloud // create unary potentials std::vector labels; std::vector unary; - if (anno_cloud_->points.size () > 0) + if (!anno_cloud_->points.empty ()) { unary.resize (N * n_labels); createUnaryPotentials (unary, labels, n_labels); diff --git a/segmentation/include/pcl/segmentation/impl/min_cut_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/min_cut_segmentation.hpp index 4169378e712..658836de4ca 100644 --- a/segmentation/include/pcl/segmentation/impl/min_cut_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/min_cut_segmentation.hpp @@ -324,7 +324,7 @@ pcl::MinCutSegmentation::buildGraph () int number_of_points = static_cast (input_->points.size ()); int number_of_indices = static_cast (indices_->size ()); - if (input_->points.size () == 0 || number_of_points == 0 || foreground_points_.empty () == true ) + if (input_->points.empty () || number_of_points == 0 || foreground_points_.empty () == true ) return (false); if (search_ == 0) diff --git a/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp index 5fac788ee92..d26cf2cd81c 100644 --- a/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp @@ -297,7 +297,7 @@ pcl::OrganizedMultiPlaneSegmentation::segmentAndRefine model_coefficients[i].values[3]); Eigen::Vector3f vp (0.0, 0.0, 0.0); - if (project_points_ && boundary_cloud.points.size () > 0) + if (project_points_ && !boundary_cloud.points.empty ()) boundary_cloud = projectToPlaneFromViewpoint (boundary_cloud, model, centroid, vp); regions[i] = PlanarRegion (centroid, diff --git a/segmentation/include/pcl/segmentation/impl/random_walker.hpp b/segmentation/include/pcl/segmentation/impl/random_walker.hpp index 639ed4efe28..9eac1335a12 100644 --- a/segmentation/include/pcl/segmentation/impl/random_walker.hpp +++ b/segmentation/include/pcl/segmentation/impl/random_walker.hpp @@ -176,9 +176,9 @@ namespace pcl size_t num_colors = B_color_bimap.size (); L.resize (num_equations, num_equations); B.resize (num_equations, num_colors); - if (L_triplets.size ()) + if (!L_triplets.empty ()) L.setFromTriplets(L_triplets.begin(), L_triplets.end()); - if (B_triplets.size ()) + if (!B_triplets.empty ()) B.setFromTriplets(B_triplets.begin(), B_triplets.end()); } diff --git a/segmentation/include/pcl/segmentation/impl/region_growing.hpp b/segmentation/include/pcl/segmentation/impl/region_growing.hpp index 559de6417d8..10272b8c80f 100644 --- a/segmentation/include/pcl/segmentation/impl/region_growing.hpp +++ b/segmentation/include/pcl/segmentation/impl/region_growing.hpp @@ -308,7 +308,7 @@ template bool pcl::RegionGrowing::prepareForSegmentation () { // if user forgot to pass point cloud or if it is empty - if ( input_->points.size () == 0 ) + if ( input_->points.empty () ) return (false); // if user forgot to pass normals or the sizes of point and normal cloud are different diff --git a/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp b/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp index 2d47662f42d..4082fa106ad 100644 --- a/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp +++ b/segmentation/include/pcl/segmentation/impl/region_growing_rgb.hpp @@ -217,7 +217,7 @@ template bool pcl::RegionGrowingRGB::prepareForSegmentation () { // if user forgot to pass point cloud or if it is empty - if ( input_->points.size () == 0 ) + if ( input_->points.empty () ) return (false); // if normal/smoothness test is on then we need to check if all needed variables and parameters diff --git a/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp b/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp index 156f10d8ccd..5ca3e65cdfc 100644 --- a/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp +++ b/segmentation/include/pcl/segmentation/impl/supervoxel_clustering.hpp @@ -68,7 +68,7 @@ pcl::SupervoxelClustering::~SupervoxelClustering () template void pcl::SupervoxelClustering::setInputCloud (const typename pcl::PointCloud::ConstPtr& cloud) { - if ( cloud->size () == 0 ) + if ( cloud->empty () ) { PCL_ERROR ("[pcl::SupervoxelClustering::setInputCloud] Empty cloud set, doing nothing \n"); return; @@ -82,7 +82,7 @@ pcl::SupervoxelClustering::setInputCloud (const typename pcl::PointCloud template void pcl::SupervoxelClustering::setNormalCloud (typename NormalCloudT::ConstPtr normal_cloud) { - if ( normal_cloud->size () == 0 ) + if ( normal_cloud->empty () ) { PCL_ERROR ("[pcl::SupervoxelClustering::setNormalCloud] Empty cloud set, doing nothing \n"); return; @@ -147,7 +147,7 @@ pcl::SupervoxelClustering::extract (std::map void pcl::SupervoxelClustering::refineSupervoxels (int num_itr, std::map::Ptr > &supervoxel_clusters) { - if (supervoxel_helpers_.size () == 0) + if (supervoxel_helpers_.empty ()) { PCL_ERROR ("[pcl::SupervoxelClustering::refineVoxelNormals] Supervoxels not extracted, doing nothing - (Call extract first!) \n"); return; @@ -181,7 +181,7 @@ pcl::SupervoxelClustering::prepareForSegmentation () { // if user forgot to pass point cloud or if it is empty - if ( input_->points.size () == 0 ) + if ( input_->points.empty () ) return (false); //Add the new cloud of data to the octree diff --git a/segmentation/include/pcl/segmentation/impl/unary_classifier.hpp b/segmentation/include/pcl/segmentation/impl/unary_classifier.hpp index 410ff06f314..b35c2b632b3 100644 --- a/segmentation/include/pcl/segmentation/impl/unary_classifier.hpp +++ b/segmentation/include/pcl/segmentation/impl/unary_classifier.hpp @@ -406,7 +406,7 @@ pcl::UnaryClassifier::trainWithLabel ( template void pcl::UnaryClassifier::segment (pcl::PointCloud::Ptr &out) { - if (trained_features_.size () > 0) + if (!trained_features_.empty ()) { // convert cloud into cloud with XYZ pcl::PointCloud::Ptr tmp_cloud (new pcl::PointCloud); diff --git a/simulation/tools/sim_terminal_demo.cpp b/simulation/tools/sim_terminal_demo.cpp index 0e5ac6ecb69..1e55ff41937 100644 --- a/simulation/tools/sim_terminal_demo.cpp +++ b/simulation/tools/sim_terminal_demo.cpp @@ -57,7 +57,7 @@ void write_sim_output(const string &fname_root){ simexample->rl_->getPointCloud (pc_out,false,simexample->camera_->getPose ()); // TODO: what to do when there are more than one simulated view? - if (pc_out->points.size()>0){ + if (!pc_out->points.empty ()){ std::cout << pc_out->points.size() << " points written to file\n"; pcl::PCDWriter writer; diff --git a/simulation/tools/sim_viewer.cpp b/simulation/tools/sim_viewer.cpp index 5e0af196a1c..fff0847d35f 100644 --- a/simulation/tools/sim_viewer.cpp +++ b/simulation/tools/sim_viewer.cpp @@ -474,7 +474,7 @@ main (int argc, char** argv) std::vector p_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd"); std::vector vtk_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".vtk"); - if (p_file_indices.size () == 0 && vtk_file_indices.size () == 0) + if (p_file_indices.empty () && vtk_file_indices.empty ()) { print_error ("No .PCD or .VTK file given. Nothing to visualize.\n"); return (-1); @@ -488,13 +488,13 @@ main (int argc, char** argv) print_highlight ("Multi-viewport rendering enabled.\n"); int y_s = 0; - if (p_file_indices.size () != 0) + if (!p_file_indices.empty ()) { y_s = static_cast(floor (sqrt (static_cast(p_file_indices.size ())))); x_s = y_s + static_cast(ceil ((p_file_indices.size () / static_cast(y_s)) - y_s)); print_highlight ("Preparing to load "); print_value ("%d", p_file_indices.size ()); } - else if (vtk_file_indices.size () != 0) + else if (!vtk_file_indices.empty ()) { y_s = static_cast(floor (sqrt (static_cast(vtk_file_indices.size ())))); x_s = y_s + static_cast(ceil ((vtk_file_indices.size () / static_cast(y_s)) - y_s)); @@ -509,10 +509,10 @@ main (int argc, char** argv) } // Fix invalid multiple arguments - if (psize.size () != p_file_indices.size () && psize.size () > 0) + if (psize.size () != p_file_indices.size () && !psize.empty ()) for (size_t i = psize.size (); i < p_file_indices.size (); ++i) psize.push_back (1); - if (opaque.size () != p_file_indices.size () && opaque.size () > 0) + if (opaque.size () != p_file_indices.size () && !opaque.empty ()) for (size_t i = opaque.size (); i < p_file_indices.size (); ++i) opaque.push_back (1.0); @@ -569,11 +569,11 @@ main (int argc, char** argv) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_COLOR, fcolor_r[i], fcolor_g[i], fcolor_b[i], cloud_name.str ()); // Change the shape rendered point size - if (psize.size () > 0) + if (!psize.empty ()) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, psize.at (i), cloud_name.str ()); // Change the shape rendered opacity - if (opaque.size () > 0) + if (!opaque.empty ()) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opaque.at (i), cloud_name.str ()); } @@ -752,11 +752,11 @@ main (int argc, char** argv) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_IMMEDIATE_RENDERING, 1.0, cloud_name.str ()); // Change the cloud rendered point size - if (psize.size () > 0) + if (!psize.empty ()) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, psize.at (i), cloud_name.str ()); // Change the cloud rendered opacity - if (opaque.size () > 0) + if (!opaque.empty ()) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opaque.at (i), cloud_name.str ()); // Reset camera viewpoint to center of cloud if camera parameters were not passed manually and this is the first loaded cloud diff --git a/surface/include/pcl/surface/impl/texture_mapping.hpp b/surface/include/pcl/surface/impl/texture_mapping.hpp index 31ced71323b..98014e16c79 100644 --- a/surface/include/pcl/surface/impl/texture_mapping.hpp +++ b/surface/include/pcl/surface/impl/texture_mapping.hpp @@ -554,7 +554,7 @@ pcl::TextureMapping::sortFacesByCamera (pcl::TextureMesh &tex_mesh, pc return (-1); } - if (cameras.size () == 0) + if (cameras.empty ()) { PCL_ERROR ("Must provide at least one camera info!\n"); return (-1); diff --git a/surface/src/on_nurbs/sequential_fitter.cpp b/surface/src/on_nurbs/sequential_fitter.cpp index 5b7bddbbaab..f9a7310604c 100644 --- a/surface/src/on_nurbs/sequential_fitter.cpp +++ b/surface/src/on_nurbs/sequential_fitter.cpp @@ -196,7 +196,7 @@ SequentialFitter::is_back_facing (const Eigen::Vector3d &v0, const Eigen::Vector void SequentialFitter::setInputCloud (pcl::PointCloud::Ptr &pcl_cloud) { - if (pcl_cloud.get () == nullptr || pcl_cloud->points.size () == 0) + if (pcl_cloud.get () == nullptr || pcl_cloud->points.empty ()) throw std::runtime_error ("[SequentialFitter::setInputCloud] Error: Empty or invalid pcl-point-cloud.\n"); m_cloud = pcl_cloud; @@ -206,7 +206,7 @@ SequentialFitter::setInputCloud (pcl::PointCloud::Ptr &pcl_clo void SequentialFitter::setBoundary (pcl::PointIndices::Ptr &pcl_cloud_indexes) { - if (m_cloud.get () == nullptr || m_cloud->points.size () == 0) + if (m_cloud.get () == nullptr || m_cloud->points.empty ()) throw std::runtime_error ("[SequentialFitter::setBoundary] Error: Empty or invalid pcl-point-cloud.\n"); this->m_boundary_indices = pcl_cloud_indexes; @@ -217,7 +217,7 @@ SequentialFitter::setBoundary (pcl::PointIndices::Ptr &pcl_cloud_indexes) void SequentialFitter::setInterior (pcl::PointIndices::Ptr &pcl_cloud_indexes) { - if (m_cloud.get () == nullptr || m_cloud->points.size () == 0) + if (m_cloud.get () == nullptr || m_cloud->points.empty ()) throw std::runtime_error ("[SequentialFitter::setIndices] Error: Empty or invalid pcl-point-cloud.\n"); this->m_interior_indices = pcl_cloud_indexes; @@ -228,7 +228,7 @@ SequentialFitter::setInterior (pcl::PointIndices::Ptr &pcl_cloud_indexes) void SequentialFitter::setCorners (pcl::PointIndices::Ptr &corners, bool flip_on_demand) { - if (m_cloud.get () == nullptr || m_cloud->points.size () == 0) + if (m_cloud.get () == nullptr || m_cloud->points.empty ()) throw std::runtime_error ("[SequentialFitter::setCorners] Error: Empty or invalid pcl-point-cloud.\n"); if (corners->indices.size () < 4) @@ -291,7 +291,7 @@ SequentialFitter::compute (bool assemble) // TomGine::tgRenderModel nurbs; // TomGine::tgRenderModel box; - if (m_data.boundary.size () > 0) + if (!m_data.boundary.empty ()) { // throw std::runtime_error("[SequentialFitter::compute] Error: empty boundary point-cloud.\n"); @@ -361,7 +361,7 @@ SequentialFitter::compute (bool assemble) } } - if (m_data.interior.size () > 0) + if (!m_data.interior.empty ()) compute_interior (fitting); // update error @@ -377,7 +377,7 @@ SequentialFitter::compute (bool assemble) ON_NurbsSurface SequentialFitter::compute_boundary (const ON_NurbsSurface &nurbs) { - if (m_data.boundary.size () <= 0) + if (m_data.boundary.empty ()) { printf ("[SequentialFitter::compute_boundary] Warning, no boundary points given: setBoundary()\n"); return nurbs; @@ -400,7 +400,7 @@ SequentialFitter::compute_boundary (const ON_NurbsSurface &nurbs) ON_NurbsSurface SequentialFitter::compute_interior (const ON_NurbsSurface &nurbs) { - if (m_data.boundary.size () <= 0) + if (m_data.boundary.empty ()) { printf ("[SequentialFitter::compute_interior] Warning, no interior points given: setInterior()\n"); return nurbs; diff --git a/surface/src/simplification_remove_unused_vertices.cpp b/surface/src/simplification_remove_unused_vertices.cpp index bd934f3e86a..9cb589afb5d 100644 --- a/surface/src/simplification_remove_unused_vertices.cpp +++ b/surface/src/simplification_remove_unused_vertices.cpp @@ -45,7 +45,7 @@ void pcl::surface::SimplificationRemoveUnusedVertices::simplify(const pcl::PolygonMesh& input, pcl::PolygonMesh& output, std::vector& indices) { - if (input.polygons.size () == 0) + if (input.polygons.empty ()) return; unsigned int nr_points = input.cloud.width * input.cloud.height; diff --git a/test/geometry/test_mesh.cpp b/test/geometry/test_mesh.cpp index ac4926ff9e3..a7741a7aeba 100644 --- a/test/geometry/test_mesh.cpp +++ b/test/geometry/test_mesh.cpp @@ -318,7 +318,7 @@ TEST (TestAddDeleteFace, NonManifold2) } // Delete all faces - while (expected.size ()) + while (!expected.empty ()) { mesh.deleteFace (FaceIndex (0)); mesh.cleanUp (); diff --git a/test/kdtree/test_kdtree.cpp b/test/kdtree/test_kdtree.cpp index 7c02a6213c6..d6bf9e90826 100644 --- a/test/kdtree/test_kdtree.cpp +++ b/test/kdtree/test_kdtree.cpp @@ -115,7 +115,7 @@ TEST (PCL, KdTreeFLANN_radiusSearch) //for (set::const_iterator it=brute_force_result.begin(); it!=brute_force_result.end(); ++it) //cerr << "FLANN missed "<<*it<<"\n"; - bool error = brute_force_result.size () > 0; + bool error = !brute_force_result.empty (); //if (error) cerr << "Missed too many neighbors!\n"; EXPECT_EQ (error, false); diff --git a/test/octree/test_octree.cpp b/test/octree/test_octree.cpp index 3c2e7c4c84d..f3b71a1e7f1 100644 --- a/test/octree/test_octree.cpp +++ b/test/octree/test_octree.cpp @@ -1193,7 +1193,7 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) unsigned idx = static_cast (pointCandidates.size ()); k_indices_bruteforce.resize (idx); k_sqr_distances_bruteforce.resize (idx); - while (pointCandidates.size ()) + while (!pointCandidates.empty ()) { --idx; k_indices_bruteforce [idx] = pointCandidates.top ().pointIdx_; @@ -1210,7 +1210,7 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) ASSERT_EQ (k_indices_bruteforce.size (), k_indices.size()); // compare nearest neighbor results of octree with bruteforce search - while (k_indices_bruteforce.size ()) + while (!k_indices_bruteforce.empty ()) { ASSERT_EQ (k_indices_bruteforce.back(), k_indices.back ()); EXPECT_NEAR (k_sqr_distances_bruteforce.back (), k_sqr_distances.back (), 1e-4); diff --git a/test/search/test_octree.cpp b/test/search/test_octree.cpp index 6c1d15c81c2..ef1f82ab3e8 100644 --- a/test/search/test_octree.cpp +++ b/test/search/test_octree.cpp @@ -137,7 +137,7 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) unsigned idx = static_cast (pointCandidates.size ()); k_indices_bruteforce.resize (idx); k_sqr_distances_bruteforce.resize (idx); - while (pointCandidates.size ()) + while (!pointCandidates.empty ()) { --idx; k_indices_bruteforce [idx] = pointCandidates.top ().pointIdx_; @@ -152,7 +152,7 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) ASSERT_EQ ( k_indices.size() , k_indices_bruteforce.size() ); // compare nearest neighbor results of octree with bruteforce search - while (k_indices_bruteforce.size ()) + while (!k_indices_bruteforce.empty ()) { ASSERT_EQ ( k_indices.back() , k_indices_bruteforce.back() ); EXPECT_NEAR (k_sqr_distances.back(), k_sqr_distances_bruteforce.back(), 1e-4); diff --git a/test/search/test_organized.cpp b/test/search/test_organized.cpp index 62a0ea28c55..86d0f40c4bb 100644 --- a/test/search/test_organized.cpp +++ b/test/search/test_organized.cpp @@ -156,7 +156,7 @@ TEST (PCL, Organized_Neighbor_Pointcloud_Nearest_K_Neighbour_Search) pointCandidates.pop (); // copy results into vectors - while (pointCandidates.size ()) + while (!pointCandidates.empty ()) { k_indices_bruteforce.push_back (pointCandidates.top ().pointIdx_); k_sqr_distances_bruteforce.push_back (float (pointCandidates.top ().pointDistance_)); diff --git a/test/search/test_search.cpp b/test/search/test_search.cpp index 541580effee..b974b0280b4 100644 --- a/test/search/test_search.cpp +++ b/test/search/test_search.cpp @@ -291,7 +291,7 @@ testKNNSearch (typename PointCloud::ConstPtr point_cloud, vector indices_mask (point_cloud->size (), true); vector nan_mask (point_cloud->size (), true); - if (input_indices.size () != 0) + if (!input_indices.empty ()) { indices_mask.assign (point_cloud->size (), false); for (const int &input_index : input_indices) @@ -307,7 +307,7 @@ testKNNSearch (typename PointCloud::ConstPtr point_cloud, vector > input_indices_; - if (input_indices.size ()) + if (!input_indices.empty ()) input_indices_.reset (new vector (input_indices)); #pragma omp parallel for @@ -361,7 +361,7 @@ testRadiusSearch (typename PointCloud::ConstPtr point_cloud, vector indices_mask (point_cloud->size (), true); vector nan_mask (point_cloud->size (), true); - if (input_indices.size () != 0) + if (!input_indices.empty ()) { indices_mask.assign (point_cloud->size (), false); for (const int &input_index : input_indices) @@ -377,7 +377,7 @@ testRadiusSearch (typename PointCloud::ConstPtr point_cloud, vector > input_indices_; - if (input_indices.size ()) + if (!input_indices.empty ()) input_indices_.reset (new vector (input_indices)); #pragma omp parallel for diff --git a/tools/crop_to_hull.cpp b/tools/crop_to_hull.cpp index fdd1e377bd9..92d9f1f2d27 100644 --- a/tools/crop_to_hull.cpp +++ b/tools/crop_to_hull.cpp @@ -183,7 +183,7 @@ main (int argc, char** argv) cropToHull (output_cloud, input_cloud, hull_points, hull_polygons, dim); - if (output_cloud->size ()) + if (!output_cloud->empty ()) saveCloud (argv[p_file_indices[2]], *output_cloud); else print_error ("No points passed crop.\n"); diff --git a/tools/obj_rec_ransac_hash_table.cpp b/tools/obj_rec_ransac_hash_table.cpp index 561bc18951e..2ed851d9db6 100644 --- a/tools/obj_rec_ransac_hash_table.cpp +++ b/tools/obj_rec_ransac_hash_table.cpp @@ -177,7 +177,7 @@ visualize (const ModelLibrary::HashTable& hash_table) // Just get the maximal number of entries in the cells for ( int i = 0 ; i < num_cells ; ++i, ++cells ) { - if (cells->size ()) // That's the number of models in the cell (it's maximum one, since we loaded only one model) + if (!cells->empty ()) // That's the number of models in the cell (it's maximum one, since we loaded only one model) { size_t num_entries = (*cells->begin ()).second.size(); // That's the number of entries in the current cell for the model we loaded // Get the max number of entries @@ -197,7 +197,7 @@ visualize (const ModelLibrary::HashTable& hash_table) for ( int i = 0; i < num_cells ; ++i, ++cells ) { // Does the cell have any entries? - if (cells->size ()) + if (!cells->empty ()) { hash_table.compute3dId (i, id3); hash_table.computeVoxelCenter (id3, cell_center); diff --git a/tools/obj_rec_ransac_orr_octree.cpp b/tools/obj_rec_ransac_orr_octree.cpp index ca01b2df4a7..70aa8c85dc7 100644 --- a/tools/obj_rec_ransac_orr_octree.cpp +++ b/tools/obj_rec_ransac_orr_octree.cpp @@ -200,7 +200,7 @@ void run (const char* file_name, float voxel_size) // Build the octree with the desired resolution ORROctree octree; - if ( normals_in->size () ) + if ( !normals_in->empty () ) octree.build (*points_in, voxel_size, &*normals_in); else octree.build (*points_in, voxel_size); @@ -211,7 +211,7 @@ void run (const char* file_name, float voxel_size) // Get the average points in every full octree leaf octree.getFullLeavesPoints (*points_out); // Get the average normal at the points in each leaf - if ( normals_in->size () ) + if ( !normals_in->empty () ) octree.getNormalsOfFullLeaves (*normals_out); // The visualizer @@ -224,7 +224,7 @@ void run (const char* file_name, float voxel_size) // Add the point clouds viz.addPointCloud (points_in, "cloud in"); viz.addPointCloud (points_out, "cloud out"); - if ( normals_in->size () ) + if ( !normals_in->empty () ) viz.addPointCloudNormals (points_out, normals_out, 1, 6.0f, "normals out"); // Change the appearance diff --git a/tools/obj_rec_ransac_result.cpp b/tools/obj_rec_ransac_result.cpp index cdcef4a67ac..77fb3f77a53 100644 --- a/tools/obj_rec_ransac_result.cpp +++ b/tools/obj_rec_ransac_result.cpp @@ -337,7 +337,7 @@ loadScene (const char* file_name, PointCloud& non_plane_points, PointC seg.setInputCloud (all_points); seg.segment (*inliers, *coefficients); - if (inliers->indices.size () == 0) + if (inliers->indices.empty ()) { PCL_ERROR ("Could not estimate a planar model for the given dataset."); return false; diff --git a/tools/pcd_viewer.cpp b/tools/pcd_viewer.cpp index 9d567ddf828..be35b549792 100644 --- a/tools/pcd_viewer.cpp +++ b/tools/pcd_viewer.cpp @@ -235,7 +235,7 @@ main (int argc, char** argv) std::vector p_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd"); std::vector vtk_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".vtk"); - if (p_file_indices.size () == 0 && vtk_file_indices.size () == 0) + if (p_file_indices.empty () && vtk_file_indices.empty ()) { print_error ("No .PCD or .VTK file given. Nothing to visualize.\n"); return (-1); @@ -306,12 +306,12 @@ main (int argc, char** argv) int y_s = static_cast(floor (sqrt (static_cast(p_file_indices.size () + vtk_file_indices.size ())))); x_s = y_s + static_cast(ceil (double (p_file_indices.size () + vtk_file_indices.size ()) / double (y_s) - y_s)); - if (p_file_indices.size () != 0) + if (!p_file_indices.empty ()) { print_highlight ("Preparing to load "); print_value ("%d", p_file_indices.size ()); print_info (" pcd files.\n"); } - if (vtk_file_indices.size () != 0) + if (!vtk_file_indices.empty ()) { print_highlight ("Preparing to load "); print_value ("%d", vtk_file_indices.size ()); print_info (" vtk files.\n"); } @@ -324,14 +324,14 @@ main (int argc, char** argv) } // Fix invalid multiple arguments - if (psize.size () != p_file_indices.size () && psize.size () > 0) + if (psize.size () != p_file_indices.size () && !psize.empty ()) for (size_t i = psize.size (); i < p_file_indices.size (); ++i) psize.push_back (1); - if (opaque.size () != p_file_indices.size () && opaque.size () > 0) + if (opaque.size () != p_file_indices.size () && !opaque.empty ()) for (size_t i = opaque.size (); i < p_file_indices.size (); ++i) opaque.push_back (1.0); - if (shadings.size () != p_file_indices.size () && shadings.size () > 0) + if (shadings.size () != p_file_indices.size () && !shadings.empty ()) for (size_t i = shadings.size (); i < p_file_indices.size (); ++i) shadings.emplace_back("flat"); @@ -387,15 +387,15 @@ main (int argc, char** argv) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_COLOR, fcolor_r[i], fcolor_g[i], fcolor_b[i], cloud_name.str ()); // Change the shape rendered point size - if (psize.size () > 0) + if (!psize.empty ()) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, psize.at (i), cloud_name.str ()); // Change the shape rendered opacity - if (opaque.size () > 0) + if (!opaque.empty ()) p->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opaque.at (i), cloud_name.str ()); // Change the shape rendered shading - if (shadings.size () > 0) + if (!shadings.empty ()) { if (shadings[i] == "flat") { @@ -650,11 +650,11 @@ main (int argc, char** argv) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_IMMEDIATE_RENDERING, 1.0, cloud_name.str ()); // Change the cloud rendered point size - if (psize.size () > 0) + if (!psize.empty ()) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, psize.at (i), cloud_name.str ()); // Change the cloud rendered opacity - if (opaque.size () > 0) + if (!opaque.empty ()) p->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, opaque.at (i), cloud_name.str ()); // Reset camera viewpoint to center of cloud if camera parameters were not passed manually and this is the first loaded cloud diff --git a/tools/pclzf2pcd.cpp b/tools/pclzf2pcd.cpp index 8fb3d94b685..c29dabe7641 100644 --- a/tools/pclzf2pcd.cpp +++ b/tools/pclzf2pcd.cpp @@ -137,7 +137,7 @@ main (int argc, char** argv) std::vector pcd_file_indices = parse_file_extension_argument (argc, argv, ".pcd"); std::vector pclzf_file_indices = parse_file_extension_argument (argc, argv, ".pclzf"); std::vector xml_file_indices = parse_file_extension_argument (argc, argv, ".xml"); - if (pcd_file_indices.size () != 1 || pclzf_file_indices.size () < 1 || xml_file_indices.size () != 1) + if (pcd_file_indices.size () != 1 || pclzf_file_indices.empty () || xml_file_indices.size () != 1) { print_error ("Need at least 1 input PCLZF file, one input XML file, and one output PCD file.\n"); return (-1); diff --git a/tracking/include/pcl/tracking/impl/particle_filter.hpp b/tracking/include/pcl/tracking/impl/particle_filter.hpp index 3ca8dc0e15f..ad89babdb26 100644 --- a/tracking/include/pcl/tracking/impl/particle_filter.hpp +++ b/tracking/include/pcl/tracking/impl/particle_filter.hpp @@ -224,7 +224,7 @@ pcl::tracking::ParticleFilterTracker::testChangeDetection std::vector newPointIdxVector; change_detector_->getPointIndicesFromNewVoxels (newPointIdxVector, change_detector_filter_); change_detector_->switchBuffers (); - return newPointIdxVector.size () > 0; + return !newPointIdxVector.empty (); } template void diff --git a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp index 1b43ef09609..b793a983e4f 100644 --- a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp @@ -1701,7 +1701,7 @@ pcl::visualization::PCLVisualizer::addPolygonMesh ( vtkSmartPointer cell_array = vtkSmartPointer::New (); vtkIdType *cell = cell_array->WritePointer (vertices.size (), vertices.size () * (max_size_of_polygon + 1)); int idx = 0; - if (lookup.size () > 0) + if (!lookup.empty ()) { for (size_t i = 0; i < vertices.size (); ++i, ++idx) { @@ -1743,7 +1743,7 @@ pcl::visualization::PCLVisualizer::addPolygonMesh ( size_t n_points = vertices[0].vertices.size (); polygon->GetPointIds ()->SetNumberOfIds (n_points - 1); - if (lookup.size () > 0) + if (!lookup.empty ()) { for (size_t j = 0; j < (n_points - 1); ++j) polygon->GetPointIds ()->SetId (j, lookup[vertices[0].vertices[j]]); @@ -1878,7 +1878,7 @@ pcl::visualization::PCLVisualizer::updatePolygonMesh ( cells = vtkSmartPointer::New (); vtkIdType *cell = cells->WritePointer (verts.size (), verts.size () * (max_size_of_polygon + 1)); int idx = 0; - if (lookup.size () > 0) + if (!lookup.empty ()) { for (size_t i = 0; i < verts.size (); ++i, ++idx) { diff --git a/visualization/src/image_viewer.cpp b/visualization/src/image_viewer.cpp index 86368b50c76..085880290f7 100644 --- a/visualization/src/image_viewer.cpp +++ b/visualization/src/image_viewer.cpp @@ -831,7 +831,7 @@ pcl::visualization::ImageViewer::markPoints ( const std::vector& uv, Vector3ub fg_color, Vector3ub bg_color, double size, const std::string &layer_id, double opacity) { - if (uv.size () == 0) + if (uv.empty ()) return; std::vector float_uv (uv.size ()); @@ -846,7 +846,7 @@ pcl::visualization::ImageViewer::markPoints ( const std::vector& uv, Vector3ub fg_color, Vector3ub bg_color, double size, const std::string &layer_id, double opacity) { - if (uv.size () == 0) + if (uv.empty ()) return; // Check to see if this ID entry already exists (has it been already added to the visualizer?) diff --git a/visualization/src/pcl_plotter.cpp b/visualization/src/pcl_plotter.cpp index e406833bd4f..402353ba39b 100644 --- a/visualization/src/pcl_plotter.cpp +++ b/visualization/src/pcl_plotter.cpp @@ -144,7 +144,7 @@ pcl::visualization::PCLPlotter::addPlotData ( int type /* = vtkChart::LINE */, std::vector const &color) { - this->addPlotData (&array_X[0], &array_Y[0], static_cast (array_X.size ()), name, type, (color.size () == 0) ? NULL : &color[0]); + this->addPlotData (&array_X[0], &array_Y[0], static_cast (array_X.size ()), name, type, (color.empty ()) ? NULL : &color[0]); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ pcl::visualization::PCLPlotter::addPlotData ( array_x[i] = plot_data[i].first; array_y[i] = plot_data[i].second; } - this->addPlotData (array_x, array_y, static_cast (plot_data.size ()), name, type, (color.size () == 0) ? NULL : &color[0]); + this->addPlotData (array_x, array_y, static_cast (plot_data.size ()), name, type, (color.empty ()) ? NULL : &color[0]); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp index 09876719ccd..2b386ae856e 100644 --- a/visualization/src/pcl_visualizer.cpp +++ b/visualization/src/pcl_visualizer.cpp @@ -3179,7 +3179,7 @@ pcl::visualization::PCLVisualizer::updatePolygonMesh ( cells = vtkSmartPointer::New (); vtkIdType *cell = cells->WritePointer (verts.size (), verts.size () * (max_size_of_polygon + 1)); int idx = 0; - if (lookup.size () > 0) + if (!lookup.empty ()) { for (size_t i = 0; i < verts.size (); ++i, ++idx) { @@ -3285,7 +3285,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, return (false); } // no texture materials --> exit - if (mesh.tex_materials.size () == 0) + if (mesh.tex_materials.empty ()) { PCL_ERROR("[PCLVisualizer::addTextureMesh] No textures found!\n"); return (false); @@ -3335,7 +3335,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, { pcl::PointCloud cloud; pcl::fromPCLPointCloud2 (mesh.cloud, cloud); - if (cloud.points.size () == 0) + if (cloud.points.empty ()) { PCL_ERROR ("[PCLVisualizer::addTextureMesh] Cloud is empty!\n"); return (false); @@ -3358,7 +3358,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); pcl::fromPCLPointCloud2 (mesh.cloud, *cloud); // no points --> exit - if (cloud->points.size () == 0) + if (cloud->points.empty ()) { PCL_ERROR ("[PCLVisualizer::addTextureMesh] Cloud is empty!\n"); return (false); @@ -4584,7 +4584,7 @@ pcl::visualization::PCLVisualizer::getUniqueCameraFile (int argc, char **argv) std::ostringstream sstream; p_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd"); - if (p_file_indices.size () != 0) + if (!p_file_indices.empty ()) { boost::uuids::detail::sha1 sha1; bool valid = false;