# derivate_vector_field (Operator)

## Name

`derivate_vector_field` — Convolve a vector field with derivatives of the Gaussian.

## Signature

`derivate_vector_field(VectorField : Result : Sigma, Component : )`

## Description

`derivate_vector_field` convolves the components of a vector field with the derivatives of a Gaussian and calculates various features derived therefrom. `derivate_vector_field` only accepts vector fields of the semantic type 'vector_field_relative'. The `VectorField` F(r,c)=(u(r,c),v(r,c)) is defined as in `optical_flow_mg`. `Sigma` is the parameter of the Gaussian (i.e., the amount of smoothing). If a single value is passed in `Sigma`, the amount of smoothing in the column and row direction is identical. If two values are passed in `Sigma`, 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 `Component` are:

'curl':

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

'divergence':

The divergence of the vector field. One application of using '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.

When used in context of photometric stereo, the operator `derivate_vector_field` offers two more parameters, which are especially designed to process the gradient field that is returned by `photometric_stereo`. 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 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 H of the underlying surface when the input vector field `VectorField` is interpreted as gradient field. One application of using 'mean_curvature' is to process the vector field that is returned by `photometric_stereo`. After filtering the vector field, even tiny scratches or bumps can be segmented.

'gauss_curvature':

Gaussian curvature K of the underlying surface when the input vector field `VectorField` is interpreted as gradient field. One application of using 'gauss_curvature' is to process the vector field that is returned by `photometric_stereo`. 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.

## Execution Information

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Automatically parallelized on domain level.
• Automatically parallelized on tuple level.

## Parameters

`VectorField` (input_object)  singlechannelimage(-array) `→` object (vector_field)

Input vector field.

`Result` (output_object)  singlechannelimage(-array) `→` object (real)

Filtered result images.

`Sigma` (input_control)  real(-array) `→` (real)

Sigma of the Gaussian.

Default value: 1.0

Suggested values: 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0

Typical range of values: ```0.2 ≤ Sigma ≤ 50.0```

Restriction: `0.01 <= Sigma <= 50.0`

`Component` (input_control)  string `→` (string)

Component to be calculated.

Default value: 'mean_curvature'

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

## Result

If the parameters are valid, the operator `derivate_vector_field` 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.

## Possible Predecessors

`optical_flow_mg`, `photometric_stereo`

## Possible Successors

`threshold`

Foundation