Image Processing for Optical Metrology

Optical measurements offer the desirable characteristics of being noninvasive and nondestructive techniques that are able to analyze in real time objects and phenomena in a remote sense. Science areas that involve optical characterization include physics, biology, chemistry and varied fields of engineering. The use of digital cameras to record objects or a specific phenomenon permits the exploitation of the potential of that the associated images can be processed to determine one or several parameter or characteristics of what is being recorded. These images need to be processed and securely there will be a model associated with the optical metrology that will provide an insight or a comprehensive understanding of the image being analyzed. Matlab® is the suitable platform to implement image processing algorithms due to its ability to perform the whole processing techniques and procedures to analyze and image. At the same time it provides a flexible and a fast programming language for user constructing algorithms. In the present chapter we provide some fundamentals about image acquisition, filtering and processing, and some applications. Some applications are well-know techniques while others offer the state of the art in the field under study. All authors agree that Matlab® is a powerful tool for image processing and optical metrology. All algorithms and/or sentences used in this chapter are made in such manner so that they work in the Matlab® R2007b platform or superior. Matlab® is a trade mark of Mathworks Inc., from here on we will refer it as Matlab only. Also the Matlab functions and parameters used along the chapter are typed in italics and in apostrophes, respectively. Algorithms in present chapter are presented in two formats depending on the algorithm extension: 1) Image titles and/or figure captions for low algorithms extension; 2) Subsection ends for larger algorithms.

that the vision process totally depends on quality acquisition; this could be an analogical or digital.The analogical acquisition process is a representation of the object with several techniques like designing, painting, photography, and video.In a similar way, digital imaging acquisition is able to represent a real object, however object properties are presented in a discrete form.Every object characteristics are mapped from a real plane to a digital plane where a group of discrete values (i.e 1, 2, 3, …,) represent position, form, color and texture.

Acquisition and digital image representation
Image acquisition process in Matlab can be done by the use of either imread or getsnapshot functions for stored images or video, respectively.Each function stores the object representation in a discrete lxmxn array, where l can be related to color data; m and n indexes represent the image spatial coordinates.An example of a real image is shown in Figure 1a, and in Figure 1b, the representation in a matrix array of the selected area from the image.Digital images are described as a bidimensional f(x,y) function, where x and y represent the spatial coordinates.The f value at the (x,y) position point is proportional to the intensity or gray scale of the image.In Matlab, a digital image satisfies following conditions: first, spatial and gray scale values must be discrete; and second, intensities are sampling at 8 bits (255 values).

Image discretization
Image discretization is the process of converting an analogical image to a digital image; this process depends on the sampling and quantization stages.Correspondence between analogical and digital images is given by the number of pixels used.If the number of pixels is enough to satisfy the Nyquist criteria (Oppenheim et al., 1997), the acquired image is a satisfactory representation of the real object observed.Quantization is the process of assigning a color or gray discrete level to each sample.Therefore, image discretization quality depends on frequency sampling as in quantization levels used.It must be noted that Matlab only reads digital images.Acquisition process can be done with scanners, CCD cameras, etc.

Thresholding and high contrast image
Frequently, acquired images under real conditions present a background problem.When relevant foreground elements are mixed with low interest background ones.Another problem that hides the desired information is a low contrast image.Therefore, the use of algorithms that deals with can be implemented in order to enhance the images.Equalization, binarization and thresholding algorithm are alternatives that have proved to be successful.In the following subsection, a method for the conversion of color images into gray levels is presented.Next, by using histogram equalization, a high contrast image from the gray scale levels is obtained.Finally, binarization process by establishing a thresholding is described in order to get a two color image (black (0) and white ( 255)) from a gray level scale (Poon & Banerjee, 2001).

