Click here to Skip to main content
Click here to Skip to main content

Skin Recognition in C#

, 28 Aug 2004
Rate this:
Please Sign up or sign in to vote.
Skin Recognition in C#.
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS--><!-- Download Links --> <!-- Article image -->

Sample Image - Skin_RecC_.jpg

<!-- Add the rest of your HTML here -->

Introduction

     This article is based on a project I started this summer. Originally the project was a simple edge detection system, but now its turning into a face recognition system.

The first thing that I did done when implementing a skin filter is to convert from RGB color space

to IRgBy color space by using this formula:

I = [L(R) + L(B) + L(G)] / 3
Rg = L(R) - L(G)
By = L(B) - [L(G) +L(R)] / 2

where L is a logarithmic function.

The next thing is to find out the hue, by using this formula:
hue = atan2(Rg,By) * (180 / 3.141592654f)

if (I <= 5 && (hue >= 4 && hue <= 255))
{
     //skin
}
else
{
     /*not skin color it black*/
     modified.SetPixel(x, y, Color.Black);
}
 

 

An example of how you would call the method Vision.DetectSkin(Bitmap original, ref Bitmap modified)

Bitmap original = new Bitmap(@"C:\mypicture.bmp");
Bitmap modified = original;
Vision.DetectSkin(original, ref modified);
//now if you save modified and the look at it you will see that it 
//detected all the skin from the original image

As you can see from the picture the algorithm isn't perfect yet and it needs some touching up.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

xwml

Canada Canada
No Biography provided

Comments and Discussions

 
Generalask about a manuscript (old document) recognition algorithm PinmemberSitti Rachmawati Yahya22-May-08 12:08 
Generalrecognition Pinmemberamir mortazavi26-Jan-05 23:34 
GeneralI would have waited PinmemberRichard Parsons30-Aug-04 11:51 
GeneralReferences PinmemberSteven Campbell30-Aug-04 10:43 
GeneralRe: References Pinmemberrajpatil22-Sep-05 10:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 29 Aug 2004
Article Copyright 2004 by xwml
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid