![]() |
Texas Instruments Audio and Video/Imaging Series |
Image correlation plays an important roll in vision systems and it can be used for autonomous navigation, tracking systems, detection of environment changes, and automatic pattern recognition. The correlation between images must usually be calculated in a very short period of time to be integrated in real-world applications. In this project, the operation of a 2D correlator is tested by implementing a pattern recognition system based on the real-time location of a vehicle model moving along a square-shaped area. This system uses some traditional filter designs for correlation-based pattern recognition.
Correlation evaluation begins when an input image is presented. Eventually it could need some preprocessing, which usually includes operations such as size adjustment, color space transformations, or image compression [1]. After preprocessing, we must calculate a 2D Fourier Transform of the image. In the case of an image consisting of M rows by N columns (M+N) we need a 1D Fourier Transform. A 1D Fast Fourier Transform (FFT) for N samples needs about Nlog2N complex products, thus a 2D FFT for an M*N image involves about N*M*log2MN complex multiplications [3],[5],[10]. We can achieve additional speed up considering that the input image is a real signal and hence its Fourier Transform is an Hermitic function (F(s) = F*(-s)) [3].
Then, the 2D Fourier Transform of the input image is multiplied by the conjugation of the filter's frequency response. We obtain the classical matched-filter (MF) when the Fourier Transform of the target is taken as a filter [7]. When all the magnitudes of the frequency response are set to 1 the filter is called a Phase-only Filter (POF). Also, we can use a circular harmonic component of the target's spectrum as a filter which leads to the Circular Harmonic Filter (CHF) [7]. These are only a sample of some of the filter designs available. The product between the spectrum of the image and the conjugation of the filter is used as input for a 2D Inverse Fourier Transform and the result is the desired correlation. The correlator implemented in this work follows Equation 1 for its calculations.
(1)
Where the terms represent:
C: | Correlation matrix |
ƒs: | Diagonal swap of the matrix's quadrants |
FFT, IFFT: | Direct and inverse 1D Fast Fourier Transforms along the rows of a matrix |
T: | Matrix transpose |
H(u,v): | Filter built from target image |
ƒ: | Input image (scene) |
max: | Maximum value of a matrix |
We can analyze the correlation result in several ways to make a decision about possible locations of the target in the input scene. The filter H(u,v) is previously calculated and stored in memory. We can calculate FFTs faster for real data if the values are arranged in a special way, because the length of the vector is reduced in half [6].
IFFT operations are performed without additional optimization while quadrants swap (ƒs) and matrix transpose (T) are accomplished using channels for Direct Memory Access (DMA) available in the IDK. Table 1 demonstrates results on the time invested in each process for the evaluation of Equation 1 using the DSP TMS320C6711.
Size of Input Image | 256x256 | 512x512 | ||
Operation | Time (s) | % | Time (s) | % |
Image acquisition ƒ | 0.00481 | 5.6 | 0.0250 | 6.2 |
First ƒs | 0.00015 | 0.1 | 0.0030 | 0.7 |
First FFT | 0.00637 | 7.4 | 0.0510 | 12.4 |
First T | 0.01002 | 11.7 | 0.0316 | 7.7 |
Second FFT | 0.01125 | 13.2 | 0.0369 | 8.9 |
Multiplication by H * (u,v) | 0.01193 | 14.0 | 0.0578 | 14.0 |
First IFFT | 0.01411 | 16.5 | 0.0744 | 18.1 |
Second T | 0.01049 | 12.3 | 0.0564 | 13.7 |
Second IFFT | 0.01187 | 14.0 | 0.0663 | 16.1 |
Third ƒs | 0.00400 | 4.7 | 0.0074 | 1.8 |
TOTAL | 0.08506 | 100 | 0.4109 | 100 |
Table 1: Processing time for each step involved in (1)
![]()
|
After binarizing the magnitude of the correlation matrix, a labeling is done in which an integer number is assigned to the pixels of each non-zero region of the matrix. Then, centers of mass are calculated for each of the labeled regions and those values are stored in memory. Finally, the display process consists of showing a mark (for example, a small cross) at each of the coordinates at the centers of mass stored in memory. All these operations must be done in real-time. We haveimplemented them with the DSP TMS320C6711 and tested in real-time conditions; mean values for processing time results for a single frame are demonstrated in Table 2.
Input Image Size | 256x256 | |
Operation | Time (s) | % |
2D Correlation | 0.08506 | 86.6 |
Binarization | 0.00338 | 3.4 |
Labeling and Center of Mass | 0.00919 | 9.4 |
Display | 0.00055 | 0.6 |
TOTAL | 0.09818 | 100 |
Table 2: Processing time for each stage involved in Figure 1
As Table 2 illustrates, additional processing for the pattern recognition system leads to an increase of 13.12 milliseconds which is about 13.4% of computational load. Most of the additional load is concentrated in the process of labeling and calculation of center of mass which takes 9.4% of the whole processing time.
![]()
|
This proposed application requires rotation invariant response of the filter because target location must be given independently of the orientation of the vehicle given that car models move in random directions. Circular Harmonic Filters (CHFs) exhibit this feature an were appropriated for this requirement.
(2)
we can calculate the order m radial component, ƒm(r) according to
(3)
From Equation 2, when the target is rotated by α degrees, all its CHCs will include a phase term of the form eimα. Using Equation 3, we can conclude that only radial components are affected when the target is scaled. Particularly, the first feature is used by CHFs to obtain rotation invariance, which guarantees a constant correlation peak value even when the target is rotated in the input scene. Order mth classical CHFs have the following impulse and frequency response:
(4)
(5)
There are many filter designs based on CH decomposition. Some of the most important versions include the following designs:
Phase-Only CHF: | ![]() |
Optimum Trade-Off CHF: | ![]() |
Phase-Derived CHF: | ![]() |
Where K is a tunable constant while m is the order of the filter.
We tested and evaluated the recognition performance of Classical, Phase-Only, Optimum Trade-Off, and Phase-Derived CHFs on the implemented system. Second order filters (m=2) lead in all cases to the best results.
![]()
|
We tested the performance of the four filter designs in real-time conditions with the pattern recognition system. The target was perfectly located almost all of the time independently of its orientation (Figure 3). This figure shows the intensity distribution of the correlation between the phase-derived CHF of target (Figure 2a) and the scene (Figure 3a). Sometimes the system lost the target, usually when the car model was located at the borders of the track, while a non-target vehicle was located at the central region. This situation is caused by a change in perspective.
In order to compare the general performance of the different filter designs, an 18 minute video clip of the cars moving randomly along the track was recorded and used as input for the recognition system. The video was processed with the recognition system, changing the filter design and the target, so a total of 12 specific situations were tested. The output of the pattern recognition system was recorded and the probabilities of success in target location were estimated by randomly sampling a representative number of output frames. These probabilities are shown in Figure 4.
![]()
|
From Figure 4, we concluded that Phase-Derived CHF shows the best performance. Also, when the car model in Figure 2c was used as target, the probability of success for all the filters was very high, close to 100%. This is because target in Figure 2c exhibits the highest mean intensity value among all three targets. Targets 2a and 2b showed a probability of detection close to 80% when detected with Phase-derived CHF. In the remaining 20% of the cases, when the target was missed, a false detection was generated due to the presence of the car model corresponding to Figure 2c, which is brighter than all the other images.
We idetified some limitations on the use of DSPs for digital image processing. DSPs are very well suited for basic image processing operations, such as binarization or spatial filtering, and they take advantage of software and hardware resources. However, the architecture of the DSP used in this implementation does not allow a peak performance when operations such as 2D filtering in frequency domain or 2D correlation are performed.
The implementation of the pattern recognition system allowed us to compare four filter designs that guarantee rotation-invariant results for correlation. Particularly, phase-derived CHFs achieved the best results when we measured probability of detection. Future work will be focused on including invariance to small perspective variations generated when the target is far away from the vertical axis of the camera. Also, a superior resistance to noise presence and changes in illumination will improve the performance of the system.
Henry Arguello Fuentes is associated in the Department of Electrical, Electronic and Telecommunications at the UIS. He received his B.S and M.S. degrees in 2000 and 2003, respectively, in electrical engineering from the same department.