mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
util3d::denseMeshPostProcessing(): coloredOutput param not used anymore
This commit is contained in:
@@ -97,8 +97,7 @@ void denseMeshPostProcessing(
|
|||||||
|
|
||||||
if(cloud.get()!=0 &&
|
if(cloud.get()!=0 &&
|
||||||
!hasColors &&
|
!hasColors &&
|
||||||
transferColorRadius >= 0.0 &&
|
transferColorRadius >= 0.0)
|
||||||
coloredOutput)
|
|
||||||
{
|
{
|
||||||
if(progressState) progressState->callback(uFormat("Transferring color from point cloud to mesh..."));
|
if(progressState) progressState->callback(uFormat("Transferring color from point cloud to mesh..."));
|
||||||
|
|
||||||
@@ -179,63 +178,8 @@ void denseMeshPostProcessing(
|
|||||||
}
|
}
|
||||||
hasColors = true;
|
hasColors = true;
|
||||||
}
|
}
|
||||||
else if(cloud.get()!=0 &&
|
|
||||||
!hasColors &&
|
|
||||||
transferColorRadius > 0.0 &&
|
|
||||||
cleanMesh &&
|
|
||||||
!coloredOutput)
|
|
||||||
{
|
|
||||||
if(progressState) progressState->callback(uFormat("Removing polygons too far from the cloud..."));
|
|
||||||
|
|
||||||
// transfer color from point cloud to mesh
|
if(minClusterSize)
|
||||||
typename pcl::search::KdTree<pointRGBT>::Ptr tree (new pcl::search::KdTree<pointRGBT>(true));
|
|
||||||
tree->setInputCloud(cloud);
|
|
||||||
pcl::PointCloud<pcl::PointNormal>::Ptr optimizedCloud(new pcl::PointCloud<pcl::PointNormal>);
|
|
||||||
pcl::fromPCLPointCloud2(mesh->cloud, *optimizedCloud);
|
|
||||||
std::vector<bool> closePts(optimizedCloud->size());
|
|
||||||
for(unsigned int i=0; i<optimizedCloud->size(); ++i)
|
|
||||||
{
|
|
||||||
std::vector<int> kIndices;
|
|
||||||
std::vector<float> kDistances;
|
|
||||||
pointRGBT pt;
|
|
||||||
pt.x = optimizedCloud->at(i).x;
|
|
||||||
pt.y = optimizedCloud->at(i).y;
|
|
||||||
pt.z = optimizedCloud->at(i).z;
|
|
||||||
tree->radiusSearch(pt, transferColorRadius, kIndices, kDistances);
|
|
||||||
if(kIndices.size())
|
|
||||||
{
|
|
||||||
closePts.at(i) = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
closePts.at(i) = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove far polygons
|
|
||||||
std::vector<pcl::Vertices> filteredPolygons(mesh->polygons.size());
|
|
||||||
int oi=0;
|
|
||||||
for(unsigned int i=0; i<mesh->polygons.size(); ++i)
|
|
||||||
{
|
|
||||||
bool keepPolygon = true;
|
|
||||||
for(unsigned int j=0; j<mesh->polygons[i].vertices.size(); ++j)
|
|
||||||
{
|
|
||||||
if(!closePts.at(mesh->polygons[i].vertices[j]))
|
|
||||||
{
|
|
||||||
keepPolygon = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(keepPolygon)
|
|
||||||
{
|
|
||||||
filteredPolygons[oi++] = mesh->polygons[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filteredPolygons.resize(oi);
|
|
||||||
mesh->polygons = filteredPolygons;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(minClusterSize && coloredOutput && !cleanMesh)
|
|
||||||
{
|
{
|
||||||
if(progressState) progressState->callback(uFormat("Filter small polygon clusters..."));
|
if(progressState) progressState->callback(uFormat("Filter small polygon clusters..."));
|
||||||
|
|
||||||
@@ -290,7 +234,7 @@ void denseMeshPostProcessing(
|
|||||||
int before = (int)mesh->polygons.size();
|
int before = (int)mesh->polygons.size();
|
||||||
mesh->polygons = filteredPolygons;
|
mesh->polygons = filteredPolygons;
|
||||||
|
|
||||||
if(progressState) progressState->callback(uFormat("Filtered %1 polygons.", before-(int)mesh->polygons.size()));
|
if(progressState) progressState->callback(uFormat("Filtered %d polygons.", before-(int)mesh->polygons.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute normals for the mesh if not already here, add also white color if colored output is required
|
// compute normals for the mesh if not already here, add also white color if colored output is required
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void denseMeshPostProcessing(
|
|||||||
int maximumPolygons = 0, // 0=disabled
|
int maximumPolygons = 0, // 0=disabled
|
||||||
const typename pcl::PointCloud<pointRGBT>::Ptr & cloud = pcl::PointCloud<pointRGBT>::Ptr(), // A RGB point cloud used to transfer colors back to mesh (needed for parameters below)
|
const typename pcl::PointCloud<pointRGBT>::Ptr & cloud = pcl::PointCloud<pointRGBT>::Ptr(), // A RGB point cloud used to transfer colors back to mesh (needed for parameters below)
|
||||||
float transferColorRadius = 0.05f, // <0=disabled, 0=nearest color
|
float transferColorRadius = 0.05f, // <0=disabled, 0=nearest color
|
||||||
bool coloredOutput = true, // If output should be colored
|
bool coloredOutput = true, // Not used anymore, output is colored if transferColorRadius>=0
|
||||||
bool cleanMesh = true, // Remove polygons not colored (if coloredOutput is disabled, transferColorRadius is still used to clean the mesh)
|
bool cleanMesh = true, // Remove polygons not colored (if coloredOutput is disabled, transferColorRadius is still used to clean the mesh)
|
||||||
int minClusterSize = 50, // Remove small polygon clusters after the mesh has been cleaned (0=disabled)
|
int minClusterSize = 50, // Remove small polygon clusters after the mesh has been cleaned (0=disabled)
|
||||||
ProgressState * progressState = 0);
|
ProgressState * progressState = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user