Optical Engineering, November 2009
Opt. Eng. 48, 119701 (2009) (5 pages)
2009 Society of Photo-Optical Instrumentation Engineers. All rights reserved.

Up: Issue Table of Contents
Go to: Previous Article | Next Article
Other formats: HTML (smaller files) | PDF ( kB)

Defect detection in aluminum foil by input-estimate-based chi-square detector

Ming Zhai

Shanghai Jiao Tong University, School of Electronic, Information and Electrical Engineering, No. 800 Dongchuan Road, Shanghai 200240 China

Zhongliang Jing,
Shan Fu, and
Xinbin Luo

Shanghai Jiao Tong University, Institute of Aerospace Science and Technology, No. 800, Dongchuan Road, Shanghai 200240 China

(Received: 19 May 2009; revised: 16 September 2009; accepted: 18 September 2009; published online: 4 November 2009)

Quality inspection of aluminum foil products plays an important role for aluminum foil manufactures. We present a method that uses input estimate (IE)-based chi-square detectors for defect detection in aluminum foil. It is assumed that the intensity of the aluminum foil image is Gaussian distributed, and the distribution of the defect intensity is different from the normal. Under these assumptions, Kalman filters with a constant velocity (CV) model are used to filter the image. We assume there is an unknown input in the CV model and the unknown input is estimated in the filtering process. The defects are determined by the chi-square test of the estimate of the unknown input. Experiments show that our technique is effective for most defects in aluminum foil. 2009 Society of Photo-Optical Instrumentation Engineers



Optical devices have been incorporated into mechatronic systems, and many machine-vision-based techniques have been used for quality control of products equipped with intelligence. In product quality control of aluminum foil manufacturing, quality inspection has to resort to machine-vision-based techniques for rigorous manufacture conditions. There are many machine-vision-based quality control techniques. In Ref. 1, edges in images are used to detect defects in ceramic tiles. In the textile industry, the Fourier analysis technique,2 morphology-based technique,3 wavelet-based technique,4 co-occurrence matrices, and Garbo-filter-based technique5 are used to detect defects in fabric surfaces. In the leather industry, oriented texture analysis is used to detect defects in leather.6 In Ref. 7, the infrared light reflected by the metal sheet is used to analyze the defects of metal sheets. However, each defect detecting technique is designed for a special target, so those techniques may not be suitable for defect detection in aluminum foil.

The techniques suitable for the detection of defects in aluminum foil should be designed according to the property of the aluminum foil product line. In our case, the foil goes through the product line at nearly five meters per second. The high resolution planar array camera is not suitable for this case, because high resolution planar cameras often have low frame rates, and the redundant information in the image sequence will affect image processing speed. Therefore, a line scan camera is used, and after every equal time span an image array can be obtained.

There are many types of defects in aluminum foil, some of which are shown in Fig. 1. Some defects have no apparent edges and some defects take up no more than 5  pixels [e.g., Figs. 1(a)1(c)1(d)1(g)], so edge-based methods may not perform well. Some defects have an intensity similar to the normal area [e.g., Fig. 1(a)], so a threshold-based method whose performance is often sensitive to its parameters may not perform well for this type of defect. Although some defects have direction properties [e.g., Fig. 1(k)], most defects have no direction property, so Garbo-filter-based techniques are not suitable. There is less texture and period information in foil images, so texture- or frequency-analysis-based methods often used in fabric defect detection are not suitable for our case. Furthermore, the intensity of the normal area may vary [e.g., Fig. 1(e)1(h)1(m)], and the sizes of the defects are different [e.g., Figs. 1(d)1(g)1(l)1(m)]; these may cause difficulty in defect detection.

Figure 1.

We collect a large number of foil images from the product line, and from these images the histogram of intensity is obtained. The histogram shows that the intensity of the foil images approximately obeys Gaussian distribution. Then we collect the images with labeled defects and compute the histogram only using the pixels labeled as defects. The two histograms show that the intensity distribution of the defect is different from the normal. This property can be used to detect defects in aluminum foil.

