![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <GeometricalAnalysisTools.h>


Public Types | |
| enum | GeomCharacteristic { Feature , Curvature , LocalDensity , ApproxLocalDensity , Roughness , MomentOrder1 } |
| enum | Density { DENSITY_KNN , DENSITY_2D , DENSITY_3D } |
| Density measurement. More... | |
| enum | ErrorCode { NoError = 0 , InvalidInput = -1 , NotEnoughPoints = -2 , OctreeComputationFailed = -3 , ProcessFailed = -4 , UnhandledCharacteristic = -5 , NotEnoughMemory = -6 , ProcessCancelledByUser = -7 } |
Static Public Member Functions | |
| static ErrorCode | ComputeCharactersitic (GeomCharacteristic c, int subOption, GenericIndexedCloudPersist *cloud, PointCoordinateType kernelRadius, const CCVector3 *roughnessUpDir=nullptr, GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr) |
| Unified way to compute a geometric characteristic. More... | |
| static ErrorCode | ComputeLocalDensityApprox (GenericIndexedCloudPersist *cloud, Density densityType, GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr) |
| Computes the local density (approximate) More... | |
| static CCVector3 | ComputeGravityCenter (const GenericCloud *theCloud) |
| Computes the gravity center of a point cloud. More... | |
| static CCVector3 | ComputeWeightedGravityCenter (GenericCloud *theCloud, ScalarField *weights) |
| Computes the weighted gravity center of a point cloud. More... | |
| static SquareMatrixd | ComputeCrossCovarianceMatrix (GenericCloud *P, GenericCloud *Q, const CCVector3 &pGravityCenter, const CCVector3 &qGravityCenter) |
| Computes the cross covariance matrix between two clouds (same size) More... | |
| static SquareMatrixd | ComputeWeightedCrossCovarianceMatrix (GenericCloud *P, GenericCloud *Q, const CCVector3 &pGravityCenter, const CCVector3 &qGravityCenter, ScalarField *coupleWeights=nullptr) |
| static cloudViewer::SquareMatrixd | ComputeCovarianceMatrix (const GenericCloud *theCloud, const PointCoordinateType *_gravityCenter=nullptr) |
| Computes the covariance matrix of a clouds. More... | |
| static ErrorCode | FlagDuplicatePoints (GenericIndexedCloudPersist *theCloud, double minDistanceBetweenPoints=std::numeric_limits< double >::epsilon(), GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr) |
| Flag duplicate points. More... | |
| static ErrorCode | DetectSphereRobust (GenericIndexedCloudPersist *cloud, double outliersRatio, CCVector3 ¢er, PointCoordinateType &radius, double &rms, GenericProgressCallback *progressCb=nullptr, double confidence=0.99, unsigned seed=0) |
| Tries to detect a sphere in a point cloud. More... | |
| static ErrorCode | ComputeSphereFrom4 (const CCVector3 &A, const CCVector3 &B, const CCVector3 &C, const CCVector3 &D, CCVector3 ¢er, PointCoordinateType &radius) |
| Computes the center and radius of a sphere passing through 4 points. More... | |
| static ErrorCode | DetectCircle (GenericIndexedCloudPersist *cloud, CCVector3 ¢er, CCVector3 &normal, PointCoordinateType &radius, double &rms, GenericProgressCallback *progressCb=nullptr) |
| Detects a circle from a point cloud. More... | |
Static Protected Member Functions | |
| static bool | ComputeGeomCharacteristicAtLevel (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr) |
| Computes geom characteristic inside a cell. More... | |
| static bool | ComputeApproxPointsDensityInACellAtLevel (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr) |
| Computes approximate point density inside a cell. More... | |
| static bool | FlagDuplicatePointsInACellAtLevel (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr) |
| Flags duplicate points inside a cell. More... | |
| static bool | RefineSphereLS (GenericIndexedCloudPersist *cloud, CCVector3 ¢er, PointCoordinateType &radius, double minReltaiveCenterShift=1.0e-3) |
| Refines the estimation of a sphere by (iterative) least-squares. More... | |
Several algorithms to compute point-clouds geometric characteristics (curvature, density, etc.)
Definition at line 22 of file GeometricalAnalysisTools.h.
Density measurement.
Definition at line 36 of file GeometricalAnalysisTools.h.
| Enumerator | |
|---|---|
| NoError | |
| InvalidInput | |
| NotEnoughPoints | |
| OctreeComputationFailed | |
| ProcessFailed | |
| UnhandledCharacteristic | |
| NotEnoughMemory | |
| ProcessCancelledByUser | |
Definition at line 46 of file GeometricalAnalysisTools.h.
| Enumerator | |
|---|---|
| Feature | |
| Curvature | |
| LocalDensity | Accurate local density (see GeometricalAnalysisTools::Density) |
| ApproxLocalDensity | Approximate local density (see GeometricalAnalysisTools::Density) |
| Roughness | Roughness |
| MomentOrder1 | 1st order moment |
Definition at line 24 of file GeometricalAnalysisTools.h.
|
staticprotected |
Computes approximate point density inside a cell.
| cell | structure describing the cell on which processing is applied |
| additionalParameters | see method description |
| nProgress | optional (normalized) progress notification (per-point) |
Definition at line 456 of file GeometricalAnalysisTools.cpp.
References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), DENSITY_2D, DENSITY_3D, DENSITY_KNN, cloudViewer::DgmOctree::findNearestNeighborsStartingFromCell(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::GreaterThanEpsilon(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, M_PI, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::minNumberOfNeighbors, NAN_VALUE, nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::DgmOctree::octreeCell::parentOctree, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, s_UnitSphereVolume, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), and cloudViewer::DgmOctree::octreeCell::truncatedCode.
Referenced by ComputeLocalDensityApprox().
|
static |
Unified way to compute a geometric characteristic.
Once the main geometric characterstic is chosen, the subOption parameter is used to specify the actual feature / curvature type / local density computation algorithm if necessary.
| c | geometric characterstic |
| subOption | feature / curvature type / local density computation algorithm or nothing (0) |
| cloud | cloud to compute the characteristic on |
| kernelRadius | neighbouring sphere radius |
| roughnessUpDir | up direction to compute signed roughness values (optional) |
| progressCb | client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
| inputOctree | if not set as input, octree will be automatically computed. |
Definition at line 29 of file GeometricalAnalysisTools.cpp.
References ApproxLocalDensity, cloudViewer::DgmOctree::build(), ComputeGeomCharacteristicAtLevel(), ComputeLocalDensityApprox(), Curvature, DENSITY_2D, DENSITY_3D, DENSITY_KNN, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), Feature, cloudViewer::DgmOctree::findBestLevelForAGivenNeighbourhoodSizeExtraction(), cloudViewer::GenericCloud::getPointScalarValue(), InvalidInput, LocalDensity, M_PI, MomentOrder1, NoError, NotEnoughPoints, octree, OctreeComputationFailed, ProcessFailed, result, Roughness, s_UnitSphereVolume, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), and UnhandledCharacteristic.
Referenced by ccTrace::buildCurvatureCost(), and ccLibAlgorithms::ComputeGeomCharacteristic().
|
static |
Computes the covariance matrix of a clouds.
| theCloud | point cloud |
| _gravityCenter | if available, its gravity center |
Definition at line 562 of file GeometricalAnalysisTools.cpp.
References cloudViewer::SquareMatrixTpl< Scalar >::clear(), ComputeGravityCenter(), cloudViewer::SquareMatrixTpl< Scalar >::m_values, points, cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
static |
Computes the cross covariance matrix between two clouds (same size)
Used in the ICP algorithm between the cloud to register and the "Closest Points Set" determined from the reference cloud.
| P | the cloud to register |
| Q | the "Closest Point Set" |
| pGravityCenter | the gravity center of P |
| qGravityCenter | the gravity center of Q |
Definition at line 611 of file GeometricalAnalysisTools.cpp.
References count, cloudViewer::GenericCloud::getNextPoint(), cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::SquareMatrixTpl< Scalar >::row(), cloudViewer::SquareMatrixTpl< Scalar >::scale(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by cloudViewer::RegistrationTools::RegistrationProcedure().
|
staticprotected |
Computes geom characteristic inside a cell.
| cell | structure describing the cell on which processing is applied |
| additionalParameters | see method description |
| nProgress | optional (normalized) progress notification (per-point) |
Definition at line 154 of file GeometricalAnalysisTools.cpp.
References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), cloudViewer::Neighbourhood::computeCurvature(), cloudViewer::Neighbourhood::computeFeature(), cloudViewer::Neighbourhood::computeMomentOrder1(), cloudViewer::Neighbourhood::computeRoughness(), Curvature, Feature, cloudViewer::DgmOctree::findNeighborsInASphereStartingFromCell(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::ReferenceCloud::getPointPersistentPtr(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, LocalDensity, MomentOrder1, NAN_VALUE, nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::DgmOctree::octreeCell::parentOctree, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSphericalSearchStruct::prepare(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, Roughness, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), std::swap(), and cloudViewer::DgmOctree::octreeCell::truncatedCode.
Referenced by ComputeCharactersitic().
|
static |
Computes the gravity center of a point cloud.
| theCloud | cloud |
Definition at line 517 of file GeometricalAnalysisTools.cpp.
References count, and cloudViewer::GenericCloud::size().
Referenced by ComputeCovarianceMatrix(), and cloudViewer::RegistrationTools::RegistrationProcedure().
|
static |
Computes the local density (approximate)
Old method (based only on the distance to the nearest neighbor).
| cloud | processed cloud |
| densityType | the 'type' of density to compute |
| progressCb | client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
| inputOctree | if not set as input, octree will be automatically computed. |
Definition at line 409 of file GeometricalAnalysisTools.cpp.
References cloudViewer::DgmOctree::build(), ComputeApproxPointsDensityInACellAtLevel(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), cloudViewer::DgmOctree::findBestLevelForAGivenPopulationPerCell(), InvalidInput, NoError, NotEnoughPoints, OctreeComputationFailed, ProcessFailed, result, and cloudViewer::GenericCloud::size().
Referenced by ComputeCharactersitic(), and ccAlignDlg::estimateDelta().
|
static |
Computes the center and radius of a sphere passing through 4 points.
| [in] | A | first point |
| [in] | B | second point |
| [in] | C | third point |
| [in] | D | fourth point |
| [out] | center | center of the sphere |
| [out] | radius | radius of the sphere |
Definition at line 1228 of file GeometricalAnalysisTools.cpp.
References dmat_solve(), NoError, Vector3Tpl< Type >::norm(), Vector3Tpl< Type >::norm2d(), ProcessFailed, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by DetectSphereRobust().
|
static |
Computes the cross covariance matrix between two clouds (same size) - weighted version Used in the ICP algorithm between the cloud to register and the "Closest Points Set" determined from the reference cloud.
| P | the cloud to register |
| Q | the "Closest Point Set" |
| pGravityCenter | the gravity center of P |
| qGravityCenter | the gravity center of Q |
| coupleWeights | weights for each (Pi,Qi) couple (optional) |
Definition at line 650 of file GeometricalAnalysisTools.cpp.
References abs(), count, cloudViewer::ScalarField::currentSize(), Vector3Tpl< double >::fromArray(), cloudViewer::GenericCloud::getNextPoint(), cloudViewer::ScalarField::getValue(), cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::SquareMatrixTpl< Scalar >::row(), cloudViewer::SquareMatrixTpl< Scalar >::scale(), cloudViewer::GenericCloud::size(), cloudViewer::ScalarField::ValidValue(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by cloudViewer::RegistrationTools::RegistrationProcedure().
|
static |
Computes the weighted gravity center of a point cloud.
| theCloud | cloud |
| weights | per point weights (only absolute values are considered) |
Definition at line 537 of file GeometricalAnalysisTools.cpp.
References count, cloudViewer::ScalarField::currentSize(), and cloudViewer::GenericCloud::size().
Referenced by cloudViewer::RegistrationTools::RegistrationProcedure().
|
static |
Detects a circle from a point cloud.
Based on "A Simple approach for the Estimation of Circular Arc Center and Its radius" by S. Thomas and Y. Chan
| [in] | cloud | point cloud |
| [out] | center | circle center |
| [out] | normal | normal to the plane to which the circle belongs |
| [out] | radius | circle radius |
| [out] | rms | fitting RMS |
| [in] | progressCb | for progress notification (optional) |
Definition at line 975 of file GeometricalAnalysisTools.cpp.
References Vector3Tpl< Type >::cross(), Vector3Tpl< Type >::dot(), error(), Vector3Tpl< PointCoordinateType >::fromArray(), cloudViewer::Neighbourhood::getGravityCenter(), cloudViewer::Neighbourhood::getLSPlane(), cloudViewer::Neighbourhood::getLSPlaneNormal(), cloudViewer::Neighbourhood::getLSPlaneX(), cloudViewer::GenericIndexedCloud::getPoint(), InvalidInput, Landau_Smith(), NoError, normal, NotEnoughMemory, NotEnoughPoints, nProgress, cloudViewer::NormalizedProgress::oneStep(), Vector3Tpl< Type >::orthogonal(), PC_ONE, ProcessCancelledByUser, ProcessFailed, cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::GenericCloud::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), Tuple3Tpl< Type >::u, cloudViewer::GenericProgressCallback::update(), Vector2Tpl< Type >::x, Tuple3Tpl< Type >::x, Vector2Tpl< Type >::y, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
static |
Tries to detect a sphere in a point cloud.
Inspired from "Parameter Estimation Techniques: A Tutorial with Application to Conic Fitting" by Zhengyou Zhang (Inria Technical Report 2676). More specifically the section 9.5 about Least Median of Squares.
| [in] | cloud | input cloud |
| [in] | outliersRatio | proportion of outliers (between 0 and 1) |
| [out] | center | center of the detected sphere |
| [out] | radius | radius of the detected sphere |
| [out] | rms | residuals RMS for the detected sphere |
| [in] | progressCb | for progress notification (optional) |
| [in] | confidence | probability that the detected sphere is the right one (strictly below 1) |
| [in] | seed | if different than 0, this seed will be used for random numbers generation (instead of a random one) |
Definition at line 769 of file GeometricalAnalysisTools.cpp.
References cloudViewer::ReferenceCloud::addPointIndex(), ComputeSphereFrom4(), dist(), error(), cloudViewer::GenericIndexedCloud::getPoint(), InvalidInput, min(), NoError, NotEnoughMemory, NotEnoughPoints, nProgress, cloudViewer::NormalizedProgress::oneStep(), ProcessCancelledByUser, ProcessFailed, RefineSphereLS(), cloudViewer::ReferenceCloud::reserve(), cloudViewer::ReferenceCloud::resize(), cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::GenericCloud::size(), cloudViewer::ReferenceCloud::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), and cloudViewer::GenericProgressCallback::update().
Referenced by ccPointPairRegistrationDlg::convertToSphereCenter().
|
static |
Flag duplicate points.
This method only requires an output scalar field. Duplicate points will be associated to scalar value 1 (and 0 for the others).
| theCloud | processed cloud |
| minDistanceBetweenPoints | min distance between (output) points |
| progressCb | client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
| inputOctree | if not set as input, octree will be automatically computed. |
Definition at line 300 of file GeometricalAnalysisTools.cpp.
References cloudViewer::DgmOctree::build(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), cloudViewer::DgmOctree::findBestLevelForAGivenNeighbourhoodSizeExtraction(), FlagDuplicatePointsInACellAtLevel(), cloudViewer::GenericCloud::forEach(), InvalidInput, NoError, NotEnoughPoints, OctreeComputationFailed, ProcessFailed, result, cloudViewer::ScalarFieldTools::SetScalarValueToZero(), and cloudViewer::GenericCloud::size().
|
staticprotected |
Flags duplicate points inside a cell.
| cell | structure describing the cell on which processing is applied |
| additionalParameters | see method description |
| nProgress | optional (normalized) progress notification (per-point) |
Definition at line 353 of file GeometricalAnalysisTools.cpp.
References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), cloudViewer::DgmOctree::findNeighborsInASphereStartingFromCell(), cloudViewer::ReferenceCloud::getAssociatedCloud(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::ReferenceCloud::getPointScalarValue(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::DgmOctree::octreeCell::parentOctree, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSphericalSearchStruct::prepare(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), and cloudViewer::DgmOctree::octreeCell::truncatedCode.
Referenced by FlagDuplicatePoints().
|
staticprotected |
Refines the estimation of a sphere by (iterative) least-squares.
Definition at line 710 of file GeometricalAnalysisTools.cpp.
References count, Vector3Tpl< double >::fromArray(), cloudViewer::GenericIndexedCloud::getPoint(), Vector3Tpl< Type >::norm(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::u, and ZERO_TOLERANCE_D.
Referenced by DetectSphereRobust().