![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Member Functions | |
FacialRecognitionWrapper (const FacialRecognitionWrapper &) | |
Identity | addIdentity (const QMultiMap< QString, QString > &attributes) |
Adds a new identity with the specified attributes. | |
void | addIdentityAttribute (int id, const QString &attribute, const QString &value) |
void | addIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes) |
Adds or sets, resp., the attributes of an identity. | |
Identity | addIdentityDebug (const QMultiMap< QString, QString > &attributes) |
This is the debug version of addIdentity, so the identity is only added to identityCache, but not into the recognition database. | |
QList< Identity > | allIdentities () const |
Returns all identities known to the database. | |
void | clearAllTraining () |
Deletes the training data for all identities, leaving the identities as such in the database. | |
void | clearTraining (const QList< Identity > &identitiesToClean) |
Deletes the training data for the given identity, leaving the identity as such in the database. | |
void | clearTraining (const QString &hash) |
Deletes the training image for the given identity, leaving the identity as such in the database. | |
void | deleteIdentities (QList< Identity > identitiesToBeDeleted) |
Deletes a list of identities from the database. | |
void | deleteIdentity (const Identity &identityToBeDeleted) |
Deletes an identity from the database. | |
Identity | findIdentity (const QMultiMap< QString, QString > &attributes) const |
Finds the identity matching the given attributes. | |
Identity | findIdentity (const QString &attribute, const QString &value) const |
Finds the first identity with matching attribute - value. | |
Identity | identity (int id) const |
bool | integrityCheck () |
Checks the integrity and returns true if everything is fine. | |
QVariantMap | parameters () const |
Identity | recognizeFace (QImage *const image) |
QList< Identity > | recognizeFaces (const QList< QImage * > &images) |
QList< Identity > | recognizeFaces (ImageListProvider *const images) |
Returns the recommended size if you want to scale face images for recognition. | |
void | setIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes) |
void | setParameter (const QString ¶meter, const QVariant &value) |
Tunes backend parameters. | |
void | setParameters (const FaceScanSettings ¶meters) |
void | setParameters (const QVariantMap ¶meters) |
void | train (const Identity &identityToBeTrained, const QList< QPair< QImage *, QString > > &images) |
void | train (const Identity &identityToBeTrained, const QPair< QImage *, QString > &image) |
Performs training by using image data directly. | |
void | train (const Identity &identityToBeTrained, TrainingDataProvider *const data) |
void | train (const QList< Identity > &identitiesToBeTrained, TrainingDataProvider *const data) |
Performs training. | |
void | vacuum () |
Shrinks the database. | |
Identity Digikam::FacialRecognitionWrapper::addIdentity | ( | const QMultiMap< QString, QString > & | attributes | ) |
Please note that a UUID is automatically generated.
QList< Identity > Digikam::FacialRecognitionWrapper::allIdentities | ( | ) | const |
Identity Digikam::FacialRecognitionWrapper::findIdentity | ( | const QMultiMap< QString, QString > & | attributes | ) | const |
Attributes are first checked with knowledge of their meaning. Secondly, all unknown attributes are used. Returns a null Identity if no match is possible or the map is empty.
Identity Digikam::FacialRecognitionWrapper::findIdentity | ( | const QString & | attribute, |
const QString & | value | ||
) | const |
Returns a null identity if no match is found or attribute is empty.
QList< Identity > Digikam::FacialRecognitionWrapper::recognizeFaces | ( | ImageListProvider *const | images | ) |
Larger images can be passed, but may be downscaled. Performs recognition. The face details to be recognized are passed by the provider. For each entry in the provider, in 1-to-1 mapping, a recognized identity or the null identity is returned.
void Digikam::FacialRecognitionWrapper::setParameter | ( | const QString & | parameter, |
const QVariant & | value | ||
) |
Available parameters: "accuracy", synonymous: "threshold", range: 0-1, type: float Determines recognition threshold, 0->accept very insecure recognitions, 1-> be very sure about a recognition.
"k-nearest" : limit the number of nearest neighbors for KNN "recognizeModel" : sets the recognizer model used to instantiate the correct recognizer
void Digikam::FacialRecognitionWrapper::train | ( | const Identity & | identityToBeTrained, |
const QPair< QImage *, QString > & | image | ||
) |
These are convenience functions for simple setups. If you want good performance and/or a more versatile implementation, be sure to implement your own TrainingDataProvider and use one of the above functions.
void Digikam::FacialRecognitionWrapper::train | ( | const QList< Identity > & | identitiesToBeTrained, |
TrainingDataProvider *const | data | ||
) |
The identities which have new images to be trained are given. An empty list means that all identities are checked.
All needed data will be queried from the provider.
An identifier for the current training context is given, which can identify the application or group of collections. (It is assumed that training from different contexts is based on non-overlapping collections of images. Keep it always constant for your app.)