We apply an input-estimate-based chi-square detector, which is widely used in maneuver target tracking, to solve the defect detecting problem and obtain inspiring results. We assume the intensity of the aluminum foil image is Gaussian distributed, and use the Kalman filters with a constant velocity (CV) model to filter the image. By assuming there is an unknown input in the CV model, the unknown input is estimated in the filtering process. The defects are determined by the chi-square significance test of the estimate of the unknown input. Experiments show that our technique is effective for most types of defects, and the processing speed can satisfy real-time applications.

This work is organized as follows. Section I is the introduction; some basic notions are reviewed in Sec. II; Sec. III is the implementation; and Sec. IV is the experimental results and the conclusions.


In this section, we review some basic notions from the theory of Kalman filters, the constant velocity (CV) model, as well as the input-estimation-based chi-square detector that we need in the sequel.

A.Kalman Filter and Constant Velocity Model

The Kalman filter is a linear estimator based on the minimum mean squared error (MMSE).8,9 For the sake of less computation and better performance, it has been widely used since it was introduced. Here is a brief review of a Kalman filter.

Given a system equation and measurement equation as follows:

<b>x</b>(<i>k</i> + 1) = <b>F</b>(<i>k</i>)<i>x</i>(<i>k</i>) + <b>G</b>(<i>k</i>)<b>u</b>(<i>k</i>) + <i>v</i>(<i>k</i>),

<b>z</b>(<i>k</i> + 1) = <b>H</b>(<i>k</i> + 1)<i>x</i>(<i>k</i> + 1) + <i>w</i>(<i>k</i> + 1),

where x and z are state and measurement vectors, respectively; v and w are zero mean Gaussian noise with covariance Q and R; u is an input vector that is estimated; F, G, and H are state, input, and measurement matrices, respectively; and F, G, H, Q, and R are assumed known and possibly time varying. The two noise sequences and the initial state are assumed mutually independent. The previous constitute the linear Gaussian (LG) assumption.

The main equations of a Kalman filter are as follows:

overline(<b>x</b>)(<i>k</i> + 1|<i>k</i>) = <b>F</b>(<i>k</i>)overline(<b>x</b>)(<i>k</i>|<i>k</i>) + <b>G</b>(<i>k</i>)<i>u</i>(<i>k</i>),

overline(<b>z</b>)(<i>k</i> + 1|<i>k</i>) = <b>H</b>(<i>k</i> + 1)overline(<b>x</b>)(<i>k</i> + 1|<i>k</i>),

<i></i>(<i>k</i> + 1) = <b>z</b>(<i>k</i> + 1) − overline(<b>z</b>)(<i>k</i> + 1|<i>k</i>),

<i>P</i>(<i>k</i> + 1|<i>k</i>) = <b>F</b>(<i>k</i>)<i>P</i>(<i>k</i>|<i>k</i>)<b>F</b>(<i>k</i>)<sup>[prime]</sup> + <i>Q</i>(<i>k</i>),

<i>S</i>(<i>k</i> + 1) = <i>R</i>(<i>k</i> + 1) + <b>H</b>(<i>k</i> + 1)<i>P</i>(<i>k</i> + 1|<i>k</i>)<i>H</i>(<i>k</i> + 1)<sup>[prime]</sup>,

overline(<b>x</b>)(<i>k</i> + 1|<i>k</i> + 1) = overline(<b>x</b>)(<i>k</i> + 1|<i>k</i>) + <i>W</i>(<i>k</i> + 1)<i></i>(<i>k</i> + 1),

<i>W</i>(<i>k</i> + 1) = <i>P</i>(<i>k</i> + 1|<i>k</i>)<b>H</b>(<i>k</i> + 1)<sup>[prime]</sup><i>S</i>(<i>k</i> + 1)<sup>−1</sup>,

<i>P</i>(<i>k</i> + 1|<i>k</i> + 1) = <i>P</i>(<i>k</i> + 1|<i>k</i>) − <i>W</i>(<i>k</i> + 1)<i>S</i>(<i>k</i> + 1)<i>W</i>(<i>k</i> + 1)<sup>[prime]</sup>,

