Top Banner
496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals Hany Farid and Eero P. Simoncelli, Senior Member, IEEE Abstract—We describe the design of finite-size linear-phase separable kernels for differentiation of discrete multidimensional signals. The problem is formulated as an optimization of the rotation-invariance of the gradient operator, which results in a simultaneous constraint on a set of one-dimensional low-pass prefilter and differentiator filters up to the desired order. We also develop extensions of this formulation to both higher dimensions and higher order directional derivatives. We develop a numerical procedure for optimizing the constraint, and demonstrate its use in constructing a set of example filters. The resulting filters are significantly more accurate than those commonly used in the image and multidimensional signal processing literature. Index Terms—Derivative, digital filter design, discrete differen- tiation, gradient, steerability. I. INTRODUCTION O NE OF THE most common operations performed on sig- nals is that of differentiation. This is especially true for multidimensional signals, where gradient computations form the basis for most problems in numerical analysis and simu- lation of physical systems. In image processing and computer vision, gradient operators are widely used as a substrate for the detection of edges and estimation of their local orientation. In processing of video sequences, they may be used for local mo- tion estimation. In medical imaging, they are commonly used to estimate the direction of surface normals when processing vol- umetric data. Newton’s calculus provides a definition for differentiation of continuous signals. Application to discretized signals requires a new definition, or at the very least a consistent extension of the continuous definition. Given the ubiquity of differential al- gorithms and the ever-increasing prevalence of digital signals, it seems surprising that this problem has received relatively little attention. In fact, many authors that describe applications based on discrete differentiation do not even describe the method by which derivatives are computed. In this paper, we define a set of principled constraints for multidimensional derivative filter design, and demonstrate their use in the design of a set of high- quality filters. Manuscript received June 10, 2003; revised November 12, 2003. The work of H. Farid was supported by an Alfred P. Sloan Fellowship, a National Sci- ence Foundation (NSF) CAREER Grant (IIS-99-83806), and a departmental NSF Infrastructure Grant (EIA-98-02068). The work of E. P. Simoncelli was supported by an NSF CAREER Grant (MIP-9796040), an Alfred P. Sloan Fel- lowship, the Sloan-Swartz Center for Theoretical Visual Neuroscience at New York University, and the Howard Hughes Medical Institute. The associate editor coordinating the review of this manuscript and approving it for publication was Dr. Phillippe Salembier. H. Farid is with the Computer Science Department, Dartmouth College, Hanover, NH 03755 USA (e-mail: [email protected]). E. P. Simoncelli is with the Center for Neural Science and the Courant In- stitute of Mathematical Sciences, NewYork University, New York, NY 10012 USA (e-mail: [email protected]). Digital Object Identifier 10.1109/TIP.2004.823819 A. One-Dimensional (1-D) Derivatives The lack of attention to derivative filter design probably stems from the fact that the most natural solution—the differ- ence between adjacent samples—appears at first glance to be completely acceptable. This solution arises from essentially dropping the limit in the continuous definition of the differential operator (1) and holding fixed at the distance between neighboring sam- ples. These “finite differences” are widely used, for example, in numerical simulation and solution of differential equations. But in these applications, the spacing of the sampling lattice is chosen by the implementor, and thus can be chosen small enough to accurately represent the variations of the underlying signal. In many digital signal processing applications, however, the sampling lattice is fixed beforehand, and finite differences can provide a very poor approximation to a derivative when the underlying signal varies rapidly relative to the spacing of the sampling lattice. An alternative definition comes from differentiating a contin- uous signal that is interpolated from the initial discrete signal. In particular, if one assumes the discrete signal, , was ob- tained by sampling an original continuous function containing frequencies no higher than cycles/length at a sampling rate of samples/length, then the Nyquist sampling theorem implies that the continuous signal may be reconstituted from the samples (2) where is a (continuous) “sinc” function, is the continuous-time signal, and is its dis- cretely sampled counterpart. Assuming that the sum in the above equation converges, we can differentiate the continuous func- tion on each side of the equation, yielding (3) where is the derivative of the sinc function . Note that the derivative operator is only being applied to continuous functions, and . 1057-7149/04$20.00 © 2004 IEEE
13

496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

Sep 13, 2019

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

Differentiation of Discrete Multidimensional SignalsHany Farid and Eero P. Simoncelli, Senior Member, IEEE

Abstract—We describe the design of finite-size linear-phaseseparable kernels for differentiation of discrete multidimensionalsignals. The problem is formulated as an optimization of therotation-invariance of the gradient operator, which results in asimultaneous constraint on a set of one-dimensional low-passprefilter and differentiator filters up to the desired order. We alsodevelop extensions of this formulation to both higher dimensionsand higher order directional derivatives. We develop a numericalprocedure for optimizing the constraint, and demonstrate its usein constructing a set of example filters. The resulting filters aresignificantly more accurate than those commonly used in theimage and multidimensional signal processing literature.