Histogram
Histogram is the graphical representation of pixels gray values distribution.Images can be classified according to its histogram as high, medium or low contrast images.A low contrast image has a histogram with a low fraction of all possible gray values, around less than 40% of the whole scale.A high contrast image has more than 90% of the gray values.
Color images can also be classified in accordance with its histogram by considering human ocular sensitivity to primary colors.This is given by the first component of the YIQ matrix: 0.299 0.587 0.114 , Where Y and RGB are the lumma components used in color television systems NTSC (that represents a gray scale in the YIQ space) and the primary components, red, green and blue, respectively.The histogram transformation for a color image is given by the following pixel to pixel operation:

Histogram equalization
Histogram equalization is the transformation of the intensity values of an image that is typically applied to enhance the contrast of the image.As an example, the contrast of the image of the figure 2a, can be handled by applying histogram equalization and it is shown in figure 3 with its respective histogram, this operation can be done by using the Matlab function histeq.In order to get the discrete values in a gsl, the following equation is used where k = 0,1,2,…, (L-1), L represents the gray level numbers into an image (255 as an example), n j is the frequency of appearance of an specific j-th gray level and n is the total number of pixels of the image.

Thresholding by histogram
Thresholding is a non-linear operation for image segmentation that consists in the conversion of a gsl image into a binary image according to a threshold value.This operation is used to separate some regions of the foreground of an image from its background.Thresholding operation can be done by using the Matlab function graythresh.Binarization may be considered as an especial case of thresholding as shown in figure 4. The Matlab function that binaries an image is im2bw.

Spatial filtering
In order to reduce noise or enhance some specific characteristics of an image some filters like high-pass, low-pass, band-pass or band-stop are used.These filters can be applied in the frequency domain (section 2.4) or in the spatial domain.Spatial domain filtering is described in this section.Filtering operations are directly applied to the image (pixel to pixel).The mathematical functions applied in the spatial domain are well known as convolution, and are described by (Mora-González et al., 2008)  where f, g,(x,y), (m,n) and MxN are the original image, the convolution mask or matrix, the original image coordinates, the coordinates where the convolution is performed, and the size of convolution mask, respectively.Equation ( 4) is applied by doing a homogeneous scanning with the convolution mask versus the whole image to be convolved.These filters are also known as Finite Impulse Response (FIR) filters because they are applied to a finite section of the spatial domain (In this case the finite section is the image).Equation ( 4) can be implemented in Matlab by using nested for loops, also conv2, fspecial or imfilter functions can be used too.These kinds of filters are dependent of the convolution mask form as is explained in the following two subsections.

Low-pass filters
Low-pass filters applied to images have the purpose of image smoothing, by blurring the edges into the image and lowering the contrast.The main characteristic of a low-pass convolution mask is that all of its elements have positive values.Some commonly used lowpass filters are: averaging, gaussian, quadratic, triangular and trigonometric.These mask are presented in a matrix form like where A, B and w are the amplitude, the width function factor and the weight function of the spatial filter, respectively.In order to determine the effectiveness of the masks of the equations ( 5) and (6), Magnitude Spectra (MS) are obtained to analyze the low frequencies allowed to pass by the filter and high frequencies attenuation.This is expressed as where ω and ℑ are the MS frequency component and the Fourier transform operator, respectively.
In figure 5, the MS of the convolution mask from equations ( 5) and ( 6) are shown.Spatial gaussian filter behavior is more stable because allows low frequencies to pass and also attenuate middle and high frequencies faster than other filters, as can be observed.The mask for nine elements is shown in table 1.It must be mentioned that the processing time slow down conforming the convolution mask increases.Spatial filtering also has a problem in the image edges, because they cannot be convolved and there are (M-1)/2 and (N-1)/2 lost information elements in x and y axes, respectively.By using the fspecial function, low-pass masks can be generated by applying the 'gaussian' or 'average' Matlab parameters.
Another mask types designed for signal processing can be implemented on image processing by a two dimensional extension.In figure 6 it is shown three different low-pass filters applied in the test image.