where the expression overline(<i>A</i>)(k+1|k) denotes the estimate of A at time k+1 estimated at time k; P and S are the state covariance and the innovation covariance; and W and are the filter gain and the innovation.

In the Kalman filter some kinetic models are often used to describe the kinetic property of the target, like the constant velocity (CV) model and the constant acceleration (CA) model.9 Given a target moving with constant velocity, the CV model is suitable to describe the kinetic property of the target. In the CV model, the state vector is x=(X,X[prime])T, where X is considered as displacement and X[prime] is the differential of X, i.e., velocity. If the measurement is displacement, the measurement matrix is H=(1  0). Otherwise, if the measurement is velocity then the measurement matrix is H=(0  1). In the CV model the state matrix is

<b>F</b> = ((1, <i>T</i>; 0, 1)),

where T is a time interval.

B.Input Estimation

The input-estimation (IE)-based chi-square detector is often used to detect target maneuvers in maneuver target tracking (MTT) applications.9,10,11,12,13,14 The detector consists of input estimation and chi-square significance tests. In the input estimation process two models are used, one is the nonmaneuvering model [Eq. (3)] and the other is the maneuvering model [Eq. (4)] with input u.

<b>x</b>(<i>k</i> + 1) = <b>F</b>(<i>k</i>)<b>x</b>(<i>k</i>) + <i>v</i>(<i>k</i>),3

<b>x</b>(<i>k</i> + 1) = <b>F</b>(<i>k</i>)<b>x</b>(<i>k</i>) + <b>G</b>(<i>k</i>)<b>u</b>(<i>k</i>) + <i>v</i>(<i>k</i>).4

Denote the present time by k and assume the target starts maneuvering at time k-s, that is, the maneuver onset time is k-s. The unknown inputs during the interval [k-s,…,k] are u(i), i=k-s,…,k-1. The state from the mismatched nonmaneuvering filter based on Eq. (3) is denoted by an asterisk:

overline(<b>x</b>)<sup>*</sup>(<i>i</i> + 1|<i>i</i>) = <b>F</b>[<i>I</i> − <i>W</i>(<i>i</i>)<b>H</b>]overline(<b>x</b>)<sup>*</sup>(<i>i</i>|<i>i</i> − 1) + <b>F</b><i>W</i>(<i>i</i>)<b>z</b>(<i>i</i>) [triangle, equals] <i>Phi</i>(<i>i</i>)overline(<b>x</b>)<sup>*</sup>(<i>i</i>|<i>i</i> − 1) + <b>F</b><i>W</i>(<i>i</i>)<b>z</b>(<i>i</i>) = [[product]<sub><i>j</i> = 0</sub><sup><i>i</i> − <i>k</i> + <i>s</i></sup> <i>Phi</i>(<i>i</i> − <i>j</i>)]overline(<b>x</b>)(<i>k</i> − <i>s</i>|<i>k</i> − <i>s</i> − 1) + [summation]<sub><i>j</i> = <i>k</i> − <i>s</i></sub><sup><i>i</i></sup>[[product]<sub><i>m</i> = 0</sub><sup><i>i</i> − <i>j</i> − 1</sup> <i>Phi</i>(<i>i</i> − <i>m</i>)]<b>F</b><i>W</i>(<i>j</i>)<b>z</b>(<i>j</i>)  <i>i</i> = <i>k</i> − <i>s</i>,…,<i>k</i> − 1,5

with the initial condition overline(<b>x</b>)*(ks|kss)=overline(<b>x</b>)*(ks|ks−1).

If the inputs are known, the hypothetical correct filter based on Eq. (4) yields estimates according to the recursion