Index Terms—Derivative, digital filter design, discrete differen-tiation, gradient, steerability.

I. INTRODUCTION

ONE OF THE most common operations performed on sig-nals is that of differentiation. This is especially true for

multidimensional signals, where gradient computations formthe basis for most problems in numerical analysis and simu-lation of physical systems. In image processing and computervision, gradient operators are widely used as a substrate for thedetection of edges and estimation of their local orientation. Inprocessing of video sequences, they may be used for local mo-tion estimation. In medical imaging, they are commonly used toestimate the direction of surface normals when processing vol-umetric data.

Newton’s calculus provides a definition for differentiation ofcontinuous signals. Application to discretized signals requiresa new definition, or at the very least a consistent extension ofthe continuous definition. Given the ubiquity of differential al-gorithms and the ever-increasing prevalence of digital signals, itseems surprising that this problem has received relatively littleattention. In fact, many authors that describe applications basedon discrete differentiation do not even describe the method bywhich derivatives are computed. In this paper, we define a setof principled constraints for multidimensional derivative filterdesign, and demonstrate their use in the design of a set of high-quality filters.

Manuscript received June 10, 2003; revised November 12, 2003. The workof H. Farid was supported by an Alfred P. Sloan Fellowship, a National Sci-ence Foundation (NSF) CAREER Grant (IIS-99-83806), and a departmentalNSF Infrastructure Grant (EIA-98-02068). The work of E. P. Simoncelli wassupported by an NSF CAREER Grant (MIP-9796040), an Alfred P. Sloan Fel-lowship, the Sloan-Swartz Center for Theoretical Visual Neuroscience at NewYork University, and the Howard Hughes Medical Institute. The associate editorcoordinating the review of this manuscript and approving it for publication wasDr. Phillippe Salembier.

H. Farid is with the Computer Science Department, Dartmouth College,Hanover, NH 03755 USA (e-mail: [email protected]).

E. P. Simoncelli is with the Center for Neural Science and the Courant In-stitute of Mathematical Sciences, New York University, New York, NY 10012USA (e-mail: [email protected]).

Digital Object Identifier 10.1109/TIP.2004.823819

A. One-Dimensional (1-D) Derivatives

The lack of attention to derivative filter design probablystems from the fact that the most natural solution—the differ-ence between adjacent samples—appears at first glance to becompletely acceptable. This solution arises from essentiallydropping the limit in the continuous definition of the differentialoperator

(1)

and holding fixed at the distance between neighboring sam-ples. These “finite differences” are widely used, for example,in numerical simulation and solution of differential equations.But in these applications, the spacing of the sampling latticeis chosen by the implementor, and thus can be chosen smallenough to accurately represent the variations of the underlyingsignal. In many digital signal processing applications, however,the sampling lattice is fixed beforehand, and finite differencescan provide a very poor approximation to a derivative when theunderlying signal varies rapidly relative to the spacing of thesampling lattice.

An alternative definition comes from differentiating a contin-uous signal that is interpolated from the initial discrete signal.In particular, if one assumes the discrete signal, , was ob-tained by sampling an original continuous function containingfrequencies no higher than cycles/length at a samplingrate of samples/length, then the Nyquist sampling theoremimplies that the continuous signal may be reconstituted from thesamples

(2)

where is a (continuous) “sinc”function, is the continuous-time signal, and is its dis-cretely sampled counterpart. Assuming that the sum in the aboveequation converges, we can differentiate the continuous func-tion on each side of the equation, yielding

(3)

where is the derivative of the sinc function. Note that

the derivative operator is only being applied to continuousfunctions, and .

1057-7149/04$20.00 © 2004 IEEE

Page 2: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 497

Fig. 1. The ideal interpolator (sinc) function (left) and its derivative (right). Dots indicate sample locations.

One arrives at a definition of discrete differentiation by sam-pling both sides of the above equation on the original samplinglattice

(4)

where is the -sampled sinc derivative. Note that the rightside of this expression is a convolution of the discretely sampledfunction , with the discrete filter , and thus the contin-uous convolution need never be performed. If the original func-tion was sampled at or above the Nyquist rate, then convolutionwith the sampled derivative of the sinc function will producethe correct result. In practice, however, the coefficients of thesinc derivative decay very slowly, as shown in Fig. 1, and accu-rate implementation requires very large filters. In addition, thesinc derivative operator has a large response at high frequen-cies, making it fragile in the presence of noise. Nevertheless,this solution (and approximations thereof) are widely used in1-D signal processing (e.g., [1]–[4]).

