11 #include <QApplication>
13 #include <QElapsedTimer>
14 #include <QMainWindow>
15 #include <QProgressDialog>
48 m_action->setEnabled(selectedEntities.size() == 1 &&
94 }
catch (
const std::bad_alloc&) {
99 for (
unsigned i = 0; i <
count; i++) {
108 csfPC.push_back(tmpPoint);
112 static bool csf_postprocessing =
false;
115 static int csf_rigidness = 2;
117 static bool ExportClothMesh =
false;
122 csfDlg.postprocessingcheckbox->setChecked(csf_postprocessing);
123 csfDlg.rig1->setChecked(csf_rigidness == 1);
124 csfDlg.rig2->setChecked(csf_rigidness == 2);
125 csfDlg.rig3->setChecked(csf_rigidness == 3);
129 csfDlg.exportClothMeshCheckBox->setChecked(ExportClothMesh);
131 if (!csfDlg.exec()) {
136 csf_postprocessing = csfDlg.postprocessingcheckbox->isChecked();
137 if (csfDlg.rig1->isChecked())
139 else if (csfDlg.rig2->isChecked())
146 ExportClothMesh = csfDlg.exportClothMeshCheckBox->isChecked();
150 QProgressDialog pDlg;
151 pDlg.setWindowTitle(
"CSF");
152 pDlg.setLabelText(tr(
"Computing...."));
153 pDlg.setCancelButton(0);
155 QApplication::processEvents();
171 std::vector<int> groundIndexes, offGroundIndexes;
173 if (!csf.
do_filtering(groundIndexes, offGroundIndexes, ExportClothMesh,
181 tr(
"[CSF] %1% of points classified as ground points")
182 .arg((groundIndexes.size() * 100.0) /
count, 0,
'f', 2),
185 tr(
"[CSF] Timing: %1 s.").arg(
timer.elapsed() / 1000.0, 0,
'f', 1),
192 if (groundpc.
reserve(
static_cast<unsigned>(groundIndexes.size()))) {
193 for (
unsigned j = 0; j < groundIndexes.size(); ++j) {
201 tr(
"Failed to extract the ground subset (not enough memory)"),
210 static_cast<unsigned>(offGroundIndexes.size()))) {
211 for (
unsigned k = 0; k < offGroundIndexes.size(); ++k) {
217 if (!offgroundpoint) {
228 QApplication::processEvents();
237 groundpoint->
setName(tr(
"ground points"));
238 cloudContainer->
addChild(groundpoint);
241 if (offgroundpoint) {
243 offgroundpoint->
setName(tr(
"off-ground points"));
244 cloudContainer->
addChild(offgroundpoint);
250 cloudContainer->
addChild(clothMesh);
static double cloth_resolution
static double class_threshold
bool do_filtering(std::vector< int > &groundIndexes, std::vector< int > &offGroundIndexes, bool exportClothMesh, ccMesh *&clothMesh, ecvMainAppInterface *app=0, QWidget *parent=0)
virtual bool registerCommand(Command::Shared command)=0
Registers a new command.
virtual QString getName() const override
Returns (short) name (for menu entry, etc.)
virtual QString getDescription() const override
Returns long name/description (for tooltip, etc.)
virtual QIcon getIcon() const override
Returns icon.
virtual void setVisible(bool state)
Sets entity visibility.
void showNormals(bool state) override
Sets normals visibility.
Hierarchical CLOUDVIEWER Object.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
bool computePerVertexNormals()
Computes per-vertex normals.
virtual QString getName() const
Returns object name.
bool isA(CV_CLASS_ENUM type) const
virtual void setName(const QString &name)
Sets object name.
virtual void setEnabled(bool state)
Sets the "enabled" property.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
ccPointCloud * partialClone(const cloudViewer::ReferenceCloud *selection, int *warnings=nullptr, bool withChildEntities=true) const
Creates a new point cloud object from a ReferenceCloud (selection)
Standard ECV plugin interface.
ecvMainAppInterface * m_app
Main application interface.
unsigned size() const override
const CCVector3 * getPoint(unsigned index) const override
A very simple point cloud (no point duplication)
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
virtual bool reserve(unsigned n)
Reserves some memory for hosting the point references.
virtual QMainWindow * getMainWindow()=0
Returns main window.
virtual const ccHObject::Container & getSelectedEntities() const =0
Returns currently selected entities ("read only")
bool haveOneSelection() const
Checks if we have exactly one selection.
virtual void addToDB(ccHObject *obj, bool updateZoom=false, bool autoExpandDBTree=true, bool checkDimensions=false, bool autoRedraw=true)=0
virtual void dispToConsole(QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE)=0
void doAction()
Slot called when associated ation is triggered.
QAction * m_action
Associated action.
virtual QList< QAction * > getActions() override
Get a list of actions for this plugin.
virtual void onNewSelection(const ccHObject::Container &selectedEntities) override
qCSF(QObject *parent=nullptr)
Default constructor.
virtual void registerCommands(ccCommandLineInterface *cmd) override
Optional: registers commands (for the command line mode)
QSharedPointer< Command > Shared
Shared type.