I am trying to learn how to find if high resolution images that I have are in focus and remove them from a list of images. I am trying to use the code that I found here: http://www.mathworks.com/matlabcentral/fileexchange/27314-focus-measure/content/fmeasure/fmeasure.m I am trying to use the following function
WSize = 15; % Size of local window (only some operators)
case 'SFIL' %Steerable filters (Minhas2009)
% Angles = [0 45 90 135 180 225 270 315];
N = floor(WSize/2);
sig = N/2.5;
[x,y] = meshgrid(-N:N, -N:N);
G = exp(-(x.^2+y.^2)/(2*sig^2))/(2*pi*sig);
Gx = -x.*G/(sig^2);Gx = Gx/sum(Gx(:));
Gy = -y.*G/(sig^2);Gy = Gy/sum(Gy(:));
R(:,:,1) = imfilter(double(Image), Gx, 'conv', 'replicate');
R(:,:,2) = imfilter(double(Image), Gy, 'conv', 'replicate');
R(:,:,3) = cosd(45)*R(:,:,1)+sind(45)*R(:,:,2);
R(:,:,4) = cosd(135)*R(:,:,1)+sind(135)*R(:,:,2);
R(:,:,5) = cosd(180)*R(:,:,1)+sind(180)*R(:,:,2);
R(:,:,6) = cosd(225)*R(:,:,1)+sind(225)*R(:,:,2);
R(:,:,7) = cosd(270)*R(:,:,1)+sind(270)*R(:,:,2);
R(:,:,7) = cosd(315)*R(:,:,1)+sind(315)*R(:,:,2);
FM = max(R,[],3);
FM = mean2(FM);
What I do not understand is how was the WSize=15 determined, does this have to do with the data or it is just about the window size in MATLAB? Also I do not understand how these two lines were determined
N = floor(WSize/2);
sig = N/2.5;
Is the 2.5 a standard deviation or some value determined from the data? I was hoping someone has used this code and can help me decipher how WSize,N and sig values were determined.
Thank you in advance.

1 commentaire

David Young
David Young le 2 Fév 2015
Perhaps the paper in Pattern Recognition that the author cites gives some indication of how the constants were chosen. The value of WSize is certainly a choice by the author, nothing to do with the implementation language, and not immediately determined by the data (though maybe based on previous experience with image data).

Connectez-vous pour commenter.

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by