Research Article

Type 1 and Type 2 Diabetes Measurement Using Human Face Skin Region

Algorithm 1

HTHSV.
Input: RGB color image 227 2273
Output: Skin segmented Image
Read RGB image
Split image into R,G,B values
Row,col, chnnels= size of RGB image
Initialize Hue(H), Saturation(S) and Value(V)=0
// Convert RGB to HSV image
for i =1 to row
for j= 1 to col
  V(i,j)=max(R(i,j),G(i,j),B(i,j))
  MinRGB=min(R(i,j),G(i,j),B(i,j))
  If V(i,j)≠0.0 Then
   S(i,j)=((V(i,j)-MinRGB))/V(i,j)
  Else
   S(i,j)=0
  End If
   If V(i,j)=R(i,j) Then
    H(i,j)=60(G(i,j)-B(i,j))/(V(i,j)-MinRGB)
   Else if V(i,j)=G(i,j) Then
    H(i,j)=120+60(B(i,j)-R(i,j)/(V(i,j)-MinRGB)
   Else if V(i,j)=B(i,j) Then
    H(i,j)=240+60(R(i,j)-G(i,j))/(V(i,j)-MinRGB)
   End If
   If H(i,j)<0 Then
    H(i,j)=H(i,j)+360
   End If
  End For
End For
//Separate Hue, saturation and value
H=H/2
S=255S
V=255 V
HSV=concatenation(H,S,V)
//Apply threshold for saturation value within a range of white light(The amount of white light will vary depends on the skin tone of each image)
Low_H,Low_S,Low_V=0,0,0
High_H,High_S,High_V=max_H,max_S,max_V
Satthr=cv2.inRange(HSV, (Low_H,Low_S,Low_V),(High_H,High_S,High_V))
//Apply the inverse threshold for hue value within a range of image.
Huethr=cv2.thresh_inv (HSV,(Low_H,Low_S,Low_V),(High_H,High_S,High_V))
//Take bitwise and between image and saturation value.
SegmentedImage=cv2.bitwiseand(image, Satthr)