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

Wednesday, July 25, 2012

INTERFACING LDR TO 89C51

Light Dependent Resistors (LDR)

SCHEMATIC:


LDR VALUE CHANGES AS THE DISTANCE BETWEEN LAMP AND LDR VARIES

WORKING:

1. LDR GIVES ANALOG SIGNAL AS ITS OUTPUT
2. OUTPUT OF LDR IS FED TO ADC WITH A REFERENCE VOLTAGE
3. THE ADC CONVERTS THE ANALOG VALUE INTO DIGITAL SIGNAL 
4. THIS SIGNAL IS GIVEN TO MICRO CONTROLLER 
5. MICRO CONTROLLER CONVERTS IT INTO READABLE FORMAT AND DISPLAYS ON LCD

ADVANTAGES:

1. CAN BE EASILY INTEGRATED INTO HOME AUTOMATION PROJECTS
2. LESS POWER CONSUMPTION AS CMOS IC IS USED

CODE:

HEX FILE : http://snack.to/czuiy3nx

PROTEUS SIMULATION FILES : http://snack.to/cujsglic

PCB LAYOUT:

AVAILABLE ON DEMAND

COST:

FULL COST: Rs 1000










12V DC TO 230V AC INVERTER

DC TO AC INVERTER 



SCHEMATIC:


12V DC TO 230V AC INVERTER USING 555 TIMER

WORKING:

1. THE TIMER IC EXCITES THE DECADE COUNTER WHICH IN TURN TURNS ON AND OFF THE POWER MOSFETS.( ALTERNATE ACTION )
2. THE TRANSFORMER TRANSFORMS THE SIGNAL WHICH IS GIVEN TO THE AC DEVICE.

COST:

FULL COST: Rs. 500

PCB LAYOUT:

AVAILABLE ON DEMAND



LM35 TEMPERATURE MEASUREMENT





SCHEMATIC:
TEMPERATURE MEASUREMENT USING LM35 AND 89C51

WORKING:

TEMPERATURE SENSOR LM35 OUTPUTS ANALOG DATA WHICH IS CONVERTED INTO DIGITAL SIGNALS BY ADC0804 AND FED TO THE MICROCONTROLLER WHICH PERFORMS COMPUTATIONS AND SENDS THE INFORMATION TO LCD IN REALTIME.

ADVANTAGES:

1. CAN BE INTERFACED WITH SYSTEMS TO ACT UPON SPECIFIC TEMPERATURES
2. CAN BE USED |IN TEMPERATURE REGULATED FANS
3. AIR CONDITIONING SYSTEMS

CODE:

HEX FILE: http://snack.to/czc52ij1

SIMULATION FILE: http://snack.to/cu9abs5k

PCB LAYOUT:

AVAILABLE ON DEMAND

COST:

FULL COST: Rs 1000

DRIVING LEDS USING AC


SCHEMATIC:( MADE IN PROTEUS ISIS )


DRIVING 5 LEDS USING AC SUPPLY 230V/50Hz


COST:


FULL COST: Rs 100

ADVANTAGES:


1. HIGH LUMINOSITY
2. ENERGY SAVING
3. EASY TO FIX
4. CAN BE MADE AT HOME

PCB LAYOUT:


AVAILABLE ON DEMAND

CLAP ACTIVATED LAMP




SCHEMATICS:( MADE IN PROTEUS ISIS )


CLAP ACTIVATED RELAY USING 555 TIMER AND DECADE COUNTER



COST:


FULL COST : Rs 500

WORKING:


AT THE SOUND OF TWO CLAPS THE LIGHT SWITCHES ON AND REMAINS ON UNTIL TWO MORE CLAPS ARE HEARD BY THE MICROPHONE.

ADVANTAGES:


1. NO NEED OF SWITCH
2. MORE DURABLE AS THE MECHANICAL SWITCH IS ELIMINATED

PCB LAYOUT:


AVAILABLE ON DEMAND ( COMMENT YOUR NAME AND EMAIL ID )