All in Focus Image Generation based on New Focusing Measure Operators

To generate an all in focus image, the Shape-FromFocus (SFF) is used. The SFF key is finding the optimal focus depth at each pixel or area in an image within sequence of images. In this paper two new focusing measure operators are suggested to be used for SFF. The suggested operators are based on modification for the state of art tool for time-frequency analysis, the Stockwell Transform (ST). The first operator depends on Discrete Orthogonal Stockwell Transform (DOST) which represents a pared version of ST, while the other depends on Pixelwise DOST (P-DOST) which provides a local spatial frequency description. Both of the operators provides the computational complexity and memory demand efficiency compared to the operator depending on ST. A comparison between the suggested operators to operators based on ST are performed and showed that the suggested operators’ performances are as analogous to that of ST. Keywords—Focus Measure; All In Focus; Stockwell Transform; DOST


INTRODUCTION
SFF is an essential process to overcome a specific limitation of imaging systems which is the different depth of field (DOF) for each part in an image [1,2,3].The SFF solves this problem by providing fully sharp focused image.The SFF depends on measuring the optimal focus by using the focus measure (FM) operator, the main key, for shape estimating.The usual SFF methods compute optimal focus and its depth by applying FM operator on every area in a frame within a sequence of images and seek the optimal focused part along the sequence.The fully focused image can be constructed from merging the focuses optimal parts [4,5].
The sharp focused area is characterized by its energy for high frequency components, and The FM operator is used to measure the amount of energy in every part.Many FM operators have been proposed in the literature for both autofocus (AF) and SFF applications [5].In [6], the performance of multiple FM operators were examined.FM operators can be classified into two broad types: space domain and, frequency domain [7] [8], and others such as compression operators [5] [9].
The ST has been used as a base for FM operator in [10] and compared to other FM operators.The suggested idea is to measure the high frequency components energy located in a region of interest in the ST domain.The ST gives good results but it suffers from high computational cost.To overcome the problem of high cost for ST, a pared version of ST, DOST was provided in [11].The DOST provides efficiency in both computational cost and memory usage.Another version of DOST, pixel-wise local spatial frequency description (P-DOST) was given in [12].The P-DOST provides a tool for studying a specific frequency at specific pixel or area.Both of DOST and P-DOST have low computational cost and robustness to Gaussian noise.
In this paper two new FM operators are presented based on DOST and P-DOST for their low computational cost and memory usage.This paper is organized as follows.In section 2, the background for ST, DOST and P-DOST are presented.The proposed algorithm and FM operators are described in section 3. Finally, experimental results and conclusion are presented in sections 4 and 5 respectively.