B. Multidimensional Derivatives

For multidimensional signals, the derivative is replaced withthe gradient: the vector of partial derivatives along each axisof the signal space. Consideration of this problem leads to anadditional set of constraints on the choice of derivative filters.Assume again that the sampled function has been formed byuniformly sampling a continuous function above the Nyquistrate. As before, we can reconstruct the original continuousfunction as a superposition of continuous interpolation func-tions. In two dimensions, for example, we have the following:

(5)

where is the sample spacing (assumed to be identical alongboth the and axes), is the continuous function,

is the discretely sampled function, and the interpolationfunction is a separable product of sinc functions

(6)

Again assuming that the sum in (5) converges, we can differ-entiate both sides of the equation. Without loss of generality,consider the partial derivative with respect to

(7)

where indicates a functional that computes the partialderivative of its argument in the horizontal direction. Again, onearrives at a definition of the derivative of the discrete functionby sampling both sides of the above equation on the originalsampling lattice

(8)

where -sampling the sinc function gives the Kroenecker deltafunction and is the -sampled sinc derivative. Onceagain, however, the coefficients of this filter decay very slowlyand accurate implementation requires very large filters.

Furthermore, the resulting two-dimensional (2-D) filter doesnot take into consideration the primary use of derivatives whenapplied to signals of more than one dimension (e.g., imagesor video). In the field of computer vision, directional deriva-tives are used to compute, for example, local edge orientation,motion (optical flow), or depth from stereo. In these applica-tions, one relies on the linear algebraic property of gradients thatthe derivative in an arbitrary direction can be computed from alinear combination of the axis derivatives

(9)

where is a unit vector [5]–[7]. In this regard,the separable sinc seems somewhat odd, because the resulting2-D -derivative filter has nonzero samples only along a rowof the input lattice, whereas the -derivative filter has nonzerosamples only along a column. The directional derivative at anangle of will contain nonzero samples from a single rowand column, as illustrated in Fig. 2.

Page 3: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

498 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

Fig. 2. Illustration of sinc-based 2-D differentiators. Shown are: (a) horizontal; (b) vertical; and (c) oblique (45 ) differentiation filters. The last of these isconstructed from a linear combination of the on-axis filters, as specified by (9).

Thus, both local differences and approximations to sincderivatives seem inadequate as discrete extensions of differ-ential operators. The solution to this dilemma is to consideralternative interpolation functions in (5). Two alternativeinterpolation solutions appear commonly in the literature: fit-ting polynomial approximations (e.g., [8]–[13]), and smoothingwith a (truncated) Gaussian filter (e.g., [14]–[17]). Thesechoices are, however, somewhat arbitrary, and the primarytopic of this paper is the development of a more principledchoice of interpolator function. We formulate the desiredconstraints for first-order differentiation, with the second-orderand higher order constraints building upon this constraint. Wethen develop a practical design algorithm for interpolator filterswith matched derivative filters of arbitrary order and length.

II. DERIVATIVE FILTER CONSTRAINTS

We start with an assumption that the interpolation functionshould be separable. This both simplifies the design

problem, and improves the efficiency of subsequent derivativecomputations. We have also explored nonseparable filters,but the marginal improvement in accuracy appears to be notworth the considerably higher computational expense. We alsoassume that the interpolator is symmetric about the origin.Finally, we assume that all axes should be treated the same. Insummary, the interpolator function is a separable product ofidentical symmetric 1-D functions.

Thus, for example, the 2-D interpolator is written as a sepa-rable product . The partial derivative (withrespect to ) of this interpolator is

(10)

where is the derivative of . With this interpolator, thesampled derivative (as in (8)) becomes

(11)

The discrete derivatives are computed using two discrete 1-Dfilters, and , which are the -sampled versions ofand , respectively. More precisely, differentiation in isaccomplished by separable convolution with the differentiationfilter along the -dimension and with the interpolatorin the -dimension.

How then do we choose ? Rather than trying to approximatethe sinc, which is virtually impossible with short filters, wedirectly impose the constraint of (9). That is, we seek filters suchthat the derivative in an arbitrary direction can be computedfrom a linear combination of the axis derivatives. This type ofrotation-invariance property was first examined by Danielsson,who compared various standard filter sets based on a similarcriterion [5]. It is important to note that giving up the sincapproximation means that the interpolator, , will not bespectrally flat. Thus, the resulting derivative filters will notcompute the derivative of the original signal, but of a spectrallyreshaped signal.

Furthermore, we note that the directional derivative filterscomputed using (9) will not necessarily be rotated versions ofa common filter (a property that has been termed steerability inthe computer vision literature [7]). If we were to include a steer-ability constraint with our assumption that the interpolator be aseparable product of symmetric 1-D functions, then the resultinginterpolator would necessarily be a Gaussian. As such, we chosenot to impose steerability as a primary constraint, although wediscuss its use as a regularizing constraint in the filter designstage in Section III.

