How the user defined facefind function works here?

2 次查看(过去 30 天)
Hi everyone. Hope, all you are doing well. I am in a problem. Please help me out if possible. I’m so poor at matlab. I need a code that can detect faces in images. So I did google and got the code below:
EXAMPLE:
x=imread('test01.jpg');%read the image to memory
if (size(x,3)>1)%if RGB image make gray scale
try
x=rgb2gray(x);%image toolbox dependent
catch
x=sum(double(x),3)/3;%if no image toolbox do simple sum
end
end
x=double(x);%make sure the input is in double format
[output,count,m,svec]=facefind(x);%run default face detection (full scan)
imagesc(x), colormap(gray)%show image
plotbox(output)%show the detections as red squares
plotsize(x,m)%draw the minimum and maximum face size boxes in top left
function [output,count,m,svec]=facefind(x,minf,maxf,dx,dy,sens);
function [output,count,m,svec]=facefind(x,minf,maxf,dx,dy,sens);
%
%INPUT:
%x - grayscale image, double format (typical in range 0-1)
%minf - minimun face size to find [default 32]
%maxf - maximum face size to find [default inf]
%dx - number of pixel jump in x-direction [default 1]
%dy - number of pixel jump in y-direction [default 1]
%sens - sensitivity of detection on a scale from 1 to 10 [default 5]
% sens = 1 -> misses fewer faces, more false accepted faces
% sens = 10 -> misses more faces, fewer false accepted faces
%
%OUTPUT:
%output - matrix with positions and scale information for
% found faces
% output(:,1) - [x1 x2 y1 y2].'
%count - number of patches evaluated for detection
%m - true (recalculated) minf and maxf m=[minf maxf]
%svec - scales of image used [x_s;y_s] (s - scale index)
%
%INFO:
%The input parameters minf, maxf, dx, dy and sens will get their
%default value if an empty matrix is given as input. For example:
%[output,count,m,svec]=facefind(x,[],[],[],[],7);
%will change the sensitivity value to 7 but keep the default
%values for minf, maxf, dx and dy.
But all the lines of the function function[output,count,m,svec]=facefind(x,minf,maxf,dx,dy,sens); is written as comment lines. But the program runs well and also give me output. I don’t know the programmer to ask this. So I beg your help. Can anyone please help me to understand why and how this function runs?
I’m looking forward to your answers. Any suggestions will be appreciated.
Thanks

回答(1 个)

vienthong10 tphcm
vienthong10 tphcm 2014-4-25
This is also my concern. I hopes people help me. thanks so much!!

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by