ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Skin tone detection
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

sandy771

57 Posts

Posted - Mar 19 2013 :  01:29:24  Show Profile  Reply
Has anyone used IE for skin tone detection? are there any built in functions that can help?

Thx.

ehkhalid

27 Posts

Posted - Mar 20 2013 :  03:28:33  Show Profile  Reply
Hi,
you can filter skil color with thresholding fuction in imageen, you can get all skin color from this link http://en.wikipedia.org/wiki/File:Felix_von_Luschan_Skin_Color_chart.svg, for each color you get the hsv value (using any image editor) and then use this value in your threshold function in imageen.

Hope this help
Go to Top of Page

fab

1310 Posts

Posted - Mar 27 2013 :  03:56:29  Show Profile  Reply
I don't like skin tone detection. Anyway here is an example based (actually I just translated formulas to code...) on the paper at http://cat.hfu.edu.tw/~b8403009/TD-006386.pdf
This example loads input.jpg, and sets Not skin pixels to black.

procedure processPixel(rgb: PRGB);
var
  d, r, g: double;
  F1, F2: double;
  w: double;
  isSkin: boolean;
  h, s, l: integer;
begin
  d := (rgb^.r + rgb^.g + rgb^.b);
  if d > 0 then
  begin
    r := rgb^.r / d;
    g := rgb^.g / d;
  end
  else
  begin
    r := 0;
    g := 0;
  end;
  F1 := -1.376 * sqr(r) +1.0743 * r + 0.2;
  F2 := -0.776 * sqr(r) +0.5601 * r + 0.18;
  w := sqr(r - 0.33) + sqr(g - 0.33);
  isSkin := (g < F1) and (g > F2) and (w > 0.001);

  RGB2HSV(rgb^, h, s, l);

  isSkin := isSkin and ((h > 240) or (h <= 50));  

  if not isSkin then
    rgb^ := CreateRGB(0, 0, 0);
end;

procedure TForm1.Button22Click(Sender: TObject);
var
  i, j: integer;
begin
  ImageEnView1.IO.LoadFromFile('input.jpg');

  for i := 0 to ImageEnView1.IEBitmap.Height - 1 do
    for j := 0 to ImageEnView1.IEBitmap.Width - 1 do
      processPixel( ImageEnView1.IEBitmap.PPixels_ie24RGB[j, i] );

  ImageEnView1.Update();
end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: