Face Detection Matlab Code






  • The Step-By-Step Digital Book: More Than 70 pages of stuff walks you through the program, everything you need to know about the concept and implementation of this face detection system that you can duplicate for your own projects.
  • MATLAB Program That Comes With The Book
  • You Learn About Image Processing
  • You Learn About Feature Extraction
  • You Learn About Neural Networks
  • You Learn About Face Detection


The guide is the best practical guide for learning about Image Processing, Face Detection, Neural Networks, Image Feature Extraction and Gabor Feature. It is written specifically for someone who is a beginner in MATLAB and new to image processing and machine learning concepts.

To Run The Code:

It is assumed that you have MATLAB and both image processing and neural network toolboxes installed. This is a minimalistic approach to learn object detection and this guide only cover what is needed to get the job done. That is why it is the best! No advanced mathematics is needed! If you can add and multiply, then you can detect faces…

Detecting faces or in general, objects, inside gray-level images is still a hard topic for new researches and students all over the world.

It’s certainly not your fault. Many researches who do not have access to the right resources, struggle for weeks and months before they understand how to manage their project.


In most of the published papers, vital information and details are missing. There are two reasons. The first is that sometimes the researcher or the research institution wants to apply for a patent. As a result they don’t want other students and researchers to understand the method fully before them. This is absolutely true.

The second reason is that, some times the author unintentionally removes vital details from the paper. Most journals and conferences have limited space quote for each paper between 2 to 8 pages. So the author must squeeze all the information and results in that limited space. As a result they start to remove paragraphs, sentences and even words to meet the publisher’s requirements.  I am sure you are also guilty of doing that before or you will do it soon.

As a consequence , it is very likely that you encounter vague mathematical formulas that even after several times skimming through the paper you still cannot understand them.

This is not the case with this ebook. This ebook has all the necessary information for you to succeed.

The other part of the problem is that you are not experienced enough to understand methods by just reading and examining other people’s programs. In some cases it is even more practical to write your own program than try to understand a code that you find on the Internet without the help of the program’s author.

And the other problem is that there exist lots of ways to do object detection using machine learning techniques, neural networks, support vector machines, boosting,… Even more, there are many methods for feature extraction; using Gabor filters, Wavelets, Viola Jones, SVD, …

Considering all the problems above, what happens most of the time is that you start reading more and more papers, books and resources and you avoid doing the only thing that you are asked; Writing the code and get the results.

But There is a Simple and Effective Way

In fact, it’s something you can start tapping into in the next few minutes
(provided you pay close attention to what you’re about to read).

The best way to learn and start your project is to learn it from another program that works, while you have access to the author and the thoughts behind each and every line of the program.
Face Detection System for MATLAB is one of the best programs that you can learn from.

There is a reason behind each line of the program and if you know them and if you follow the program line by line, you will be able to change the program or parameters and adapt it for your own project. And Eventually you will have enough wisdom to write a program without knowing it.

Here is How It Works …

Face detection is the first and foremost step in any automated face recognition system. Its reliability greatly affects the performance and usability of the whole system.

Given a single image or a video frame, an ideal face detector should have the ability to locate all the present faces inside that image, regardless of their position, facial gestures, variations in scale and orientation. Furthermore it should be robust against variation in illumination, skin color or background …

Several clues may facilitate the detection process. Skin color (for detecting faces in colourful images and videos) is one that often can be used. Motion (for detecting faces in video) is another well-known clue that can be estimated by analyzing several video frames in a row. But the hardest kind of detection is face detector in grey-level still images, in which there is no cue of any type such as color or motion.

The processing is usually done as follows:

  • Step One: Feature Extraction Function You need a function that can transform a small patch of image into a vector. If you only reshape the 2D patch into a 1D vector, it is still a function and correct. But in practice it contains several stages. This function is the feature extraction function and should extract features in a wise manner, followed by a normalization. In Face Detection System for MATLAB, Gabor features are extracted from the patch and you will learn all about it in the guide that you are about to download.
  • Step Two: Generating Data for Training The next thing that you have to do is to crop some images with the same height and width. The height and width is the same size as the patch that we talked about in the previous step. Crop them using any editing software that you have; Paint, Gimp or PhotoShop.Then you use the feature extraction function that you already have and generate a vector for each image. You should store each vector in a matrix, so that it can be used later for the training of the classifier. Not only you need the data for faces, you also need data for patches that does not contain any face. Sometimes gathering these information is a challenge because you don’t really know what is not a face. This problem is discussed in detail in the guide as well as how to read all the files and store them in the matrix.
  • Step Three: Train The Classifier: Every detection system needs a classifier that looks at your vector and decides if it is the deal or not. In case of face detection, the classifier looks for faces. The main issues are to choose your classifier and set the parameters in a way that you get reasonable results. Face Detection System for MATLAB uses Neural Network as its classifier. Everything regarding how to generate the network and train it is discussed inside the guide in detail.
  • Step Four: Scan a Picture Then an image is scanned at all possible locations [and scales] by a sub-window (patch). Each patch is fed to the feature extraction function and the output vector goes to the classifier. There are ways to pre-select possible locations and how to pin point the location of the faces.


  1. Imgage Processing In MATLAB
  2. Artificial Neural Networks
    • Perceptron Neuron
    • Single Layer Perceptron
    • Multi-Layer Feed-Forward Network
    • Backpropagation Training
    • Creating Networks
    • Inputs and Outputs
    • Initialization
    • Testing and Simulation
    • Training Set Generation
  3. Feature Extraction: (Gray-Level Features – Histogram Equalization – Illumination Effects – Normalization)
  4. Gabor Features and Gabor Feature Extraction: (Concept – Code – Fast Gabor Transform)
  5. Other Elements of a Face Detection System: (Pre-Selection – Search Algorithm – Post-Processing)
  6. Future Work: (on Pre-Selection – on Feature Selection – on Classification – on Fast Convolutional Neural Networks)





You have 30 days to work through this guide and see just how solid it is at teaching you all about object detection in MATLAB.

If you don’t think this guide – for any reason – couldn’t help you, just ask for a refund. So you’ll get your money back nice and fast. Even last month someone mistakenly bought two copies and I refunded one of the automatically. As you know in PayPal, it is as simple as a click on “Issue Refund”.

Will some people take advantage of this 1-month guarantee and return the guide even though it’s working really well for them? Undoubtedly, yeah. But I’m betting that you’re one of the “good people.”

Bottom line is – this is the real deal. You’ll love it, or you get your money back. Couldn’t be easier.