overline(<b>x</b>)(<i>i</i> + 1|<i>i</i>) = <i>Phi</i>(<i>i</i>)overline(<b>x</b>)(<i>i</i>|<i>i</i> − 1) + <b>F</b><i>W</i>(<i>i</i>)<b>z</b>(<i>i</i>) + <i>G</i><b>u</b>(<i>i</i>) = [[product]<sub><i>j</i> = 0</sub><sup><i>i</i> − <i>k</i> + <i>s</i></sup> <i>Phi</i>(<i>i</i> − <i>j</i>)]overline(<b>x</b>)(<i>k</i> − <i>s</i>|<i>k</i> − <i>s</i> − 1) + [summation]<sub><i>j</i> = <i>k</i> − <i>s</i></sub><sup><i>i</i></sup>[[product]<sub><i>m</i> = 0</sub><sup><i>i</i> − <i>j</i> − 1</sup> <i>Phi</i>(<i>i</i> − <i>m</i>)][<b>F</b><i>W</i>(<i>j</i>)<b>z</b>(<i>j</i>) + <i>G</i><b>u</b>(<i>j</i>)]  <i>i</i> = <i>k</i> − <i>s</i>,…,<i>k</i> − 1.6

The innovations corresponding to the hypothetical correct filter [Eq. (6)] is

<i></i>(<i>i</i> + 1) = <b>z</b>(<i>i</i> + 1) − <b>H</b> overline(<b>x</b>)(<i>i</i> + 1|<i>i</i>).7

The innovations corresponding to the nonmaneuvering filter [Eq. (5)] is

<i></i><sup>*</sup>(<i>i</i> + 1) = <b>z</b>(<i>i</i> + 1) − <b>H</b> overline(<b>x</b>)<sup>*</sup>(<i>i</i> + 1|<i>i</i>).8

Combining Eqs. (5),(6),(7),(8) yields

<i></i><sup>*</sup>(<i>i</i> + 1) = <i></i>(<i>i</i> + 1) + <b>H</b>[summation]<sub><i>j</i> = <i>k</i> − <i>s</i></sub><sup><i>i</i></sup>[[product]<sub><i>m</i> = 0</sub><sup><i>i</i> − <i>j</i> − 1</sup> <i>Phi</i>(<i>i</i> − <i>m</i>)]<i>G</i><b>u</b>(<i>j</i>).9

Assuming the input to be constant over the interval [k-s,…,k-1], i.e., u(j)=u, j=k-s,…,k-1, yielding

<i></i><sup>*</sup>(<i>i</i> + 1) = <i></i>(<i>i</i> + 1) + <b>u</b> <i>Psi</i>(<i>i</i> + 1),10


<i>Psi</i>(<i>i</i> + 1) [triangle, equals] <i>H</i>[summation]<sub><i>j</i> = <i>k</i> − <i>s</i></sub><sup><i>i</i></sup>[[product]<sub><i>m</i> = 0</sub><sup><i>i</i> − <i>j</i> − 1</sup> <i>Phi</i>(<i>i</i> − <i>m</i>)]<i>G</i>.11

Based on Eq. (10), the input can be estimated via LS from

<i>y</i> = <i>Psi</i> <b>u</b> + <i>epsilon</i>,12


<b>y</b> = [(<i></i><sup>*</sup>(<i>k</i>); [vertical center dots]; <i></i><sup>*</sup>(<i>k</i> − <i>s</i> + 1))],13

<i>Psi</i> = [( <i>Psi</i>(<i>k</i>); [vertical center dots];  <i>Psi</i>(<i>k</i> − <i>s</i> + 1))],14

and epsilon, whose components are innovations [Eq. (7)], is zero mean with block-diagonal covariance matrix

<b>S</b> = diag[<b>S</b>(<i>i</i>)].15

The input estimate in batch form is

<b>u</b>-tilde = (<i>Psi</i><sup>[prime]</sup><b>S</b><sup>−1</sup><i>Psi</i>)<sup>−1</sup><i>Psi</i><sup>[prime]</sup><b>S</b><sup>−1</sup><i>y</i>,16

with the resulting covariance matrix

<i>L</i> = cov(<b>u</b>-tilde) = (<i>Psi</i><sup>[prime]</sup><b>S</b><sup>−1</sup><i>Psi</i>)<sup>−1</sup>.17

C.Chi-Square Significance Test

