Skip to content

derivate_vector_fieldDerivateVectorFieldDerivateVectorFieldderivate_vector_fieldderivate_vector_field🔗

Short description🔗

derivate_vector_fieldDerivateVectorFieldDerivateVectorFieldderivate_vector_fieldderivate_vector_field — Convolve a vector field with derivatives of the Gaussian.

Signature🔗

derivate_vector_field( image VectorField, out image Result, real Sigma, string Component )void DerivateVectorField( const HObject& VectorField, HObject* Result, const HTuple& Sigma, const HTuple& Component )static void HOperatorSet.DerivateVectorField( HObject vectorField, out HObject result, HTuple sigma, HTuple component )def derivate_vector_field( vector_field: HObject, sigma: MaybeSequence[float], component: str ) -> HObject

Herror derivate_vector_field( const Hobject VectorField, Hobject* Result, double Sigma, const char* Component )

Herror T_derivate_vector_field( const Hobject VectorField, Hobject* Result, const Htuple Sigma, const Htuple Component )

HImage HImage::DerivateVectorField( const HTuple& Sigma, const HString& Component ) const

HImage HImage::DerivateVectorField( double Sigma, const HString& Component ) const

HImage HImage::DerivateVectorField( double Sigma, const char* Component ) const

HImage HImage::DerivateVectorField( double Sigma, const wchar_t* Component ) const (Windows only)

HImage HImage.DerivateVectorField( HTuple sigma, string component )

HImage HImage.DerivateVectorField( double sigma, string component )

Description🔗

derivate_vector_fieldDerivateVectorField convolves the components of a vector field with the derivatives of a Gaussian and calculates various features derived therefrom. derivate_vector_fieldDerivateVectorField only accepts vector fields of the semantic type vector_field_relative. The VectorFieldvectorFieldvector_field \(F(r,c)=(u(r,c),v(r,c))\) is defined as in optical_flow_mgOpticalFlowMg. Sigmasigmasigma is the parameter of the Gaussian (i.e., the amount of smoothing). If a single value is passed in Sigmasigmasigma, the amount of smoothing in the column and row direction is identical. If two values are passed in Sigmasigmasigma, the first value specifies the amount of smoothing in the column direction, while the second value specifies the amount of smoothing in the row direction. The possible values for Componentcomponentcomponent are:

  • 'curl'"curl": The curl of the vector field. One application of using 'curl'"curl" is to analyze optical flow fields. Metaphorically speaking, the curl is how much a small boat would rotate if the vector field was a fluid.

    \[\begin{eqnarray*} curl = \frac{\partial u(r,c)}{\partial c} - \frac{\partial v(r,c)}{\partial r} \end{eqnarray*}\]
  • 'divergence'"divergence": The divergence of the vector field. One application of using 'divergence'"divergence" is to analyze optical flow fields. Metaphorically speaking, the divergence is where the source and sink would be if the vector field was a fluid.

    \[\begin{eqnarray*} div = \frac{\partial u(r,c)}{\partial r} + \frac{\partial v(r,c)}{\partial c} \end{eqnarray*}\]

When used in context of photometric stereo, the operator derivate_vector_fieldDerivateVectorField offers two more parameters, which are especially designed to process the gradient field that is returned by photometric_stereoPhotometricStereo. In this case, we interpret the input vector field as gradient of the underlying surface.

In the following formulas, the input vector field is therefore noted as \(G(r,c) = \nabla f = ( \frac{\partial f(r,c)}{\partial r} , \frac{\partial f(r,c)}{\partial c} )\) where the first and second component of the input is the gradient field of the surface \(f(r,c)\). In the formulas below f_rc denotes the first derivative in column direction of the first component of the gradient field.

  • 'mean_curvature'"mean_curvature": Mean curvature \(H\) of the underlying surface when the input vector field VectorFieldvectorFieldvector_field is interpreted as gradient field. One application of using 'mean_curvature'"mean_curvature" is to process the vector field that is returned by photometric_stereoPhotometricStereo. After filtering the vector field, even tiny scratches or bumps can be segmented.

    \[\begin{eqnarray*} A & = & (1 + \frac{\partial f(r,c)^2}{\partial r}) \frac{\partial^2 f(r,c)}{\partial c^2} \\ B & = & \frac{\partial f(r,c)}{\partial r} \frac{\partial f(r,c)}{\partial c} ( \frac{\partial^2 f(r,c)}{\partial r \partial c} + \frac{\partial^2 f(r,c)}{\partial c \partial r} ) \\ C & = & (1 + \frac{\partial f(r,c)^2}{\partial c}) \frac{\partial^2 f(r,c)}{\partial r^2} \\ D & = & (1 + \frac{\partial f(r,c)^2}{\partial r} + \frac{\partial f(r,c)^2}{\partial c})^{\frac{3}{2}}\\ H & = & \frac{A - B + C}{D} \end{eqnarray*}\]
  • 'gauss_curvature'"gauss_curvature": Gaussian curvature \(K\) of the underlying surface when the input vector field VectorFieldvectorFieldvector_field is interpreted as gradient field. One application of using 'gauss_curvature'"gauss_curvature" is to process the vector field that is returned by photometric_stereoPhotometricStereo. After filtering the vector field, even tiny scratches or bumps can be segmented. If the underlying surface of the vector field is developable, the Gaussian curvature is zero.

    \[\begin{eqnarray*} K = \frac{\frac{\partial f(r,c)^2}{\partial r \partial r} * \frac{\partial f(r,c)^2}{\partial c \partial c} - \frac{\partial f(r,c)^2}{\partial r \partial c} * \frac{\partial f(r,c)^2}{\partial c \partial r} } {(1 + \frac{\partial f(r,c)^2}{\partial r} + \frac{\partial f(r,c)^2}{\partial c})^2} \end{eqnarray*}\]

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 domain level.

  • Automatically parallelized on tuple level.

Parameters🔗

VectorFieldvectorFieldvector_field (input_object) singlechannelimage(-array) → object (vector_field)HObject (vector_field)HImage (vector_field)HObject (vector_field)Hobject (vector_field)

Input vector field.

Resultresultresult (output_object) singlechannelimage(-array) → object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Filtered result images.

Sigmasigmasigma (input_control) real(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

Sigma of the Gaussian.

Default: 1.01.0
Suggested values: 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 5.00.7, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0
Value range: 0.01 ≤ Sigma ≤ 50.0

Componentcomponentcomponent (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Component to be calculated.

Default: 'mean_curvature'"mean_curvature"
List of values: 'curl', 'divergence', 'gauss_curvature', 'mean_curvature'"curl", "divergence", "gauss_curvature", "mean_curvature"

Result🔗

If the parameters are valid, the operator derivate_vector_fieldDerivateVectorField returns the value 2 (H_MSG_TRUE). The behavior in case of empty input (no input images available) is set via the operator set_system('no_object_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

optical_flow_mgOpticalFlowMg, photometric_stereoPhotometricStereo

Possible successors

thresholdThreshold

Module🔗

Foundation