Showing posts with label MATLAB. Show all posts
Showing posts with label MATLAB. Show all posts

Wednesday, February 27, 2013

Handwriting Recognition Using MATLAB

Alright Now, I have been a little Preoccupied with studies, but as usual i found out time for some fiddling with image processing. I chose MATLAB because of its simplicity. Sure, there are more powerful tools available out there, but for the basic understanding i think i did a pretty good job with "Handwriting Recognition using MATLAB"

Check Out This Video To See How It Works :





Well, I will be updating this post in some days, this code is up for sale .

Friday, July 27, 2012

FACE DETECTION USING MATLAB


Image Showing Labelled Faces
Face Detection:


In this tutorial, I present a face recognition system that attempts to recognize faces using the Skin Segmentation Technique. This tutorial is intended to provide an insight into developing a face recognition system using Skin Detection and hopefully gives a good starting point for those who are interested in developing a face recognition system.


There are other methods of face detection in an image, but i structured my own format and it works very well.


My Method:


1. Histogram Equalization
2. Skin Detection and Segmentation
3. Filling The Holes
4. Eliminating Pixels Below a Threshold
5. Putting Bounding Boxes Around Detected Faces And Counting

Step 1:


Brightness Preserving Dynamic Histogram Equalization:


Code:

close all;
clear all;
clc;
rgbInputImage = imread('Your File Here');
%rgbInputImage=getsnapshot(rgbInputImage);
labInputImage = applycform(rgbInputImage,makecform('srgb2lab'));
Lbpdfhe = fcnBPDFHE(labInputImage(:,:,1));
labOutputImage = cat(3,Lbpdfhe,labInputImage(:,:,2),labInputImage(:,:,3));
rgbOutputImage = applycform(labOutputImage,makecform('lab2srgb'));
figure, imshow(rgbInputImage);
figure, imshow(rgbOutputImage);
img=rgbOutputImage;
final_image = zeros(size(img,1), size(img,2));

This routine calls a function fcnBPDHE.(Function Brightness Preserving Dynamic Histogram Equalization.)

You Need To Have The Function saved in your MATLAB directory.


An Image Before Histogram Equalization:


Original Input Image

An Image After Histogram Equalization:



Notice The Increase In Brightness


Step 2:

Detect Skin Regions:

The next step is to detect the skin regions in an image. Photos in which people are fully covered give the best results as the complexity of the code reduces and complex procedures such as neural networks or template matching are not required. But this code does a good job of identifying faces even with some skin shown in the image. 


Code For Skin Detection & Segmentation:

if(size(img, 3) > 1)
for i = 1:size(img,1)
for j = 1:size(img,2)
R = img(i,j,1);
G = img(i,j,2);
B = img(i,j,3);
if(R > 92 && G > 40 && B > 20)
v = [R,G,B];
if((max(v) - min(v)) > 15)
if(abs(R-G) > 15 && R > G && R > B)
%it is a skin
final_image(i,j) = 1;
end
end
end
end
end

Image After Skin Detection And Segmentation:

Some Parts Are Falsely Detected