Вы находитесь на странице: 1из 8

Precision Engineering 24 (2000) 62 69

A fast algorithm for determining the Gaussian filtered mean line

in surface metrology
Y.-B. Yuana,c,*, X.-F. Qianga, J.-F. Songb, T.V. Vorburgerb

Harbin Institute of Technology (HIT), Harbin, Peoples Republic of China, 150001

National Institute of Standards and Technology (NIST), Gaithersburg, MD 20899 USA
Guest Researcher, NIST

Received 30 November 1998; received in revised form 11 August 1999; accepted 16 August 1999

A fast recursive algorithm for determining the Gaussian filtered mean line was deduced using the central limit theorem and an
approximation method. This recursive algorithm uses a small number of multiplications per loop and otherwise such simple computer
operations as addition and subtraction, and therefore, can achieve a very high computational speed. Special cases are also presented in which
the relatively inefficient multiplication operation in the computer can be replaced by the efficient digit shifting operation, and the filtering
computational efficiency is enhanced further. High-order algorithms are proposed for practical use to improve filtering accuracy. The
forward filtering and backward filtering implementation of the recursive algorithm results in zero phase distortion of the filtered mean
line. A new relationship between the Gaussian filtering method and the classical 2RC filtering method is also established using this
algorithm. Published by Elsevier Science Inc.
Keywords: Surface roughness; Mean line; Digital filter; Recursive algorithm; Gaussian filter

1. Introduction
The mean line is the reference line used for surface
assessment. In surface metrology, the determination of the
mean line is a fundamental procedure for describing and
assessing surface characteristics. Almost all surface parameters are defined and calculated based on the mean-linesystem or M-system [1,2].
The least-squares method and the 2RC filter are the
traditional methods for determining mean lines [3]. The
former method produces mean lines that are sensitive to the
location of the sampling lengths on the surface profile and
are generally discontinuous from one cut-off length to the
next because of their being calculated piecewise for each
cut-off length within the entire evaluation length [3]. The
latter method distorts the true profile because of its nonlinear phase characteristic [3]. In the 1960s, Whitehouse [4,5]
worked on this problem and developed the concept and
Contribution of the National Institute of Standards and Technology,
not subject to copyright.
* Corresponding author. Tel.: 301-975-5356.
E-mail address: yibao.yuan@nist.gov (Y.-B. Yuan).
0141-6359/00/$ see front matter Published by Elsevier Science Inc.
PII: S 0 1 4 1 - 6 3 5 9 ( 9 9 ) 0 0 0 3 1 - 8

method of the phase-corrected filter, which laid a foundation

for zero-phase mean line filtering theory in surface metrology. In 1979, Raja and Radhakrishnan solved practical
problems in the implementation of the phase-corrected filter
using digital filtering techniques and designed several different types of digital filters used for processing surface
profiles [6].
The ISO 11562 standard proposed the Gaussian filtered
mean line as the reference line for profiles measured with
contact (stylus) instruments [7]. The Gaussian filter was
recognized as an optimal filter because of its zero-phase
characteristic and its minimum product of time width and
frequency width [8]. However, the low efficiency of the
algorithms for calculating the Gaussian filtered mean line
has been a problem for researchers wishing to use Gaussian
filters in their calculations.
The convolution integral method [9,10] is the most
widely used algorithm for calculating the Gaussian filtered
mean line, but it has low efficiency. In 1993, Luo et al. [11]
developed two- (2-D) and three-dimensional (3-D) Gaussian filtering algorithms using a Fast Fourier Transform
(FFT) algorithm under a project supported by the European
Community. In 1994, Vanherck [12] reported on an inter-

Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

national cooperation on phase-corrected Gaussian filtering.