A. First Order

We first compute the Fourier transform of both sides of (9),relying on the well-known fact that differentiation correspondsto multiplication by a unit-slope ramp function in the frequencydomain

(12)

where and are the discrete-space Fourier transformsof the 1-D filters and , respectively [2]

(13)

Page 4: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 499

This constraint should hold for and for allorientations, as represented by the unit vector .

We now define an error functional by dropping the factor ofand integrating the squared error in this equality over

the frequency domain, as well as the unit vector that specifiesthe direction of differentiation. In addition, in order to make theerror independent of the magnitude of the filters (e.g., to avoidthe trivial zero solution), we divide the expression by the totalFourier energy of the prefilter as shown in (14), at the bottom ofpage. Expanding the square in the numerator, we note that thecross terms (those containing ) will integrate to zero be-cause they are anti-symmetric. The remaining error expressionis as shown in the equation at the bottom of page. The integrandsin the numerator differ only by permutation of the axes, and thusthe value of the two integrals will be identical. Combining theseinto a single term (and dropping the irrelevant factor of two)gives

(15)

Finally, noting that is strictly real due to the assumedsymmetry of , we can factor it out of both numerator anddenominator expressions and eliminate it from the quotient

(16)

Thus, the 2-D constraint has been reduced to a 1-D constraint,in the form of a Rayleigh quotient. Equation (16) is the fun-damental error functional used within this paper, but we notethat the integral in the numerator can be augmented to includea weighting function over frequency. For applications in whichthe signals to be differentiated are known to occupy a partic-ular range of frequencies, inclusion of such a weighting functioncan improve differentiation accuracy over this range. Before dis-cussing the optimization method, we show how these same basic

concepts can be generalized to both higher order derivatives andhigher dimensions.

B. Second Order

Similar to the first-order derivative, the constraint embodyingthe desired linear-algebraic properties of the second-orderderivative is

(17)

In the Fourier domain, this constraint takes the form

(18)

where and are the Fourier transforms of the1-D filters , and , respectively. As before, wedefine the numerator of our error functional by integrating overboth frequency and orientation variables

(19)

This can again be simplified by noting that cross terms con-taining and are antisymmetric and will integrate tozero, leaving

(20)

As in the first-order case, the full error functional is formed bydividing by the -norm of the prefilter, as shown in (21), at thebottom of the page. The first term reduces to a 1-D constraint,but the second term does not, and thus we are forced to optimizethe full 2-D expression.

(14)

(21)

Page 5: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

500 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

C. Higher Order and Higher Dimensions

The constraint embodying the desired linear algebraic prop-erties of the th-order derivative is

(22)

where the right-hand side will require th order derivative filters. Following the same general framework as in

the previous two sections yields a constraint on the form of theprefilter and first- through th-order derivative filters.

The problem formulation defined above in two dimensionsextends naturally to higher dimensions. In full generality,dimensions, th-order derivatives come from expanding thefollowing expression:

(23)where we have used a numerical index variableas an axis label in place of the previous mnemonic labels ( , ).As before, this can be used to generate an error functional forfilter design.

III. DISCRETE DERIVATIVE FILTER DESIGN

With the desired constraints in place, we now describe a prac-tical method for designing derivative filters of a given orderand support (length). For notational clarity, we assume the de-sign of odd-length filters—the formulation for even-length fil-ters requires only minor modifications. We also assume thatthe prefilter and all even-order derivative kernels are symmetricabout the central tap and that all odd-order derivative kernels areantisymmetric.

A. First Order

In order to design a filter of length , we define a parametervector of length containing the independent pre-filter samples (the others are determined by the symmetry as-sumption). Similarly, we define a parameter vector of length

containing the independent derivative kernel sam-ples (the remaining samples determined by antisymmetry of thekernel). We construct a discrete version of the error functionalin (16)

(24)

where and are matrices whose columns contain the real(symmetric) and imaginary (asymmetric) components of thediscrete Fourier basis of size , such that gives thediscrete Fourier transform (DFT) of the (symmetric) prefilter,

TABLE IEXAMPLE FILTER TAPS FOR OPTIMAL DIFFERENTIATORS OF VARIOUS ORDERS

AND SIZES. SHOWN ARE HALF OF THE FILTER TAPS, THE OTHER HALF ARE

DETERMINED BY SYMMETRY: THE PREFILTER AND EVEN-ORDER DERIVATIVES

ARE SYMMETRIC AND THE ODD-ORDER DERIVATIVES ANTI-SYMMETRIC

