#### Previous topic

scipy.ndimage.generic_filter1d

#### Next topic

scipy.ndimage.generic_laplace

# scipy.ndimage.generic_gradient_magnitude

`scipy.ndimage.``generic_gradient_magnitude`(input, derivative, output=None, mode='reflect', cval=0.0, extra_arguments=(), extra_keywords=None)

  Gradient magnitude using a provided gradient function.

  Parameters:

  input : array_like

  > Input array to filter.

  derivative : callable

  > Callable with the following signature:

  >     derivative(input, axis, output, mode, cval,
  >                *extra_arguments, **extra_keywords)

  > See extra_arguments, extra_keywords below. derivative can assume that input and output are ndarrays. Note that the output from derivative is modified inplace; be careful to copy important inputs before returning them.

  output : array, optional

  > The output parameter passes an array in which to store the filter output.

  mode : {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional

  > The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘reflect’

  cval : scalar, optional

  > Value to fill past edges of input if mode is ‘constant’. Default is 0.0

  extra_keywords : dict, optional

  > dict of extra keyword arguments to pass to passed function

  extra_arguments : sequence, optional

  > Sequence of extra positional arguments to pass to passed function