The chi-square significance test is used to test the significance of the estimation of input. A maneuver is declared if and only if Eq. (16) is statistically significant. The significance test for the input is

<i>xi</i> = <b>u</b>-tilde<sup>[prime]</sup><i>L</i><sup>−1</sup><b>u</b>-tilde.18

It is a chi-square distributed variable, i.e., xi~chi<sub><i>n</i><sub><i>u</i></sub></sub><sup>2</sup>, where nu=dim(<b>u</b>-tilde) is the dimension of vector <b>u</b>-tilde. If

<i>xi</i> > <i>chi</i><sub><i>n</i><sub><i>z</i></sub></sub><sup>2</sup>(<i>alpha</i>),19

then decide if a maneuver occurs, where 1−alpha is the confidence level.


In our product line the aluminum foil goes through the line scan camera at almost five meters per second. After each equal time span, an intensity image I with M rows and N columns is obtained. Statistics from a large number of foil images show that the intensity approximately obeys Gaussian distribution, and the intensity distribution of the defects is different from the normal. The intensity of every column (row) constitutes a time sequence that is Gaussian distributed, and the time sequence is considered as the measurement sequence of velocity in the CV model. Under these conditions, H=(0  1), the state matrix is

<b>F</b> = ((1, <i>T</i>; 0, 1)),

where T is a time interval, and the variance R should be set a bit larger than the variance of the intensity of the image I. Since every column (row) is considered as a measurement sequence of velocity in the CV model, the Kalman filter is used to filter the column from up to down. There are N columns in image I, so N Kalman filters are used correspondingly. Each column relates to one filter. In the filtering process of each filter, use the input-estimation (IE)-based chi-square detector to detect maneuvers. The position, where a maneuver is determined to occur, is considered to be the defect position. The detecting result is stored in the defect mask Sigma. Sigma is an MN matrix, and if the (i,j)'th point in image I is detected to be a defect point, then label the (i,j)'th element of Sigma with 1, otherwise label it with zero. It is found that the position of the defect areas detected by the IE detector will be behind the correct defects due to the detection delay of the IE detector, so it will lead to imprecise locations of defects. To solve the problem, we detect image I from the four directions: up to down; down to up; left to right; and right to left. So totally 2M+2N filters are used. Denote Sigmaup, Sigmadown, Sigmaleft, and Sigmaright as the defect mask from the detecting results of the four directions, respectively, and compute the logical OR of the four defect mask,

<i>Sigma</i> = <i>Sigma</i><sub>up</sub>|<i>Sigma</i><sub>down</sub>|<i>Sigma</i><sub>left</sub>| <i>Sigma</i><sub>right</sub>,20

where the operator | is logical OR. The defect mask Sigma is the final defect mask, and the defect area of image I is labeled in Sigma.

The Kalman filter needs initialization to determine the first state vector x(0) and the first state covariance P(0|0). Set x(0)=(0,X<sub>0</sub><sup>[prime]</sup>)T, where X<sub>[prime]</sub><sup>0</sup> is the average intensity of the image I. It is an alternative choice to set X<sub>0</sub><sup>[prime]</sup> equal to the intensity of the pixel where the filter started at if the defects seldom occur in the marginal area of the image. Set the first state covariance

<i>P</i>(0|0) = ((<i>R</i>, <i>R</i>/<i>T</i>; <i>R</i>/<i>T</i>, 2<i>R</i>/<i>T</i><sup>2</sup>)).

It is an alternative choice to set

<i>P</i>(0|0) = ((1, 0; 0, 1)),

which will lead to the convergence of the filter with a little delay.

Results and Conclusions