ABOUT THE ORIGIN (SAMPLE NUMBER 0)

and gives the DFT of the (antisymmetric) derivative filter.This may be bundled more compactly as

(25)

with concatenated matrices , ,and vector . This error function is in the form of aRayleigh quotient, and thus the solution may be found usingstandard techniques. Specifically, we solve for the generalizedeigenvector associated with the minimal eigenvalue of and

(i.e., ). This eigenvector is then rescaled sothat the resulting prefilter has unit sum, and the prefilter andderivative filters are then constructed by symmetrizing or anti-symmetrizing the corresponding portions of (i.e., the prefilteris constructing by concatenating a reversed copy of with it-self, and the derivative filter is constructing by concatenating areversed and negated copy of with itself). We note that it wouldbe preferable to introduce the unit-sum constraint directly intothe error function, but this would destroy the Rayleigh quotientand would lead to a less elegant solution.

1) Uniqueness: The uniqueness of the solution depends onthe isolation of the minimal eigenvalue. In experimenting withthe design procedure, we found the minimal eigenvalue comeswithin the machine tolerance of zero when designing filters oflength samples. For larger filters, the second eigen-value also approaches zero. Thus, for filters of length ,an additional constraint must be invoked to uniquely constrain(i.e., regularize) the solution. As mentioned earlier, our primarydesign constraint does not guarantee that directional derivativefilters will be steerable. The sinc-based derivative filters are ex-treme examples of the failure of this property, as shown in Fig. 2.

Page 6: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 501

Fig. 3. Shown are: (a) horizontal; (b) vertical; and (c) oblique (30 ) differentiation filters. The last of these is constructed from a linear combination of the on-axisfilters, as specified by (9). These filters should be compared with those of Fig. 2.

One possible secondary constraint is that the low-pass filter beas flat as possible over the entire frequency range [4]. But wechoose instead a constraint that is more consistent with our em-phasis on rotation-invariance. In particular, we have chosen touse steerability as a secondary constraint in order to choose fromamongst those filters that satisfy the primary constraint. Specif-ically, we seek a solution of the form

(26)

where is any solution of minimizing (25) and is a ma-trix containing the zero-eigenvalue eigenvectors from (25). Theparameter vector is chosen to minimize the steerability errorfunctional

(27)

where is the 2-D rotation operator (implemented on adiscrete lattice using bicubic interpolation), and is the 2-DFourier operator. Note that this secondary steerability constraintdoes not interfere with the primary constraint of (25), sincethe two constraints are imposed in complementary orthogonalsubspaces. This nonlinear minimization is initialized withan optimally designed 11-tap filter padded with zeros toaccommodate the desired filter length. A gradient descent min-imization is then performed on in order to optimize, acrossall orientations, the steerability constraint of (27). The resultingminimization yields a pair of stable filters that perfectly satisfythe original constraint of (16) and are maximally steerable.

B. Second Order

Unlike the first-order filter design problem, the second-ordererror functional (21) does not have a closed-form solution. Assuch, we have adopted an iterative approach whereby first-orderfilters are used to initialize the design of the second-order filters.Specifically, assuming the first-order solutions for the prefilter

and the derivative filter , the error functional given in (21)may be simplified to

(28)

As before, a discrete version of the error functional on the filtervalues is written as

(29)

where contains one half of the full filters taps. The minimumof this quadratic error function is easily seen to be

(30)

This filter, along with the previously designed prefilter and first-order filter, are used to initialize a gradient descent minimizationof the full error functional of (21).

C. Higher Order

It is relatively straightforward to generalize the filter designfrom the previous two sections to filters of arbitrary order.Specifically, the design of a set of first- through th-orderderivative filters begins by designing a prefilter and first-orderderivative pair (Section III-A). The second- through th-orderfilters are then designed in an iterative fashion, each ini-tialized with the design of the previous orders. In general,given the prefilter and first- through -1st derivative fil-ters, the error functional in (23) reduces to the constraint

, from which the th-order derivativefilter is initially estimated as

(31)

for even-order derivatives; for odd-order, the estimate is givenby . This estimate, along with the lower orderderivative filters, are used to initialize a gradient descentminimization of the (nonlinear) error functional that describesthe desired derivative relationships [e.g., (23)].

Page 7: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

502 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

Fig. 4. First order derivatives: Fourier magnitude, plotted from �� to �. The dashed line corresponds to the product of a ramp and prefilter. The solid linecorresponds to the derivative filter.

D. Summary

A summary of the algorithm is as follows.

1) Choose dimensionality D, order N, and

kernel size L.

2) Choose number of Fourier samples K � L.

3) Precompute the Fourier matrices Fs and Fa.

4) Solve for first-order filters of size