High-pass filters
High frequency components are mostly located in image borders, like fast tone changes and marked details.The main purpose of a high-pass filter is to highlight the image details for skeletonizing, geometrical orientation, contrast enhancement, and revealing hidden characteristics, among many others.One of the most common high-pass spatial filters is the high-boost that consists in an interactive subtraction process between the original image and low-pass filters.The weighting function for a 3x3 matrix is obtained by The differential filters are another kind of high-pass filters that get its weighting function based on the partial derivates applied to the image.The most usual differential filters are the gradient and laplacian, based on the following equations if the magnitude of the partial derivatives work with a 3x3 mask, then Other used filters based on gradients are the Sobel, Prewitt and Canny.The Sobel spatial filter uses the central weight constant k=2 (Pratt, 2001).Meanwhile the Pewwit space filter uses k=1.The Canny space filter uses two different thresholds for weak and strong edges detection (Canny, 1986).Table 2 shows the nine elements masks of the most utilized highpass filters.Figure 7 shows six examples of the application of these functions as high-pass filters to figure 1a.It is observed that the Canny filter is the most powerful edge detector filter.

Mathematical discrete transforms
Discrete transform analysis has played an important role in digital image processing.
Several transform types are applicable to digital image processing, but due to their optical metrology potential applications, Fourier and Radon transforms are presented in this chapter section.

Fourier transform
Discrete Fourier Transform (DFT) represents the change from spatial to frequency domain.
In convergent optical systems this transform represents the propagated optical perturbation from exit pupil to the focal point in a single lens arrangement.Equations ( 13) and ( 14) represent the DFT pair for the mathematical two dimensional (2D) model (Gonzalez, 2002) { } ( ) Table 2. Some 3x3 convolution masks g for high-pass differential filters (Bow, 2002).where (u,v), MxN and ℑ -1 are the Fourier space coordinates, the image size, the inverse Fourier transform operator, respectively.Matlab has fft2 and ifft2 special functions for equations ( 13) and ( 14), respectively, where FFT is the acronyms of Fast Fourier Transform.
Other functions of Fourier transforms are fft, ifft for one dimension, and fftshift for the shifting of the zero-frequency component to spectra center.An important characteristic obtained from the Fourier transform is that it gives the frequencies content of the image.Due to this property, frequency filter design is a very straight forward task.Low frequencies are located into the matrix around the central coordinates, while frequencies gradually increase as are spread out from its center in a radial form.This characteristic is ideal for frequency filtering (low-pass, high-pass, band-pass, and band-stop).The frequency filtering process consists in the multiplication between image Fourier transform with a binary circular mask.Figure 8 shows the filtered Fourier spectra and the resulting filtered images for a high-pass, low-pass, band-pass and band-stop.

Radon transform
Radon transform applied in pattern recognition or digital image processing may be considered as the image's gsl projection over a given angle with respect to x axis.The mathematical model of the Radon transform is (Bracewell, 1995) { } ( ) where ℜ, δ, R and θ are the Radon transform operator, the Dirac delta function, the distance from the origin to the profile line and the angle of direction of the same line, respectively.Each of these parameters can be observed in figure 9, Q is the origin of the profile line to be obtained (thick blue bold line).Equation ( 15) is implemented in Matlab with the special function radon.

Optical metrology fundamentals
Optical metrology is a field of physics that include theoretical and experimental methods to estimate physical parameters using the light wavelength as fundamental scale.

Optical interferometry
Optical interferometry is based in the light interference phenomenon to determine different physical variables.A typical application is in nondestructive optical testing that requires high accuracy.The interferometer is the optical system used by this technique, which allows by interfering fringes the estimation of deformation components, shapes, strains or vibrations in objects with polished or rough surfaces.According to users' requirements, different configurations of interferometers can be selected to measure displacements components.

