machinevisiontoolbox.Image.gradients
- Image.gradients(kernel=None, mode='same', border='reflect', bordervalue=0)
Compute horizontal and vertical gradients
- Parameters:
kernel (2D ndarray, optional) – derivative kerne, defaults to Sobel
mode (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:
gradient images
- Return type:
Image
,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:
Kernel