2
votes

i searched face detection for matlab to my project. i found one: http://people.kyb.tuebingen.mpg.de/kienzle/fdlib/fdlib.htm

i downloaded the source code, but it didn't work, i got that error from matlab:

??? Undefined function or method 'fdmex' for input arguments of type 'uint8'.

Error in ==> tinytest at 10 s = fdmex(x', threshold);

the main script is:

x = imread('geeks.jpg');

% decision threshold.
% change this to a smaller value, if too many false detections occur.
% change it to a larger value, if faces are not recognized.
% a reasonable range is -10 ... 10.
threshold = 0; 

imagesc(x); hold on; colormap gray;
s = fdmex(x', threshold);

for i=1:size(s,1)
    h = rectangle('Position',[s(i,1)-s(i,3)/2,s(i,2)-s(i,3)/2,s(i,3),s(i,3)], ...
      'EdgeColor', [1,0,0], 'linewidth', 2);
end    

axis equal; 
axis off

can you find the error?

3

3 Answers

0
votes

Usually when I see a uint8 error and a grayscale image, its a red flag to me that I need to do

colorImg=imread('imageName.jpg') 

% Even if the image is grayscale, if its png or jpg, 
% it will load in as a color image almost exclusively

img=rgb2gray(colorImg) 

If you look at the img output, you will notice now its of type double instead of uint8 :)

If that doesn't work, hopefully macduffs will, mine just seems easier if that actually does fix it. :)

0
votes

Depending on your version of matlab, it looks like the fdlib, comes with a .dll, rename it to .mexw32 or whatever your host machine desires. You can determine this by running:

>> mexext

mexw32

on the Matlab command prompt. Use the mex extension and rename the fdmex.dll to fdmex.mexw32, or whatever mexext returns and it should run flawlessly.

If I run in on my Windows XP machine, I get that beautiful picure:

enter image description here

However, if you do not have a 32 bit machine, the author of the software writes on the link in the question:

Please note that all builds were optimized for Intel Pentium CPUs. If you would like to run it on a different platform, or have any other questions, please let me know.

He has a link to his profile and email, so I recommend contacting him for a 64 bit version of the executable.

0
votes

If you have a recent version of Matlab with the Computer Vision System Toolbox installed, you can use vision.CascadeObjectDetector system object to detect faces in images.