calcGradients

Calculate gradient magnitude and orientation of an image slice.

void
calcGradients
(
InputTensor
V = DeepElementType!InputTensor
)
(
InputTensor input
,
ref Slice!(Contiguous, [2], V*) mag
,
ref Slice!(Contiguous, [2], V*) orient
,,
TaskPool pool = taskPool
)
if (
isFloatingPoint!V
)
in { static assert (isSlice!InputTensor, "Input tensor has to be of type mir.ndslice.slice.Slice"); static assert (InputTensor.init.shape.length == 2, "Input tensor has to be 2 dimensional. (matrix)"); assert (!input.empty); }

Parameters

input
Type: InputTensor

Input slice of an image.

mag
Type: Slice!(Contiguous, [2], V*)

Output magnitude value of gradients. If shape does not correspond to input, is allocated anew.

orient
Type: Slice!(Contiguous, [2], V*)

Orientation value of gradients in radians. If shape does not correspond to input, is allocated anew.

edgeKernelType

Optional convolution kernel type to calculate partial derivatives. Default value is EdgeKernel.SIMPLE, which calls calcPartialDerivatives function to calculate derivatives. Other options will perform convolution with requested kernel type.

pool
Type: TaskPool

TaskPool instance used parallelise the algorithm.

Note: Input slice's memory has to be contiguous. Magnitude and orientation slices' strides have to be the identical.

Meta