Spectral Analysis for Cell Size Measurement
Technique based on the Fourier analysis of cellular patterns,
with the use of Matlab and Photoshop
Implemented by JeanPhilippe Hébral
Under the supervision of Dr Joseph E. Shepherd
Detonation Physics Laboratory  GALCIT  Caltech
The context
The Detonation Physics Laboratory operates a 280 mm diameter, 7.3 meter long detonation tube, which is used to study detonations in combustible gaseous mixtures. Sooted foils, aligned with the axis of the tube, are used to record the detonation cell size. Those foils feature a cellular pattern, whose characteristic dimension (usually ranging from some mm's to some cm's) can be empirically related to dynamic parameters such as initiation energy and critical tube diameter.
In front of the detonation tube, a soot foil after a shot, featuring the characteristic cellular pattern
If you want to know more about the detonation tube operated at Caltech, the Explosion Dynamics Laboratory web site is likely to provide you with the information you need.
Until now, the detonation cell size was measured manually: around 10 measurements were made for each foil and a minimum, maximum and average cell width were obtained. The inherent irregularity of some mixtures together with the subjectiveness of this technique resulted in uncertainties of +/ 50%.
Thus, it was important to find a systematic way to determine the cell size, that would be repeatable and independent of the user.
The principle
The idea of the implemented technique is to compute a 2dimensional Fourier analysis of the digital picture of the foil, in order to highlight the dominant frequencies in the cellular pattern. The cells exhibit a periodicity, with which a relevant frequency and its harmonics can be associated. The Fourier Transform makes it possible to compute these frequencies.
Practically, this requires a digital picture to be taken under as uniform a light as possible. Edge detection is used on the image in order to highlight the cellular pattern, then a Power Spectral Density (PSD) calculation is made, and finally the relevant frequency information is extracted out of the PSD.
The image processing is implemented with Photoshop 5.5, and the computation with Matlab.
The procedure
Here's a quick and visual overview of the different steps involved in the Cell Size Measurement Programs.
For comparison purpose, the process has been applied to an actual soot foil photograph as well as to an idealized image, featuring a perfectly periodic cellular pattern.
 Actual photograph  Synthesis cellular pattern (ideal case) 
The original digital picture, after turning it into Black & White, looks like this: 

No picture expected here 
Working on a square image is more convenient, so we crop the original to keep only the most relevant area: 

No picture expected here 
After a preprocessing aimed to eliminate the noise (scratches, stream lines, unevenness of the soot,...) and to emphasize the edges, we get this: 


The edge detection procedure produces this image: 


The Power Spectral Density (PSD) of this pattern looks like this: 


Plot of the intensity at a fixed radius around the crossing point of the legs in the PSD. Notice the 4 peaks, corresponding to the intersection of the circle with the legs. 


The angular plot lets us know the angles of the legs. We can then compute a radial scanning along one of the legs. This plot shows the intensity variation along the leg which is at the angle 35 degrees 


A zoom in the neighborhood of the DC peak shows the fundamental and harmonics frequencies. 


One can prove that the spatial wave length, i.e. the cell width, is the size of the (square) image divided by the abscissa of the fundamental. Hence the cell width and its harmonics!
The results
Here's a set of results obtained from sooted foil pictures from J. E. Shepherd. This series of shots was performed in 1985 at Sandia National Laboratories, using a HydrogenAir mixture at T=20°C with equivalence ratio of 0.5.


Original sooted foil
The square limit indicates the cropped region used to compute the cell size. 
Cellular pattern edges before computation of the cell size 
HydrogenAir mixture  Equivalence ratio of 0.5 
T=20 °C 
The size of the bubble is proportional to the energy of the
corresponding harmonic.
The additional data point and error bar correspond to the cell
width
dimension obtained through manual measurement and statistical analysis by
J. E. Shepherd & S. R. Tieszen at Sandia National Laboratories:
 Lower Bound: 8.6 cm
 Most Probable Value: 11.5 cm
 Upper Bound: 14.4 cm