In that report, a triangle impulse response and a series of
rectangular impulse responses were used to simulate the
impulse response of the Gaussian filter to improve the
computational efficiency. These approximate methods resulted in high computational efficiency with a trade off
against the accuracy of the Gaussian filter. It was reported
[12] that the determination of the Gaussian-filtered mean
line, when using a PC 486/25 MHz computer over five
cut-off lengths with a total of only 2000 data points, took 22
seconds. In 1996, Krystek presented a fast Gaussian filtering
algorithm in which the symmetry of the Gaussian function
and a recursive algorithm for Gaussian filtering coefficients
were studied to reduce the amount of multiplications in
Gaussian filtering. This approach greatly speeds up the
convolution algorithm [13]. Using Krysteks method, 15
seconds were taken for the Gaussian filtering for a surface
profile of seven cut-off lengths with a total of 9333 data
points on a PC 486/33 MHz computer. The computational
efficiency of Krysteks method is comparable to that of the
ordinary FFT filter algorithm [13]. In 1996, Hara et al. [14]
used the second-order Butterworth high-pass filter to simulate the transmission characteristic of the Gaussian filtering
method. The amplitude characteristic of that filter is very
close to the Gaussian filter. However, the phase characteristic is a nonlinear function, resulting in phase distortion, as
a cost of enhancing the computational efficiency.
Based on the central limit theorem, approximation methods, and digital signal processing principles, we present a
new recursive filter algorithm for determining the Gaussian
filtered mean line. This approach can ensure both amplitude
accuracy and a zero-phase characteristic and can also realize
high computational efficiency.


or [Eq. (4)]

aa yi k ab xi r




where ak, br, M and N are the constants of the digital filter.
From Eq. (3), it can be seen that the mathematical model
of the digital filter only deals with multiplication and addition operations. It is well known that the efficiency of
multiplication is much lower than that of addition. Therefore, the computational speed mostly depends upon the
number of multiplications performed once the mathematical
model of a digital filter is developed. As a result, reducing
or eliminating the multiplication operations is the key issue
for increasing the computational efficiency. This idea has
been successfully used for developing the FFT algorithm
[10] and is the approach by which we improve the efficiency
of the Gaussian filter.
2.2. Approximation of Gaussian function
The Gaussian function [Eq. (5)]
Gu e u


is easily used for designing a finite impulse response digital

filter (FIR DF) [9,10]. However, to reduce the number of
multiplications, an infinite impulse response digital filter
(IIR DF) would be very useful for realizing Gaussian filtering. Therefore, Eq. (5) is rewritten as follows: [Eq. (6)]
Gu 1 u 2

1 4 1 6
u u


1 u2


When u 1, [Eq. (7)]

Gu 1 u 2

2. Basic theory


which represents the simplest approximation of a Gaussian


2.1. Fast filtering principles

2.3. Central limit theorem

Given that the impulse response of a digital filter is h(i),
that the input and output digital signals are x(i) and y(i),
respectively, and that the frequency spectra obtained
through z-transform are H(ej), X(ej), Y(ej) correspondingly, then the input output relation of the digital filter can
be represented as [9,10] either [Eq. (1)]
yi xi*hi


where the * represents a convolution operation, or [Eq. (2)]

Ye j Xe j He j


The digital filter can also be represented by a difference

equation [9,10]; that is, [Eq. (3)]

a yi k b xi r




When a number of functions of relatively arbitrary forms

undergo convolution operations together, the results generally become smoother as the number of functions increases,
and the final result approaches a Gaussian function. The
strict description of this trend resulting from such a repeated
convolution is the central limit theorem [15].
Both the impulse response in the time domain and the
Fourier transform in the frequency domain of the Gaussian
filter are Gaussian functions. The transform of a self-convolution in the time domain is equal to a self-multiplication
in the frequency domain. Analogously, the inverse transform of a self-convolution in the frequency domain is equal
to a self-multiplication in the time domain. The results of
the self-convolution and the self-multiplication are also
Gaussian functions. That is, for multiplication: [Eq. (8)]


Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

e u e u e u

e mu

2.5. Construction of IIR type of Gaussian filter

