Derivative
Gradient filter but using predefined kernels.
ðžïļ Image options and parameters of derivative
method
Derivative filter is a special case of a gradient filter, therefore it uses gradient algorithm. However, the key difference are the kernels used in this very algorithm. In ImageJS there are three distinguished kernels: Sobel, Scharr and Prewitt.


Parameters and default valuesâ
options
Optionsâ
Property | Required | Default value |
---|---|---|
bitDepth | no | image.bitDepth |
borderType | no | replicate |
borderValue | no | 0 |
filter | no | sobel |
Sobel kernelâ
Scharr kernelâ
Prewitt kernelâ
info
As was mentioned, derivative filter is a type of gradient filter. Therefore using the same kernels with gradient filter will provide the same image output. Derivative filter simplifies some kernel's application.
Applying Sobel kernel using gradient filter
return image.gradientFilter({
kernelX: [
[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1],
],
kernelY: [
[-1, -2, -1],
[0, 0, 0],
[1, 2, 1],
],
});
Applying Sobel kernel using derivative filter
return image.derivativeFilter({ filter: 'sobel' });