23 #include <QMainWindow>
32 tr(
"Min Cut Segmentation"),
33 tr(
"Min Cut Segmentation from clouds"),
34 ":/toolbar/PclAlgorithms/icons/mincut.png")),
37 m_neighboursNumber(14),
39 m_backWeightRadius(3.0f),
40 m_foregroundWeight(0.8f),
53 if (have_cloud != 1)
return -11;
78 m_cx =
static_cast<float>(
m_dialog->cxAxisDoubleSpinBox->value());
79 m_cy =
static_cast<float>(
m_dialog->cyAxisDoubleSpinBox->value());
80 m_cz =
static_cast<float>(
m_dialog->czAxisDoubleSpinBox->value());
85 static_cast<float>(
m_dialog->backWeightRadiusSpinbox->value());
87 static_cast<float>(
m_dialog->foreWeightSpinbox->value());
94 if (!cloud)
return -1;
97 if (!sm_cloud)
return -1;
100 std::vector<pcl::PointIndices> clusters;
107 PointRGB foregroundPoint(0.0f, 0.0f, 0.0f, 255, 255, 255);
108 foregroundPoint.x =
m_cx;
109 foregroundPoint.y =
m_cy;
110 foregroundPoint.z =
m_cz;
113 rgbCloud, clusters, cloudSegmented, foregroundPoint,
116 if (
result < 0)
return -1;
122 xyzCloud, clusters, cloudSegmented, foregroundPoint,
125 if (
result < 0)
return -1;
131 if (out_cloud_sm.height * out_cloud_sm.width == 0) {
163 "Selected entity does not have any suitable scalar field "
167 "Wrong Parameters. One or more parameters cannot be "
171 "Min Cut Segmentation does not returned any point. Try "
172 "relaxing your parameters");
pcl::PointCloud< PointT > PointCloudT
pcl::PointXYZRGB PointRGB
pcl::PCLPointCloud2 PCLCloud
pcl::PointCloud< PointRGB > PointCloudRGB
Base abstract class for each implemented PCL filter.
int isFirstSelectedCcPointCloud()
Returns 1 if the first selected object is a ccPointCloud.
void newEntity(ccHObject *)
Signal emitted when a new entity is created by the filter.
ecvMainAppInterface * m_app
Associated application interface.
virtual QString getErrorMessage(int errorCode)
Returns the error message corresponding to a given error code.
ccPointCloud * getSelectedEntityAsCCPointCloud() const
Returns the first selected entity as a ccPointCloud.
void refreshLabelComboBox()
virtual ~MinimumCutSegmentation()
virtual int checkSelected()
Checks if current selection is compliant with the filter.
virtual QString getErrorMessage(int errorCode)
Returns the error message corresponding to a given error code.
MinimumCutSegmentationDlg * m_dialog
virtual int openInputDialog()
virtual void getParametersFromDialog()
Collects parameters from the filter dialog (if openDialog is successful)
virtual int compute()
Performs the actual filter job.
virtual int checkParameters()
CC to PCL cloud converter.
PCLCloud::Ptr getAsSM(std::list< std::string > &requested_fields) const
ccHObject * getParent() const
Returns parent object.
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.
virtual void setEnabled(bool state)
Sets the "enabled" property.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
bool hasColors() const override
Returns whether colors are enabled or not.
bool hasScalarFields() const override
Returns whether one or more scalar fields are instantiated.
virtual void setGlobalShift(double x, double y, double z)
Sets shift applied to original coordinates (information storage only)
virtual const CCVector3d & getGlobalShift() const
Returns the shift applied to original coordinates.
virtual void setGlobalScale(double scale)
virtual double getGlobalScale() const
Returns the scale applied to original coordinates.
static ccMesh * Convert(PCLTextureMesh::ConstPtr textureMesh)
Converts a PCL point cloud to a ccPointCloud.
template int GetMinCutSegmentation< PointT >(const PointCloudT::ConstPtr inCloud, std::vector< pcl::PointIndices > &outClusters, PointCloudRGB::Ptr cloud_segmented, const PointT foregroundPoint, int neighboursNumber, float smoothSigma, float backWeightRadius, float foreWeight, const pcl::IndicesConstPtr indices)
template int GetMinCutSegmentation< PointRGB >(const PointCloudRGB::ConstPtr inCloud, std::vector< pcl::PointIndices > &outClusters, PointCloudRGB::Ptr cloud_segmented, const PointRGB foregroundPoint, int neighboursNumber, float smoothSigma, float backWeightRadius, float foreWeight, const pcl::IndicesConstPtr indices)