Interference
Figure 10 shows the schematic of a common optical arrangement used in interferometry well known as Michelson interferometer.The beam splitter (BS) splits the incident collimated laser light in two wavefronts that propagate in different directions and are reflected by the plane mirrors M1 and M2 respectively, and then they are combined with the same BS to form an interference pattern that can be observed directly on the screen.where a 1 (x,y) and a 2 (x,y) are the amplitudes and its respective phases φ 1 (x,y) y φ 2 (x,y).The intensity at a point in the interference pattern is determined with the product of perturbation U multiplied by its complex conjugated U * , this is where I 1 (x,y)=a 1 2 (x,y) and I 2 (x,y)=a 1 2 (x,y) are the intensities for each wavefront and φ(x,y) is the phase difference between them, since these propagate along to different paths before the interference.
Due to cosine of equation ( 18), I(x,y) reaches its maxima when φ(x,y) corresponds to even multiples of π (constructive interference) and its minima for odd multiples of π (destructive interference) (Gasvik, 2002).In general, optical interferometry is applied to estimate this phase difference, which can arise due to geometrical variations or deformations in a testing object.In figure 11 are shown two synthetic interference patterns when is replaced a mirror: a) with tilt in y and defocus and b) with defocus and coma in the interferometer of figure 10.The phase difference involving the geometrical variations of the mirrors is given by φ(x,y)=4πΔz/λ, where λ is the wavelength of the illumination source and Δz is the shape phase difference introduced by the mirrors.Another way to generate fringe patterns is by replacing a mirror of the interferometer for a testing object with an optically rough surface that experiments a deformation.In this case, the interference fringe pattern is not observed directly on the screen as in the previous described case.The superposition of a wavefront reflected by a rough surface (object beam) with a regular wavefront (reference beam) as the reflected by a plane mirror in the Michelson interferometer causes that I 1 , I 2 and φ of equation ( 18) vary fast and randomly, normally obtaining a speckle pattern.In speckle pattern interferometry the fringe patterns are obtained by the correlation of two speckle patterns recorded using a CCD camera placed at the screen position of the interferometer for the object before and after a deformation Δφ(x,y).Assuming I i (x,y), I f (x,y) are the intensities of the speckle patterns for the initial no-deformed state and the final deformed state respectively, the fringe patter can be calculated by (Lehmann, 2001) and the phase difference involving the deformation of the object is given by Δφ(x,y)=4πz'/λ, where z' is the displacement of the object in z direction (Waldner, 2000).

Phase shifting
In order to determine the phase φ(x,y) from fringe patterns, is applied a procedure wellknown as phase shifting.For this procedure can be registered several images introducing a phase difference which experimentally is achieved with a piezoelectric (PZ) that modifies the optical path length of one of the beams.A widely used algorithm to calculate the phase employs four consecutive images shifted by π/2 (Huntley, 2001) 1 (,) (,) (,) t a n , (,) (,) where I a (x,y), I b (x,y), I c (x,y) and I d (x,y) are the intensities of the shifted images.Due to the inverse tangent, in this pattern arise an effect of wrapping in a 2π module; moreover can be affected by noise of high frequency in the case of speckle interferograms.If the interest of the user is to explore the reduction of speckle noise and phase unwrapping techniques can consults references (Sirohi, 1993) and (Ghiglia, 1998).
In figure 12 are shown the wrapped phases calculated with equation ( 20) using the fringe patterns presented in the section.

Image diffraction
The mathematical representation for a collimated wavefront passing through a convergent optical system until the focal point is given by the Fourier transform, as is observed in figure 13.By setting a diffraction grating in the entrance pupil of a convergent lens, a Fraunhofer diffraction pattern is obtained in the focal point (Goodman, 2005), given by ( ) where U o (u, v), r(x, y), A and λ are the complex amplitude distribution of the field in the back focal plane of the lens, the grating function, the amplitude of the monochromatic plane wave and the illumination wavelength, respectively.The result of equation ( 21) varies depending on the function of the grating.For our purposes, those functions are binary and sinusoidal.Fig. 13.Diagram for performing the Fourier transform of a grating with a positive lens.

Binary grating
A binary grating can be mathematically represented by a Fourier series expansion of a step function (fstep) bounded in the [0,T] interval, see figure 14a.The function is defined by: 2 2 ,0 (,) , 0, and its Fourier series expansion is given by (Tolstov, 1962)  where T and a are the grating period and the amplitude, respectively.Then the intensity profile at the focal plane is calculated from equations ( 17) and ( 21), with r(x,y) as vertical binary grating of equation ( 23), giving (Mora-González et al., 2009) ( ) is the scale factor at the focal plane and is the angular frequency.The binary grating intensity profile presents an infinite number of diffraction orders (harmonics) modulated by a sinc function (see figure 14b).