We apply our technique to detect defects in a defect image database that contains ten types of defects. The correct detection rate is 95%, and some results are shown in Fig. 2. Due to the detection delay of the IE detector, the defect mask will be a bit larger than the correct defect, but it will not affect the correct detection. For large defects, there will be a hole in the defect mask [e.g., Fig. 2(m)]. This shortcoming can be solved by some morphology operators. In fact, the sizes of defects in the foil are often small, so this shortcoming can be ignored for detecting and locating defects. Moreover, in our technique the four detecting processes of the four directions are mutually independent, so the four processes can be carried out in parallel. If carried out in parallel, the process time can be reduced by three quarters in theory. We test our technique on a PC with an Intel E4500 CPU (2.2  GHz) to detect the defect images of size 1024768. If in parallel, the average processing time is less 52  ms, if not, the average processing time is more than 110  ms.

Figure 2.

There are many maneuver detectors such as measurement-residual-based chi-square detectors, input-estimate-based Gaussian significance detectors, and generalized likelihood ratio test detectors. It will be our future work to study whether these detectors can be used in defect detection for aluminum foil and compare their performance.


  1. S. Vasilic and Z. Hocenski, “The edge detecting methods in ceramic tiles defects detection,” in Proc. 2006 IEEE Intl. Symp. Industrial Electron. 1, 469–472 (2006). first citation in article
  2. C. Chan and G. K. H. Pang, “Fabric defect detection by Fourier analysis,” IEEE Trans. Ind. Appl. 36(5), 1267–1276 (2000). [Inspec] [ISI] first citation in article
  3. J. K. Chandra, P. K. Banerjee, and A. K. Datta, “Morphological reconstruction operation for the detection of defects in woven fabric,” in Proc. 2008 IEEE Region 10 Colloquium Third ICIIS, pp. 1–5 (2008). first citation in article
  4. H. Fujiwara and Z. Zhang, “Visual inspection of textile surfaces with translation invariant wavelet shrinkage,” in Proc. 30th Ann. Conf. IEEE Industrial Electron. Soc., Vol. 2, pp. 1252–1257 (2004). first citation in article
  5. I. C. Baykal and G. A. Jullien, “In-camera defection of fabric defects,” in Proc. Intl. Symp. Circuits Syst., Vol. 3, pp. 933–996 (2004). first citation in article
  6. F. P. Lovergine, A. Branca, G. Attolico, and A. Distante, “Leather inspection by oriented texture analysis with a morphological,” in Proc. 1997 Intl. Conf. Image Process., Vol. 2, pp. 669–671 (1997). first citation in article
  7. H. Chen, U. K. Madawala, and J. Tham, “A low cost sensing technique for detecting on defects metal sheets,” in Proc. IEEE Intl. Conf. Industrial Technol., pp. 2286–2291 (2006). first citation in article
  8. R. E. Kalman, “A new approach to linear filtering and prediction problems,” J. Basic Eng. 82, 35–45 (1960). first citation in article
  9. Y. Bar-Shalom and X. R. Li, Estimation with Applications to Tracking and Navigation: Theory, Algorithms, and Software, Wiley, New York (2001). first citation in article
  10. J. Ru, A. Bashi, and X. R. Li, “Performance comparison of target maneuver onset detection algorithms,” Proc. SPIE 5428, 419–428 (2004). first citation in article
  11. Y. Bar-Shalom and K. Birmiwal, “Variable dimension filter for maneuvering target tracking,” IEEE Trans. Aerosp. Electron. Syst. AES-18(5), 621–629 (1982). [Inspec] [ISI] first citation in article
  12. S. S. Blackman, Multiple Target Tracking with Radar Applications, Artech House, Norwood, MA (1986). first citation in article
  13. J. R. Cloutier and C. F. Lin, “Maneuvering target tracking via smoothing and filtering through measurement concatenation,” J. Guid. Control Dyn. 16(2), 377–384 (1993). [Inspec] first citation in article
  14. X. R. Li and V. P. Jilkov, “A survey of maneuvering target tracking—part IV: decision-based methods,” Proc. SPIE 4728, 511–534 (2002). first citation in article


Full figure (24 kB)

Fig. 1. Aluminum foil defect images. First citation in article

Full figure (28 kB)

Fig. 2. Defect images and defect masks. First citation in article

Up: Issue Table of Contents
Go to: Previous Article | Next Article
Other formats: HTML (smaller files) | PDF ( kB)