IMPROVED FILTERING TECHNIQUES

Abstract: A method of and apparatus for ordinal filtering to separate unwanted signals such as noise and/or unwanted data from wanted signals such as wanted data in a complex signal conglomerate, wherein a succession of ordinal typically median filters (10-16) of increasing order or a median filter of adjustable order value is employed successively to ordinal filter first the raw input and then the progressively filtered output or the order value successively increases, and the output of the highest order filtering step is utilised to form at least part of the required output signal.

Description: Title: Improved Filtering Techniques. Field of invention This invention concerns the filtering of data to remove unwanted signals (e.g. noise) using one or more ordinal value filters. Background to the invention A real time ordinal value filter which determines which one of a set of R applied data values is the Nth -largest, becomes a median filter if R is odd and N is made equal to (R+D/2. In such a mode the filter provides as an output the "middle" value of the data set, having in general an equal number of other data values from the set larger and smaller than itself. The design and operation of median filters is described inter alia in U.S. Patents 4441165, 4439840, 4560974 and 45135440. In a simple case of linear array of data samples, if R=3 and N=2, the median value is the middle value of each three successive data values when the latter are sorted into order, beginning with the smallest and ending with the largest of each group of three. Since there is no averaging the median filter will remove spurious samples without degrading sharp transitions in the original sample series. Put another way, if the data samples represent a regularly sampled, time dependent signal, then the median filter has the property of not restricting the band width of the signal (which would degrade steep transitions in the original signal) but instead allows original signal transitions, representing long duration features, to be transmitted at full band width while substantially attenuating shorter durations spurious spikes, characteristic of electrical noise. The particular threshold at which such a filter will eliminate spurious signals but pass other signals is determined by the values of R and N. The greater the number of atypical samples that represent the spurious signal that is to be eliminated, the greater will have to be the value of R. However it has been found that a median filter, set to eliminate spurious signals represented by less than N samples for example, may actually introduce spurious signals into the filter output, if transitions of the original signal (relating to the information) are closer together than N sampling, intervals. Such spurious signals have the effect of increasing the number of samples representing the true signal event. This can have serious repercussions if the information is contained, at least in part, in the number of samples representing the amplitude excursions in the original. In an attempt to further enhance noise reduction, it has been proposed to repeat a median filtering step by applying the filtered signal from a first median filter, either to the input of the same filter again or to a second identical filter. At first it was thought that this might overcome the introduction of spurious signals as discussed above, but it has been found that this repeated ordinal value filtering does not remove all spurious signals introduced by the first ordinal value filter. Experiments have shown that the introduction of adventitious information into the filter output is reduced when the value of R is small. For example, in the case of a linear sequence of samples, if R=3, it would appear that there is little likelihood of any spurious additional signals appearing in the output. By appropriate choice of sampling interval, a median filter with a value of R=3 should not introduce any unwanted signal transitions in the filter output signal. However spurious signals represented by three or more samples will not be supressed, which when the sampling rate is high, may not result in very satisfactory noise reduction. Increasing the number of samples representing a given signal will not necessarily result in an increase in the accuracy of the filtered signal since the value of R has to be increased to take account of the greater number of sampling intervals which will have occured during a given spurious noise signal spike. The present invention seeks to overcome this apparently fundamental problem associated with ordinal value filters (and median filters in particular), when they are employed to remove unwanted signals, e.g. to clean up "noisy" electrical signals. Summary of the invention A method of ordinal value filtering to remove unwanted items of data from wanted items of data in a conglomerate of items, comprises the steps of (i) selecting a group of the items from the conglomerate, (ii) processing the selected items of data by successive ordinal value filtering with increasing order, to provide a first data output, (iii) selecting at least one different group of the items from the conglomerate and processing each different group by the same succession of increasing order ordinal value filtering to provide second and subsequent data outputs, and (iv) either applying the succession of data outputs as the filtered output or combining the succession of data outputs with other data, to form the filtered output signal. Where the conglomerate of items of data is in one dimension (e.g. a series of electrical signals whose amplitude varies, and spaced by distance and/or time) the selected groups may comprise groups of successive ones of the varying amplitude signals. Where the conglomerate of items of data is in two dimensions, (e.g. sampled values of an electrical signal arising from the scanning of a succession of lines in a television type scanner) the selected groups may comprise successive similar arrays of the sampled values, each group including sample values from two or more lines of the original scanning so that each group can be thought of as relating to a small area of the total scanned area. The present invention therefore provides a method of ordinal value (for example median) filtering to remove spurious noise spikes ranging in duration, area or volume, from one signal sample up to a maximum of (M-l) samples, in which the filter comprises a series of ordinal value filters (typically median filters), of increasing order, and the number of samples included in the groups applied to the succession of filters together with the geometrical arrangement of the samples in each group is selected to produce the derived properties of the overall filter. An overall filter can be referred to as a data-sieve. A data-sieve is designed as follows :- (1) Two masks are used to characterise any particular filter. A first mask S2 is used to identify all samples (items) to be included in the final filter of the series of filters. (2) The position of one of the samples encompassed by the first mask S2 is then chosen as the origin of the first mask, and a second mask SI (smaller than S2) is centered on the origin of S2 so as to encompass a subset of the samples within by S2. (3) The samples to be included in the first ordinal value filter (order 1) can then be identified as those outside SI but inside a circular window centred on the selected origin with a radius such that the window just includes those samples which lie just outside SI. (4) The samples to be included in the second ordinal value filter (order 2) can be identified by incrementing the radius of the circular window until the next subset of samples lying outside SI are also encompassed by the window. (5) The radius of the window is successively incremented to define third and subsequent windows, until a window is defined which encompasses all the samples lying between SI and S2, (which comprises the final ordinal value filter, order ) . If SI is vanishingly small, the sample values between SI and S2 for the first order filter, will simply compose the sample located at the origin, and since an ordinal value filter leaves such a sample unchanged, the first order filter can, in practice, be ommitted from the series. (In the case of a two dimensional lattice of samples, the first mask may, for example, be generally circular. In the case of a single dimensional array, this mask will be linear and be orientated so as to encompass a linear group of the samples. The mask shape does not have to be symmetrical. ) The data-sieve may be used as follows to filter a signal:- (a) A signal is first filtered using an ordinal value filter (commonly a median filter) of order 1. (b) Subsequently the output from the order 1 filter is filtered using an ordinal value filter of order 2, and thereafter each filter output is filtered successively with filters of increasing order to a final filtering step where the filter is of order M. Typically the data samples are arranged in either a one or a two dimensional regular array. The characteristics of a filter such as described above will not normally change in the course of scanning the full sample set. The method may be realised by providing a cascade of different ordinal value filters connected in series from ordinal value 1 to ordinal value M, with the output of each filter supplying the input to the next in the line, each filter in the line having a higher order than the previous one. Alternatively the method may comprise the steps of adjusting the order value of a single ordinal value filter through the range 1 to M, instead of using a plurality of different filters, and storing the output signal from each filtering operation whilst the filter value is changed to the next value, before it is supplied to the input of the changed filter. By storing each subsequently filtered signal and incrementally increasing the filter order from 1 to M, the final stored signal will comprise the desired filtered signal for output purposes . Whilst the series connection of M different filters to form a data-sieve allows a stored array of samples, in one or more dimensions, to be scanned, an alternative method is to have a plurality of data-sieves arranged in an array that simultaneously filter a corresponding plurality of input signals . The invention is applicable to low pass filtering (as so far described) but may also be applied to high pass filtering and band pass filtering. If a high pass filter is required, the output from the highest order filter must be subtracted from the raw data. The resulting signal will then only include all signals not eliminated by the data-sieve. If a band pass filter is required, the output from one of the ordinal value filters in the chain must be subtracted from the output of an earlier one. The invention also lies in an ordinal value filter in which the order value is adjustable, together with a means for incrementing the order by 1 after each successive application of data thereto, with storage means associated with the input (and/or output) of the filter, for storing the filtered signals and supplying the stored signal to the input of the filter for a subsequent pass through the filter. Preferably means for counting is provided to determine when a desired order value has been achieved, to terminate the process and release the stored information as an output signal. The invention also lies in apparatus comprising a plurality of ordinal value filters connected in series with the output of the first connected to the input of the second and so on with each successive filter having an increasing order from a low value associated with the first filter, to a high value associated with the last in the series. Typically the order value increments by 1 from one filter to the next in the series. The invention may be applied to any information bearing signal whether derived from an optical to electrical converter such as a camera (TV or solid state), or from a transducer detecting sound or vibration or other varying physical, chemical, electro-chemical, atomic or particle activity. The invention may be employed as a decoder to reliably separate pulses of one width from pulses of other widths and may for example be used in conjunction with pattern recognition apparatus to clean up information to be processed for pattern matching purposes . In this way the invention can be thought of as separating objects of one size from objects of another size. The invention will now be described by way of example with reference to the accompanying drawings in whic :- Figure 1 illustrates diagrammatically one embodiment of the invention, for simplicity a single dimension filter, and Figure 2 is a table which illustrates the advantage of using the series of ordinal value filters of the invention, relative to single and repeat median filtering of data samples from one dimensional data. In accordance with the invention the embodiment shown in Figure 1 comprises a cascade of conventional median filters each with a wider window (i.e. a higher order) than the previous one, connected together in series. The resulting (low pass) output is taken from the output of the final filter. A filter that processes samples, representing a signal in one dimension, with a mask window SI encompassing no samples, and a final mask window S2 encompassing 9 samples, with a central origin, is shown in Figure 1. The input signal is first filtered through an ordinal value filter 10 (in this case taking the median) of order 2, which encompasses 3 samples. The output is passed to a second conventional ordinal value filter 12, of order 3, and the output of this is passed to a third ordinal value filter 14, of order 4, whose output is passed to the fourth and last filter 16, of order 5. The filters are sometimes described in relation to the minimum pulse width R (i.e. pulse duration) which will be passed by the filter, and in this context, the first filter (of order 2) can be thought of as having a window width of three samples (i.e. R=3) Since it will remove pulses represented by less than two samples. The second filter (of order 3) has a window of width of five (i.e. R=5) samples and therefore removes pulses represented by less than 3 samples etc. The window widths R are not constrained to odd numbers of samples, although the nature of median filters and of single dimensional data streams makes it normally convenient to design median filters for use with single dimensional data streams in this way. A band pass filter can be produced by subtracting a later output from an earlier one, such as shown in Figure 1, in which a sampling amplifier constructed as a subtraction stage, is connected between Output 1 and Output 4. A high pass filter (sometimes referred to as a short pass filter) can be produced by subtracting the final output from the original input signal. The table of Figure 2 illustrates how the present invention is an improvement over a single or multiple pass median filter and also illustrates the high pass filter characteristic in the bottom line of the table. The top line of the table indicates nineteen sampling intervals along an electrical signal. Row 1 of the table illustrates numerical values which might be found at the different sampling points in a typical data signal. Thus at position 3 a spurious noise spike of one sampling pulse interval duration and having an amplitude of nine units is found. A similar noise spike of two sampling intervals duration (but having a smaller amplitude of seven units) is found at positions 7 and 8. A true information amplitude excursion is found at positions 12, 13 and 14 having an amplitude of three units and thereafter a typical drifting base line situation is illustrated with a spurious noise spike of three units superimposed over the base line in that positions 15 to 19 have values of 1, 1, 4, 1 and 1 respectively. If we consider this signal applied to a single median filter of window width 5 the output from the filter will be as shown in Row 2. Such a filter has a total window width of five sampling points (2N - 1) and from a study of Row 2 it will be seen that the whole of the true information amplitude excursion will be transmitted by the filter, an additional extra sampling interval will be added at position 15 to extend the trailing edge of the true amplitude excursion and filter will produce for the remaining sampling positions 16, to 19 a value of 1. This demonstrates how a simple median filter having a value of N=3 will be confused if a second significant excursion (whether a true one or otherwise) follows the trailing edge of a previous true excursion by a distance (i.e. number of sampling intervals) less than the N value of the filter concerned. In the example shown the N value is 3 and the sampling point spacing between the trailing edge of the true excursion at 14 and the leading edge of a noise spike at 17 is only two sampling intervals. As a consequence the trailing edge of the true pulse is extended by one sampling interval. Row 3 of the table illustrates the effect of repeating the median filtering using the same median filter (or another median filter having the same N value) and it will be noted that the corrupted value of the true information excursion in the original signal still appears in the output of the median filter. In fact were the signal to be passed through the median filter an infinite number of times, the width of the pulse beginning at position 12 would remain unaltered and the same incorrect pulse would appear at the output of the filter every time. If now a filter constructed in accordance with the invention is used the result will be as shown at Row 4 of the table. Here the first stage of the filter has an N value of 2 and the second an N value of 3 , so that the overall result will be exactly the same i.e. all pulses having a duration of less that 3 sampling intervals will be eliminated. Note however that in this case the length of the true information excursion in the original data is not corrupted by the addition of a false value at point 15 and the output from the second stage of the two stage filter is a true representation (within the limits of the sampling accuracy) of the original data. Note also that in both cases the last positions of the output signal also register level 1, since the change in base line value of the signal has extended over a period of more than three sampling intervals. However the spurious pulse sitting at position 17 is not seen and the value at this point is reduced to the pedestal value of 1, corresponding to the base line value at positions 15, 16, 18 and 19. Row 5 illustrates how the invention can be turned into a short pulse filter (i.e. all pulses of three sampling intervals or greater duration will be discarded and only pulses having shorter durations i.e. one or two sampling pulse intervals will be passed). This is achieved by subtracting the output corresponding to Row 4 of the table from the original data. In this way the noise spikes at position 3, positions 7 and 8 and at position 17 will appear in the output of the subtraction stage but the information excursion excursion bridging at positions 12, 13 and 14, and more importantly still the pedestal appearing at points 15 to 19 will be removed. It is of interest to note that the noise spike at position 17 is also shown at its correct amplitude of three units relative to the drifting base line, rather than the four units (relative to zero) as shown in Row 1. This simple example has been given to show how a cascade of steadily increasing window width median filters will give greater accuracy than when a single median filter is used whether or not the filtering step using the single filter is repeated. In an alternative arrangement (not shown) the four median filters shown in Figure 1 may be replaced by a single median filter (having adjustable N=value) provided the input information can be stored in a convenient memory (such as a "first in first out" (F.I.F.O.) memory device) after each passage through the filter, to enable it to be recycled through the filter a number of times with the N value of the filter being increased with each successive pass. The final resulting signal which passes into the memory after the last pass through the filter will correspond to the desired filtered version of the input signal and can be provided as the output signal by appropriately redirecting the output of the memory device away from the input of the median filter, to an output of the filter. This may be achieved automatically by a counter, which simply counts the number of cycles and gates the output of the memory device when the required number of cycles has been completed. Where the original data must be retained two "first in first out" (F.I.F.O.) memories may be provided, one to store the original data, and the other to act as a buffer and store the filtered version of the original data, and then the subsequent filtered versions of the contents of the buffer as it is recycled through the median filter. In this arrangement the output from the first memory may need to be recycled as it is read into the input of the median filter on the first occasion, so as to act as a refresh for the memory and thereby preserve the original data . The output from the second F.I.F.O. memory associated with the output of the median filter is applied to the input of the median filter after the original data has been secured in the first F.I.F.O. memory, to filter the first signal this time with a higher N value. . Recycling is continued with step-wise increase of N value as previously described and at the end of an appropriate number of cycles, the signals stored in the second F. I.F.O.memory will correspond to the final filtered signal whilst the original data remains in the first memory. If a high pass filter is required (i.e. the elimination of pulses of duration greater than a particular number of sampling intervals) then the two memories can be read out simultaneously to a suitable arithmetic stage adapted to subtract one from the other. If a band pass filter effect is required then the ' information in the first memory must be replaced with the output from the appropriate one of the median filter steps during the sequence of filtering steps and the output from the first and second memories again subtracted at the end of the process. If the first memory must preserve the original data for other purposes, a third memory will be required for storing the output from the intermediate median filtering step. One embodiment of the invention thus comprises a multiple stage filter comprising N - 1 original value filtering stages connected in series, each stage being a conventional median filter and the filter width of each stage is incremented by two starting with the first filter of width three. The output of the cascade filter behaves as a low pass data-sieve removing signals and noise that occupy widths of less than N sample intervals in the data stream. As described high pass and band pass filters can be constructed by subtracting the output of later stages from either the input or an intermediate stage. Although the methods and apparatus described herein have tended to imply the presence of electrical signals, it is to be understood that the invention is not limited to systems which employ/generate electrical signals but is equally applicable to any system, such as an optical system where the information is in the form of modulated light beams.

Claims: Claims 1. A method of ordinal value filtering a signal conglomerate to remove unwanted signals from wanted signals, comprising the steps of:- (i) ordinal value filtering at least a selected part of the signal conglomerate with a filter value N = n, (ii) subsequently ordinal value filtering the output the first filter with a filter value (n + x) and thereafter filtering the successive filter outputs with increasing filter values up to (N + ), and (iii) utilising the output of the final ordinal value filtering step where x = M as at least part of the final output signal. 2. A method according to claim 1, for removing unwanted items of data from wanted items of data in a conglomerate of items, comprising the steps of:- (i) selecting a group of the items from the conglomerate, (ii) processing the selected items of data by successive ordinal value filtering with increasing order, to provide a first data output, (iii) selecting at least one different group of the items from the conglomerate and processing each different group by the same succession of increasing order ordinal value filtering to provide second and subsequent data outputs, and (iv) either applying the succession of data outputs as the filtered output or combining the succession of data outputs with other data, to form the filtered output signal. 3. A method according to claim 2 wherein, where the conglomerate of items of data is in one dimension, such as a series of. electrical signals whose amplitude varies, and which are spaced by distance and/or times, the selected groups comprise groups of successive ones of the varying amplitude signals, whilst where the conglomerate of items of data is in two dimensions, such as sampled values of an electrical signal arising from the scanning of a succession of lines in a television type scanners, the selected groups comprise successive similar arrays of the sampled values, each group including sample values from two or more lines of the original scanning. 4. A method according to claim 1, applied to ordinal value, for example median, filtering to remove spurious noise spikes ranging in duration, area or volume, from one signal sample up to a maximum of (M-l) samples, in which the filter comprises a series of ordinal value filters, typically median filters, of increasing order, and the number of samples included in the groups applied to the succession of filters together with the geometrical arrangement of the samples in each group is selected to produce the required properties fro the overall filter. 5. A method according to any of claims 1 to 4 , utilising a data-sieve in which two masks are used to characterise any particular filter, wherein:- (i) a first mask S2 is used to identify all samples or items to be included in the final filter of the series of filters; (ii) the position of one of the samples encompassed by the first mask S2 is chosen as the origin of the first mask, and a second mask Si, smaller than S2 is centred on the origin of S2 so as to encompass a subset of the samples within by S2; (iii) the samples to be included in a first ordinal value filter of order 1 are identified as those outside Si but inside a circular window centred on the selected origin with a radius such that the window just includes those samples which lie immediately outside SI; (iv) the samples included in the second ordinal value filter order 2 are identified by incrementing the radius of the circular window until the next subset of samples lying outside SI are also encompassed by the window; and (v) the radius of the window is successively incremented to define third and subsequent windows, until a window is defined which encompasses all the samples lying between Si and S2, which comprises the final ordinal value filter of order . 6. A method according to any of claims 1 to 5, including the step of providing a cascade of different ordinal value filters connected in series from ordinal value 1 to ordinal value M, with the output of each filter supplying the input to the next in the line, each filter in the line having a higher order than the previous one. 7. A method according to any of claims 1 to 5, which includes the steps of adjusting the order value of a single ordinal value filter through the range 1 to M, and storing the output signal from each filtering operation whilst the filter value is changed to the next value before the stored signal is supplied to the input of the changed filter. 8. A method according to claim 5, utilising a plurality of data-sieves arranged in an array simultaneously to filter a corresponding plurality of input signals. 9. A method according to any of claims 1 to 8, wherein, for high pass filtering the output from the highest order filter is subtracted from the raw input signal, whilst for band pass filtering the output from one of the ordinal value filters in the chain is subtracted from the output of an earlier one. 10. A method according to claim 1, applied to filtering to remove spurious noise spikes ranging in duration from one signal sampling interval up to a maximum duration of M sampling intervals, comprising the steps of:- (i) median filtering the noisy signal with a filter value N = n, (ii) subsequently median filtering the output from the median filter with a filter value (n + 1) and thereafter successively with filters of values increasing by one at each step, and (iii) supplying the output of the final median filtering step where N = M as the output signal. 11. An ordinal vaue filter for carrying out the method of claim 1, in which the order value is adjustable, and means are provided for incrementing the order by 1 after each successive application of data thereto, together with storage means associated with the input and/or output of the filter for storing the filtered signals and supplying the stored signal to the input of the filter for a subsequent pass through the filter, and preferably means for counting to determine when a desired order value has been achieved,thence to terminate the process and release the stored information as an output signal. 12. Apparatus for carrying out the method of claim 1, comprising a plurality of ordinal value filters connected in series with the output of the first connected to the input of the second and so on with each successive filter having an increasing order from a low value associated with the first filter, to a high value associated with the last in the series, typically with the order value incrementing by 1 from one filter to the next in the series.

Inventors: BANGHAM JAMES ANDREW, BANGHAM, JAMES, ANDREW
Applicants: BANGHAM JAMES ANDREW, BANGHAM, JAMES, ANDREW
Application year: 1988
Main classification: H03H17
IPC codes: H03H17