![]() |
Multimedia »
General Graphics »
Bitmaps
Beginner
License: The Code Project Open License (CPOL)
Image Processing: Skin Detection, Some Filters and EXIF TagsBy Maxim_BarsukSimple algorithms of skin detection and some useful filters |
C#, Windows (WinXP), .NET, GDI+
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
RedMatter library is simple tool, which includes filters for skin detection and color correction and instruments for EXIF tags reading. Also you may develop your own filter and use it - it's very easy. Now RedMatter includes the following filters and tools:
Apriority skin detection methods use a set of rules. These rules create a polygon in the color space. For example:
(R > 95 and G > 40 and B < 20 and
max{R, G, B} – min{ R, G, B }> 15
and |R - G| > 15 and R > G and R > B)
or
(R > 220 and G > 210 and B > 170 and
|R - G| = 15 and
R > B and G > B)
Or:
All skin detection classes implement a simple interface ISkinDetector:
public interface ISkinDetector: IImageSelector
{
bool IsSkin(Color color);
}
You may use these filters very easily:
BaseDetector detector = new BaseDetector(sourceImage, new SimpleSkinDetector());
pbxImage.Image = detector.SkinDetectionImage;
The library includes six apriority filters with different sets of rules.
Parametric methods (for example, the Gauss method) use the comparison image with the sample of skin. Skin color distribution can be modelled by an elliptical Gaussian joint probability density function (PDF), de?ned as:
Here, c is a color vector and µ and Ss are the distribution parameters.
where n is the total number of skin color samples cj.
Example of usage:
// corrImage – It is sample of skin.
GaussianSkinDetector gauss = new GaussianSkinDetector(corrImage);
gauss.Threshold = 6;
BaseDetector detector = new BaseDetector(sourceImage, gauss);
pbxImage.Image = detector.SkinDetectionImage;
Example of usage:
SoftContourFilter soft = new SoftContourFilter(sourceImage);
soft.Softness = 20.0;
soft.Threshold = 125;
pbxImage.Image = soft.ResultImage;
Example of code:
VignetteFilter vign = new VignetteFilter(sourceImage);
vign.Fade = 35;
vign.VignetteWidth = 50;
pbxImage.Image = vign.ResultImage;
This effect like the noise on the old TV.
You may use this filter very easily:
WavesFilter waves = new WavesFilter(sourceImage);
waves.Period = 50;
waves.Fade = 0.5;
pbxImage.Image = waves.ResultImage;
Did you see the movie "Sin city"? This effect is similar to the visual design of the film.
It's very easy:
SinCityFilter sin = new SinCityFilter(sourceImage, colorDialog.Color);
sin.Tolerance = 50;
pbxImage.Image = sin.ResultImage;
+
= 
We need two images - the image for correction and image-source of color. Example of code:
StatisticColorCorrector scc = new StatisticColorCorrector(sourceImage, corrImage);
pbxImage.Image = scc.ResultImage;
Exchangeable image file format (Exif) is a specification for the image file format used by digital cameras (for all specifications, see here).
You may get a list of all EXIF tags:
PropertyReader pr = new PropertyReader(bitmap);
foreach (EXIFTag tag in pr.GetAllTags())
{
// some code with { tag.TagName, tag.TagValue }
}

This library can be useful for image processing, solution problems of skin detection, and creation filters. I use this library in my research very often.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Jul 2009 Editor: Deeksha Shenoy |
Copyright 2009 by Maxim_Barsuk Everything else Copyright © CodeProject, 1999-2010 Web11 | Advertise on the Code Project |