Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 59342a9b rédigé par Ronan COLLIER's avatar Ronan COLLIER
Parcourir les fichiers

Merge branch 'improvements' into 'master'

Improvements

See merge request !9
parents 8a0afac7 95eb59f2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!9Improvements
......@@ -15,6 +15,7 @@ if ( PLUGIN_STANDARD_QCOLORIMETRIC_SEGMENTER )
${CMAKE_CURRENT_SOURCE_DIR}/qColorimetricSegmenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qColorimetricSegmenter.h
${CMAKE_CURRENT_SOURCE_DIR}/qColorimetricSegmenter.qrc
${CMAKE_CURRENT_SOURCE_DIR}/HSV.h
${CMAKE_CURRENT_SOURCE_DIR}/HSVDialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HSVDialog.h
${CMAKE_CURRENT_SOURCE_DIR}/HSVDialog.ui
......
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
//qCC_db
#include <ccColorTypes.h>
//! HSV color
struct Hsv
{
//! Default constrctor
Hsv()
: h(0)
, s(0)
, v(0)
{
}
//! Constrctor from a RGB color
Hsv(const ccColor::Rgb& rgb)
{
float r = rgb.r / 255.0f;
float g = rgb.g / 255.0f;
float b = rgb.b / 255.0f;
float maxComp = std::max(std::max(r, g), b);
float minComp = std::min(std::min(r, g), b);
float deltaComp = maxComp - minComp;
float hue = 0;
if (deltaComp != 0)
{
if (r == maxComp)
{
hue = (g - b) / deltaComp;
}
else
{
if (g == maxComp)
{
hue = 2 + (b - r) / deltaComp;
}
else
{
hue = 4 + (r - g) / deltaComp;
}
}
hue *= 60;
if (hue < 0)
hue += 360;
}
h = (static_cast<uint16_t>(hue) % 360);
s = static_cast<uint16_t>(maxComp == 0 ? 0 : (deltaComp / maxComp) * 100);
v = static_cast<uint16_t>(maxComp * 100);
}
// HSV components
uint16_t h, s, v;
};
......@@ -14,29 +14,20 @@
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include "HSVDialog.h"
//local
#include "mainwindow.h"
//Local
#include "HSV.h"
//Qt
#include <QVariant>
#include <QApplication>
#include <QClipboard>
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QSettings>
//common
//qCC
#include <ccPickingHub.h>
//qCC_db
#include <ccGenericPointCloud.h>
#include <ccPointCloud.h>
//qCC_gl
#include <ccGLWidget.h>
#include <ccGLWindow.h>
//Qt
#include <QCheckBox>
/*
Constructor
......@@ -44,7 +35,6 @@
HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent)
: QDialog(parent)
, Ui::HSVDialog()
, m_pickingWin(0)
, m_pickingHub(pickingHub)
{
assert(pickingHub);
......@@ -52,12 +42,11 @@ HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent)
setModal(false);
setupUi(this);
//restore semi-persistent parameters
red->setValue(0);
green->setValue(0);
blue->setValue(0);
//Link between Ui and actions
//link between Ui and actions
connect(pointPickingButton_first, &QCheckBox::toggled, this, &HSVDialog::pickPoint);
connect(red, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &HSVDialog::updateValues);
connect(green, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &HSVDialog::updateValues);
......@@ -66,7 +55,9 @@ HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent)
//auto disable picking mode on quit
connect(this, &QDialog::finished, [&]()
{
if (pointPickingButton_first->isChecked()) pointPickingButton_first->setChecked(false);
//if (pointPickingButton_first->isChecked()) pointPickingButton_first->setChecked(false);
if (m_pickingHub)
m_pickingHub->removeListener(this);
}
);
}
......@@ -80,6 +71,7 @@ void HSVDialog::pickPoint(bool state)
{
return;
}
if (state)
{
if (!m_pickingHub->addListener(this, true))
......@@ -92,9 +84,10 @@ void HSVDialog::pickPoint(bool state)
{
m_pickingHub->removeListener(this);
}
pointPickingButton_first->blockSignals(true);
pointPickingButton_first->setChecked(state);
pointPickingButton_first->blockSignals(false);
pointPickingButton_first->blockSignals(true);
pointPickingButton_first->setChecked(state);
pointPickingButton_first->blockSignals(false);
}
/*
......@@ -103,14 +96,14 @@ void HSVDialog::pickPoint(bool state)
void HSVDialog::onItemPicked(const PickedItem& pi)
{
assert(pi.entity);
m_pickingWin = m_pickingHub->activeWindow();
if (pi.entity->isKindOf(CC_TYPES::POINT_CLOUD))
{
//Get RGB values of the picked point
ccGenericPointCloud* cloud = static_cast<ccGenericPointCloud*>(pi.entity);
const ccColor::Rgb& rgb = cloud->getPointColor(pi.itemIndex);
if (pointPickingButton_first->isChecked()) {
const ccColor::Rgba& rgb = cloud->getPointColor(pi.itemIndex);
if (pointPickingButton_first->isChecked())
{
ccLog::Print("Point picked");
//blocking signals to avoid updating 2 times hsv values for nothing
......@@ -127,7 +120,6 @@ void HSVDialog::onItemPicked(const PickedItem& pi)
pointPickingButton_first->setChecked(false);
}
}
}
/*
......@@ -137,48 +129,8 @@ void HSVDialog::updateValues()
{
ccColor::Rgb rgb(red->value(), green->value(), blue->value());
hsv hsv_values = rgb2hsv(rgb);
Hsv hsv_values(rgb);
hue_first->setValue(hsv_values.h);
sat_first->setValue(hsv_values.s);
val_first->setValue(hsv_values.v);
}
/*
Method to convert from rgb values to hsv values
return : hsv struct
*/
hsv HSVDialog::rgb2hsv(ccColor::Rgb rgb) {
hsv res;
float r = rgb.r / 255.0f;
float g = rgb.g / 255.0f;
float b = rgb.b / 255.0f;
float max = std::max(std::max(r, g), b);
float min = std::min(std::min(r, g), b);
float delta = max - min;
res.v = max;
if (delta != 0) {
float hue;
if (r == max) {
hue = (g - b) / delta;
}
else {
if (g == max) {
hue = 2 + (b - r) / delta;
}
else {
hue = 4 + (r - g) / delta;
}
}
hue *= 60;
if (hue < 0) hue += 360;
res.h = hue;
}
else {
res.h = 0;
}
res.s = max == 0 ? 0 : ((max - min) / max) * 100;
res.v = max * 100;
return res;
}
\ No newline at end of file
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
......@@ -15,31 +17,14 @@
//# #
//##########################################################################
#ifndef HSVDialog_H
#define HSVDialog_H
#include <ui_HSVDialog.h>
#include "ccPickingListener.h"
#include <ccPickingListener.h>
//Qt
#include <ccHObject.h>
#include <QDialog>
#include <qcheckbox.h>
class ccGLWindow;
class ccPlane;
class ccHObject;
class ccPickingHub;
/*
Struct for HSV
*/
typedef struct {
double h;
double s;
double v;
} hsv;
/*
Get the values of the HSV interface, and interactions
*/
......@@ -47,26 +32,19 @@ class HSVDialog : public QDialog, public ccPickingListener, public Ui::HSVDialog
{
Q_OBJECT
public:
explicit HSVDialog(ccPickingHub* pickingHub, QWidget* parent = 0);
explicit HSVDialog(ccPickingHub* pickingHub, QWidget* parent = nullptr);
//! Inherited from ccPickingListener
virtual void onItemPicked(const PickedItem& pi);
hsv rgb2hsv(ccColor::Rgb rgb);
public slots:
void pickPoint(bool);
void updateValues();
protected: //members
//! Picking window (if any)
ccGLWindow* m_pickingWin;
//! Picking hub
ccPickingHub* m_pickingHub;
};
#endif // HSVDialog_H
......@@ -233,7 +233,7 @@
<string>Pick the plane center (click again to cancel)</string>
</property>
<property name="icon">
<iconset resource="../../../qCC/icones.qrc">
<iconset resource="../../../../qCC/icons.qrc">
<normaloff>:/CC/images/ccPointPicking.png</normaloff>:/CC/images/ccPointPicking.png</iconset>
</property>
<property name="checkable">
......@@ -314,7 +314,7 @@
</layout>
</widget>
<resources>
<include location="../../../qCC/icones.qrc"/>
<include location="../../../../qCC/icons.qrc"/>
</resources>
<connections>
<connection>
......
#include "KmeansDlg.h"
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include <QVariant>
KmeansDlg::KmeansDlg(QWidget* parent)
: QDialog(parent)
, Ui::KmeansDialog()
{
setupUi(this);
}
#ifndef KMEANSDIALOG_H
#define KMEANSDIALOG_H
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include <ui_KmeansDlg.h>
......@@ -9,10 +24,9 @@
class KmeansDlg : public QDialog, public Ui::KmeansDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit KmeansDlg(QWidget* parent = 0);
explicit KmeansDlg(QWidget* parent = nullptr);
};
#endif
\ No newline at end of file
......@@ -42,7 +42,10 @@
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
<number>65536</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
......@@ -66,7 +69,7 @@
<item>
<widget class="QLabel" name="label_It">
<property name="text">
<string>Number of iterations</string>
<string>Max number of iterations</string>
</property>
</widget>
</item>
......@@ -89,7 +92,10 @@
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
<number>1000</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
......
#include "QuantiDialog.h"
#include<cmath>
#include <QVariant>
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
QuantiDialog::QuantiDialog(QWidget* parent)
: QDialog(parent)
, Ui::QuantiDialog()
{
setupUi(this);
//connect(area_quanti, static_cast<void(QSpinBox::*)(double)>(&QSpinBox::valueChanged), this, SLOT(QuantiDialog::updateLabe()));
//connect(area_quanti, SIGNAL(valueChanged(int)), this, &QuantiDialog::updateLabelValue);
connect(area_quanti, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &QuantiDialog::updateLabelValues);
connect(area_quanti, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &QuantiDialog::updateLabelValues);
}
/*
Method applied after entering a value in RGB text fields
*/
void QuantiDialog::updateLabelValues()
{
nb_color_label->setText(QString::fromStdString(std::to_string(static_cast<int>(pow(area_quanti->value(), 3)))));
int value = area_quanti->value();
nb_color_label->setText(QString::number(value*value*value));
}
#ifndef QUANTIDIALOG_H
#define QUANTIDIALOG_H
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include <ui_QuantiDialog.h>
......@@ -11,10 +26,9 @@ class QuantiDialog : public QDialog, public Ui::QuantiDialog
{
Q_OBJECT
public:
explicit QuantiDialog(QWidget* parent = 0);
explicit QuantiDialog(QWidget* parent = nullptr);
public slots:
void updateLabelValues();
};
#endif
\ No newline at end of file
......@@ -40,15 +40,15 @@
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="area_quanti">
<property name="decimals">
<number>0</number>
</property>
<widget class="QSpinBox" name="area_quanti">
<property name="minimum">
<double>1.000000000000000</double>
<number>1</number>
</property>
<property name="maximum">
<double>255.000000000000000</double>
<number>1000</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
......
......@@ -14,37 +14,27 @@
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include "RgbDialog.h"
//local
#include "mainwindow.h"
//Qt
#include <QVariant>
#include <QApplication>
#include <QClipboard>
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QSettings>
#include "RgbDialog.h"
//common
#include <ccPickingHub.h>
#include <ccGenericPointCloud.h>
#include <ccPointCloud.h>
//qCC_gl
#include <ccGLWidget.h>
#include <ccGLWindow.h>
//Qt
#include <QCheckBox>
/*
Constructor
*/
RgbDialog::RgbDialog(ccPickingHub* pickingHub, QWidget* parent)
: QDialog(parent)
, Ui::RgbDialog()
, m_pickingWin(0)
, m_pickingWin(nullptr)
, m_pickingHub(pickingHub)
{
assert(pickingHub);
......@@ -55,8 +45,7 @@ RgbDialog::RgbDialog(ccPickingHub* pickingHub, QWidget* parent)
//Link between Ui and actions
connect(pointPickingButton_first, &QCheckBox::toggled, this, &RgbDialog::pickPoint_first);
connect(pointPickingButton_second, &QCheckBox::toggled, this, &RgbDialog::pickPoint_second);
//auto disable picking mode on quit
connect(this, &QDialog::finished, [&]()
{
......@@ -155,4 +144,4 @@ void RgbDialog::onItemPicked(const PickedItem& pi)
}
}
}
\ No newline at end of file
}
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
......@@ -15,22 +17,14 @@
//# #
//##########################################################################
#ifndef RgbDialog_H
#define RgbDialog_H
#include <ui_RgbDialog.h>
#include "ccPickingListener.h"
//Qt
#include <ccHObject.h>
#include <QDialog>
#include <qcheckbox.h>
class ccGLWindow;
class ccPlane;
class ccHObject;
class ccPickingHub;
class ccGLWindow;
/*
Get the values of the RGB interface, and interactions
*/
......@@ -38,7 +32,7 @@ class RgbDialog : public QDialog, public ccPickingListener, public Ui::RgbDialog
{
Q_OBJECT
public:
explicit RgbDialog(ccPickingHub* pickingHub, QWidget* parent = 0);
explicit RgbDialog(ccPickingHub* pickingHub, QWidget* parent = nullptr);
//! Inherited from ccPickingListener
virtual void onItemPicked(const PickedItem& pi);
......@@ -54,9 +48,4 @@ protected: //members
//! Picking hub
ccPickingHub* m_pickingHub;
private:
static const int NULL_VALUE = 0;
};
#endif // RgbDialog_H
......@@ -55,7 +55,7 @@
<string>Pick the plane center (click again to cancel)</string>
</property>
<property name="icon">
<iconset resource="../../../qCC/icones.qrc">
<iconset resource="../../../../qCC/icons.qrc">
<normaloff>:/CC/images/ccPointPicking.png</normaloff>:/CC/images/ccPointPicking.png</iconset>
</property>
<property name="checkable">
......@@ -216,7 +216,7 @@
<string>Pick the plane center (click again to cancel)</string>
</property>
<property name="icon">
<iconset resource="../../../qCC/icones.qrc">
<iconset resource="../../../../qCC/icons.qrc">
<normaloff>:/CC/images/ccPointPicking.png</normaloff>:/CC/images/ccPointPicking.png</iconset>
</property>
<property name="checkable">
......@@ -439,7 +439,7 @@
</layout>
</widget>
<resources>
<include location="../../../qCC/icones.qrc"/>
<include location="../../../../qCC/icons.qrc"/>
</resources>
<connections>
<connection>
......
......@@ -14,30 +14,20 @@
//# COPYRIGHT: Tri-Thien TRUONG, Ronan COLLIER, Mathieu LETRONE #
//# #
//##########################################################################
#include "ScalarDialog.h"
//local
#include "mainwindow.h"
//Qt
#include <QVariant>
#include <QApplication>
#include <QClipboard>
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QSettings>
#include "ScalarDialog.h"
//common
#include <ccPickingHub.h>
#include <ccGenericPointCloud.h>
#include <ccPointCloud.h>
//qCC_gl
#include <ccGLWidget.h>
#include <ccGLWindow.h>
//Qt
#include <QCheckBox>
/*
Constructor
*/
......
#pragma once
//##########################################################################
//# #
//# CLOUDCOMPARE PLUGIN: ColorimetricSegmenter #
......@@ -15,20 +17,13 @@
//# #
//##########################################################################
#ifndef ScalarDialog_H
#define ScalarDialog_H
#include <ui_ScalarDialog.h>
#include "ccPickingListener.h"
//Qt
#include <ccHObject.h>
#include <QDialog>
#include <qcheckbox.h>
class ccGLWindow;
class ccPlane;
class ccHObject;
class ccPickingHub;
/*
......@@ -38,7 +33,7 @@ class ScalarDialog : public QDialog, public ccPickingListener, public Ui::Scalar
{
Q_OBJECT
public:
explicit ScalarDialog(ccPickingHub* pickingHub, QWidget* parent = 0);
explicit ScalarDialog(ccPickingHub* pickingHub, QWidget* parent = nullptr);
//! Inherited from ccPickingListener
virtual void onItemPicked(const PickedItem& pi);
......@@ -54,9 +49,4 @@ protected: //members
//! Picking hub
ccPickingHub* m_pickingHub;
private:
static const int NULL_VALUE = 0;
};
#endif // ScalarDialog_H
Ce diff est replié.
......@@ -18,24 +18,15 @@
//##########################################################################
#include "ccStdPluginInterface.h"
#include "ccPointCloud.h"
#include <QObject>
#include <QtGui>
#include <ccPickingListener.h>
#include <ccPickingHub.h>
#include <ccGLWindow.h>
#include "ccPointCloud.h"
#include "ccScalarField.h"
//CCCoreLib
#include <ReferenceCloud.h>
#include "RgbDialog.h"
#include "HSVDialog.h"
#include "ScalarDialog.h"
#include "QuantiDialog.h"
#include "KmeansDlg.h"
//Qt
#include <QObject>
#include <QtGui>
const int MIN_VALUE = 0;
const int MAX_VALUE = 255;
class ccPointCloud;
class ColorimetricSegmenter : public QObject, public ccStdPluginInterface
{
......@@ -51,27 +42,6 @@ public:
void onNewSelection(const ccHObject::Container& selectedEntities) override;
QList<QAction*> getActions() override;
public slots:
//! Handles new entity
void handleNewEntity(ccHObject*);
//! Handles entity (visual) modification
void handleEntityChange(ccHObject*);
//! Handles new error message
void handleErrorMessage(QString);
signals:
//! Signal emitted when an entity is (visually) modified
void entityHasChanged(ccHObject*);
//! Signal emitted when a new entity is created by the filter
void newEntity(ccHObject*);
//! Signal emitted when a new error message is produced
void newErrorMessage(QString);
private:
std::vector<ccPointCloud*> getSelectedPointClouds();
......@@ -86,33 +56,46 @@ private:
void KmeansClustering();
void addPoint(CCCoreLib::ReferenceCloud* filteredCloud, unsigned int j);
bool addPoint(CCCoreLib::ReferenceCloud& filteredCloud, unsigned int j);
template <typename T>
void createClouds(T& dlg, ccPointCloud* cloud, CCCoreLib::ReferenceCloud* filteredCloudInside, CCCoreLib::ReferenceCloud* filteredCloudOutside, std::string name);
void createCloud(ccPointCloud* cloud, CCCoreLib::ReferenceCloud* referenceCloud, std::string name, bool inside);
void createClouds( T& dlg,
ccPointCloud* cloud,
const CCCoreLib::ReferenceCloud& filteredCloudInside,
const CCCoreLib::ReferenceCloud& filteredCloudOutside,
QString name);
//picked point callbacks
//void pointPicked(ccHObject* entity, unsigned itemIdx, int x, int y, const CCVector3& P);
//virtual void onItemPicked(const ccPickingListener::PickedItem& pi); //inherited from ccPickingListener
void createCloud( ccPointCloud* cloud,
const CCCoreLib::ReferenceCloud& referenceCloud,
QString name);
//! Segment a cloud with RGB color
void filterRgbWithSegmentation();
//! Region (shared)
typedef QSharedPointer<CCCoreLib::ReferenceCloud> Region;
//! Region set
typedef std::vector<Region> RegionSet;
/**
* @brief regionGrowing Segmentation method grouping the points into regions of similar colors.
* @brief Segmentation method grouping the points into regions of similar colors.
* Method described in Qingming Zhan, Yubin Liang, Yinghui Xiao, 2009 "Color-based segmentation of point clouds".
* @param regions output regions
* @param pointCloud The point cloud to segment.
* @param TNN Point-point colorimetrical similarity threshold.
* @param TPP Number of neighbours to search using KNN.
* @param TD Threshold distance between neighbouring points.
* @return Vector containing the resulting regions.
* @return success.
*/
std::vector<CCCoreLib::ReferenceCloud*>* regionGrowing(ccPointCloud* pointCloud, const unsigned TNN, const double TPP, const double TD);
static bool RegionGrowing( RegionSet& regions,
ccPointCloud* pointCloud,
const unsigned TNN,
const double TPP,
const double TD);
/**
* @brief regionMergingAndRefinement Merge previously created regions in 'regionGrowing' method.
* @brief Merge previously created regions in 'regionGrowing' method.
* @param mergedRegions refined and merged regions
* @param basePointCloud The base segmented point cloud used to create the regions.
* @param regions Vector containing the regions.
* @param TNN Point-point colorimetrical similarity threshold.
......@@ -121,39 +104,23 @@ private:
* @param Min Minimal size for a region.
* @return Vector containing the resulting merged and refined regions.
*/
std::vector<CCCoreLib::ReferenceCloud*>* regionMergingAndRefinement(ccPointCloud* basePointCloud, std::vector<CCCoreLib::ReferenceCloud*>* regions, const unsigned TNN, const double TRR, const double TD, const unsigned Min);
static bool RegionMergingAndRefinement( RegionSet& mergedRegions,
ccPointCloud* basePointCloud,
const RegionSet& regions,
const unsigned TNN,
const double TRR,
const double TD,
const unsigned Min);
private: //members
//! Default action
/** You can add as many actions as you want in a plugin.
Each action will correspond to an icon in the dedicated
toolbar and an entry in the plugin menu.
**/
QAction* m_action_filterRgb;
//QAction* m_action_filterRgbWithSegmentation;
QAction* m_action_filterHSV;
QAction* m_action_filterScalar;
QAction* m_action_ToonMapping_Hist;
QAction* m_action_ToonMapping_KMeans;
//! Picking hub
ccPickingHub* m_pickingHub = nullptr;
RgbDialog* rgbDlg;
HSVDialog* hsvDlg;
ScalarDialog* scalarDlg;
QuantiDialog* quantiDlg;
KmeansDlg* kmeansDlg;
//link to application windows
//ccGLWindow* m_window;
//QMainWindow* m_main_window;
QAction* m_action_histogramClustering;
QAction* m_action_kMeansClustering;
const unsigned TNN = 1;
const double TPP = 2.0;
const double TD = 2.0;
const double TRR = 2.0;
const unsigned Min = 2;
//! Error state after the last call to addPoint
bool m_addPointError;
};
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter