Automated interference refractometer: An algorithm for locating an irregular fringe pattern

Automated interference refractometer: An algorithm for locating an irregular fringe pattern

AUTOMATED INTERFERENCE REFRACTOMETER: AN ALGORITHM FOR LOCATING AN IRREGULAR FRINGE PATTERN P.G. Jeavons Received February 1986; accepted May 1986...

364KB Sizes 0 Downloads 15 Views

AUTOMATED INTERFERENCE REFRACTOMETER: AN ALGORITHM FOR LOCATING AN IRREGULAR FRINGE PATTERN P.G. Jeavons

Received

February

1986; accepted

May 1986

ABSTRACT The inteference refractometer is potentially a valuable instrument for the measurement of gas concentrations, but its usefulness has been limited by the necessity to locate visually a patten of light and dark bands in order to obtain the reading. The instrument is therefore liable to human error and is unsuitable for continuous monitoring. An improved design has been Keywords:

Pattern

recognition,

interferometry,

gas analysis

INTRODUCTION An interference refractometer is used to determine the exact composition of gas mixtures by measuring the difference in the refractive indices between the mixture and some standard. An interference pattern is produced by passing a beam of light through both the gas mixture and the standard, the position of this pattern indicating the refractive index of the mixture. In the normal instrument this position must be determined visually. However, my colleagues in the Nuffleld Department of Anaesthetics (personal communication, B.R. Sugg, E. Palayiwa, W.L. Davies, R. Jackson, T. McCraghan, C.E.W. Hahn) have recently patented an improvement in which this process is automated by the use of a photodiode array and a microprocessor’. This paper describes the algorithm for determining the position of the fringe pattern from the output of the photodiode array. Interference refractometers have many advantages over other instruments for gas measurement, notably their simplicity and great stability; their use in anaesthetic gas measurement is well established*. However, the need for visual interpretation of a moving fringe pattern has made the results liable to human error and the device unsuitable for continuous use, and hence its use in the operating theatre has been discouraged. Attempts have been made to automate the instrumen$, but these involved the need for complex moving parts to track the motion of the fringes and an initial setting-up process to lock onto one fringe. The design which is briefly described below avoids these disadvantages by the use of a microprocessor and introduces the possibility that many extra Oxford University, Nuffield Department of Anaesthetics, John Radcliffe Hospital, Headington, Oxford 0x3 9DU, Reprints

from

patented, in which t/us location process is automated by the use of a microprocessor and an array of light-sensitive diodes. To implement this improvement it was necessary to design an algorithm which would reliably locate the pattern. This paper describes the approaches which were considered and the successful algorithm. Some examples are given to illustrate the power of thefinal algorithm to locate patterns even after severe distortion.

UK

features may be incorporated into the instrument: e.g. alarm signalling, data logging, remote data collection and process control. The automated refractometer contains a white light source such as a tungsten filament bulb, the light from which is passed through a diffuser and collimator and split into two beams by a parallel sided glass plate. One beam passes through a cell containing the gas to be analysed and the other through an identical cell containing a reference gas. The two beams are recombined and directed onto a light sensitive device such as a photodiode array, which produces a pattern of interference fringes which is converted into a sequence of digital values and stored for processing. The fringe pattern recorded by a photodiode array is typically of the shape indicated in Figure 1, which corresponds to the numerical values given in Table 1. There is a central bright area which appears as a large peak where the two beams interfere constructively for all wavelengths. On either side of this bright area is a dark band caused by destructive interference. Moving outwards there are several lesser peaks corresponding to the coloured bands produced by constructive interference in the various colour components of white light. As the sampled gas mixture varies, the refractive index of the sample

Table 1 recorded 0 22 30 37 37 3.5 47 35 48 29

The digital values for a typical fringe pattern by a photodiode array with 128 pixels 0 24 33 38 38 36 48 34 51 22

6 26 32 38 37 37 48 31 54 17

8 27 32 37 31 39 46 32 54 15

8 29 33 37 37 40 44 35 55 19

13 30 32 36 37 42 43 37 51 26

17 31 32 36 36 44 42 40 44 35

as

19 33 32 33 35 46 37 44 37 46

Mr P.G. Jeavons

@ 1987 Buttelworth 0141~5425/87/010157-04

& Co (Publishers) $03.00

Ltd J. Biomed.

Eng.

1987, Vol. 9, April

157

Aigorithmfor locatingjiinge pattern: P.G. Jeavons

Figure 1 A diagram of the optical path within the interferometer showing a typical fringe pattern. The following components are marked: 1, light source; 2, collimator; 3, beam splitter cell; 4, sample cell; 5, reference cell; 6, photodiode array; 7, microprocessor

will vary and this pattern will be displaced relative to its original position. The size of the displacement may be calibrated to indicate the concentrations of the sampled gas mixture, these concentrations may be computed and displayed. Obviously

it is crucial to the success of the method

that one should be able to determine the position of the fringe pattern reliably and accurately, even though the pattern may be distorted in several ways as shown in Figure 2.

METHODS A number Feature

of approaches

identification.

were considered. Method

1

A method of locating the fringe pattern would be to identify the position of some local feature in the pattern, such as the dark bands on either side of the central bright area. This may be done by calculating the convolution of the recorded pattern with some reference pattern such as a half-cycle sine-wave, in order to find the position with the greatest degree of matching. In this technique given by:

the matching

criterion,

M, is

k M(i)

=

2

q+-l)R(j)

i =

1, . . ) zv++z

j=l

where PO RC 1 K N

= = * =

value value length length

of pixel of reference pattern of reference pattern of photodiode array

Note that the reference pattern should be adjusted to have zero mean by subtracting an appropriate correction from each value, this ensures that the algorithm ignores any constant offset in the signal.

Figure 2 Distortions in the fimge pattern due to optical defects, noise, and failure of isolated photodiodes

168

J. Biomed. Eng. 1987, Vol. 9, April

This technique is computationally efficient and allows for some degree of self-validation in that the positions with a maximum value of M should be a

Algolithrnforlocntingfn’nge pattern: P.G. Jeavmas

constant distance apart (which depends only on the optical arrangements) and this may be checked before proceeding to identify the position of the pattern. However, this technique has the disadvantage that it relies on the identification of a local feature of the pattern and hence is susceptible to noise and distortion. It was found to be very difficult to identify reliably the same feature. Comparison

with reference

pattern.

Method

criterion,

M, is

=

2

P(i+j-I)

S(j)

i

=l,

Method 1

Method 2

Method 3

Number of pixels used to calculate each value of M

20

100

100

Total number

4720

15600

1

of multiplications

where P( 1 L c N

= = = =

value of pixel

length of half-cycle of square wave number of half-cycles (usually 5) length of photodiode array

This is extremely efficient computationally since it involves no multiplication (apart from the multiples of the wavelength which are computed once only); it is also insensitive to noise since it averages over a large portion of the array. It does rely on a knowledge of the distance between peaks (in order to set the value of L) but this has been found to be reliably fixed by the optics of the system.

k M(i)

A summary of the difference between the three approaches. The values given assume a photodiode array with 256 pixels and a pattern of fringes with peaks separated by 40 pixels

2

Another possible method would be to store the fringe pattern formed by sampling the reference gas and then, to determine the position of the best match and hence the shift, calculate the digital correlation of subsequent patterns with this stored pattern. In this technique the matching given by the equation:

Table 2

. . , N-k+1

j=l

where P( ) = value of pixel S( ) = value of stored pattern k

= length of stored pattern

N

= length of photodiode

array

Note that, as before, the stored pattern should be corrected to have zero mean. The technique has the advantages of fewer assumptions about the shape of the fringe pattern and it treats the pattern more globally, but it is not computationally efficient because it involves a considerable number of multiplications. It also has the disadvantage that it is necessary to identify the ‘region of interest’ in the original pattern in order to select the portion to be stored and used in the correlation sum. Finding this region of interest is equivalent to locating the position of the fringe pattern, which was the original problem. Convolution

with a square

wave.

Method

3

The third approach utilizes a simple global feature of the pattern, namely that it consists of a sequence of peaks and troughs with known intervals, decreasing in amplitude from a central maximum. This may be done by calculating the convolution of the pattern with an odd number of half-cycles of a square-wave to obtain the position of best match. The matching equation: c-l

M(i)= 2 j=o

criterion,

M, is now given by the

L

1 I=1

(-l)+(i+jL+&l)

i=l,..

) N-c*L+l

Three fringe patterns together with the values of M Figure 3 calculated using Method 3. Note that the maximum value of M remains at the correct position in spite of the distortions in the pattern

J. Biomed. Eng. 1987, Vol. 9, April

159

Algorithm for locatingftinge pattern: P. G. Jeavas

THE ALGORITHM For the reasons given above and summarized in Table 2, it was decided to adopt the third method and a program embodying this algorithm was developed in FORTRAN on a microcomputer and transferred to the microprocessor in the instrument. A listing of this program is available from the author. A number of examples of fringe patterns and the corresponding calculated values for M are given in Figure3. It will be seen that even after severe distortion this algorithm still successfully locates the pattern. It may be possible to increase the resolution of the instrument, without adding extra photodiodes, by using some form of numerical interpolation to identify the peak value of M at a point intermediate between adjacent pixels. To enable this modifi-

160

J. Biomed. Eng. 1987, Vol.9,April

cation to be made easily, the values of M at each point in the array are stored and are available for hrther processing at the end of the FORTRAN routine. It is also intended to include additional error checking and validation in the production model, in particuIar to check that the value of M had reached a certain specified lower limit; failure to do so might indicate a problem with the light source or the gas supply equipment.

REFERENCES 1 2 3

British Patent Application No. 84 15670, Gas analysis apparatus and method, 20th June 1984, Penlon Limited Hulands G.H. and Nunn J.F., Portable interference refractometers in anaesthesia, Br J Anaesth 1970, 42, 1051-1059 Diprose K.V. and Redmar. L.R., An automatic interference refractometer, Bf J Anaesth 1978, 50 1155-l 157