You can download the code from here: admissionschol...
Images processing has always been an active field of research. There are scope of improvement, innovation, development and modification in image processing. As a result the field is ever expanding, full of challenges and excitements. Usually students start image processing with fundamentals of image processing. It includes related mathematical background, popular algorithms, their implementations and applications. Eventually they start working on projects. One of the most common image processing project is Face Detection. In this article, we are going to explain how to perform Face Detection in Still Picture using MATLAB.
This article explains the implementation process of face detection in still picture using MATLAB. Along with explanation, it includes the MATLAB code.
Implementation of Face Detection in Still Picture using MATLAB
It is wise to start with the basics. Generally speaking, the most basic version of face detection is Face Detection in Still Picture. In general it is always beneficial to start with the basics because learners get the scope of developing a solid foundation. If you are working with face detection, I recommend you to understand the basics of face detection in still pictures first.
Once we have the image, we are ready to start writing the code. I am going to explain the code line by line. Hopefully it will make it easier to understand.
1. First read the image using ‘imread()’ function and store it in a variable
2. Then read the width and height of the image using ‘size()’ function. We need to know the size of the image to resize it. If the image is too large, it will take longer to detect the face. However, reducing the size of the image does not impact the detection accuracy significantly.
3. Once the size is detected, we are going to initiate an ‘if’ condition.
4. If the width of the image is more than 320 pixels, then we will resize it to 320 pixel width. We use ‘imresize()’ function to resize images. We will not touch the height so that the width and height ratio is maintained by the function.
5. Now we can use ‘vision.CascadeObjectDetector’, a built-in pre-trained object detection of MATLAB, to detect the face. First of all, we need to create an instance of this object
6. Then using ‘step()’ function, we have to assign the image to the object detector. After doing it, the ‘step()’ function will return the location of the face
7. As we have the location of the face on the image now, we can simply draw a rectangle on that location using ‘insertShape()’ function
8. And finally we can show the image with detected face
Using this simple 8 steps, we can detect face on images using MATLAB. You can download the code from here: admissionschol...
11 сен 2024