libface 0.2
|
Classes | |
class | LibFacePriv |
Public Member Functions | |
LibFace (Mode type=ALL, const std::string &configDir=".", const std::string &cascadeDir=std::string(OPENCVDIR)+"/haarcascades") | |
~LibFace () | |
int | count () const |
std::vector< Face > * | detectFaces (const IplImage *img, const CvSize &originalSize) |
std::vector< Face > * | detectFaces (const std::string &filename, int scaleFactor=1) |
std::vector< Face > * | detectFaces (const char *image, int width, int height, int step, int depth=IPL_DEPTH_8U, int channels=1, int scaleFactor=1) |
std::map< std::string, std::string > | getConfig () |
double | getDetectionAccuracy () const |
int | getRecommendedImageSizeForDetection (const CvSize &size=cvSize(0, 0)) const |
CvSize | getRecommendedImageSizeForRecognition (const CvSize &size=cvSize(0, 0)) const |
int | loadConfig (const std::string &configDir) |
int | loadConfig (const std::map< std::string, std::string > &config) |
std::vector< std::pair< int, float > > | recognise (const IplImage *img, std::vector< Face > *faces_p, int scaleFactor=1) |
std::vector< std::pair< int, float > > | recognise (const std::string &filename, std::vector< Face > *faces_p, int scaleFactor=1) |
std::vector< std::pair< int, float > > | recognise (const char *image, std::vector< Face > *faces_p, int width, int height, int step, int depth=IPL_DEPTH_8U, int channels=1, int scaleFactor=1) |
std::vector< std::pair< int, float > > | recognise (std::vector< Face > *faces, int scaleFactor=1) |
int | saveConfig (const std::string &configDir) |
void | setDetectionAccuracy (double value) |
int | update (const std::string &filename, std::vector< Face > *faces=NULL, int scaleFactor=1) |
int | update (const char *image, std::vector< Face > *faces, int width, int height, int step, int depth=IPL_DEPTH_8U, int channels=1, int scaleFactor=1) |
int | update (std::vector< Face > *faces=NULL, int scaleFactor=1) |
int | update (const IplImage *img, std::vector< Face > *faces, int scaleFactor=1) |
libface::LibFace::LibFace | ( | Mode | type = ALL , |
const std::string & | configDir = "." , |
||
const std::string & | cascadeDir = std::string(OPENCVDIR)+"/haarcascades" |
||
) |
Constructor for the LibFace class. Type argument specifies what you want to do with the library. By default ALL is specified, meaning that it will do both face detection and recognition. DETECT can be specified to do only face detection. EIGEN can be specified to do only face recognition, without face detection.
type | Type of the face recognition/detection/both to use. ALL by default. |
configDir | Config directory of the libface library. If there is libface.xml library will try to load it. By default it is empty (""). |
cascadeDir | Directory where haar cascade is. By default it is /usr/share/opencv/haarcascades |
libface::LibFace::~LibFace | ( | ) |
Deconstructor for the library.
int libface::LibFace::count | ( | ) | const |
Get the count of all faces trained
vector< Face > * libface::LibFace::detectFaces | ( | const IplImage * | img, |
const CvSize & | originalSize | ||
) |
Method for detecting faces in the picture with the pointer. It will attempt to check if this file was last to be loaded, if it has been then it will use last pointer. The IDs for all faces will be -1.
img | A pointer to the IplImage for face detection. |
originalSize | Original size of the image. |
vector< Face > * libface::LibFace::detectFaces | ( | const char * | image, |
int | width, | ||
int | height, | ||
int | step, | ||
int | depth = IPL_DEPTH_8U , |
||
int | channels = 1 , |
||
int | scaleFactor = 1 |
||
) |
Method for detecting faces in the picture with the specified encoding. The IDs for all faces will be -1.
image | A pointer to the char encoding. |
width | Image width. |
height | Image height. |
step | Step. |
depth | Image depth (default: IPL_DEPTH_8U). |
channels | Number of channels in the image (default: 1). |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
std::vector<Face>* libface::LibFace::detectFaces | ( | const std::string & | filename, |
int | scaleFactor = 1 |
||
) |
Method for detecting faces in the picture with the specified filename. It will attempt to check if this file was last to be loaded, if it has been then it will use last pointer. The IDs for all faces will be -1.
filename | Filename of the file to find faces in. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
map< string, string > libface::LibFace::getConfig | ( | ) |
Method for getting the configuration from the face recognition. There is no configuration for face detection. The config is returned as a mapping of strings to strings. Each key is a variable name of the config and value is data it holds. Both need to be returned in exact the same way in order for the loadConfig opertion to work. In the mean time the config can be stored in the database. Alternatively use saveConfig() method for libface to store config localy.
double libface::LibFace::getDetectionAccuracy | ( | ) | const |
Get the detection accuracy (see above for interpretation)
int libface::LibFace::getRecommendedImageSizeForDetection | ( | const CvSize & | size = cvSize(0,0) | ) | const |
Returns the image size (one dimension) recommended for face detection. Give the size of the available image, if possible. If the image is considerably larger, it will be rescaled automatically.
CvSize libface::LibFace::getRecommendedImageSizeForRecognition | ( | const CvSize & | size = cvSize(0,0) | ) | const |
Returns the image size recommended for face recognition. Note that the returned size may not preserve pixel aspect ratio. Give the size of the available image, if possible. If the image is larger, it will be rescaled automatically.
int libface::LibFace::loadConfig | ( | const std::string & | configDir | ) |
Method for lading config file from the specified directory that contains libface.xml.
dir | Directory where the libface.xml is. |
int libface::LibFace::loadConfig | ( | const std::map< std::string, std::string > & | config | ) |
Method for loading the config into libface. The config needs to be of the same format as returned by the getConfig().
config | - a mapping of string to string with keys being variables and values are corresponding values. |
std::vector<std::pair<int, float> > libface::LibFace::recognise | ( | const std::string & | filename, |
std::vector< Face > * | faces_p, | ||
int | scaleFactor = 1 |
||
) |
Method to recognise faces in the given image. The array of faces will be updated with new id for each face.
filename | Filename of the image with the faces. |
faces | Pointer to the std::vector of Face objects. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
std::vector<std::pair<int, float> > libface::LibFace::recognise | ( | const char * | image, |
std::vector< Face > * | faces_p, | ||
int | width, | ||
int | height, | ||
int | step, | ||
int | depth = IPL_DEPTH_8U , |
||
int | channels = 1 , |
||
int | scaleFactor = 1 |
||
) |
Method to recognise faces in the given image. The array of faces will be updated with new id for each face.
filename | Filename of the image with the faces. |
faces | Pointer to the std::vector of Face objects. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
std::vector<std::pair<int, float> > libface::LibFace::recognise | ( | std::vector< Face > * | faces, |
int | scaleFactor = 1 |
||
) |
Method to recognise faces in the given image. The array of faces will be updated with new id for each face.
faces | Pointer to the std::vector of Face objects. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
int libface::LibFace::saveConfig | ( | const std::string & | configDir | ) |
Method for saving current configuration of the face recognition library. Creates/overwrites the libface.xml file.
dir | Directory to store the config file in. |
void libface::LibFace::setDetectionAccuracy | ( | double | value | ) |
Set the detection accuracy between 0 and 1. Trades speed vs accuracy: 0 is fast, 1 is slow but more accurate. Default is 0.8.
int libface::LibFace::update | ( | const char * | image, |
std::vector< Face > * | faces, | ||
int | width, | ||
int | height, | ||
int | step, | ||
int | depth = IPL_DEPTH_8U , |
||
int | channels = 1 , |
||
int | scaleFactor = 1 |
||
) |
Method to update the library with faces from the picture specified.
image | Image encoded as chars. |
faces | Pointer to a std::vector of Face objects. Default to NULL, meaning the whole image is face. |
width | Width of the image. |
height | Height of the image. |
step | Step. |
depth | Depth of the image (default: IPL_DEPTH_8U). |
channels | Number of channels (default: 1). |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
int libface::LibFace::update | ( | const std::string & | filename, |
std::vector< Face > * | faces = NULL , |
||
int | scaleFactor = 1 |
||
) |
Method to update the library with faces from the picture specified.
filename | Filename of the image to load. |
faces | Pointer to a sts::vector of Face objects. Default to NULL, meaning the whole image is face. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
int libface::LibFace::update | ( | const IplImage * | img, |
std::vector< Face > * | faces, | ||
int | scaleFactor = 1 |
||
) |
Method to update the library with faces from the picture specified.
img | Pointer to the image where faces are. |
faces | Pointer to a std::vector of Face objects. Default to NULL, meaning the whole image is face. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |
int libface::LibFace::update | ( | std::vector< Face > * | faces = NULL , |
int | scaleFactor = 1 |
||
) |
Method to update the library with faces from the picture specified.
filename | Filename of the image to load. |
faces | Pointer to a std::vector of Face objects. Default to NULL, meaning the whole image is face. |
scaleFactor | Allows to specify if image should be scaled. Make things faster. Default not scaled (1). NOT USED at the moment. |