I am trying to implement automatic face detection using MATLAB. I know how to implement it using OpenCV, but i would like to do it in MATLAB.
I saw two websites on this:
1) http://www.mathworks.com/matlabcentral/fileexchange/11073. Firstly, this website is good and it works on neural networks. It works well witht the images that are given together with it. However, when I train the neural networks using my images, the accuracy is very bad.
2) The second is http://www.mathworks.com/matlabcentral/fileexchange/13716-face-eye-detection. The accuracy is bad when i test with an image of my own.
Looking for better solutions as well as suggestions on what i should do. Thanks.
Starting with the R2012a release, the Computer Vision System Toolbox includes a Viola-Jones based face detector with the vision.CascadeObjectDetector
system object.
Since you mentioned OpenCV, how about directly using it from MATLAB. Checkout mexopencv project.
Here is sample code to detect faces:
%# Load a face detector and an image
detector = cv.CascadeClassifier('haarcascade_frontalface_alt.xml');
im = imread('myface.jpg');
%# Preprocess
gr = cv.cvtColor(im, 'RGB2GRAY');
gr = cv.equalizeHist(gr);
%# Detect
boxes = detector.detect(gr, 'ScaleFactor',1.3, 'MinNeighbors',2, 'MinSize',[30,30]);
%# Draw results
imshow(im);
for i = 1:numel(boxes)
rectangle('Position',boxes{i}, 'EdgeColor','g');
end
It is worth mentioning that MATLAB's computer vision toolbox also uses OpenCV in its implementation..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With