of 13

Filter

Published on June 2016 | Categories: Topics | Downloads: 12 | Comments: 0
329 views

Iris Recognition Filters

Comments

Content

2D Gabour Filter :
In image processing a Gabor filter is a linear filter used for edge detection. Frequency and orientation representations of Gabor filters are similar to those of the human visual system, and they have been found to be particularly appropriate for texture representation and discrimination. In the spatial domain, a 2D Gabor filter is a Gaussian kernel function modulated by a sinusoidal plane ave. Formulae: Its impulse response is defined by a sinusoidal ave !a plane ave for 2D Gabor filters" multiplied by a Gaussian function. #ecause of the multiplication$convolution property !%onvolution theorem", the Fourier transform of a Gabor filter&s impulse response is the convolution of the Fourier transform of the harmonic function and the Fourier transform of the Gaussian function. 'he filter has a real and an imaginary component representing orthogonal directions. 'he t o components may be formed into a complex number or used individually. %omplex

(eal

Imaginary

here

and

In this equation,

represents the avelength of the sinusoidal factor,

represents the orientation of the

normal to the parallel stripes of a Gabor function, is the phase offset, is the sigma of the Gaussian envelope and is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function.

MatLab: function gb=gabor_fn(sigma,theta,lambda,psi,gamma) sigma_x = sigma; sigma_y = sigma/gamma; % Bounding box nstds = 3; xmax = max(abs(nstds sigma_x cos(theta)),abs(nstds sigma_y sin(theta))); xmax = ceil(max(!,xmax)); ymax = max(abs(nstds sigma_x sin(theta)),abs(nstds sigma_y cos(theta))); ymax = ceil(max(!,ymax)); xmin = "xmax; ymin = "ymax; #x,y$ = meshgrid(xmin%xmax,ymin%ymax); % &otation x_theta=x cos(theta)'y sin(theta); y_theta="x sin(theta)'y cos(theta); gb= exp("() (x_theta(*+/sigma_x*+'y_theta(*+/sigma_y*+))( cos(+ pi/lambda x_theta 'psi);

Laplacian of Gaussian: Laplacian filters are derivative filters used to find areas of rapid change (edges) in images. Since derivative filters are very sensitive to noise, it is common to smooth the image (e.g., using a Gaussian filter) before applying the Laplacian. This two-step process is call the Laplacian of Gaussian (LoG) operation.

There are different ways to find an appro imate discrete convolution !ernal that appro imates the effect of the Laplacian. " possible !ernel is

This is called a negative Laplacian because the central pea! is negative. #t is $ust as appropriate to reverse the signs of the elements, using -%s and a &', to get a positive Laplacian. #t doesn(t matter. To include a smoothing Gaussian filter, combine the Laplacian and Gaussian functions to obtain a single e)uation*

MatLab: ++ ,ead #mage +,eads the #mage into an array for further processing - . imread((build.tif()/ +- . rgb0gray(-)/ ++ 1oint detection 2 . imread((turbine.tif()/ +2%. bwareaopen(2, 03)/ + fplap . 4% % %/ % -5 %/ % % %6 +Laplacian at a point fplap . 43 % 3/ % -' %/ 3 % 36 +Laplacian at a point filtim . imfilter(2,fplap,(symmetric(, (conv()/

subplot(0,0,%) imshow(2)/ title((7riginal()/ subplot(0,0,0) imshow(filtim)/ title((Laplacian 1oint 8iltered()/ subplot(0,0,9) imshow(2-filtim)/ title((:ifference #mage()/ ++ Gaussian 8iltering of image + fgauss . fspecial((gaussian(,40;,0;6,'.3) + + 0;-0; Gaussian filter with S: .0; is created. + filtim . imfilter(-,fgauss,(symmetric(, (conv()/ + + 8ilter the image by convolution with the above designed filter. + + filtim now contains the gaussian filtered image. + + subplot(0,0,%) + imshow(-)/ + title((7riginal()/ + + subplot(0,0,0) + imshow(filtim)/ + title((Gaussian 8iltered()/ + + subplot(0,0,9) + imshow(--filtim)/ + title((:ifference #mage()/ + + + flap% . fspecial((laplacian(, .0)/ + + filtim% . imfilter(filtim,flap%,(symmetric(, (conv()/ + + + fsobel . 4-% 3 %/ -0 3 0/ -% 3 %6 +Grad in y + fsobel . 4-% -0 -%/ 3 3 3/ % 0 %6 +Grad in + + fsobel . 43 -% -0/ % 3 -%/ 0 % 36 +'; degree + filtim% . imfilter(filtim,fsobel,(symmetric(, (conv()/ + + subplot(0,0,') + imshow(filtim%)/ + title((LoG #mage()/ ++ Spatial 8iltering Smoothing <=eighted> [email protected] Aoost 8iltering + + favg . 4%B%C 0B%C %B%C/ 0B%C 'B%C 0B%C/ %B%C 0B%C %B%C6 + filtim . imfilter(-,favg,(symmetric(, (conv()/ + + subplot(0,0,%) + imshow(-)/ + title((7riginal()/

+ + subplot(0,0,0) + imshow(filtim)/ + title((=eighted 8iltering()/ + + subplot(0,0,9) + imshow(--filtim)/ + title((:ifference #mage()/ + + subplot(0,0,') + imshow(-&3.0.D(--filtim))/ + title((@igh Aoost Sharpened()/ ++

)inear integro$differential operator
'he general form

Lu(x)=trA(x)⋅D2u+b(x)⋅∇u+c(x)u+d(x)+∫Rn(u(x+y)−u(x) −y⋅∇u(x)χB1(y))dμx(y)
where A(x) is a nonnegative matri for all x, and μx is a nonnegative measure for all x satisfying

∫Rnmin(y2,1)dμx(y)<+∞

MatLab: Example:
, = imread(-cameraman(tif-); subplot(+,+,!); imsho.(,); title(-/riginal ,mage-);

0 = fspecial(-motion-,+1,2)); 3otionBlur = imfilter(,,0,-replicate-); subplot(+,+,+); imsho.(3otionBlur);title(-3otion Blurred ,mage-);

0 = fspecial(-dis4-,!1); blurred = imfilter(,,0,-replicate-); subplot(+,+,3); imsho.(blurred); title(-Blurred ,mage-);

Edge Detection: Edge detection algorithms operate on the premise that each pi el in a grayscale digital image has a first derivative, with regard to the change in intensity at that point, if a significant change occurs at a given pi el in the image, then a white pi el is placed in the binary image, otherwise, a blac! pi el is placed there instead. #n general, the gradient is calculated for each pi el that gives the degree of change at that point in the image. The )uestion basically amounts to how much change in the intensity should be re)uired in order to constitute an edge feature in the binary image. " threshold value, T, is often used to classify edge points. Some edge finding techni)ues calculate the second derivative to more accurately find points that correspond to a local ma imum or minimum in the first derivative. This techni)ue is often referred to as a Zero Crossing because local ma ima and minima are the places where the second derivative e)ual Fero, and its left and right neighbors are non-Fero with opposite signs. 1. Canny Edge Detector:

Finds edges by looking for local maxima of the gradient of f!x,y". 'he gradient is calculated using the derivative of a Gaussian filter. 'he method uses t o thresholds to detect strong and eak edges, and includes the eak edges in the output only if they are connnected to strong edges. 'herefore, this method is more likely to detect true eak edges.

sigma=!; f=5eros(!+6,!+6); f(3+%78,3+%78)=+)); #g3, t3$=edge(f, -canny-, #1(12 1(!1$, sigma); figure,imsho.(g3); t3

Houg transfor!:
'he purpose of the technique is to find imperfect instances of ob*ects ithin a certain class of shapes by a voting procedure. %generate the picture f=5eros(!+6,!+6); f(3+%78,3+%78)=+)); %find edges sigma=!; #g3, t3$=edge(f, -canny-, #1(12 1(!1$, sigma); %9o the 0ough transform #0 t r$ = hough(g3); %r and c store column labels((( %9isplay the transform in such a .ay that .e can dra. points on it later((( imsho.(0, #$, -:9ata-, t, -;9ata-, r ); %<dd axis labels to the picture xlabel(-=theta-), ylabel(-=rho-); axis on, axis normal;

2ou result should loo! li!e this*

Hig "ass #ilter: #or!ula:

% G e p(-(distance)H0B(0D(d3H0))) or % G low1ass
MatLab: function GaussianHigh ass a=imr!ad("cam!raman#tif$)% imsho&(a) '' origina( imag! )m n*=si+!(a)% f,transform=fft2(a)% f,shift=fftshift(f,transform)% =m'2% -=n'2% d.=/.% for i=10m for 1=10n distanc!=s-rt((i2 )32+(12-)32)% (o&,fi(t!r(i,1)=12!4 (2(distanc!)32'(25(d.32)))% !nd

!nd fi(t!r,a (6=f,shift#5(o&,fi(t!r% imag!,origna(=ifftshift(fi(t!r,a (6)% imag!,fi(t!r,a (6=a7s(ifft2(imag!,origna())% imsho&(imag!,fi(t!r,a (6,)*) '' shar !nd imag!

Split-and-merge algorithm: 'he purpose of the algorithm is, given a curve composed of line segments, to find a similar curve ith fe er points. 'he algorithm defines &dissimilar& based on the maximum distance bet een the original curve and the simplified curve. 'he simplified curve consists of a subset of the points that defined the original curve.

Gif imag!0

MatLab:
function g = splitmerge(f, mindim, fun) > = +*nextpo.+(max(si5e(f))); #3, ?$ = si5e(f); f = padarray(f, #> " 3, > " ?$, -post-); %@erform splitting first(

A = Btdecomp(f, Csplit_test, mindim, fun); % ?o. merge by loo4ing at each Buadregion and setting all its % elements to ! if the bloc4 satisfies the predicate( % Det the si5e of the largest bloc4( Ese full because A is sparse( Fmax = full(max(A(%))); % Aet the output image initially to all 5eros( Ghe 3<&HI& array is % used later to establish connectiJity( g = 5eros(si5e(f)); 3<&HI& = 5eros(si5e(f)); % Begin the merging stage( for H = !%Fmax #Jals, r, c$ = Btgetbl4(f, A, H); if Kisempty(Jals) % Lhec4 the predicate for each of the regions % of si5e H"by"H .ith coordinates giJen by Jectors % r and c( for , = !%length(r) xlo. = r(,); ylo. = c(,); xhigh = xlo. ' H " !; yhigh = ylo. ' H " !; region = f(xlo.%xhigh, ylo.%yhigh); flag = feJal(fun, region); if flag g(xlo.%xhigh, ylo.%yhigh) = !; 3<&HI&(xlo., ylo.) = !; end end end end % Minally, obtain each connected region and label it .ith a % different integer Jalue using function b.label( g = b.label(imreconstruct(3<&HI&, g)); % Lrop and exit g = g(!%3, !%?); %"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""% function J = split_test(B, mindim, fun) % G0,A ME?LG,/? ,A @<&G /M ME?LG,/? [email protected],G"3I&DI( ,G 9IGI&3,?IA % N0IG0I& >E<9&ID,/?A <&I [email protected],G( Ghe function returns in J % logical !s (G&EI) for the bloc4s that should be split and % logical 1s (M<FAI) for those that should not( % >uadregion B, passed by Btdecomp, is the current decomposition of % the image into 4 bloc4s of si5e m"by"m( % 4 is the number of regions in B at this point in the procedure( 4 = si5e(B, 3); % @erform the split test on each bloc4( ,f the predicate function % (fun) returns G&EI, the region is split, so .e set the appropriate % element of J to G&EI( Ilse, the appropriate element of J is set to % M<FAI( J(!%4) = false; for , = !%4

end

Buadregion = B(%, %, ,); if si5e(Buadregion, !) O= mindim J(,) = false; continue end flag = feJal(fun, Buadregion); if flag J(,) = true; end

K-Means clustering algorithm :

This algorithm aims at minimiFing an objective function, in this case a s)uared error function. The ob$ective function

,

where is a chosen distance measure between a data point and the cluster centre indicator of the distance of the n data points from their respective cluster centres.
%Fet-s ma4e some fa4e data .ith t.o groups n=P); %sample si5e x=#randn(n,!)'+;randn(n,!)'2(P)$; y=#randn(n,!)'+;randn(n,!)'2(P)$;

, is an

%the true group identity groups=#ones(n,!);ones(n,!)'!$; %plot the data scatter(x,y,)1,groups,-filled-) data=#x,y$; ,9:=4means(data,+); %&un 4"means, as4ing for t.o groups %Fet-s ma4e some fa4e data .ith t.o groups n=!)1; %sample si5e x=#randn(n,!)'3;randn(n,!)'3$; y=#randn(n,!)'3;randn(n,!)'3$; %plot the data subplot(!,+,!) plot(x,y,-o4-,-3ar4erMaceLolor-,-4-) %no. diJide into t.o using 4"means and plot the results data+=#x,y$; ,9:=4means(data+,+); %plot the 4"means results subplot(!,+,+) scatter(x,y,)1,,9:,-filled-) %&un 4"means for a range of 4 for 4=+%8 ,9:=4means(data,4); %Ghe data .ith t.o groups #A,0$ = silhouette(data, ,9:); sil<(4)=mean(A); %Ghe mean silhoette Jalue for t.o groups ,9:=4means(data+,4); %Ghe data .ith one group #A,0$ = silhouette(data+, ,9:); silB(4)=mean(A); %Ghe mean silhoette Jalue for one group end clf hold on plot(!%8, sil<,-o4"-,-3ar4erMaceLolor-,-4-) %+ groups plot(!%8, silB,-or"-,-3ar4erMaceLolor-,-r-) %! group set(gca,-:Gic4-,!%8) xlabel(-4-) ylabel(-mean silhouette Jalue-) hold off

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close