예제 #1
0
int AutoSegmentationTools::labelConnectedComponents(GenericIndexedCloudPersist* theCloud, uchar level, bool sixConnexity, GenericProgressCallback* progressCb, DgmOctree* inputOctree)
{
    if (!theCloud)
        return -1;

    //compute octree if none was provided
    DgmOctree* theOctree = inputOctree;
    if (!theOctree)
    {
        theOctree = new DgmOctree(theCloud);
        if (theOctree->build(progressCb)<1)
        {
            delete theOctree;
            return -1;
        }
    }

    //we use the default scalar field to store components labels
    theCloud->enableScalarField();

    int result = theOctree->extractCCs(level,sixConnexity,progressCb);

    //remove octree if it was not provided as input
    if (!inputOctree)
        delete theOctree;

    return result;
}
예제 #2
0
//marque les composantes connexes
int AutoSegmentationTools::labelConnectedComponents(GenericIndexedCloudPersist* theCloud, uchar level, bool sixConnexity, GenericProgressCallback* progressCb, DgmOctree* _theOctree)
{
	if (!theCloud)
		return -1;

	DgmOctree* theOctree = _theOctree;
	if (!theOctree)
	{
		theOctree = new DgmOctree(theCloud);
		if (theOctree->build(progressCb)<1)
		{
			delete theOctree;
			return -1;
		}
	}

	//on initialise les distances pour recevoir les labels des CCs
	theCloud->enableScalarField();

	int result = theOctree->extractCCs(level,sixConnexity,progressCb);

	if (!_theOctree)
		delete theOctree;

	return result;
}