DGtal
0.9.4beta

The objective of this tutorial is to perform some elementary surface analysis of 3D objects. With this tutorial, you will experiment the following DGtal features
Please use the following template file for this tutorial: AreaSurfaceEstimationtemplate.cpp
When analyzing 3D border of a shape, the surface area plays an important role for shape description. A way to estimate the area of a surface is to compute the difference between the normal of the shape and the normal of the digital point. Given a shape \( \mathcal{X}\), the surface area function can be estimated with :
\[ \hat{AreaSurface (X)} = \sum_x ( \textbf{n_e}(x) . \textbf{n_s}(\hat{x}) ) \]
where \( \textbf{n_e}(x) \) denotes the normal vector estimated at position \( x \in \mathcal{X} \), \( \textbf{n_s}(\hat{x}) \) the normal vector of surface element (surfel) \( \hat{x} \in Dig_h{\mathcal{X}} \), and \( . \) the dot product.
Let start with shape construction. First of all, create a source file with the following includes (or copy the AreaSurfaceEstimationtemplate.cpp source file):
Once you have created the digital shape, you need to get the domain and create a KhalimskySpace (see Z3i::KSpace) from it.
At this point, you have a digital object created from an Euclidean one. Now, we want to extract the border of this digital object.
As discussed in the introduction, we will use a normal vector estimator to compute the surface area of our object. We will use IntegralInvarianceCovarianceEstimator (II) who, with the good functor (can be found in IIGeometricFunctors namespace/file ). DGtal offers also some other normal vector estimators, so feel free to use wich one you want.
The main idea is to choose the functor you want (IIGeometricFunctors::IINormalDirectionFunctor on this case) and use the II estimator on all the digital surface:
To extract the surfel normal vector, we need to use some method from the KSpace (see KhalimskySpaceND for all methods avalaible):
You can check AreaSurfaceEstimationfinal.cpp to get some answers to the above mentioned questions.
Several optimizations can be developed. For example, instead of evaluate for all surface element separately, we can estimate all surfels in one call of eval(). This uses some optimization of II estimator and can be see in overall computation time. Some others normal vector estimators can be used, as VoronoiCovarianceMeasureLocalEstimator.