min(L; 11), using (25).

5) If L > 11, solve for unique filters of size

L by numerically optimizing (27), initial-

ized with the L = 11 solution.

6) For each order n = 2 up to N:

a) solve for the nth-order filter using

(31);

b) numerically optimize (23) over all

filter orders 1 through n, initial-

izing with solution from part a), to-

gether with the filters designed for

order n � 1.

IV. RESULTS

We have designed filters of various sizes and orders—someexample filter taps are given in Table I.1 Each design producesa set of matched 1-D differentiation filters that are meant to beused jointly in computing the full set of separable derivativesof the chosen order. Note that when designing, for example,a second-order derivative, the accompanying first-order differ-entiation filter is not necessarily optimal with respect to thefirst-order constraint in isolation. Note also that although wehave constrained all differentation filters in each set to be thesame size, there is no inherent reason why different filters couldnot be designed with a different number of taps.

1Source code (MATLAB) is available at: [Online] http://www.cs.dart-mouth.edu/farid/research/derivative.html.

Page 8: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 503

Fig. 5. First-order derivatives: errors in estimating the orientation of a sinusoidal grating of varying spatial frequencies and orientations. The intensity image inthe left column shows the orientation error (brighter pixels correspond to larger errors) across all spatial frequencies—the axes span the range [��; �]. The plotsin the second and third columns correspond to the indicated radial and angular slices through this 2-D frequency space.

Shown in Fig. 3 are the horizontal and vertical derivatives andthe synthesized directional derivative at an angle of . Notethat these filters are much closer to being rotation invariant thanthe sinc-based derivatives of Fig. 2. In the following sections, theaccuracy of these filters is compared with a number of standardderivative filters.

A. First Order

Shown in Fig. 4 is the frequency response of severalfirst-order derivative filters and the product of an imaginary

ramp and the frequency response of their associated prefilters.If the filters were perfectly matched, as per our design cri-teria, then these responses should be identical. Shown arethe responses from our optimally designed 3-, 5-, and 7-tapfilters. For comparison, we show the responses of a variety ofcommonly used differentiators: a standard (binomial) 2-tap( , ), a standard (binomial) 3-tap( , ), a 3-tap Sobel operator[18] ( , ), a 5- and 7-tapGaussian ( , ), and a

Page 9: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

504 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

Fig. 6. First-order derivatives: errors in estimating the orientation of a sinusoidal grating of varying spatial frequencies and orientations (see caption of Fig. 5).Note that the scaling of the truncated sinc filter errors is different than the others.

Page 10: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 505

Fig. 7. Second-order derivatives: Fourier magnitudes, plotted from �� to �. Left side: first-order filter (solid line), compared with product of a ramp and theprefilter (dashed line). Right side: second-order filter compared with product of squared ramp and prefilter.

15-tap truncated sinc function (see Fig. 1). The optimal filters ofcomparable (or smaller) support are seen to outperform all of theconventional filters, usually by a substantial margin. Note that

the standard deviation of the 5- and 7-tap Gaussian filter wasset to 0.96 and 1.12 pixels, respectively. These values minimizethe rms error in the frequency response matching between the

Page 11: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

506 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

Fig. 8. Second-order derivatives: errors in estimating the orientation of a sinusoidal grating of varying spatial frequencies and orientations. Note that the scalingof the 3-tap filter’s errors are different than the others.

Page 12: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

FARID AND SIMONCELLI: DIFFERENTIATION OF DISCRETE MULTIDIMENSIONAL SIGNALS 507

prefilter and derivative filter, and thus are superior to mostGaussian differentiators used in the literature. For example,Barron et al. suggest a 5-tap Gaussian of width pixels[16].

Recall that our filters were designed so as to optimallyrespect the linear algebraic properties of multidimensionaldifferentiation. This property is critical when estimating, forexample, local orientation in an image (by taking the arctangentof the two components of the gradient). Figs. 5 and 6 show theerrors in estimating the orientation of a 2-D sinusoidal grating,

of size 32 32 with horizontal and vertical spatialfrequency ranging from 0.0078 to 0.4062 cycles/pixel. Theorientation is computed as a least-squares estimate across theentire 32 32 image. Specifically, we solve for the orientation

that minimizes

where the sum is taken over all image positions. The errors forour optimal filters are substantially smaller than all of the con-ventional differentiators.

B. Second Order

Shown in Fig. 7 is the frequency response of several first- andsecond-order derivative filters. Also shown for the first-order(second-order) derivative is the product of a negative parabola(squared imaginary ramp) and the frequency response of theprefilter. If the filters were perfectly matched, as per our de-sign criteria, then these responses should be identical to the fre-quency responses of the corresponding derivative filters. Shownare the responses from our optimally designed 3-, 5-, and 7-tapfilters. For comparison, we show the response from a standard3-tap ( , ,

), and a 5-tap Gaussian (as in the previoussection the width of the Gaussian is 0.96 pixels).

