Skip to content

Commit 5905d1c

Browse files
committed
Merge remote-tracking branch 'origin/master' into pcl-1.7.0
2 parents 94cd21e + 71639c5 commit 5905d1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3439
-2171
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ before_install:
99
- sudo apt-get install cmake libvtk5-qt4-dev libflann-dev libeigen3-dev libopenni-dev libqhull-dev libboost-filesystem1.53-dev libboost-iostreams1.53-dev libboost-thread1.53-dev
1010
script:
1111
- mkdir build && cd build
12-
- cmake -DCMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2" -DPCL_ONLY_CORE_POINT_TYPES=ON .. && make -j2 && make test
12+
- cmake -DBUILD_global_tests=ON -DCMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2" -DPCL_ONLY_CORE_POINT_TYPES=ON .. && make -j2 && make test

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ endif()
109109

110110
if(MSVC)
111111
SET(CMAKE_COMPILER_IS_MSVC 1)
112-
add_definitions ("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX")
112+
add_definitions ("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX /bigobj")
113113
if("${CMAKE_CXX_FLAGS}" STREQUAL "")
114114
SET(CMAKE_CXX_FLAGS "/bigobj /EHsc /fp:precise /wd4800 /wd4521 /wd4251 /wd4275 /wd4305 /wd4355 ${SSE_FLAGS}")
115115

apps/cloud_composer/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ if(build)
185185
set (SAN_HEADERS include/pcl/apps/${SUBSYS_NAME}/tools/sanitize_cloud.h)
186186
define_composer_tool (sanitize_cloud "${SAN_SOURCES}" "${SAN_HEADERS}" "${SAN_DEPS}")
187187

188-
#Voxel SuperPixels
188+
#Supervoxels
189189
set (VSP_DEPS pcl_octree pcl_segmentation)
190-
set (VSP_SOURCES tools/voxel_superpixels.cpp include/pcl/apps/${SUBSYS_NAME}/tools/impl/voxel_superpixels.hpp)
191-
set (VSP_HEADERS include/pcl/apps/${SUBSYS_NAME}/tools/voxel_superpixels.h)
192-
define_composer_tool (voxel_superpixels "${VSP_SOURCES}" "${VSP_HEADERS}" "${VSP_DEPS}")
190+
set (VSP_SOURCES tools/supervoxels.cpp include/pcl/apps/${SUBSYS_NAME}/tools/impl/supervoxels.hpp)
191+
set (VSP_HEADERS include/pcl/apps/${SUBSYS_NAME}/tools/supervoxels.h)
192+
define_composer_tool (supervoxels "${VSP_SOURCES}" "${VSP_HEADERS}" "${VSP_DEPS}")
193193

194194
endif () #VTK_FOUND AND QT4_FOUND AND VTK_USE_QVTK
195195

apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/voxel_superpixels.hpp renamed to apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@
3535
*
3636
*/
3737

38-
#ifndef IMPL_VOXEL_SUPERPIXELS_HPP_
39-
#define IMPL_VOXEL_SUPERPIXELS_HPP_
38+
#ifndef IMPL_SUPERVOXELS_HPP_
39+
#define IMPL_SUPERVOXELS_HPP_
4040

41-
#include <pcl/apps/cloud_composer/tools/voxel_superpixels.h>
41+
#include <pcl/apps/cloud_composer/tools/supervoxels.h>
4242
#include <pcl/apps/cloud_composer/impl/cloud_item.hpp>
4343
#include <pcl/apps/cloud_composer/items/normals_item.h>
4444
#include <pcl/point_cloud.h>
45-
#include <pcl/segmentation/supervoxels.h>
45+
#include <pcl/segmentation/supervoxel_clustering.h>
4646

4747