Note the multiplicity in the ordinates of the series of peaks (#1,#2,#5), (#3,#6), (#4,#7), highlighting the presence of some characteristic spatial wave lengths and their associated harmonics.
Recall that the harmonics of a fundamental frequency f are the frequencies 2f, 3f, 4f,... Therefore, the "harmonics" of a "fundamental" wave length λ are the wave lengths λ/2, λ/3, λ/4,...
In this case, the predominant wave length fundamental seems to be 10.4 cm (peak #7 at 5.1 cm is one of its harmonics). We will consider it as the dominant cell size of this foil. The coexistence of other frequencies will induce fluctuations around this "most recurrent" value.
The programs
Here's a brief description of the Matlab programs developped to achieve our goal. You can just browse through (the source code will appear in your webbrowser window, you don't need Matlab to read them), or enjoy running them on your computer by downloading the source code.
If clicking on 'Download' opens the file instead of copying it to your harddrive, right click on the link and select 'Save target as...' or 'Save link as...'; make sure that the file has the Matlab .m extension.
You can read them all, or use the links below if you want to go directly to a specific one...
 The main program:
 cellsizer: runs the whole procedure, calling the other programs according to the user's wishes
Read or Download
 The image processing programs:
 filtr: intended to filter the image in case of very noisy pattern
Read or Download
 matlabsobel: computes the edge enhancement of the picture, using the Sobel algorithm included in Matlab
Read or Download
 persobel: computes the edge enhancement of the picture, using a homemade Sobel algorithm
Read or Download
 The Fourier Transform Analysis programs:
 calcpsd: computes the 2dimensional Power Spectral Density of the picture
Read or Download
 disppsd: displays the PSD
Read or Download
 The data extraction programs:
 angplot: first step of the data extraction, an angular scanning of the PSD at a given radius
Read or Download
 radplot: second step of the data extraction, a radial scanning of the PSD at a given angle
Read or Download
 peak: final step of the data extraction, the computation of the cell size and its harmonics
Read or Download
 The multipurpose programs:
 center: seeks the brightest pixel of a picture, and thus finds the center of the PSD for instance
Read or Download
 grayscale: linearly stretches the gray scale of an image to 0255
Read or Download
The user guide
A user guide has been developed, documenting this procedure, so that anybody can benefit from the work already done, and progress further toward an even higher quality and reliability of results.
It contains a basic theoretical background to the 2dimensional Fourier analysis, the instructions for beginners to be able to use the involved programs (Matlab and Photoshop), the parameters I used to get my best results, a comprehensive tutorial example, and the description of all the developed programs.
The guide is in format .pdf, and can therefore be read either in this browser if you have Acrobat Reader or similar, or downloaded for printing for your convenience.
Before using the program(s), please read the guide and follow the tutorials. In order to get these programs to work,
you will need to have a working version of Matlab, be familiar with how Matlab works, download the programs (separately), make sure the programs are
in a directory that is in the Matlab path, and download or create some test images. Unfortunately, we are not able to offer
assistance with getting the programs running and cannot make any assurances about the results.
How to do it  The ultimate user guide is here! (Updated December 7th,2000)
References
 Shepherd, J. E., S. R. Tieszen (1986). "Detonation Cellular Structure and Image Processing". Sandia Report, Sandia National Laboratories, Albuquerque, NM, SAND860033.
 Tieszen, S. R., M. P. Sherman, W. B. Benedick, M. Berman (1987). "Detonability of H2AirDiluent Mixtures". Sandia Report, Sandia National Laboratories, Albuquerque, NM, SAND851263.
 Shepherd, J. E., I. O. Moen, S. B. Murray, and P. A. Thibault (1986). "Analyses of the Cellular Structure of Detonations". 21st Symposium (International) on Combustion, The Combustion Institute, Pittsburgh, PA, 16491658.
 Lee, J. J., D. Garinis, D. L. Frost, J. H. S. Lee, and R. Knystautas (1995). "Twodimensional autocorrelation function analysis of smoked foil patterns". Shock Waves (1995) 5:169174.
Last Updated April 2nd, 2007