Shown in Fig. 8 are the errors from estimating the orienta-tion of a 2-D sinusoidal grating, , using second-orderderivatives. As before, orientation estimation was performedon gratings of size 32 32 with horizontal and vertical spa-tial frequency ranging from 0.0078 to 0.4062 cycles/pixel.is computed by applying the first-order derivative filter in thehorizontal and vertical directions, and is computedby applying the second-order derivative filter in the horizontal(vertical) direction and the prefilter in the vertical (horizontal)direction. The orientation is computed using a least-squares es-timator across the entire 32 32 image. Specifically, we solvefor the angle that minimizes

where the sum is taken over all positions in the image. Note thatthe errors for our optimal filters are substantially smaller thanthe standard and Gaussian filters.

V. DISCUSSION

We have described a framework for the design of discretemultidimensional differentiators. Unlike previous methods, weformulate the problem in terms of minimizing errors in the esti-mated gradient direction, for a fixed size kernel. This emphasison the accuracy of the direction of the gradient vector is advan-tageous for many multidimensional applications. The result is amatched set of filters—low-pass prefilter and differentiators upto the desired order—a concept first introduced in [19].

We have also enforced a number of auxiliary properties,including a fixed finite extent, symmetry, unit D.C. response(in the prefilter), and separability. Although we also testednonseparable designs (see also [20]), the marginal improvementin accuracy appears to not be worth the considerably highercomputational expense. Finally, we incorporated steerability asan orthogonal regularizing constraint for large filters, where theprimary constraint was insufficient to give a unique solution.

A number of enhancements could be incorporated into ourdesign method. We have ignored noise, and have not incorpo-rated a prior model on images. Simple spectral models can easilybe included, but a more sophisticated treatment might make thedesign problem intractable. We have also not explicitly mod-eled the image sensing process (e.g., [9], [10]). Again, simplespectral models could be included, but a more realistic treat-ment would likely prove impractical. The basic design methodmight also be optimized for specific applications (e.g., [21]).

Finally, the basic case of finite finite-impulse response (FIR)filter design can be extended in several ways. A number of au-thors have considered infinite-impulse response (IIR) solutions,for use in temporal differentiation [22], [23]. It would be in-teresting to consider the joint design of IIR and FIR filters fordifferentiation of video signals. It is also natural to combinemultiscale decompositions with differential measurements (e.g.,[24]–[27]), and thus might be worth considering the problem ofdesigning a multiscale decomposition that provides optimizeddifferentiation.

REFERENCES

[1] B. Kumar and S. C. D. Roy, “Coefficients of maximally linear, FIR dig-ital differentiators for low frequencies,” Electron. Lett., vol. 24, no. 9,pp. 563–565, Apr. 1988.

[2] A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Pro-cessing. Englewood Cliffs, NJ: Prentice-Hall, 1989.

[3] J. le Bihan, “Maximally linear FIR digital differentiators,” J. Circuits,Syst., Signal Processsing, vol. 14, no. 5, pp. 633–637, 1995.

[4] I. Selesnick, “Maximally flat lowpass digital differentiators,” IEEETrans. Circuits Syst. II, vol. 49, pp. 219–223, Mar. 2002.

[5] P. Danielsson, “Rotation-invariant linear operators with directional re-sponse,” in Proc. 5th Int. Conf. Pattern Recognition, Miami, FL, Dec.1980.

[6] J. Koenderink and A. vanDoorn, “Representation of local geometry inthe visual system,” Biol. Cybern., vol. 55, pp. 367–375, 1987.

[7] W. T. Freeman and E. H. Adelson, “The design and use of steerablefilters,” IEEE Trans. Pattern Anal. Machine Intell., vol. 13, pp. 891–906,Sept. 1991.

[8] J. M. S. Prewitt, Object Enhancement and Extraction. New York: Aca-demic, 1970, pp. 75–149.

[9] R. M. Haralick, “Digital step edges from zero crossing of second di-rectional derivatives,” IEEE Trans. Pattern Anal. Machine Intell, vol.PAMI-6, pp. 58–68, Jan. 1984.

[10] T. Vieville and O. Faugeras, “Robust and fast computation of unbiasedintensity derivatives in images,” in Proc. European Conf. Computer Vi-sion, Santa Margherita Ligure, Italy, 1992, pp. 203–211.

Page 13: 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. … · 496 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004 Differentiation of Discrete Multidimensional Signals

508 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 13, NO. 4, APRIL 2004

