DerivativeFilter[data,{n1,n2,…}]
computes the ni
derivative of data at level i.
DerivativeFilter[data,{n1,n2,…},σ]
computes the derivative at a Gaussian scale of standard deviation σ.
DerivativeFilter[data,{der1,der2,…},…]
computes several derivatives der1, der2, ….
DerivativeFilter
DerivativeFilter[data,{n1,n2,…}]
computes the ni
derivative of data at level i.
DerivativeFilter[data,{n1,n2,…},σ]
computes the derivative at a Gaussian scale of standard deviation σ.
DerivativeFilter[data,{der1,der2,…},…]
computes several derivatives der1, der2, ….
Details and Options
- DerivativeFilter is a linear filter that computes the derivatives of data based on a spline interpolation model. Regularization with a Gaussian kernel of standard deviation σ (defaults to 0) can be used to reduce susceptibility to noise.
- The data can be any of the following:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries, TemporalData, … image arbitrary Image or Image3D object audio an Audio object video a Video object - DerivativeFilter operates separately on each level of data.
- DerivativeFilter[image,…] uses the array coordinate system, where the first coordinate runs from the top to the bottom of image, and the second coordinate increases from left to right.
- DerivativeFilter gives a result with the same dimensions as data.
- DerivativeFilter can take the following options:
-
InterpolationOrder Automatic interpolation order up to 9 Padding "Fixed" padding method - With Padding->{pad1,pad2,…}, different padding schemes can be used for every dimension of data.
- The derivative order has to be smaller than the specified interpolation order.
Examples
open all close allBasic Examples (3)
A horizontal derivative of an image:
DerivativeFilter[[image], {0, 1}]//ImageAdjustA regularized horizontal derivative of an image:
DerivativeFilter[[image], {0, 1}, 3]//ImageAdjustdata = PixelValue[[image], {All, 60}];
der = DerivativeFilter[data, {1}];ListLinePlot[{data, der}, PlotRange -> All]Scope (14)
Data (6)
First-order derivatives of a 2D array:
DerivativeFilter[BoxMatrix[1, 5], {1, 1}]//Chop//MatrixFormObtain the first derivative of a TimeSeries object:
ts = TemporalData[TimeSeries, {{{-3.47, -0.95, 4.45, 9.11, 14.4, 16.07, 20.16, 18.76, 16.88, 9.88, 4.39,
-1.33, -5.41, -4.2, 0.04, 5.73, 11.01, 14.89, 20.36, 18.27, 15.19, 9.74, 6.06, 0.33, -2.74,
-1.83, 3.83, 6.68, 12.06, 15.51, 20.64, 19.73, ... 15.41, 19.84, 20.45, 16.79, 9.6, 4.26,
-2.3, -1.26, -2.29, -2.08, 7.1, 10.29, 16.92, 19.01, 19.79}}, {{0, 91, 1}}, 1,
{"Continuous", 1}, {"Discrete", 1}, 1,
{ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 11.2];
filtered = DerivativeFilter[ts, {1}];
ListLinePlot[{ts, filtered}, PlotLegends -> {"original", "filtered"}]Filter an Audio signal:
a = Import["ExampleData/rule30.wav", "Audio"];
b = AudioNormalize[DerivativeFilter[a, {1}]]AudioPlot[{a, b}]Vertical derivative of a color image:
DerivativeFilter[[image], {1, 0}]//ImageAdjustDerivativeFilter[Video["ExampleData/fish.mp4"], {1, 0}]
| |
Vertical derivative of a 3D image:
DerivativeFilter[[image], {1, 0, 0}]Parameters (8)
DerivativeFilter[{1, 2, -1, 0, 1, 2}, {0}]First, second and third derivatives of a step sequence:
step = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};ListLinePlot[DerivativeFilter[step, {{1}, {2}, {3}}], PlotRange -> All, Axes -> {True, False}, Ticks -> False, PlotLegends -> {1, 2, 3}]Vertical derivative of an image:
DerivativeFilter[[image], {1, 0}]//ImageAdjustDerivativeFilter[[image], {0, 1}]//ImageAdjustSecond-order derivative in both dimensions:
10DerivativeFilter[[image], {2, 2}]Compute several derivatives of an image:
ImageAdjust /@ DerivativeFilter[[image], {{1, 0}, {0, 1}, {0, 2}}]Vertical derivative of a 3D image:
i = [image];
DerivativeFilter[i, {1, 0, 0}]DerivativeFilter[i, {0, 1, 1}]Regularize the derivative using Gaussian smoothing:
filtered = DerivativeFilter[TemporalData[TimeSeries, {{{0., -0.27267267057145633, -0.6672983789995302, -0.5338541947930846,
-0.6117404489279314, -0.6755527076595494, -0.02125421294486496, -0.10792797291843935,
-0.6138271235477938, -0.3248568606554575, -0.08843449054 ... 2053424, -0.49980440691873723, -0.5388679788215971,
-0.4101602764645551}}, {{0, 1., 0.01}}, 1, {"Continuous", 1}, {"Continuous", 1}, 1,
{ValueDimensions -> 1, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.1], {1}, #]& /@ {0, 3};
ListLinePlot[filtered, PlotRange -> All, PlotLegends -> {"σ=0 (default)", "σ=3"}]Horizontal derivative at different Gaussian scales:
ImageAdjust@DerivativeFilter[[image], {0, 1}, #]& /@ {0, 5, 10}Options (3)
InterpolationOrder (1)
Filtering an array using different InterpolationOrder values:
Chop@MatrixForm@DerivativeFilter[ArrayPad[{1}, 5], {1},
InterpolationOrder -> #]& /@ {2, 3}Padding (2)
Derivative filtering using different padding schemes:
v = {1, 2, 3, 2, 2, 1, 2, 1, 0, 0, 0};
pad = {"Fixed", "Periodic", "Reflected"};
ListLinePlot[DerivativeFilter[v, {1}, Padding -> #]& /@ pad, PlotLegends -> pad, PlotRange -> All]First derivatives of a grayscale image using different padding schemes:
ImageAdjust[DerivativeFilter[[image], {1, 1}, 3, Padding -> #]]& /@ {"Fixed", "Periodic", 0.2}Use different padding schemes in each spatial direction:
ImageAdjust[DerivativeFilter[[image], {1, 1}, 3, Padding -> {"Fixed", "Periodic"}]]Applications (5)
{Ly, Lx} = DerivativeFilter[[image], {{1, 0}, {0, 1}}];
Sqrt[Lx^2 + Ly^2]//ImageAdjustCompute the Laplacian of an image at scale σ=6:
{Lxx, Lyy} = DerivativeFilter[[image], {{2, 0}, {0, 2}}, 6];
Lxx + Lyy//ColorNegate//ImageAdjustσ = 2;
{Lxx, Lxy, Lyy} = DerivativeFilter[[image], {{0, 2}, {1, 1}, {2, 0}}, σ];
(σ^3 / 2/2)(Sqrt[(Lxx - Lyy)^2 + 4Lxy^2] - Lxx - Lyy)//ImageAdjusttJunctionFilter[img_, σ_ : 1] :=
Module[
{data = ImageData[img], Lx, Ly, Lxx, Lxy, Lyy, Lxxx, Lxxy, Lxyy, Lyyy},
{Lx, Ly} = DerivativeFilter[data, {{0, 1}, {1, 0}}, σ];
{Lxx, Lxy, Lyy} = DerivativeFilter[data, {{0, 2}, {1, 1}, {2, 0}}, σ];
{Lxxx, Lxxy, Lxyy, Lyyy} = DerivativeFilter[data, {{0, 3}, {1, 2}, {2, 1}, {3, 0}}, σ];
Image[
Chop[-Lx^5Lxyy + Ly^4(2Lxy^2 - Lxxy Ly + Lxx Lyy) + Lx Ly^3(6Lxx Lxy - Lxxx Ly + 2Lxyy Ly - 6Lxy Lyy) + Lx^3Ly(-6Lxx Lxy - Lxxx Ly + Lxyy Ly + 6Lxy Lyy) + Lx^4(2Lxy^2 + 2Lxxy Ly + Lxx Lyy - Ly Lyyy) + Lx^2Ly^2(3Lxx^2 - 8Lxy^2 + Lxxy Ly - 4Lxx Lyy + 3Lyy^2 - Ly Lyyy)]
]
];
tJunctionFilter[[image], 2]//ImageAdjustGet borders from a colored map:
Norm[DerivativeFilter[[image], {{1, 0}, {0, 1}}]]Properties & Relations (4)
For larger values of
, the results of GaussianFilter and DerivativeFilter converge:
data = {0, 0, 1, 2, 1, 0, 0, 0, 0, 1, 2, 5, -1, 0, 2, 1};
σ = 0.5;
ListLinePlot[
{DerivativeFilter[data, {1}, σ], GaussianFilter[data, σ{3, 1}, {1}]},
PlotRange -> All
]σ = 1;
ListLinePlot[
{DerivativeFilter[data, {1}, σ], GaussianFilter[data, σ{3, 1}, {1}]},
PlotRange -> All
]σ = 1.5;
ListLinePlot[
{DerivativeFilter[data, {1}, σ], GaussianFilter[data, σ{3, 1}, {1}]},
PlotRange -> All
]DerivativeFilter and the corresponding derivatives of a spline interpolation return the same values:
data = {0, 0, 0, 0, 0, 0, 0, 0, 0.7, 1, 1, 1, 1, 1, 1, 1, 1};f = ListInterpolation[data, Method -> "Spline", InterpolationOrder -> 3];f'[9]DerivativeFilter[data, {1}, InterpolationOrder -> 3][[9]]Plot the result of the filter on top of the derivative of the interpolating function:
Plot[
Evaluate[Derivative[1][f][x]],
{x, 1, Length[data]},
PlotRange -> All,
Epilog -> {Red, PointSize[0.025], MapIndexed[Point[{First[#2], #1}]&, DerivativeFilter[data, {1}, InterpolationOrder -> 3]]}
]Derivative filtering of a binary image gives a grayscale image of a real type:
d = Image[DiskMatrix[10, 81], "Bit"];ImageType[DerivativeFilter[d, {1, 1}]]DerivativeFilter is a linear filter:
list1 = {1, 1, 1, 1, 1, 0, 0, 3, 12, 1, 0, 0, 0, 0, 0};
list2 = {2, 2, 2, 2, 1, 5, 4, 6, 2, 2, 1, 1, 1, 1, 1};
DerivativeFilter[list1 + list2, {1}] == DerivativeFilter[list1, {1}] + DerivativeFilter[list2, {1}]See Also
GaussianFilter Derivative RidgeFilter DifferentiatorFilter
Function Repository: NormalTexture
History
Introduced in 2010 (8.0) | Updated in 2014 (10.0) ▪ 2016 (11.0) ▪ 2025 (14.3)
Text
Wolfram Research (2010), DerivativeFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/DerivativeFilter.html (updated 2025).
CMS
Wolfram Language. 2010. "DerivativeFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/DerivativeFilter.html.
APA
Wolfram Language. (2010). DerivativeFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DerivativeFilter.html
BibTeX
@misc{reference.wolfram_2026_derivativefilter, author="Wolfram Research", title="{DerivativeFilter}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/DerivativeFilter.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_derivativefilter, organization={Wolfram Research}, title={DerivativeFilter}, year={2025}, url={https://reference.wolfram.com/language/ref/DerivativeFilter.html}, note=[Accessed: 13-June-2026]}