Sinusoidal grating
In order to observe the sinusoidal grating profile, it must be above x axis because negative gsl cannot be observed.The equation proposed for the vertical sinusoidal grating is given by (see figure 14c) ( ) The intensity profile at the focal plane from equation ( 21) with r(x,y) as vertical sinusoidal grating of equation ( 25), giving (Mora-González et al., 2009) ( ) [ ] ( )

Aplications
As shown in previous sections, Digital Image Processing is a useful tool to obtain improved results in Optical Metrology.Applications details are presented in following subsections.

Fringe analysis
Fringe analysis refers to the process of finding the phase associated to physical variables that are being estimated.A typical case consists in the interpretation of the fringe patterns that can be achieved with phase shifting techniques, when the object under study remains static while three or more frames are acquired when the experiment conditions are free of environmental perturbations.Another case is when the environmental conditions are not met, and then the analysis of a single interferogram is more convenient.In both cases a wrapped phase is obtained before the related continuous phase is assessed.Phase unwrapping is a numerical technique for retrieving a continuous phase from the calculated phase by using the arctangent (atan2) of the sine and cosine functions of the phase.In its simplest form, phase unwrapping consists in the addition or subtraction of a 2π multiple when a discontinuity bigger than π is found between adjacent pixels (Robinson, 1993).This approach however is very sensitive to noise, and is said to be path dependent.It means that any error may propagate along the path followed to phase unwrapping.In this study we will review the least square method (Ghiglia, 1998).Basically, it consists in the integration of the phase gradient by solving a linear equation system employing a numerical technique.Lets assume φ x (x,y) and φ y (x,y) as the phase differences in the horizontal and vertical directions, respectively.These phases are calculated from the wrapped phase φ w (x,y) as follows: In the above equations p(x,y) is a pupil function equal to one inside of an interferogram field and zero otherwise.A discretized Laplacian equation is then obtained from the phase differences: This equation represents a linear equations system that can be solved with iterative algorithms.In particular, is employed an overrelaxation method (SOR) due to it may be easily programmed.The following equation is then iterated until the solution converges: where, d=p(x+1,y)+p(x-1,y)+p(x,y+1)+p(x,y-1), and r is a parameter of the SOR method that must be set between the [1,2] range.Figure 15 shows the wrapped phase φ w obtained from the sine and cosine of the phase and the unwrapped phase φ.A simple iterative algorithm that unwraps the phase from the discretized Laplacian is given as: Algoritm 1. % Unwraps phase.while (q<max)%q is the number of iterations (500 for this case) q=q+1; for i=1:n for j=1:m if p(i,j)==1 t=p(i+1,j)+p(i-1,j)+p(i,j+1)+p(i,j-1); g(i,j)=g(i,j)-((t*g(i,j)-g(i+1,j)-g(i-1,j)-g(i,j+1)-g(i,j-1)+L(i,j))*1.95/t);%iteratedequation else g(i,j)=0; end,end,end,end A single interferogram with open fringes may also be analyzed for phase recovering (Creath & Wyant, 1992).Experimentally an open fringe interferogram can be achieved if a tilt term is added to the phase, usually by tilting the reference beam in an interferometer.Equation ( 18) can be modified in order to include a tilt term in the x direction, this is as follows: domain (Takeda, 1982).The Fourier procedure to recover the phase consist in isolating either C (u,v) or C* (u,v).Then the inverse transform is taken in order to retrieve the wrapped phase from the imaginary and real parts of the filtered spectra.The last step, as done with phase shifting procedures, is to apply a phase unwrapping procedure to recover the continuous phase.The complete process of p h a s e r e c o v e r y f r o m a n o p e n f r i n g e interferogram is observed in figure 16 ; mod(i,j)=127*exp(-1*(x^2+y^2)); I(i,j)=(back(i,j)+mod(i,j)*cos(phase(i,j)))*pupil(i,j); % Interferogram with closed fringes H(i,j)=exp(-180*((x-0.25)^2+y^2));%Band-Passfilter G(i,j)=1-exp(-1000*(x^2+y^2));%High pass filter end,end IF=fftshift(fft2(I));%Fourier transform of the interferogram IFH=IF.*H.*G; %Filtered Fourier transform Ih=ifft2(fftshift(IFH)); %Inverse Filtered Fourier transform fw=atan2(imag(Ih),real(Ih)).*pupil;%Wrappedphase with tilt fw1=atan2(sin(fw-g),cos(fw-g)).*pupil;%Wrapped phase without tilt phase1=(phase-g).*pupil;%Unwrapped phase