[11] J. de Vriendt, “Fast computation of unbiased intensity derivatives in im-ages using separable filters,” Int. J. Comput. Vis., vol. 13, no. 3, pp.259–269, 1994.

[12] M. Azaria, I. Vitsnudel, and Y. Y. Zeevi, “The design of two-dimensionalgradient estimators based on one-dimensional operators,” IEEE Trans.Image Processing, vol. 5, pp. 155–159, Jan. 1996.

[13] I. R. Khan and R. Ohba, “New design of full band differentiators basedon Taylor series,” Proc. Inst. Elect. Eng. Visual Image Signal Processing,vol. 146, no. 4, pp. 185–189, Aug. 1999.

[14] P. Meer and I. Weiss, “Smoothed differentiation filters for images,” J.Vis. Commun. Image Represent., vol. 3, no. 1, pp. 58–72, 1992.

[15] T. Lindeberg, “Discrete derivative approximations with scale-spaceproperties: a basis for low-level feature extraction,” J. Math. ImagingVis., vol. 3, no. 4, pp. 349–376, 1993.

[16] J. L. Barron, D. J. Fleet, and S. S. Beauchemin, “Performance of opticalflow techniques,” Int. J. Comput. Vis., vol. 12, no. 1, pp. 43–77, 1994.

[17] B. M. ter Haar Romeny, W. J. Niessen, J. Wilting, and L. M. J. Florack,“Differential structure of images: accuracy of representation,” in Proc.IEEE Int. Conf. Image Processing, 1994, pp. 21–25.

[18] R. Gonzalez and R. Woods, Digital Image Processing. New York: Ad-dison-Wesley, 1992.

[19] E. P. Simoncelli, “Design of multi-dimensional derivative filters,” inProc. 1st Int. Conf. Image Processing, vol. I. Austin, TX, Nov. 1994,pp. 790–793.

[20] H. Farid and E. Simoncelli, “Optimally rotation-equivariant directionalderivative kernels,” in Int. Conf. Computer Analysis of Images and Pat-terns, Kiel, Germany, Sept. 1997, pp. 207–214.

[21] M. Elad, P. Teo, and Y. Hel-Or, “Optimal filters for gradient-based mo-tion estimation,” in Proc. Int. Conf. Computer Vision, vol. 1, Kerkyra,Greece, Sept. 1999, pp. 559–565.

[22] B. Carlsson, A. Ahlen, and M. Sternad, “Optimal differentiators basedon stochastic signal models,” IEEE Trans. Signal Processing, vol. 39,pp. 341–353, Feb. 1991.

[23] D. Fleet and K. Langley, “Recursive filters for optical flow,” IEEE Trans.Pattern Anal. Machine Intell., vol. 17, pp. 61–67, Jan. 1995.

[24] G. H. Granlund, “In search of a general picture processing operator,”Comput. Graph. Image Processing, vol. 8, pp. 155–173, 1978.

[25] B. D. Lucas and T. Kanade, “An iterative image registration techniquewith an application to stereo vision,” in Proc. 7th Int. Joint Conf. Artifi-cial Intelligence, Vancouver, BC, Canada, 1981, pp. 674–679.

[26] P. Burt, “Pyramid methods in image processing,” in Proc. 1st Int. Conf.Image Processing, Austin, TX, Nov. 1994.

[27] E. P. Simoncelli and W. T. Freeman, “The steerable pyramid: a flex-ible architecture for multi-scale derivative computation,” in Proc. 2ndInt. Conf. Image Processing, vol. III, Washington, DC, Oct. 1995, pp.444–447.

Hany Farid received the B.S. degree in computer science and applied mathe-matics from the Unversity of Rochester, Rochester, NY, in 1988 and the Ph.D.degree in computer science from the University of Pennsylvania, Philadelphia,in 1997.

He joined the faculty at Dartmouth College, Hanover, NH, in 1999, followinga two year post-doctoral position in brain and cognitive sciences at the Massa-chusetts Institute of Technology, Cambridge.

Eero P. Simoncelli (S’92–M’93–SM’04) received the B.S. degree in physicsfrom Harvard University, Cambridge, MA, in 1984, and the M.S. and Ph.D.degrees in 1988 and 1993, respectively, both in electrical engineering, from theMassachusetts Institute of Technology, Cambridge.

He was an Assistant Professor in the Computer and Information ScienceDepartment, University of Pennsylvania, Philadelphia, from 1993 to 1996. Hemoved to New York University, New York, in September 1996, where he is cur-rently an Associate Professor in Neural Science and Mathematics. In August2000, he became an Associate Investigator of the Howard Hughes Medical In-stitute, under their new program in computational biology. His research interestsspan a wide range of topics in the representation and analysis of visual images,in both machine and biological systems.