U Fac ET
LATEST VERSION 2.1 (27.02.2012)
Description:
This UModule contains parts of code from the application created for
the Master thesis supervised by Marek Wnuk (Wroclaw University of
Technology): "Wykorzystanie systemu wizyjnego do rozpoznawania
emocji czlowieka" ("Vision system in human emotions recognition")
by Marcin Namysl in June 2008. This module works with UCamera module http://www.urbiforge.org/index.php/Modules/UCamera
and provide some additional functionality.
More info (in Polish):
http://rab.ict.pwr.wroc.pl/~mw/Stud/Dypl/mnamysl/m_namysl_praca_dyplomowa.pdf
Requirement:
Urbi SDK 2.7.1 or higher
OpenCV 2.3.1 )
MS Visual Studio 2008 or higher for compilation from sources
Instalation:
Set correct cascades paths in default.cfg file
Ex. paths to Haar classifier cascades
FACE_PATH cascades/haarcascade_frontalface_alt.xml
R_EYE_PATH cascades/eyes/thing_shan_eye_cascade.xml
L_EYE_PATH cascades/eyes/thing_shan_eye_cascade.xml
MOUTH_PATH cascades/mouth/Mouth.xml
NOSE_PATH cascades/nose/Nariz.xml
Module functions:
UFacet.new(&image); - initialize with image source
UFacet.mode; - set detector mode
mode 0 - you have to get image then call detector function manually, you can use this option to OFF detector (see example 1)
mode 1 - get image manually in a loop (see example 2)
mode 2 - use input port data-flow (see example 3)
UFacet.image; - access to UImage variable, you can see image in Urbi console also
UFacet.width; - image width (determined by scale)
UFacet.height; - image height (determined by scale)
UFacet.scale; - set image scale for processing
UFacet.time; - processing time
UFacet.fps; - algorithm performance
UFacet.input; - object input (use in mode 3 only)
UFacet.SetImage(image); - use this function to detect object manually, you can run this function in background
UFacet.faces; - number of detected faces
UFacet.roix[]; - list of face X coordinate (pixels)
UFacet.roiy[]; - list of face Y coordinate (pixels)
UFacet.angle[]; - list of face declination angle (not verified, for future use)
UFacet.LEbBnd[]; - list of left eyebrow bend angle (top)
UFacet.LEbDcl[]; - list of left eyebrow declination angle (side)
UFacet.LEyOpn[]; - list of distance between the right eyelids (rel. eyeball subregion)
UFacet.LEbHgt[]; - list of distance between left pupil and eyebrow top (rel. eye subregion)
UFacet.REbBnd[]; - list of right eyebrow bend angle (top)
UFacet.REbDcl[]; - list of right eyebrow declination angle (side)
UFacet.REyOpn[]; - list of distance between the right eyelids (rel. eyeball subregion)
UFacet.REbHgt[]; - list of distance between right pupil and eyebrow top (rel. eye subregion)
UFacet.LiAspt[]; - list of aspect ratio of the lips bounding box (percents)
UFacet.LLiCnr[]; - list of Y position of the left corner of the lips (rel. lips bounding box)
UFacet.RLiCnr[]; - list of Y position of the right corner of the lips (rel. lips bounding box)
UFacet.Wrnkls[]; - list of number of horizontal wrinkles in the center of the forehead
UFacet.Nstrls[]; - list of nostrils baseline width (rel. face width)
UFacet.TeethA[]; - list of area of the visible teeth (rel. lips bounding box)
Example 1:
loadModule("UCamera");
var Global.Cam=UCamera.new(0);
loadModule("UFacet");
var Global.Facet=UFacet.new(Global.Cam.&image);
Facet.scale=1;
Facet.loadSettings("default.cfg");
t: loop {
Global.Cam.GetImage();
Global.Facet.SetImage(Global.Cam.image);
},
// display an image
Facet.image;
// display parameters of first face
if (Facet.faces>0){
echo(Facet.roix[0]);
echo(Facet.roiy[0]);
echo(Facet.angle[0]);
echo(Facet.LEbBnd[0]);
echo(Facet.LEbDcl[0]);
echo(Facet.LEyOpn[0]);
echo(Facet.LEbHgt[0]);
echo(Facet.REbBnd[0]);
echo(Facet.REbDcl[0]);
echo(Facet.REyOpn[0]);
echo(Facet.REbHgt[0]);
echo(Facet.LiAspt[0]);
echo(Facet.LLiCnr[0]);
echo(Facet.RLiCnr[0]);
echo(Facet.Wrnkls[0]);
echo(Facet.Nstrls[0]);
echo(Facet.TeethA[0]);
};
Example 2:
loadModule("UCamera");
var Global.Cam=UCamera.new(0);
loadModule("UFacet");
var Global.Facet=UFacet.new(Global.Cam.&image);
Facet.mode=1;
Facet.scale=1;
Facet.loadSettings("default.cfg");
t: loop {
Global.Cam.GetImage();
},
// display an image
Facet.image;
// display parameters of first face
if (Facet.faces>0){
echo(Facet.roix[0]);
echo(Facet.roiy[0]);
echo(Facet.angle[0]);
echo(Facet.LEbBnd[0]);
echo(Facet.LEbDcl[0]);
echo(Facet.LEyOpn[0]);
echo(Facet.LEbHgt[0]);
echo(Facet.REbBnd[0]);
echo(Facet.REbDcl[0]);
echo(Facet.REyOpn[0]);
echo(Facet.REbHgt[0]);
echo(Facet.LiAspt[0]);
echo(Facet.LLiCnr[0]);
echo(Facet.RLiCnr[0]);
echo(Facet.Wrnkls[0]);
echo(Facet.Nstrls[0]);
echo(Facet.TeethA[0]);
};
Example 3:
loadModule("UCamera");
var Global.Cam=UCamera.new(0);
Global.Cam.notify=1;
loadModule("UFacet");
var Global.Facet=UFacet.new(Global.Cam.&image);
Facet.mode=2;
Facet.scale=1;
Facet.loadSettings("default.cfg");
var Conn = Global.Cam.&image >> Global.Facet.&input;
//Conn.asynchronous=true;
// display an image
Facet.image;
// display parameters of first face
if (Facet.faces>0){
echo(Facet.roix[0]);
echo(Facet.roiy[0]);
echo(Facet.angle[0]);
echo(Facet.LEbBnd[0]);
echo(Facet.LEbDcl[0]);
echo(Facet.LEyOpn[0]);
echo(Facet.LEbHgt[0]);
echo(Facet.REbBnd[0]);
echo(Facet.REbDcl[0]);
echo(Facet.REyOpn[0]);
echo(Facet.REbHgt[0]);
echo(Facet.LiAspt[0]);
echo(Facet.LLiCnr[0]);
echo(Facet.RLiCnr[0]);
echo(Facet.Wrnkls[0]);
echo(Facet.Nstrls[0]);
echo(Facet.TeethA[0]);
};
Download here:
Version 2.0
http://lirec.ict.pwr.wroc.pl/~jkedzier/urbi/ufacet21_for_opencv231.zip