machinevisiontoolbox.Image.gradients
- Image.gradients(K=None, mode='same', border='reflect', bordervalue=0)
Compute horizontal and vertical gradients
- Parameters:
K (
Kernel
or ndarray, optional) – derivative kernel, defaults to Sobelmode (str, optional) – option for convolution, see
convolve
, defaults to ‘same’border (str, optional) – option for boundary handling, see
convolve
, defaults to ‘reflect’bordervalue (scalar, optional) – padding value, , see
convolve
, defaults to 0
- Returns:
horizontal and vertical gradient images
- Return type:
2-tuple of
Image
Compute horizontal and vertical gradient images.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('monalisa.png', grey=True) >>> Iu, Iv = img.gradients()
- References:
Robotics, Vision & Control for Python, Section 11.5.1.3, P. Corke, Springer 2023.
- Seealso: