 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
35 if (cmd.
clouds().size() < 1) {
36 cmd.
error(
"No cloud loaded (1 is expected)");
47 }
catch (
const std::bad_alloc&) {
48 return cmd.
error(
"Not enough memory!");
51 for (
unsigned i = 0; i <
count; i++) {
57 csfPC.push_back(tmpPoint);
61 bool csfPostprocessing =
false;
62 double clothResolution = 2;
63 double classThreshold = 0.5;
65 int maxIteration = 500;
66 bool exportGround =
false;
67 bool exportOffground =
false;
70 const QString& ARGUMENT = cmd.
arguments().front();
75 QString scene = cmd.
arguments().takeFirst();
77 cmd.
print(
"Set scene to steep slope");
80 cmd.
print(
"Set scene to relief");
83 cmd.
print(
"Set scene to flat");
86 cmd.
error(
"Unknown scene parameter. Defaulting to relief");
92 cmd.
print(
"Slope processing turned on");
93 csfPostprocessing =
true;
98 clothResolution = cmd.
arguments().takeFirst().toDouble(&conv);
102 "Invalid parameter: value after \"-%1\"")
105 cmd.
print(QString(
"Custom cloth resulution set: %1")
106 .arg(clothResolution));
111 maxIteration = cmd.
arguments().takeFirst().toInt(&conv);
115 "Invalid parameter: value after \"-%1\"")
118 cmd.
print(QString(
"Custom max iteration set: %")
124 classThreshold = cmd.
arguments().takeFirst().toDouble(&conv);
128 "Invalid parameter: value after \"-%1\"")
131 cmd.
print(QString(
"Custom class threshold set: %1")
132 .arg(classThreshold));
136 cmd.
print(
"Ground will be exported");
141 cmd.
print(
"Off-ground will be exported");
142 exportOffground =
true;
144 cmd.
print(
"Set all parameters");
161 std::vector<int> groundIndexes;
162 std::vector<int> offGroundIndexes;
163 ccMesh* clothMesh =
nullptr;
164 if (!csf.
do_filtering(groundIndexes, offGroundIndexes,
false, clothMesh,
166 return cmd.
error(
"Process failed");
169 cmd.
print(QString(
"[CSF] %1% of points classified as ground points")
170 .arg((groundIndexes.size() * 100.0) /
count, 0,
'f',
177 if (groundpc.
reserve(
static_cast<unsigned>(groundIndexes.size()))) {
178 for (
unsigned j = 0; j < groundIndexes.size(); ++j) {
186 "Failed to extract the ground subset (not enough memory)");
193 static_cast<unsigned>(offGroundIndexes.size()))) {
194 for (
unsigned k = 0; k < offGroundIndexes.size(); ++k) {
200 if (!offgroundpoint) {
202 "Failed to extract the off-ground subset (not enough "
209 QString baseName = cmd.
clouds()[0].basename;
215 baseName + QObject::tr(
"_ground_points"),
217 cmd.
clouds().push_back(groundDesc);
220 groundDesc, QString(),
nullptr,
222 if (!errorStr.isEmpty()) {
228 if (offgroundpoint) {
230 offgroundpoint, baseName + QObject::tr(
"_offground_points"),
232 cmd.
clouds().push_back(offgroundDesc);
233 if (exportOffground) {
235 offgroundDesc, QString(),
nullptr,
237 if (!errorStr.isEmpty()) {
float y
Definition: wlPointCloud.h:19
virtual bool reserve(unsigned n)
Reserves some memory for hosting the point references.
Definition: ReferenceCloud.cpp:51
Type x
Definition: CVGeom.h:137
static const char COMMAND_CSF_PROC_SLOPE[]
Definition: qCSFCommands.h:22
virtual std::vector< CLCloudDesc > & clouds()
Currently opened point clouds and their filename.
Definition: ecvCommandLineInterface.cpp:133
virtual QDialog * widgetParent()
Returns a (widget) parent (if any is available)
Definition: ecvCommandLineInterface.cpp:126
virtual bool error(const QString &message) const =0
const CCVector3 * getPoint(unsigned index) const override
Definition: PointCloudTpl.h:143
static const char COMMAND_CSF_CLASS_THRESHOLD[]
Definition: qCSFCommands.h:25
double cloth_resolution
Definition: CSF.h:56
int rigidness
Definition: CSF.h:58
unsigned size() const override
Definition: PointCloudTpl.h:38
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
static const char COMMAND_CSF_MAX_ITERATION[]
Definition: qCSFCommands.h:24
float z
Definition: wlPointCloud.h:20
static const char COMMAND_CSF[]
Definition: qCSFCommands.h:17
static const char COMMAND_CSF_EXPORT_OFFGROUND[]
Definition: qCSFCommands.h:27
double class_threshold
Definition: CSF.h:54
float x
Definition: wlPointCloud.h:18
Definition: qCSFCommands.h:29
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
Definition: ReferenceCloud.cpp:84
int k_nearest_points
Definition: CSF.h:48
static const char COMMAND_CSF_SCENE_SLOPE[]
Definition: qCSFCommands.h:19
Point type.
Definition: wlPointCloud.h:15
ccPointCloud * partialClone(const cloudViewer::ReferenceCloud *selection, int *warnings=nullptr, bool withChildEntities=true) const
Creates a new point cloud object from a ReferenceCloud (selection)
Definition: ecvPointCloud.cpp:290
static const char COMMAND_CSF_CLOTH_RESOLUTION[]
Definition: qCSFCommands.h:23
CommandCSF()
Definition: qCSFCommands.h:30
virtual void removeClouds(bool onlyLast=false)=0
Removes all clouds (or only the last one ;)
Generic command interface.
Definition: ecvCommandLineInterface.h:130
virtual QStringList & arguments()=0
Returns the list of arguments.
bool do_filtering(std::vector< int > &groundIndexes, std::vector< int > &offGroundIndexes, bool exportClothMesh, ccMesh *&clothMesh, ecvMainAppInterface *app=0, QWidget *parent=0)
Definition: CSF.cpp:73
virtual void print(const QString &message) const =0
double time_step
Definition: CSF.h:52
Type z
Definition: CVGeom.h:137
Definition: wlPointCloud.h:28
Command line interface.
Definition: ecvCommandLineInterface.h:112
Loaded cloud description.
Definition: ecvCommandLineInterface.h:68
static const char COMMAND_CSF_EXPORT_GROUND[]
Definition: qCSFCommands.h:26
int count
Definition: FileIOFactory.cpp:132
Command(const QString &name, const QString &keyword)
Default constructor.
Definition: ecvCommandLineInterface.cpp:225
static const char COMMAND_CSF_SCENE_FLAT[]
Definition: qCSFCommands.h:21
A very simple point cloud (no point duplication)
Definition: ReferenceCloud.h:29
virtual bool process(ccCommandLineInterface &cmd) override
Main process.
Definition: qCSFCommands.h:32
Triangular mesh.
Definition: ecvMesh.h:35
Type y
Definition: CVGeom.h:137
Parameters params
Definition: CSF.h:63
int iterations
Definition: CSF.h:60
static bool IsCommand(const QString &token, const char *command)
Test whether a command line token is a valid command keyword or not.
Definition: ecvCommandLineInterface.cpp:119
static const char COMMAND_CSF_SCENE[]
Definition: qCSFCommands.h:18
bool bSloopSmooth
Definition: CSF.h:50
virtual QString exportEntity(CLEntityDesc &entityDesc, const QString &suffix=QString(), QString *outputFilename=nullptr, ccCommandLineInterface::ExportOptions options=ExportOption::NoOptions)=0
Exports a cloud or a mesh.
static const char COMMAND_CSF_SCENE_RELIEF[]
Definition: qCSFCommands.h:20