4848
template <typename PointT> QList <pcl::cloud_composer::CloudComposerItem*>
49-
pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction (QList <const CloudComposerItem*> input_data)
49+
pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList <const CloudComposerItem*> input_data)
5050
{
5151
QList <CloudComposerItem*> output;
5252

5353
foreach (const CloudComposerItem* input_item, input_data)
5454
{
5555
// if ( !input_item->isSanitized () )
5656
// {
57-
// qCritical () << "VoxelSuperpixelsTool requires sanitized input!";
57+
// qCritical () << "SupervoxelsTool requires sanitized input!";
5858
// return output;
5959
// }
6060
QVariant variant = input_item->data (ItemDataRole::CLOUD_TEMPLATED);
@@ -83,63 +83,23 @@ pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction (QList <const
8383
float normal_weight = parameter_model_->getProperty("Normals Weight").toFloat ();
8484
float spatial_weight = parameter_model_->getProperty("Spatial Weight").toFloat ();
8585

86-
pcl::SuperVoxels<PointT> super (resolution, seed_resolution);
86+
87+
pcl::SupervoxelClustering<PointT> super (resolution, seed_resolution);
8788
super.setInputCloud (input_cloud);
8889
super.setColorImportance (rgb_weight);
8990
super.setSpatialImportance (spatial_weight);
9091
super.setNormalImportance (normal_weight);
91-
pcl::PointCloud<pcl::PointSuperVoxel>::Ptr supervoxel_cloud;
92-
super.extract (supervoxel_cloud);
93-
94-
95-
96-
typename pcl::PointCloud<PointXYZRGB>::Ptr color_segments;
97-
color_segments = super.getColoredVoxelCloud ();
98-
99-
typename pcl::PointCloud<pcl::PointXYZL>::Ptr label_cloud;
100-
label_cloud = super.getLabeledVoxelCloud ();
92+
std::map <uint32_t, typename pcl::Supervoxel<PointT>::Ptr > supervoxel_clusters;
93+
super.extract (supervoxel_clusters);
10194

102-
std::map<uint32_t, PointSuperVoxel> label_centers;
103-
super.getSuperVoxelCenters (label_centers);
104-
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);
105-
std::map<uint32_t, PointSuperVoxel>::iterator itr_centers = label_centers.begin ();
106-
107-
typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, pcl::PointSuperVoxel, pcl::octree::EdgeProperties> VoxelAdjacencyList;
108-
typedef boost::graph_traits<VoxelAdjacencyList>::vertex_iterator VertexIterator;
109-
VoxelAdjacencyList supervoxel_adjacency_list;
110-
super.getSuperVoxelAdjacencyList (supervoxel_adjacency_list);
111-
//The vertices in the supervoxel adjacency list are the supervoxel centroids
112-
std::pair<VertexIterator, VertexIterator> vertex_iterator_range;
113-
vertex_iterator_range = boost::vertices(supervoxel_adjacency_list);
114-
for (VertexIterator itr=vertex_iterator_range.first ; itr != vertex_iterator_range.second; ++itr)
115-
{
116-
PointSuperVoxel label_centroid = supervoxel_adjacency_list[*itr];
117-
std::cout << label_centroid<<std::endl;
118-
}
119-
120-
for (; itr_centers != label_centers.end () ; ++itr_centers)
121-
std::cout << itr_centers->second<<std::endl;
122-
for (int i = 0; i < label_cloud->points.size (); ++i)
123-
{
124-
pcl::PointXYZL point = label_cloud->points[i];
125-
pcl::PointSuperVoxel super_center = label_centers[point.label];
126-
127-
pcl::Normal normal_point;
128-
//point.normal = itr_centers->second.normal;
129-
normal_point.normal_x = super_center.normal_x;
130-
normal_point.normal_y = super_center.normal_y;
131-
normal_point.normal_z = super_center.normal_z;
132-
normal_point.curvature = super_center.curvature;
133-
// std::cout << point.x <<" "<< point.y <<" "<< point.z <<" "<< point.label<<"\n";
134-
// std::cout << super_center<< std::endl;
135-
// std::cout << normal_point<<std::endl<<std::endl;
136-
cloud_normals->points.push_back (normal_point);
137-
}
138-
CloudItem* cloud_item_out = CloudItem::createCloudItemFromTemplate<PointXYZRGB>(input_item->text(),color_segments);
95+
std::map <uint32_t, typename pcl::Supervoxel<PointT>::Ptr > refined_supervoxel_clusters;
96+
super.refineSupervoxels (3, refined_supervoxel_clusters);
97+
98+
typename pcl::PointCloud<PointXYZRGBA>::Ptr color_segments;
99+
color_segments= super.getColoredVoxelCloud ();
139100

140-
NormalsItem* normals_item = new NormalsItem (tr("Normals r=%1").arg(0.03),cloud_normals,0.03);
141-
142-
cloud_item_out->addChild (normals_item);
101+
CloudItem* cloud_item_out = CloudItem::createCloudItemFromTemplate<PointXYZRGBA>(input_item->text(),color_segments);
102+
143103

144104
output.append (cloud_item_out);
145105

@@ -155,8 +115,8 @@ pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction (QList <const
155115

156116

157117

158-
#define PCL_INSTANTIATE_performTemplatedAction(T) template PCL_EXPORTS void pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction<T> (QList <const CloudComposerItem*>);
118+
#define PCL_INSTANTIATE_performTemplatedAction(T) template PCL_EXPORTS void pcl::cloud_composer::SupervoxelsTool::performTemplatedAction<T> (QList <const CloudComposerItem*>);
159119

160120

161121

162-
#endif //IMPL_VOXEL_SUPERPIXELS_HPP_
122+
#endif //IMPL_SUPERVOXELS_HPP_

apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_superpixels.h renamed to apps/cloud_composer/include/pcl/apps/cloud_composer/tools/supervoxels.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
*
3636
*/
3737

38-
#ifndef VOXEL_SUPERPIXELS_H_
39-
#define VOXEL_SUPERPIXELS_H_
38+
#ifndef SUPERVOXELS_H_
39+
#define SUPERVOXELS_H_
4040

4141
#include <pcl/apps/cloud_composer/tool_interface/abstract_tool.h>
4242
#include <pcl/apps/cloud_composer/tool_interface/tool_factory.h>
@@ -46,12 +46,12 @@
4646
{
4747
namespace cloud_composer
4848
{
49-
class VoxelSuperpixelsTool : public SplitItemTool
49+
class SupervoxelsTool : public SplitItemTool
5050
{
5151
Q_OBJECT
5252
public:
53-
VoxelSuperpixelsTool (PropertiesModel* parameter_model, QObject* parent);
54-
virtual ~VoxelSuperpixelsTool ();
53+
SupervoxelsTool (PropertiesModel* parameter_model, QObject* parent);
54+
virtual ~SupervoxelsTool ();
5555

5656
virtual QList <CloudComposerItem*>
5757
performAction (QList <const CloudComposerItem*> input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE);
@@ -66,28 +66,28 @@
6666
};
6767

6868

69-
class VoxelSuperpixelsToolFactory : public QObject, public ToolFactory
69+
class SupervoxelsToolFactory : public QObject, public ToolFactory
7070
{
7171
Q_OBJECT
7272
Q_INTERFACES (pcl::cloud_composer::ToolFactory)
7373
public:
7474
SplitItemTool*
7575
createTool (PropertiesModel* parameter_model, QObject* parent = 0)
7676
{
77-
return new VoxelSuperpixelsTool(parameter_model, parent);
77+
return new SupervoxelsTool(parameter_model, parent);
7878
}
7979

8080
PropertiesModel*
8181
createToolParameterModel (QObject* parent);
8282

8383
inline virtual QString
84-
getPluginName () const { return "Voxel Superpixels";}
84+
getPluginName () const { return "Supervoxels";}
8585

8686
inline virtual QString
8787
getToolGroupName () const { return "Segmentation";}
8888

8989
inline virtual QString
90-
getIconName () const { return ":/voxel_superpixels.png"; }
90+
getIconName () const { return ":/supervoxels.png"; }
9191

9292
inline virtual CloudComposerItem::ItemType
9393
getInputItemType () const
@@ -113,4 +113,4 @@
113113

114114

115115

116-
#endif //VOXEL_SUPERPIXELS_H_
116+
#endif //SUPERVOXELS_H_
Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
#include <pcl/apps/cloud_composer/tools/voxel_superpixels.h>
1+
#include <pcl/apps/cloud_composer/tools/supervoxels.h>
22
#include <pcl/apps/cloud_composer/items/cloud_item.h>
3-
4-
#include <pcl/point_types.h>
53
#include <pcl/filters/extract_indices.h>
64
#include <pcl/kdtree/kdtree.h>
5+
#include <pcl/point_types.h>
76
#include <pcl/segmentation/extract_clusters.h>
87

8+
#include <pcl/apps/cloud_composer/tools/impl/supervoxels.hpp>
99

10-
#include <pcl/apps/cloud_composer/tools/impl/voxel_superpixels.hpp>
10+
Q_EXPORT_PLUGIN2(cloud_composer_voxel_superpixels_tool, pcl::cloud_composer::SupervoxelsToolFactory)
1111

12-
Q_EXPORT_PLUGIN2(cloud_composer_voxel_superpixels_tool, pcl::cloud_composer::VoxelSuperpixelsToolFactory)
13-
14-
pcl::cloud_composer::VoxelSuperpixelsTool::VoxelSuperpixelsTool (PropertiesModel* parameter_model, QObject* parent)
12+
pcl::cloud_composer::SupervoxelsTool::SupervoxelsTool (PropertiesModel* parameter_model, QObject* parent)
1513
: SplitItemTool (parameter_model, parent)
1614
{
1715

1816
}
1917

20-
pcl::cloud_composer::VoxelSuperpixelsTool::~VoxelSuperpixelsTool ()
18+
pcl::cloud_composer::SupervoxelsTool::~SupervoxelsTool ()
2119
{
2220

2321
}
2422

2523
QList <pcl::cloud_composer::CloudComposerItem*>
26-
pcl::cloud_composer::VoxelSuperpixelsTool::performAction (ConstItemList input_data, PointTypeFlags::PointType type)
24+
pcl::cloud_composer::SupervoxelsTool::performAction (ConstItemList input_data, PointTypeFlags::PointType type)
2725
{
2826
if (type != PointTypeFlags::NONE)
2927
{
@@ -38,18 +36,18 @@ pcl::cloud_composer::VoxelSuperpixelsTool::performAction (ConstItemList input_da
3836

3937
QList <CloudComposerItem*> output;
4038

41-
qCritical () << "voxel_superpixels requires templated types!";
39+
qCritical () << "supervoxels requires templated types!";
4240

4341
return output;
4442
}
4543

46-
template QList <pcl::cloud_composer::CloudComposerItem*> pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction <pcl::PointXYZRGB> (QList <const CloudComposerItem*>);
47-
//template QList <pcl::cloud_composer::CloudComposerItem*> pcl::cloud_composer::VoxelSuperpixelsTool::performTemplatedAction <pcl::PointXYZRGBA> (QList <const CloudComposerItem*>);
44+
template QList <pcl::cloud_composer::CloudComposerItem*> pcl::cloud_composer::SupervoxelsTool::performTemplatedAction <pcl::PointXYZRGB> (QList <const CloudComposerItem*>);
45+
//template QList <pcl::cloud_composer::CloudComposerItem*> pcl::cloud_composer::SupervoxelsTool::performTemplatedAction <pcl::PointXYZRGBA> (QList <const CloudComposerItem*>);
4846

4947

5048
/////////////////// PARAMETER MODEL /////////////////////////////////
5149
pcl::cloud_composer::PropertiesModel*
52-
pcl::cloud_composer::VoxelSuperpixelsToolFactory::createToolParameterModel (QObject* parent)
50+
pcl::cloud_composer::SupervoxelsToolFactory::createToolParameterModel (QObject* parent)
5351
{
5452
PropertiesModel* parameter_model = new PropertiesModel(parent);
5553

@@ -58,12 +56,6 @@ pcl::cloud_composer::VoxelSuperpixelsToolFactory::createToolParameterModel (QObj
5856
parameter_model->addProperty ("RGB Weight", 0.2, Qt::ItemIsEditable | Qt::ItemIsEnabled);
5957
parameter_model->addProperty ("Normals Weight", 0.8, Qt::ItemIsEditable | Qt::ItemIsEnabled);
6058
parameter_model->addProperty ("Spatial Weight", 0.4, Qt::ItemIsEditable | Qt::ItemIsEnabled);
61-
//parameter_model->addProperty ("Min Plane Size", 10000, Qt::ItemIsEditable | Qt::ItemIsEnabled);
62-
//parameter_model->addProperty ("Angular Threshold", 2.0, Qt::ItemIsEditable | Qt::ItemIsEnabled);
63-
//parameter_model->addProperty ("Distance Threshold", 0.02, Qt::ItemIsEditable | Qt::ItemIsEnabled);
64-
//parameter_model->addProperty ("Cluster Dist. Thresh.", 0.01, Qt::ItemIsEditable | Qt::ItemIsEnabled);
65-
//parameter_model->addProperty ("Min Cluster Size", 1000, Qt::ItemIsEditable | Qt::ItemIsEnabled);
66-
6759

6860
return parameter_model;
6961
}

common/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ if(build)
6868
include/pcl/Vertices.h
6969
include/pcl/PointIndices.h
7070
include/pcl/sse.h
71+
include/pcl/PCLPointField.h
72+
include/pcl/PCLPointCloud2.h
73+
include/pcl/PCLImage.h
74+
include/pcl/PCLHeader.h
75+
include/pcl/ModelCoefficients.h
76+
include/pcl/PolygonMesh.h
77+
include/pcl/Vertices.h
78+
include/pcl/PointIndices.h
79+
include/pcl/register_point_struct.h
80+
include/pcl/conversions.h
7181
)
7282

7383
set(common_incs

common/include/pcl/common/common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ namespace pcl
160160
template <typename PointT> inline void
161161
getMinMax (const PointT &histogram, int len, float &min_p, float &max_p);
162162

163+
/** \brief Calculate the area of a polygon given a point cloud that defines the polygon
164+
* \param polygon point cloud that contains those vertices that comprises the polygon. Vertices are stored in counterclockwise.
165+
* \return the polygon area
166+
* \ingroup common
167+
*/
168+
template<typename PointT> inline float
169+
calculatePolygonArea (const pcl::PointCloud<PointT> &polygon);
170+
163171
/** \brief Get the minimum and maximum values on a point histogram
164172
* \param cloud the cloud containing multi-dimensional histograms
165173
* \param idx point index representing the histogram that we need to compute min/max for

common/include/pcl/common/impl/common.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,5 +386,26 @@ pcl::getMinMax (const PointT &histogram, int len, float &min_p, float &max_p)
386386
}
387387
}
388388

389+
//////////////////////////////////////////////////////////////////////////////////////////////
390+
template <typename PointT> inline float
391+
pcl::calculatePolygonArea (const pcl::PointCloud<PointT> &polygon)
392+
{
393+
float area = 0.0f;
394+
int num_points = polygon.size ();
395+
int j = 0;
396+
Eigen::Vector3f va,vb,res;
397+
398+
res(0) = res(1) = res(2) = 0.0f;
399+
for (int i = 0; i < num_points; ++i)
400+
{
401+
j = (i + 1) % num_points;
402+
va = polygon[i].getVector3fMap ();
403+
vb = polygon[j].getVector3fMap ();
404+
res += va.cross (vb);
405+
}
406+
area = res.norm ();
407+
return (area*0.5);
408+
}
409+
389410
#endif //#ifndef PCL_COMMON_IMPL_H_
390411

doc/tutorials/content/building_pcl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ You should see something like the following on screen::
4040
BUILD_common ON
4141
BUILD_features ON
4242
BUILD_filters ON
43-
BUILD_global_tests ON
43+
BUILD_global_tests OFF
4444
BUILD_io ON
4545
BUILD_kdtree ON
4646
BUILD_keypoints ON

doc/tutorials/content/conditional_removal.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Removing outliers using a ConditionalRemoval filter
44
---------------------------------------------------
55

6-
This document demonstrates how to use the ConditionalRemoval filter to remove points from a PointCloud that do no statisfy a specific or multiple conditions.
6+
This document demonstrates how to use the ConditionalRemoval filter to remove points from a PointCloud that do no satisfy a specific or multiple conditions.
77

88
The code
99
--------
@@ -25,7 +25,7 @@ In the following Lines, we define the PointCloud structures, fill in the input c
2525
:language: cpp
2626
:lines: 8-27
2727

28-
Then, we create the condition which a given point must satisfy so that it remains in our PointCloud. To do this we must add two comparisons to the conditon, greater than 0.0, and less than 0.8. This condition is then used to build the filter.
28+
Then, we create the condition which a given point must satisfy so that it remains in our PointCloud. To do this we must add two comparisons to the condition, greater than 0.0, and less than 0.8. This condition is then used to build the filter.
2929

3030
.. literalinclude:: sources/conditional_removal/conditional_removal.cpp
3131
:language: cpp
Loading
Loading
Loading
Loading
Loading
Loading
Loading

doc/tutorials/content/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,21 @@ Segmentation
928928

929929
.. |se_8| image:: images/don_segmentation.png
930930
:height: 100px
931+
932+
* :ref:`supervoxel_clustering`
933+
934+
====== ======
935+
|se_9| Title: **Supervoxel Clustering**
936+
937+
Author: *Jeremie Papon*
938+
939+
Compatibility: > PCL 1.7
940+
941+
In this tutorial, we show to break a pointcloud into the mid-level supervoxel representation.
942+
====== ======
943+
944+
.. |se_9| image:: images/supervoxel_clustering_small.png
945+
:height: 100px
931946

932947
.. _surface_tutorial:
933948

0 commit comments

Comments
 (0)