Wavefront deformation analysis
Optical metrology applied for the determination of different physical variables has greatly contributed with the constant advance of technology at a point that it is becoming a powerful measurement alternative for the solution of problems in engineering and sciences.

Deformation analysis using speckle interferometry
In this section, is presented a deformation analysis for the estimation of out-of-plane displacement components in a simulated model of a cantilever made of aluminum with a load applied at its free end.The example corresponds to a typical problem in structural mechanics where the Young´s modulus can be determined from the displacement of the loaded bar made of an isotropic material.The suggested arrangement for the testing in electronic speckle pattern interferometry (ESPI) is shown in figure 17.The laser light beam is divided by the beam splitter BS1.One beam is reflected by a mirror attached to a piezoelectric PZ (PC controlled), and then is expanded to uniformly illuminate at a small angle respect to the normal of the object surface, and the other beam is coupled into an optical fiber to obtain the reference illumination.The light reflected by the object and the reference beam introduced with BS2 interfere on the CCD.The object was simulated by considering the following dimensions: 15 cm length and 3 cm height with a thickness of 0.5 cm.Using the two intensities I i (x,y), I f (x,y) of the speckle patterns generated by ESPI arrangement seen in the CCD image plane before and after applying a force of 0.1 N, the correlation fringes using equation ( 19) is shown in figure 18a and in figure 18b is shown the wrapped phase calculated by equation ( 20).In figure 18c is shown the filtered and unwrapped phase using a conventional spatial average filter of 3 x 3 pixels and an iterative least-squares algorithm.

Wavefront detection
Optical testing using diffraction gratings as wavefront modulators is another alternative to detect wavefront aberrations.

Grating diffraction
Diffraction gratings are optical devices commonly used on physics.There are several gratings types, but as shown in 3.2 section, sinusoidal gratings only diffracts three harmonic modes, due to this property, sinusoidal gratings have been developed by different techniques.According to the method reported by (Mora-González et al., 2009), is possible to generate these gratings by laser printing on acetates.In figure 19, are shown different increment sizes (Δy) of three sine profiles and the corresponding spectra of equations ( 25) and ( 26), respectively.It must be pointed that for larger Δy values, the resolution diminishes and more diffraction orders emerge.

Ronchi test
The Ronchi test is one of the most non invasive optical tests used in optical workshops, due to the simplicity for observing aberrations over the optical surface.The test only needs to propagate a convergent aberrated wavefront through a diffraction grating to obtain a modulated fringe pattern (ronchigram) (Mora-González et al., 2001, 2003, 2011).In figure 20 is shown the typical diagram of the Ronchi test using a collimated illumination system.In figure 21

Bio-metrology
In the present subsection several functions of Matlab and their applications as blood flow measurement and pattern recognition in fingerprint are shown.