If the function 1/(1 u2) is used as the approximation of
H(c/) in Eq. (13), then, we can define the function [Eq.

and for convolution (*): [Eq. (9)]


2 u2/m
e u e u e u



Because eu can be approximated by (1 u2)1, the term

emu can be approximated by (1 u2)m [Eq. (10)]

1 u 2 m 1 mu 2
1 mu 2

mm 1 4

m 2u 4

e mu remainders


If u remains constant and m approaches infinity, then it is

very interesting that the Gaussian term in Eq. (10) becomes
narrower, and from the central limit theorem, the remainders become less significant.
2.4. Gaussian filter
The weighting function of the Gaussian filter can be
given as [2] [Eq. (11)]

1 t/c2


where t is the independent variable in the spatial domain, c

is the cut-off wavelength (in the units of t), and is a
constant. If 0.4697, then when c, the transmission
ratio of the Gaussian filter is 50%.
The Fourier transform of the Gaussian function is also a
Gaussian function, and the amplitude characteristic of a
Gaussian filter can be obtained by means of the Fourier
transform of h(t), [Eq. (12)]

H 1 c/

1 / c 2

e f/fc


1 / c 2

Here, we do not care about the phase lags of the standard

2CR filter and its corresponding 2RC filter, because their
amplitude transmission characteristics can be implemented
without any phase distortion in the form of phase-corrected
or zero-phase-shift digital filters [8,16,17]. If we let 1 3,
then Eq. (14a) is the standard amplitude transmission characteristic of a 2RC filter for calculating the mean line in
surface roughness measurements.
To ensure that the transmission ratio H1(c/), when
c, is equal to 50%, the value of 1 in Eq. (14a) is
constrained to be equal to 1. Now a series of Gaussian filter
approximations can be constructed by self-multiplication of
the function Eq. (14a) in the frequency domain with the
same constraint [Eqs. (15), (16), (17), (18), (19)]

H 2 c /
1 2 c / 2

H 4 c /

e /c


so the amplitude transmission characteristic of its corresponding mean line filter with the form of a 2RC low-pass
filter can be calculated by this way [Eq. (14c)]

1 3 c / 2

1 4 c / 2

H 5 c /
1 5 c / 2

e c/


Alternatively, we write [Eq. (13)]

H c/ e c/


From Eqs. (12) and (13), it can be seen that this form of the
Gaussian filter is actually a low-pass filter.


The standard 2CR filter for surface metrology is a high-pass

filter whose amplitude transmission characteristic is [2] [Eq.

H 3 c /

ht e jtdt

1 1 c/ 2

H 6 c /
1 6 c / 2








The constraint yields 2 0.4142, 3 0.1892, 4

0.0905, 5 0.0443, 6 0.0219. The transmission characteristic deviations of these approximation filters from the
Gaussian filter are shown in Fig. 1.

Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69


Fig. 1. The transmission characteristic deviation of the theoretical approximation filters H2 H6 from the Gaussian filter.

Obviously, the higher the order of the self-convolution in

the time domain and self-multiplication in the frequency
domain, the smaller the approximation error and the higher
the approximation accuracy. For example, it can be seen
that the approximation error is about 4% for H3(c/), but
is no more than 0.5% for H6(c/ ).

This equation can also be written as [Eq. (21)]

A 4 2

1 4/ c 2

H a4 j H a4j
H a4 j 2

3. Gaussian digital filtering and the fast algorithm

Considering both the approximation accuracy and the
processing efficiency, the functions H4(c/) and H5(c/
) are selected as bases for the design of the Gaussian
digital filters. The accuracy of H5(c/) is higher than that
of H4(c/ ), but its efficiency is lower than the latter by
about a factor of 2, because it contains about twice as many

where 2/, c 2 /c, and A4(2) is formulated as

a conjugate pair of complex functions Ha4(j). A4(2) or
Ha4(j)2 is an amplitude-squared function.
According to the relationship between the Laplace transform and the Fourier transform, we let s j. Then [Eq.
A 4s 2 H a4s H a4s

3.1. Eight-cascade, zero-phase-shift, Gaussian mean line

The filter H4(c/) [see Eq. (17)] consists of a cascade
of eight A4(c/) filters, which we will call an 8-cascade
filter, where each one, A4(c/), is given by [Eq. (20)]
A 4 c /

1 4 c / 2

1 4/ c2 s 2


The poles of A4(s2) are located at s 1/4 c. Let

the pole in the left half s-plane 1/ 4 c, correspond
to Ha4(s). Then [Eq. (23)]

H a4s





Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

Ha4(s) is the prototype analog filter for designing a Gaussian

digital filter equivalent to H4. By using a bilinear transformation [9,10], the analog filter Ha4(s) can be transformed
into the digital filter H4(z) [Eq. (24)]
H 4 z

ri ri 1 b xi xi 1
2ri 1
y mN t i y mN t i 1 b rN t i
rN t i 1 2y mN t i 1

10441 z 1
100N c 1044 100N c 1044 z 1

where Nc is the number of sampled points within a cut-off

length c (or sampling length), H4(z) is an elementary cascade for the desired Gaussian filter, which is obtained by an
8-cascade of {H4(z) H4(z1)} assembled as a pair according to the zero-phase-shift filtering principle [8,16,17]. The
zero-phase-shift filtering principle is shown by the equation
[Eq. (25)]
H 4 z H 4 z 1 zej H 4e j 2 e j0


where (2/n), and n is the number of sampled points

within a spatial wavelength , n (/c) Nc. If the
Gaussian filter consists of an 8-cascade of such zero-phaseshift filters, each of them is expressed in the spatial domain
by difference equations [Eqs. (26), (27)]
ri a ri 1 b xi xi 1

It can be seen that the number of multiplications in Eqs. (29)
and (30) are reduced to one-half of those used in Eqs. (26)
and (27). That means the computational efficiency is increased by nearly 2:1.
For the special cases when b 1044/(100Nc 1044)
2k the multiplication by 2k can be implemented as a digit
shift based on binary storage. Then, all multiplication operations left in the filter equations are replaced by bit shift
operations, so that the Gaussian filter algorithm achieves its
highest efficiency. The values of Nc that suit this condition
are [Eq. (31a)]
N c 1044 2 k 1044/100


as closely as possible, except for integer round-off. From

Eq. (31a), when [Eq. (31b)]
k 5, N c 324


k 6, N c 658

y mN t i a y mN t i 1 b rN t i
rN t i 1


k 7, N c 1326



The fast algorithm can then be expressed as follows [Eqs.

(32), (33)]

where i 1, 2, 3, . . . , Nt; [Eqs. (28a), (28b)]

a 100N c 1044/100N c 1044


b 1044/100N c 1044


Nt is the total number of data points in a traversing length;

{x(i)} is the input of each filter;
{r(i)} is the medial result of each filter;
and {ym(i)} is the output of each filter.
For simplicity, the filtering initial state conditions may be
given as x(0) 0, r(0) 0, and ym(Nt) 0. Of course, other
values for these initial state quantities can also be selected,
because the end effects in a filtering process are unavoidable, no matter what the initial state quantities are. The end
effects converge to zero when the filtering algorithm is
stable. One strategy for dealing with them is to determine
first the spatial extent of the end effects, then throw the end
effects away. So the selection of the initial state quantities is
not important. After the eight-cascade zero-phase-shift filter, the center part of {ym(i)} becomes the Gaussian filtered
mean line for the measured surface profile. Eq. (26) is called
the forward filter, or the direct filter; whereas, Eq. (27)
is called the backward or correction filter.
Because a 1 2b, Eqs. (26) and (27) can be rewritten
as [Eqs. (29), (30)]

ri ri 1 2 k xi xi 1
2ri 1


y mN t i y mN t i 1 2 k rN t i
rN t i 1 2y mN t i 1
Eqs. (32) and (33) show that the Gaussian filtered mean line
can be calculated merely by using such simple operations as
addition, subtraction, and digital shifting.
3.2. Sixteen-cascade, zero-phase-shift, Gaussian mean line
Higher-order approximations of Gaussian mean line filters [H5(c/), H6(c/), etc.] can also be designed using
the same methods described above. For example, the Gaussian filter from H5(c /) consists of a 16-fold cascade of
zero-phase-shift filters or a 32-fold cascade of elementary
filters. The elementary filter is [Eq. (34)]
H 5 z

14931 z 1
100N c 1493 100N c 1493 z 1


Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

Each zero phase filter has the same general form as that
described in Eqs. (29) and (30). The only difference is [Eq.
b 1493/100N c 1493



then the new high-efficiency formula will be obtained in the

same manner as that shown in Eqs. (32) and (33), but the Nc
values will be different. When k 5, Nc 463; when k
6, Nc 940.
3.3. Transmission characteristics of the practical
Gaussian filters



1044 2 1 cos


100N c 2 1044 2 100N c 2 1044 2cos


where n is the number of sampled points within a spatial
wavelength , n (/c) Nc.
The sixteen-cascade zero-phase-shift Gaussian filters
transmission characteristic is [Eq. (37)]

H e



1493 2 1 cos


100N c 2 1493 2 100N c 2 1493 2cos



If Nc is chosen to be large enough, for example, Nc 200,
it can be shown that both digital approximation filters above
approach the Gaussian filtering characteristic well. For any
value of Nc, not just the special values that eliminate multiplication operations, both IIR type digital filters are fast
enough for mean line filtering. For example, if we assume
that Nc 1600, a typical set-up condition for one of our
instruments, then [Eq. (38)]

and [Eq. 39)]

H 4 e j Nc





Under the same condition, the transmission characteristic

deviations of the digital approximation filters [Eq. (40)]

H e




and [Eq. (41)]

H e




from the Gaussian filter are plotted in Fig. 2, which agree

with those shown in Fig. 1.
3.4. Example

The eight-cascade zero-phase-shift Gaussian filters

transmission characteristic is [Eq. (36)]

H e


H 5 e j Nc

and if we select values of Nc such that b 1493/(100Nc

1493) 2k; that is [Eq. (35b)]
N c 1493 2 k 1493/100



A simulated surface profile is shown in Fig. 3(a) that

consists of ten harmonic components with known frequencies ranging from 0.1/ c to 25/c. The detailed filter parameters are the cut-off length, c 0.8 mm, sampling
interval, 0.5 m, traversing length of the filtered profile,
7c 5.6 mm, and the total number of sampled data points,
Nt 11,200. The simulation results show that the mean
lines of H416, H532 and theoretical Gaussian filter calculated directly from the ten sinusoidal harmonic components
are almost identical, except for the two ends of the profile.
The small differences among these mean lines and their
amplified versions are shown in Fig. 3(b) and (c), respectively. They result from the transmission characteristic deviations (Fig. 2) of the two approximation filters from the
Gaussian filter. The end effect or transition for filtering is
unavoidable for all types of filters. The shapes of the end
effects are determined by their impulse responses and initial
states. However, the width of the end effect is mainly
determined by the impulse response of a filter. For Gaussian
filtering, the span of the end effect is about half of the
cut-off length; that is, c/2. Conventionally, we measure
unfiltered profile data with a traversing length of 7c and
use the 5c profile data in the center of the 7c profile for
surface assessment. Conversely, we omit the 2c profile
data distorted at two ends because of the end effect of the
filtering process. This approach can ensure the surface assessment accuracy. In this example, because Nc 1600, the
bit shifting approach is not used.
4. Summary
The computational efficiency for determining the Gaussian filtered mean line is mainly determined by four factors:
the complexity of the algorithm itself, the speed of the
computer, the quantity of data to be processed, and the
program language and programming technique. Of all these
factors, the first is a key issue for improving the computational efficiency.


Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

Fig. 2. The transmission characteristic deviations of the digital approximation filters H416 and H532 from the Gaussian filter.

Based on a simple approximation function and the central limit theorem, the complicated method for calculating
the Gaussian filtered mean line is considerably simplified.
The new recursive algorithms are accurate and are also fast,

because they calculate the Gaussian filtered mean line using

a small amount of addition, subtraction, and multiplication
or digital shifting operations without phase distortion. The
approximation method demonstrates a relationship between

Fig. 3. (a) Surface profile and its filtered mean lines; (b) the mean line deviations of the practical approximation filters from the Gaussian filter; (c) the
amplified mean line deviations of (b).

Y.-B. Yuan et al. / Precision Engineering 24 (2000) 62 69

the 2RC filtered mean line and Gaussian filtered mean line.
The amplitude transmission characteristic of a Gaussian
filtered mean line is well approximated by those of an 8RC
zero-phase-shift filtered mean line or a 16RC zero-phaseshift filtered mean line.
When using the eight-cascade, zero-phase-shift Gaussian
filter to process a 7-cut-off-length surface profile containing
11,200 sampled data points, only 0.66 seconds are required
using a PC 486/33 MHz computer in C language. For the
16-cascade zero-phase-shift Gaussian filter and 32-cascade
zero-phase-shift Gaussian filter, only 1.32 seconds and 2.64
seconds are taken for filtering under the same constraints,
respectively. For the same conditions, 18 seconds are estimated for Krysteks fast Gaussian filtering algorithm [13]
from the calculation, (11,200/9333) 15 s 18 s, where
9333 is the number of filtered data points, and 15 s is the
filtering time in Krysteks example. Because, the computational efficiency of Krysteks method is comparable to an
existing fast convolution method based on FFT techniques
[13], we conclude that the current approach is considerably
faster than that approach, as well.
The fast recursive algorithm described in this paper can
also be used in 3-D surface topography for determining the
Gaussian filtered mean plane, which can improve the computational efficiency even more. The algorithm for determining the 3-D Gaussian filtered mean plane will be discussed elsewhere.

[1] ISO 4287-1997, Geometrical product specifications(GPS)Surface
texture: Profile methodTerms, definitions and surface texture parameters,International Organization for Standardization, Geneva.


[2] ASME B46.1. Surface texture: Surface roughness, waviness, and lay.
New York: American Society of Mechanical Engineers, 1995.
[3] Whitehouse DJ, Reason RE. The Equation of the Mean Line of
Surface Texture Found by an Electric Wave Filter. Leicester, UK:
Rank Taylor Hobson, 1965: pp. 137.
[4] Whitehouse DJ. The Mean Line Found by a Phase-Corrected Wave
Filter. Leicester, UK: Rank Taylor Hobson, 1965: pp. ivii.
[5] Whitehouse DJ. Survey of reference lines in the assessment of surface
texture. Ann CIRP 1972;21(2): 26773.
[6] Raja J, Radhakrishnan V. Digital filtering of surface profiles. Wear
1979;57: 14755.
[7] ISO 11562-1996, Geometrical Product Specifications(GPS)Surface
Texture: Profile MethodMetrological Characteristics of Phase Correct Filters. International Organization for Standardization, Geneva.
[8] Yuan YB. Research on some fundamental theories of surface topography measurement. Ph.D. thesis, Harbin Institute of Technology,
Harbin, Peoples Republic of China, 1997.
[9] Hamming RW. Digital Filters, 3rd ed. Upper Saddle River, NJ:
Prentice-Hall, 1988.
[10] Shu Hu An. Digital Signal ProcessingTheory, Algorithm, and Realization. Beijing, Peoples Republic of China: Tsinghua University
Press, 1997.
[11] Luo NL, Sullivan PJ, Stout KJ. Gaussian filtering of three-dimensional engineering surface topography. Proc SPIE 1993;2101:52738.
[12] Vanherck P. STCs cooperative work on phase correct Gaussian
filtering in surface roughness measurement. Ann CIRP 1994;43(2):
599 601.
[13] Krystek M. A fast Gauss filtering algorithm for roughness measurements. Prec Eng 1996;19:198 200.
[14] Hara S, Tsukada T, Ito M. The conditions to apply the phase corrected
filter to traced profiles for roughness profiles (1st rept)Application
of the Gaussian high-pass digital filter. J Japan Soc Prec Eng 1996;
62(4):594 98.
[15] Weaver HJ. Applications of Discrete and Continuous Fourier Analysis. Malabar, FL: Krieger Publishing Company, 1992.
[16] Qiang XF, Yuan YB. An optimal digital filter model used in surface
roughness assessment. J Astronaut Metrol Measure 1988;6:1 6.
[17] Qiang XF, Yuan YB. A fast algorithm for finding the mean line in
surface roughness assessment. Chinese J Sci Instrum 1994;15(4):