Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

applying gabor filter to an images

I am a very much new to image processing.I want to know how to apply gabor filter on an image with 12 different orientations say 0,15,30,45 to 165.I want to apply this gabor filter for 12 orientations and output of each orientation has to be displayed.My input is a image of retina and output of orientation should be fine tuned image of retina after applying gabor filter.How do i do it?

 %code for gabor filter                
 I = getimage();         
 I=I(:,:,2);    
 lambda  = 8;    
theta   = 0;    
psi     = [0 pi/2];    
gamma   = 0.5;    
 bw      = 1;    
 N       = 12;    
img_in = im2double(I);    
%img_in(:,:,2:3) = [];  % discard redundant channels, it's gray anyway    
 img_out = zeros(size(img_in,1), size(img_in,2), N);        
 for n=1:N         
        gb = gabor_fn(bw,gamma,psi(1),lambda,theta)...          
         + 1i * gabor_fn(bw,gamma,psi(2),lambda,theta);     
         % gb is the n-th gabor filter         
         img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');          
        % filter output to the n-th channel       
        %theta = theta + 2*pi/N;          
        theta = 15 * n;   % i wrote this because my angles are multiples of 15       
        % next orientation           
 end 

 figure(1);           
 imshow(img_in);                  
 title('input image');                    
 figure(2);            
 img_out_disp = sum(abs(img_out).^2, 3).^0.5;        
 %default superposition method, L2-norm        
 img_out_disp = img_out_disp./max(img_out_disp(:));           
 % normalize        
 imshow(img_out_disp);         
 title('gabor output, L-2 super-imposed, normalized');        

my input image is enter image description here

and my output image is enter image description here

how do i orient my image in 12 different direction by applying gabor filter

I am supposed to get a ouput of a retinal image but i am getting my output image as

enter image description here

like image 300
vidya Avatar asked Nov 20 '25 14:11

vidya


1 Answers

You should add these two lines:

...
% gb is the n-th gabor filter 
img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');   
figure;
imshow(img_out(:,:,n));
...  
like image 61
zenpoy Avatar answered Nov 22 '25 04:11

zenpoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!