Skip to content

smooth_object_model_3dSmoothObjectModel3dSmoothObjectModel3dsmooth_object_model_3dT_smooth_object_model_3dπŸ”—

Short descriptionπŸ”—

smooth_object_model_3dSmoothObjectModel3dSmoothObjectModel3dsmooth_object_model_3dT_smooth_object_model_3d β€” Smooth the 3D points of a 3D object model.

SignatureπŸ”—

smooth_object_model_3d( object_model_3d ObjectModel3D, string Method, attribute.name GenParamName, attribute.value GenParamValue, out object_model_3d SmoothObjectModel3D )void SmoothObjectModel3d( const HTuple& ObjectModel3D, const HTuple& Method, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* SmoothObjectModel3D )static void HOperatorSet.SmoothObjectModel3d( HTuple objectModel3D, HTuple method, HTuple genParamName, HTuple genParamValue, out HTuple smoothObjectModel3D )def smooth_object_model_3d( object_model_3d: MaybeSequence[HHandle], method: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[float, int, str]] ) -> Sequence[HHandle]

def smooth_object_model_3d_s( object_model_3d: MaybeSequence[HHandle], method: str, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[float, int, str]] ) -> HHandleHerror T_smooth_object_model_3d( const Htuple ObjectModel3D, const Htuple Method, const Htuple GenParamName, const Htuple GenParamValue, Htuple* SmoothObjectModel3D )

static HObjectModel3DArray HObjectModel3D::SmoothObjectModel3d( const HObjectModel3DArray& ObjectModel3D, const HString& Method, const HTuple& GenParamName, const HTuple& GenParamValue )

