3

私は画像処理に非常に慣れていません.0,15,30,45から165までの12の異なる方向を持つ画像にガボールフィルターを適用する方法を知りたいです.12の方向と出力にこのガボールフィルターを適用したい.各方向を表示する必要があります。私の入力は網膜の画像で、方向の出力は、ガボール フィルターを適用した後の網膜の微調整画像である必要があります。どうすればよいですか?

 %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');        

私の入力画像は ここに画像の説明を入力

私の出力画像は ここに画像の説明を入力

ガボール フィルターを適用して、画像を 12 の異なる方向に向ける方法

網膜画像の出力を取得することになっていますが、出力画像を次のように取得しています

ここに画像の説明を入力

4

2 に答える 2

2

次の 2 行を追加する必要があります。

...
% gb is the n-th gabor filter 
img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');   
figure;
imshow(img_out(:,:,n));
...  
于 2013-11-06T10:52:41.840 に答える
0

ガボールフィルターを12回、毎回指定した方向(シータ)で適用したいという質問でわかりましたよね?これを行うには --> for ループの前にこれを書く ----> ...

responses = {}; % to save each response from filter.

画像をフィルタリングした後、次のように畳み込みます---->
...

response =  conv2(img_in,gb,'same'); 

...

次に、このような振幅を取得します ---> ...

realpart = real(response);
imagpart = imag(response);
response = sqrt(realpart.^2 + imagpart.^2);

...

---> img_out(:,:,n) をこれに置き換えます ---->
...

responses = cat(1,responses,response);

このコードは、各フィルターからの応答をセルに保存します。応答を確認したい場合は、これを行うだけです...

X = responses{1}; % or 2 or 3...

このリンクは、ガボール フィルターに関するより良い情報を提供します http://matlabserver.cs.rug.nl/edgedetectionweb/web/edgedetection_params.html

これがあなたを助けることを願っています。宜しくお願いします。

于 2015-10-28T20:55:25.333 に答える