11 #pragma warning(disable : 4996)
12 #pragma warning(disable : 4819)
20 #include <pcl/ModelCoefficients.h>
21 #include <pcl/PointIndices.h>
22 #include <pcl/Vertices.h>
31 std::vector<int>& b) {
33 sort(
a.begin(),
a.end());
34 sort(b.begin(), b.end());
35 set_intersection(
a.begin(),
a.end(), b.begin(), b.end(), back_inserter(c));
39 static std::vector<int>
UnionVector(std::vector<int>&
a, std::vector<int>& b) {
41 set_union(
a.begin(),
a.end(), b.begin(), b.end(), back_inserter(c));
45 static std::vector<int>
DiffVector(std::vector<int>
a, std::vector<int> b) {
47 sort(
a.begin(),
a.end());
48 sort(b.begin(), b.end());
49 set_difference(
a.begin(),
a.end(), b.begin(), b.end(), back_inserter(c));
54 if (col.
r <= 1 && col.
g <= 1 && col.
b <= 1) {
62 if (col.
r <= 1 && col.
g <= 1 && col.
b <= 1) {
70 const QString&
name =
"curve",
73 if (curve_sm->width * curve_sm->height == 0) {
93 int verticesCount = polyVertices->
size();
94 if (curvePoly->
reserve(verticesCount)) {
113 PCLCloud::Ptr sm_cloud,
117 bool randomColors =
true) {
129 out_cloud_cc->
showSF(
false);
132 QString cloudName = QString(
"%1 %2 (size=%3)")
135 .arg(out_cloud_cc->
size());
136 out_cloud_cc->
setName(cloudName);
150 const PointCloudT::ConstPtr xyzCloud,
151 const std::vector<pcl::PointIndices>& cluster_indices,
152 unsigned minPointsPerComponent,
161 :
"" + QString(
" [clusters]-"));
166 for (std::vector<pcl::PointIndices>::const_iterator it =
167 cluster_indices.begin();
168 it != cluster_indices.end(); ++it) {
170 for (std::vector<int>::const_iterator pit = it->indices.begin();
171 pit != it->indices.end(); ++pit)
172 cloud_cluster->points.push_back(xyzCloud->points[*pit]);
173 cloud_cluster->width =
174 static_cast<uint32_t
>(cloud_cluster->points.size());
175 cloud_cluster->height = 1;
176 cloud_cluster->is_dense =
true;
178 PCLCloud::Ptr sm_cloud(
new PCLCloud);
181 if (sm_cloud->height * sm_cloud->width == 0) {
200 const std::vector<std::vector<size_t>>& cluster_indices,
201 unsigned minPointsPerComponent,
214 for (
auto& cluster : cluster_indices) {
225 QString cloudName = QString(
"%1 %2 (size=%3)")
248 const PointCloudT::ConstPtr cloudRemained,
249 const std::vector<PointCloudT::Ptr>& cloudExtractions,
254 ccCloud ? ccCloud->
getName() :
"" + QString(
" [segmentation]-"));
260 PCLCloud::Ptr sm_cloud(
new PCLCloud);
262 if (sm_cloud->height * sm_cloud->width != 0) {
263 AddPointCloud(ecvGroup, sm_cloud, error,
"remaining", ccCloud,
271 for (std::vector<PointCloudT::Ptr>::const_iterator it =
272 cloudExtractions.begin();
273 it != cloudExtractions.end(); ++it) {
274 PCLCloud::Ptr sm_cloud(
new PCLCloud);
276 if (sm_cloud->height * sm_cloud->width == 0) {
pcl::PointCloud< PointT > PointCloudT
pcl::PCLPointCloud2 PCLCloud
virtual void setVisible(bool state)
Sets entity visibility.
virtual void setTempColor(const ecvColor::Rgb &col, bool autoActivate=true)
Sets current temporary (unique)
virtual void showColors(bool state)
Sets colors visibility.
virtual void showSF(bool state)
Sets active scalarfield visibility.
void setPointSize(unsigned size=0)
Sets point size.
Hierarchical CLOUDVIEWER Object.
unsigned getChildrenNumber() const
Returns the number of children.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
virtual QString getName() const
Returns object name.
virtual void setName(const QString &name)
Sets object name.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
static ccPointCloud * From(const cloudViewer::GenericIndexedCloud *cloud, const ccGenericPointCloud *sourceCloud=nullptr)
Creates a new point cloud object from a GenericIndexedCloud.
bool setRGBColor(ColorCompType r, ColorCompType g, ColorCompType b)
Set a unique color for the whole cloud (shortcut)
void setColor(const ecvColor::Rgb &col)
Sets the polyline color.
virtual void setGlobalShift(double x, double y, double z)
Sets shift applied to original coordinates (information storage only)
virtual void setGlobalScale(double scale)
unsigned size() const override
void setClosed(bool state)
Sets whether the polyline is closed or not.
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
virtual bool reserve(unsigned n)
Reserves some memory for hosting the point references.
static Rgb Random(bool lightOnly=true)
Generates a random color.
static ccMesh * Convert(PCLTextureMesh::ConstPtr textureMesh)
Converts a PCL point cloud to a ccPointCloud.
constexpr Rgb red(MAX, 0, 0)
RgbTpl< float > Rgbf
3 components, float type
constexpr Rgb green(0, MAX, 0)