II. BACKGROUND
ST has been shown as a generalization of the short-time Fourier transform (STFT), and the wavelet transforms [13].From [10] Where H is the 2D Fourier transform of h , x , and y are x-coordinates and y-coordinates in space respectively and x k , and y k are indices in the frequency along x-axis and y-axis.
From [14], it has been demonstrated that the ST redundancy comes from the equal sampling rate for both low and high frequency bands despite the fact of Nyquist criterion which states that the sampling rate depends on the frequency of the sampled data.A detailed study for the 2D-ST computational complexity for an image of size N N * is given in [12].It has been shown that ST has a computational cost of ) log ( The DOST suggested in [11] gives lower sampling rates for lower frequencies, and higher sample rates for higher www.ijacsa.thesai.orgfrequencies to solve the ST redundancy.It does so by building a set of N orthogonal unit-length basis vectors, each of which targets a particular region in the time-frequency domain.The regions defined by DOST are described by a set of parameters: v specifies the center of each frequency band (voice) p ,  is the width of that band, and  specifies the location in time.
DOST basis vectors for a particular band p and the parameters describing these basis vectors are defined in the following cases according to p where 1 ) is the center of the temporal window, and is the index of time interval.The time-frequency distribution for a family of vectors for a signal of length 16 is shown in Fig. 1 [15].
Calculating DOST is by taking the inner product the basis mentioned above and the input signal.By taking linear combinations of the Fourier complex sinusoids in band-limited subspaces and applying appropriate phase and frequency shifts, the 2D-DOST of [ y x h is defined in [12] as follows:  which was proved in [16].It is obvious DOST has less computational complexity required than for the 2D-ST.( y  x .Due to the variable size and limits of every DOST components at each band, the P-DOST is constructed by obtaining all components of DOST at each band ( From ( 4), the P-DOST corresponding response is occupying part of the DOST response space.Hence.It only requires size of, considering the negative side, ).The P-DOST response is referred to as the local domain (or spectrum).Since P-DOST selects only some components from the whole components set for DOST, a reduction will consequently go further for the computational complexity and memory demands.Consequently, the computational complexity for calculating P-DOST for single pixel is of order Considering the DOST calculations, it is obvious that P-DOST is less demanding for computational complexity than for DOST.

III. PROPOSED ALGORITHM
The algorithm suggests a stack of L frames  6) along all the L frames.
3) Find optimal Z by using (7).4) Repeat steps from 1 to 3 and merge all windows to get the generated fully focused image.
| P a g e www.ijacsa.thesai.org The formulas for calculating D FM is given as follows: The suggested D FM and P FM in the algorithm are based on DOST and P-DOST respectively and both of them measure the energy in frequencies components (frequency > 0 (DC)).A formula used for the suggested operators are given in ( 5) and (6).The operators are used to find the optimal focused window by measuring the highest response resulted by the operator.By merging the optimal focused window a fully focused image of the scene can be reconstructed.The idea for measuring the energy is the of the energy for the components within an area reflects the sharpness and hence the focusing.For P FM , the pixel ) ( 0 0 ,y x is selected at the center of the targeted window and used to represent the window.

IV. EXPERIMENTAL RESULTS
To evaluate the performance of the proposed algorithm and its robustness, three experiments for three sequences of images were conducted each of 256 gray levels.The first experiment contains sequence of 60 images of cone.The size for this sequence is 360*360.A simulation software was used to generate the images focused at different parts of the image Fig. 2a through 2d, the proposed algorithm has been used to construct all in focus image through  The first sequence of images was adopted and used for next evaluating tests.To evaluate the robustness of the algorithm against noise, three different measures were adopted to measure the all in focus image quantitatively.The first measure is the rmse (root mean square error) which is defined as follows To test the performance of the algorithm, the algorithm was applied to the sequence with added Gaussian noise of variance ranging from 0 to 10 and the window size is ranging from 4 to 64 Fig. 5 shows the results of this test. Where DOST due to using orthonormal set of basic functions as described above, has computational complexity of ) log (

Fig. 1 .
Fig. 1.Time-Frequency distribution for DOST components in positive direction The P-DOST suggested in [12] aims to find the voice frequency distribution for a pixel or region within the image.By choosing a set of ) , ( y x coordinates representing a single pixel or area, all the values of ] , , , [ y x v v y x s for all horizontal size, and same scene pictures an object at different focusing depths.The frames are divided into windows in(5) or ( this sequence.The resulting images are shown in Fig. 2e, 2f.The second experiment contains a sequence of 30 natural images, each of size 299*215.The sequence and the generated all in focus image are shown in Fig. 3.The third experiment contains also 30 natural images of size 215 * 215.Results are shown in Fig. 4.

Fig. 2 .
Fig. 2. Pictures from (a) to (d) are defocus cone images at different focusing level, e) SFF by using D FM , (f) SFF by using in focus image from the sequence of images

Fig. 3 .
Fig. 3. Pictures from (a) to (d) are defocus cone images at different focusing level, (e) SFF by using D FM , (f) SFF by using

Fig. 4 .
Fig. 4. Pictures from (a) to (d) defocus cone images at different focusing level, e) using D FM , (f) SFF by using

Fig. 5 .FigFMFM
Fig. 5. rmse against window size for different variance levels of gaussian noise