Blood flow measurement
Laser speckle effect is an interference phenomena that is produced when an optical rough surface is illuminated by a laser source that can be observed directly or imaged by using an optical system.The resulting intensity well known as speckle pattern is the result of multiple interferences produced by the roughness of the object under test.The speckle pattern consists in a distribution of brilliant points and dark points.By assuming ideal conditions like high coherent light source, unique frequency and perfect diffusing surface.It can be proved that the standard deviation of the intensity fluctuations from a speckle pattern is equal to the same that the average of the intensity.Speckle pattern contrast is defined by the relationship between standard deviation (σ) and the averaged intensity (I) (Goodman, 2005): If the illuminated surface is static, the contrast observed in the speckle pattern is maximum, however, if the surface is moving, the speckle patterns changes completely.This phenomenon is known as "decorrelation" and can be observed when light is dispersed by a great number of moving dispersers, i. e. moving particles into a fluid.The decorrelation is used for fluid velocity quantification considering that a speckle pattern photography taken at a finite time is blurred (contrast losing) in flowing areas.Contrast changes depend on fluid velocity and photography exposure time (T).By assuming a Lorentzian velocity distribution, speckle contrast (σ/<I>) is defined as correlation and exposure time function Correlation time τ c is inversely proportional to local velocity of the dispersing particles.The following code calculates a contrast image from a speckle image.Local blood flow velocity can be found from image contrast information and equation (34).Figure 22 shown speckle images before and after processing.The process for core finding is very simple.First, a high-pass filter with a gradient type convolution mask is applied to a fingerprint image in order to enhance the contrast.Next the image is skeletonized, and the Radon Transform (RT) is applied in the x and y directions to obtain RT 90 and RT 0 profiles, respectively.Finally, the noise produced from ridges and rows in the fingerprint is minimized by a least-squares algorithm.The whole process is illustrated in figure 23

Conclusion
Mathematical fundamentals for Digital Image Processing and their implementation by means of algorithms and Matlab commands were established.It has been demonstrated according to some Optical Metrology applications, the Matlab algorithms efficiency.This confirms that Matlab is a computational powerful tool.However, optical metrology applications are not only limited to the discussed examples in the present chapter.Applications of all the proposed algorithms can be extended without any problem from deformation analysis by another interferometric techniques (Speckle photography, Moiré, etc.) or optical tests (Hartmann, Foucault, etc.), until analysis and pattern recognition in medicine (X-Ray images, tomography, etc.), among other branches of science and engineering.

Acknowledgment
The authors wish to express their gratitude for financial support of this project to Departamento de Ciencias Exactas y Tecnología, of Centro Universitario de los Lagos, Universidad de Guadalajara.The image of figure 22 courtesy of Julio Cesar Ramirez San-Juan, Ph.D (Instituto Nacional de Astrofísica Óptica y Electrónica).

Fig. 1
Fig. 1. a) real color image, and b) matrix of the green color component of the selected area.
and s k are the original pixel intensities in color and gray scale levels (gsl) respectively.In figure2is shown the image obtained by the use of equation (2) and its corresponding histogram, these operations can be done by using the Matlab functions rgb2gray and imhist.

Fig. 8 .
Fig. 8. Fourier filtering applied to figure 1a.a) high-pass, b) low-pass, c) band-pass and d) band-stop.Where, circle and ring are masks of 30 and 60 pixels radii.

Fig. 10 .
Fig. 10.Michelson interferometer.The superposition of the two wavefrons at a position (x,y) is expressed by the complex sum:

Fig. 11 .
Fig. 11.Fringe patterns of mirrors with: a) tilt in y and defocus, YD; and b) defocus and coma, DC.These wavefronts were generated using nested for loops.For these cases N=128 pixels; C 1 =0.01 and C 2 = 0.00001 are the numerical parameter of each aberration.
Fig. 14.Functions of a) binary and c) sinusoidal gratings.Fourier spectra of b) binary and d) sinusoidal gratings.

Fig. 18 .
Fig. 18.Deformation analysis of a cantilever with ESPI.a) interference fringe pattern; b) wrapped phase and c) unwrapped phase.
are shown the ronchigram before and after circular low-pass filtering and their corresponding wrapped phase calculated with equation (20).

Fig. 20 .
Fig. 20.Collimated light Ronchi test diagram.Where f is the focus of lenses and r is the distance between lens under test and Ronchi grating.
Fig. 22. Blood flow measurement results.a) speckle image of a rat cortex.b) speckle image of contrast after processing with the code of algoritm 3.