HObjectModel3D HObjectModel3D::SmoothObjectModel3d( const HString& Method, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HObjectModel3D HObjectModel3D::SmoothObjectModel3d( const char* Method, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HObjectModel3D HObjectModel3D::SmoothObjectModel3d( const wchar_t* Method, const HTuple& GenParamName, const HTuple& GenParamValue ) const (Windows only)

static HObjectModel3D[] HObjectModel3D.SmoothObjectModel3d( HObjectModel3D[] objectModel3D, string method, HTuple genParamName, HTuple genParamValue )

HObjectModel3D HObjectModel3D.SmoothObjectModel3d( string method, HTuple genParamName, HTuple genParamValue )

DescriptionπŸ”—

The operator smooth_object_model_3dSmoothObjectModel3d smoothes the 3D points in ObjectModel3DobjectModel3Dobject_model_3d and returns the smoothed points in SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d. Currently, the operator offers three methods for smoothing that can be selected in Methodmethodmethod: 'mls'"mls", 'xyz_mapping'"xyz_mapping" and 'xyz_mapping_compute_normals'"xyz_mapping_compute_normals". 'mls'"mls" applies a Moving Least Squares (MLS) algorithm on the 3D points. As a side effect of the smoothing, the method extends SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d by corresponding normals. 'xyz_mapping'"xyz_mapping" smoothes the coordinates of the 3D points using a 2D filter and the 2D mapping contained in ObjectModel3DobjectModel3Dobject_model_3d. 'xyz_mapping_compute_normals'"xyz_mapping_compute_normals" applies the same smoothing as 'xyz_mapping'"xyz_mapping", but additionally extends SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d by normals.

Additional parameters can be set with GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value. The parameter names settable for Methodmethodmethod='mls'"mls" use the prefix 'mls'"mls". Analogically, parameter names settable for Methodmethodmethod='xyz_mapping'"xyz_mapping" and Methodmethodmethod='xyz_mapping_compute_normals'"xyz_mapping_compute_normals" use the prefix 'xyz_mapping'"xyz_mapping".

MLS smoothingπŸ”—

By selecting Methodmethodmethod='mls'"mls", for each point P, the MLS smoothing algorithm fits a planar surface or a higher order polynomial surface to its texttt{k}-neighborhood (the texttt{k} nearest points). The surface fitting is essentially a standard weighted least squares parameter estimation of the plane or polynomial surface parameters, respectively. The closest neighbors of P have higher contribution than the other points, which is controlled by the following weighting function with a parameter \(\sigma\):

\[\begin{eqnarray*} w(P') = exp\left(-\frac{\Vert P'-P\Vert ^2}{\sigma^2}\right) \end{eqnarray*}\]

The point is then projected on the surface. This process is repeated for all points resulting in a smoothed point set. The fitted surfaces have well defined normals (i.e., they can easily be computed from the surface parameters). Therefore, the points are augmented by the corresponding normals as side effect of the smoothing.

Additional parameters can be adjusted for the MLS smoothing specifically using the following parameter names and values for GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value:

  • 'mls_kNN'"mls_kNN": Specify the number of nearest neighbors texttt{k} that are used to fit the MLS surface to each point.

    Suggested values: 4040, 6060, 8080, 100100, 400400.

    Default: 6060.

  • 'mls_order'"mls_order": Specify the order of the MLS polynomial surface. For 'mls_order'"mls_order"=11 the surface is a plane.

    Suggested values: 11, 22,33.

    Default: 22.

  • 'mls_abs_sigma'"mls_abs_sigma": Specify the weighting parameter \(\sigma\) as a fixed absolute value in meter. The value to be selected depends on the scale of the point data. As a rule of thumb, \(\sigma\) can be selected to be the typical distance between a point P and its k/2-th neighbor \(P_{k/2}\). Note that setting an absolute weighting parameter for point data with varying density might result in different smoothing results for points that are situated in parts of the point data with different densities. This problem can be avoided by using 'mls_relative_sigma'"mls_relative_sigma" instead that is scale independent, which makes it also a more convenient way to specify the neighborhood weighting. Note that if 'mls_abs_sigma'"mls_abs_sigma" is passed, any value set in 'mls_relative_sigma'"mls_relative_sigma" is ignored.

    Suggested values: 0.00010.0001, 0.0010.001, 0.010.01, 0.10.1, 1.01.0.

  • 'mls_relative_sigma'"mls_relative_sigma": Specify a multiplication factor \(\sigma_{rel}\) that is used to compute \(\sigma_{P}\) for a point P by the formula:

    \[\begin{eqnarray*} \sigma_{P} = \sigma_{rel}\Vert P_{k/2}-P\Vert, \end{eqnarray*}\]

    where \(P_{k/2}\) is the k/2-th neighbor of P. Note that, unlike \(\sigma\), which is a global parameter for all points, \(\sigma_{P}\) is computed for each point P and therefore adapts the weighting function to its neighborhood. This avoids problems that might appear while trying to set a global parameter \(\sigma\) ('mls_abs_sigma'"mls_abs_sigma") to a point data with highly varying point density. Note however that if 'mls_abs_sigma'"mls_abs_sigma" is set, 'mls_relative_sigma'"mls_relative_sigma" is ignored.

    Suggested values: 0.10.1, 0.50.5, 1.01.0, 1.51.5, 2.02.0.

    Default: 1.01.0.

  • 'mls_force_inwards'"mls_force_inwards": If this parameter is set to 'true'"true", all surface normals are oriented such that they point ``in the direction of the originβ€™β€˜. Expressed mathematically, it is ensured that the scalar product between the normal vector and the vector from the respective surface point to the origin is positive. This may be necessary if the resulting SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d is used for surface-based matching, either as model in create_surface_modelCreateSurfaceModel or as 3D scene in find_surface_model, because here, the consistent orientation of the normals is important for the matching process. If 'mls_force_inwards'"mls_force_inwards" is set to 'false'"false", the normal vectors are oriented arbitrarily.

    List of values: 'true'"true", 'false'"false".

    Default: 'true'"true".

2D mapping smoothingπŸ”—

By selecting Methodmethodmethod='xyz_mapping'"xyz_mapping" or Methodmethodmethod='xyz_mapping_compute_normals'"xyz_mapping_compute_normals", the coordinates of the 3D points are smoothed using a 2D filter and the 2D mapping contained in ObjectModel3DobjectModel3Dobject_model_3d. Additionally, for Methodmethodmethod='xyz_mapping_compute_normals'"xyz_mapping_compute_normals", SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d is extended by normals computed from the XYZ-mapping. If no 2D mapping is available, an exception is raised. As the filter operates on the 2D depth image, using Methodmethodmethod='xyz_mapping'"xyz_mapping" or Methodmethodmethod='xyz_mapping_compute_normals'"xyz_mapping_compute_normals" is usually faster than using Methodmethodmethod='mls'"mls". Invalid points (e.g., duplicated points with coordinates [0,0,0]) should be removed from the 3D object model before applying the operator, e.g., by using select_points_object_model_3dSelectPointsObjectModel3d with attribute 'point_coord_z'"point_coord_z" or 'num_neighbors_fast X'"num_neighbors_fast X".

Additional parameters can be adjusted for the 2D mapping smoothing specifically using the following parameter names and values for GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value:

  • 'xyz_mapping_filter'"xyz_mapping_filter": Specify the filter used for smoothing the 2D mapping. The sizes of the corresponding filter mask are set with 'xyz_mapping_mask_width'"xyz_mapping_mask_width" and 'xyz_mapping_mask_height'"xyz_mapping_mask_height".

    In the default filter mode 'median_separate'"median_separate", the filter method used on the 2D image is comparable to median_separateMedianSeparate. This mode is usually faster than 'median'"median", but can also lead to less accurate results or artifacts at surface discontinuities.

    Using filter mode 'median'"median", the used filter method is comparable to median_imageMedianImage.

    List of values: 'median_separate'"median_separate", 'median'"median".

    Default: 'median_separate'"median_separate".

  • 'xyz_mapping_mask_width'"xyz_mapping_mask_width",'xyz_mapping_mask_height'"xyz_mapping_mask_height": Specify the width and height of the used filter mask.

    For 'xyz_mapping_filter'"xyz_mapping_filter"='median_separate'"median_separate" or 'xyz_mapping_filter'"xyz_mapping_filter"='median'"median", even values for 'xyz_mapping_mask_width'"xyz_mapping_mask_width" or 'xyz_mapping_mask_height'"xyz_mapping_mask_height" are increased to the next odd value automatically.

    For 'xyz_mapping_filter'"xyz_mapping_filter"='median'"median", the used filter mask must be quadratic ('xyz_mapping_mask_width'"xyz_mapping_mask_width" = 'xyz_mapping_mask_height'"xyz_mapping_mask_height"). Thus, when setting only 'xyz_mapping_mask_width'"xyz_mapping_mask_width" or 'xyz_mapping_mask_height'"xyz_mapping_mask_height", the other parameter is set to the same value automatically. If two different values are set, an error is raised.

    Suggested values: 33, 55, 77, 99.

    Default: 33.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

This operator supports canceling timeouts and interrupts.

ParametersπŸ”—

ObjectModel3DobjectModel3Dobject_model_3d (input_control) object_model_3d(-array) β†’ (handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

Handle of the 3D object model containing 3D point data.

Methodmethodmethod (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Smoothing method.

Default: 'mls'"mls"
List of values: 'mls', 'xyz_mapping', 'xyz_mapping_compute_normals'"mls", "xyz_mapping", "xyz_mapping_compute_normals"

GenParamNamegenParamNamegen_param_name (input_control) attribute.name-array β†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Names of generic smoothing parameters.

Default: [][]
List of values: 'mls_abs_sigma', 'mls_force_inwards', 'mls_kNN', 'mls_order', 'mls_relative_sigma', 'xyz_mapping_filter', 'xyz_mapping_mask_height', 'xyz_mapping_mask_width'"mls_abs_sigma", "mls_force_inwards", "mls_kNN", "mls_order", "mls_relative_sigma", "xyz_mapping_filter", "xyz_mapping_mask_height", "xyz_mapping_mask_width"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value-array β†’ (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)Sequence[Union[float, int, str]]Htuple (double / Hlong / char*)

Values of generic smoothing parameters.

Default: [][]
Suggested values: 10, 20, 40, 60, 0.1, 0.5, 1.0, 2.0, 0, 1, 2, 3, 5, 7, 910, 20, 40, 60, 0.1, 0.5, 1.0, 2.0, 0, 1, 2, 3, 5, 7, 9

SmoothObjectModel3DsmoothObjectModel3Dsmooth_object_model_3d (output_control) object_model_3d(-array) β†’ (handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)Sequence[HHandle]Htuple (handle)

Handle of the 3D object model with the smoothed 3D point data.

Combinations with other operatorsπŸ”—

Combinations

Alternatives

surface_normals_object_model_3dSurfaceNormalsObjectModel3d, sample_object_model_3dSampleObjectModel3d, simplify_object_model_3dSimplifyObjectModel3d

ModuleπŸ”—

3D Metrology