Click here to Skip to main content
13,045,790 members (47,213 online)
Click here to Skip to main content
Add your own
alternative version


50 bookmarked
Posted 28 Aug 2004

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 -->


     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))
     /*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.


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

Canada Canada
No Biography provided

You may also be interested in...

Comments and Discussions

Generalask about a manuscript (old document) recognition algorithm Pin
Sitti Rachmawati Yahya22-May-08 12:08
memberSitti Rachmawati Yahya22-May-08 12:08 
Generalrecognition Pin
amir mortazavi26-Jan-05 23:34
memberamir mortazavi26-Jan-05 23:34 
GeneralI would have waited Pin
Richard Parsons30-Aug-04 11:51
memberRichard Parsons30-Aug-04 11:51 
GeneralReferences Pin
Steven Campbell30-Aug-04 10:43
memberSteven Campbell30-Aug-04 10:43 
GeneralRe: References Pin
rajpatil22-Sep-05 10:10
memberrajpatil22-Sep-05 10:10 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 29 Aug 2004
Article Copyright 2004 by xwml
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid