Introduction
This code can detect human emotion from image. First, it takes an image, then by skin color segmentation, it detects human skin color, then it detect human face. Then it separates the eyes & lip from the face. Then it draws bezier curve for eyes & lips. Then it compares the bezier curve of eyes and lips to the bezier curves of eyes & lips that are stored in the data base. Then it finds the nearest bezier curse from the data base & gives that data base stored bezier curve emotion as this image emotion.How Does It Work?
Skin Color Segmentation
For skin color segmentation, first we contrast the image. Then we perform skin color segmentation.Face Detection
For face detection, first we convert binary image from RGB image. For converting binary image, we calculate the average value of RGB for each pixel and if the average value is below than 110, we replace it by black pixel and otherwise we replace it by white pixel. By this method, we get a binary image from RGB image.Eyes Detection
For eyes detection, we convert the RGB face to the binary face. Now, we consider the face width by W. We scan from the W/4 to (W-W/4) to find the middle position of the two eyes. The highest white continuous pixel along the height between the ranges is the middle position of the two eyes.Lip Detection
For lip detection, we determine the lip box. And we consider that lip must be inside the lip box. So, first we determine the distance between the forehead and eyes. Then we add the distance with the lower height of the eye to determine the upper height of the box which will contain the lip. Now, the starting point of the box will be the � position of the left eye box and ending point will be the � position of the right eye box. And the ending height of the box will be the lower end of the face image. So, this box will contain only lip and may some part of the nose. Then we will cut the RGB image according the box.Apply Bezier Curve on Lip
In the lip box, there is lip and may be some part of nose. So, around the box there is skin color or the skin. So, we convert the skin pixel to white pixel and other pixel as black. We also find those pixels which are similar to skin pixels and convert them to white pixel. Here, if two pixels RGB values difference is less than or equal 10, then we called them similar pixel. Here, we use histogram for finding the distance between the lower average RGB value and higher average RGB value. If the distance is less than 70, then we use 7 for finding similar pixel and if the distance is getter than or equal 70 then we use 10 for finding similar pixel. So, the value for finding similar pixel depends on the quality of the image. If the image quality is high, we use 7 for finding similar pixel and if the image quality is low, we use 10.Apply Bezier Curve on Eye
For apply Bezier curve on eyes, first we have to remove eyebrow from eye. For remove eyebrow, we search 1stcontinuous black pixel then continuous white pixel and then continuous black pixel from the binary image of the eye box. Then we remove the 1st continuous black pixel from the box and then we get the box which only contains the eye.Database and Training
In our database, there are two tables. One table �Person
� is for storing the name of people and their index of 4 kinds of emotion which are stored in other table �Position
�. In the �Position
� table, for each index, there are 6 control points for lip Bezier curve, 6 control points for left eye Bezier curve, 6 control points for right eye Bezier curve, lip height and width, left eye height and width and right eye height and width. So, by this method, the program learns the emotion of the people.Emotion Detection
For emotion detection of an image, we have to find the Bezier curve of the lip, left eye and right eye. Then we convert each width of the Bezier curve to 100 and height according to its width. If the person�s emotion information is available in the database, then the program will match which emotion�s height is nearest the current height and the program will give the nearest emotion as output.Using the Program
We can use it in this way:- Select an image by clicking
Browse
button. - Then click
Skin Color
button. - Then click
Connected
button. - Then click
Next
button, then it will open a new window. - Then click
Binary Image
button. - Then click
Face
button. - Then click
eye lip
button. - Then click
Left_Eye_Next
button. - Then click
Left_Eye_Next
button again. - Then click
Left_Eye_Next
button again. - Then click
Left_Eye_Next
button again. - Then click
Right_Eye_Next
button. - Then click
Right_Eye_Next
button again. - Then click
Right_Eye_Next
button again. - Then click
Right_Eye_Next
button again. - Then click
Lip_Next
button. - Then click
Lip_Next
button again. - Then click
Lip_Next
button again. - Then click
Emotion
button for show the emotion. - If you want to enter a face result to the database then, write the person's name in the text box & select a emotion from the combo box then click the
Entry
button.
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :