درود
در پست های قبلی کدی برای تشخیص رنگ پوست در فضای RGB قرار دادم ،اما کمی مشکل داشت این یکی خیلی بهتره.


function Is_Skin(const R, G, B: Byte): Boolean; inline;
function Max(const A, B: Integer): Integer; inline;
begin
if A > B then
Result := A
else
Result := B;
end;
function Min(const A, B: Integer): Integer; inline;
begin
if A < B then
Result := A
else
Result := B;
end;

begin
if ((R > 95) and (G > 40) and (B > 20) and (Max(R, Max(G, B)) - Min(R,
Min(G, B)) > 15) and (abs(R - G) > 15) and (R > G) and (R > B)) then
Result := True
else
Result := False;
end;

procedure Get_SkinColor(const AInput: TBitmap; AOut: TBitmap;
AspecifyByColor: BOOL = False; AspecifyColor: TColor = clRed);
var
iHeight, iWidth: Longint;
pScanLine: Pointer;
RGBBitmap: TRGBTriple;
begin

with AOut do
begin
Height := AInput.Height;
Width := AInput.Width;

// PixelFormat := pf32bit;

for iHeight := Height - 1 downto 0 do
begin
pScanLine := AInput.ScanLine[iHeight];
for iWidth := 0 to Width - 1 do
begin
// Read RGB from scan line
RGBBitmap :=
TRGBTriple(Pointer(Longint(pScanLine) +
(iWidth * SizeOf(TRGBTriple)))^);

if Is_Skin(RGBBitmap.rgbtRed, RGBBitmap.rgbtGreen, RGBBitmap.rgbtBlue)
then
begin
if AspecifyByColor then
begin
AOut.Canvas.Pixels[iWidth, iHeight] := AspecifyColor;
end
else
begin
AOut.Canvas.Pixels[iWidth, iHeight] :=
RGB(RGBBitmap.rgbtRed, RGBBitmap.rgbtGreen, RGBBitmap.rgbtBlue);
end;
end;

end;
end;
end;

end;

اینم طرز استفاده :
procedure TForm1.btn_RunClick(Sender: TObject);
begin
Get_SkinColor(img_1.Picture.Bitmap, img_4.Picture.Bitmap { ,true,clWhite { } )
end;


Skin color RGB.JPG
موفق باشید.