digiKam
|
Classes | |
class | Private |
Public Member Functions | |
Identity | addIdentity (const QMultiMap< QString, QString > &attributes) |
void | addIdentityAttribute (int id, const QString &attribute, const QString &value) |
void | addIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes) |
Identity | addIdentityDebug (const QMultiMap< QString, QString > &attributes) |
QList< Identity > | allIdentities () const |
NOTE: For the documentation of standard attributes, see identity.h. More... | |
void | clearAllTraining (const QString &trainingContext=QString()) |
void | clearTraining (const QList< Identity > &identitiesToClean, const QString &trainingContext=QString()) |
void | deleteIdentities (QList< Identity > identitiesToBeDeleted) |
void | deleteIdentity (const Identity &identityToBeDeleted) |
FacialRecognitionWrapper () | |
FacialRecognitionWrapper (const FacialRecognitionWrapper &) | |
Identity | findIdentity (const QMultiMap< QString, QString > &attributes) const |
Identity | findIdentity (const QString &attribute, const QString &value) const |
Identity | identity (int id) const |
bool | integrityCheck () |
QVariantMap | parameters () const |
Identity | recognizeFace (QImage *const image) |
QList< Identity > | recognizeFaces (const QList< QImage * > &images) |
QList< Identity > | recognizeFaces (ImageListProvider *const images) |
void | setIdentityAttributes (int id, const QMultiMap< QString, QString > &attributes) |
void | setParameter (const QString ¶meter, const QVariant &value) |
void | setParameters (const QVariantMap ¶meters) |
void | train (const Identity &identityToBeTrained, const QList< QImage * > &images, const QString &trainingContext) |
void | train (const Identity &identityToBeTrained, QImage *image, const QString &trainingContext) |
void | train (const Identity &identityToBeTrained, TrainingDataProvider *const data, const QString &trainingContext) |
void | train (const QList< Identity > &identitiesToBeTrained, TrainingDataProvider *const data, const QString &trainingContext) |
void | vacuum () |
~FacialRecognitionWrapper () | |
|
explicit |
References Digikam::FacialRecognitionWrapper::Private::ref.
Digikam::FacialRecognitionWrapper::FacialRecognitionWrapper | ( | const FacialRecognitionWrapper & | other | ) |
References Digikam::FacialRecognitionWrapper::Private::ref.
Digikam::FacialRecognitionWrapper::~FacialRecognitionWrapper | ( | ) |
References Digikam::FacialRecognitionWrapper::Private::ref.
Identity Digikam::FacialRecognitionWrapper::addIdentity | ( | const QMultiMap< QString, QString > & | attributes | ) |
Adds a new identity with the specified attributes. Please note that a UUID is automatically generated.
References Digikam::FaceDb::addIdentity(), Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, findIdentity(), Digikam::Identity::id(), identity(), Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::Identity::isNull(), Digikam::FacialRecognitionWrapper::Private::mutex, Digikam::Identity::setAttribute(), Digikam::Identity::setAttributesMap(), Digikam::Identity::setId(), and Digikam::FaceDb::updateIdentity().
void Digikam::FacialRecognitionWrapper::addIdentityAttribute | ( | int | id, |
const QString & | attribute, | ||
const QString & | value | ||
) |
void Digikam::FacialRecognitionWrapper::addIdentityAttributes | ( | int | id, |
const QMultiMap< QString, QString > & | attributes | ||
) |
Adds or sets, resp., the attributes of an identity.
References Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::FacialRecognitionWrapper::Private::mutex, and Digikam::FaceDb::updateIdentity().
Identity Digikam::FacialRecognitionWrapper::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.
References Digikam::Identity::id(), identity(), Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::Identity::setAttribute(), Digikam::Identity::setAttributesMap(), and Digikam::Identity::setId().
NOTE: For the documentation of standard attributes, see identity.h.
Returns all identities known to the database
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, and Digikam::FacialRecognitionWrapper::Private::mutex.
Referenced by Digikam::DatabaseTask::run().
void Digikam::FacialRecognitionWrapper::clearAllTraining | ( | const QString & | trainingContext = QString() | ) |
Deletes the training data for all identities, leaving the identities as such in the database.
References Digikam::FacialRecognitionWrapper::Private::clear(), Digikam::FaceDb::clearIdentities(), Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, and Digikam::FacialRecognitionWrapper::Private::mutex.
Referenced by Digikam::FacesDetector::FacesDetector().
void Digikam::FacialRecognitionWrapper::clearTraining | ( | const QList< Identity > & | identitiesToClean, |
const QString & | trainingContext = QString() |
||
) |
Deletes the training data for the given identity, leaving the identity as such in the database.
References Digikam::FacialRecognitionWrapper::Private::clear(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, and Digikam::FacialRecognitionWrapper::Private::mutex.
Deletes a list of identities from the database.
References deleteIdentity(), and identity().
void Digikam::FacialRecognitionWrapper::deleteIdentity | ( | const Identity & | identityToBeDeleted | ) |
Deletes an identity from the database.
References Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FaceDb::deleteIdentity(), Digikam::Identity::id(), Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::Identity::isNull(), and Digikam::FacialRecognitionWrapper::Private::mutex.
Referenced by deleteIdentities().
Identity Digikam::FacialRecognitionWrapper::findIdentity | ( | const QMultiMap< QString, QString > & | attributes | ) | const |
Finds the identity matching the given attributes. 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.
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::findByAttribute(), Digikam::FacialRecognitionWrapper::Private::findByAttributes(), Digikam::Identity::isNull(), and Digikam::FacialRecognitionWrapper::Private::mutex.
Identity Digikam::FacialRecognitionWrapper::findIdentity | ( | const QString & | attribute, |
const QString & | value | ||
) | const |
Finds the first identity with matching attribute - value. Returns a null identity if no match is found or attribute is empty.
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::findByAttribute(), Digikam::FacialRecognitionWrapper::Private::mutex, and value.
Referenced by addIdentity().
Identity Digikam::FacialRecognitionWrapper::identity | ( | int | id | ) | const |
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, and Digikam::FacialRecognitionWrapper::Private::mutex.
Referenced by addIdentity(), addIdentityDebug(), deleteIdentities(), Digikam::FacialRecognitionWrapper::Private::findByAttribute(), Digikam::FacialRecognitionWrapper::Private::findByAttributes(), Digikam::FacialRecognitionWrapper::Private::Private(), and Digikam::FacialRecognitionWrapper::Private::trainIdentityBatch().
bool Digikam::FacialRecognitionWrapper::integrityCheck | ( | ) |
Checks the integrity and returns true if everything is fine.
References Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FaceDb::integrityCheck(), and Digikam::FacialRecognitionWrapper::Private::mutex.
QVariantMap Digikam::FacialRecognitionWrapper::parameters | ( | ) | const |
Identity Digikam::FacialRecognitionWrapper::recognizeFace | ( | QImage *const | image | ) |
References recognizeFaces().
QList< Identity > Digikam::FacialRecognitionWrapper::recognizeFaces | ( | const QList< QImage * > & | images | ) |
References recognizeFaces(), and Digikam::QListImageListProvider::setImages().
QList< Identity > Digikam::FacialRecognitionWrapper::recognizeFaces | ( | ImageListProvider *const | images | ) |
Returns the recommended size if you want to scale face images for recognition. 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.
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::identityCache, Digikam::ImageListProvider::images(), Digikam::FacialRecognitionWrapper::Private::mutex, Digikam::OpenCVDNNFaceRecognizer::recognize(), and Digikam::FacialRecognitionWrapper::Private::recognizer.
Referenced by Digikam::RecognitionWorker::process(), recognizeFace(), and recognizeFaces().
void Digikam::FacialRecognitionWrapper::setIdentityAttributes | ( | int | id, |
const QMultiMap< QString, QString > & | attributes | ||
) |
void Digikam::FacialRecognitionWrapper::setParameter | ( | const QString & | parameter, |
const QVariant & | value | ||
) |
Tunes backend parameters. 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
References Digikam::FacialRecognitionWrapper::Private::applyParameters(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::mutex, Digikam::FacialRecognitionWrapper::Private::parameters, and value.
Referenced by Digikam::RecognitionWorker::setThreshold().
void Digikam::FacialRecognitionWrapper::setParameters | ( | const QVariantMap & | parameters | ) |
void Digikam::FacialRecognitionWrapper::train | ( | const Identity & | identityToBeTrained, |
const QList< QImage * > & | images, | ||
const QString & | trainingContext | ||
) |
References train().
void Digikam::FacialRecognitionWrapper::train | ( | const Identity & | identityToBeTrained, |
QImage * | image, | ||
const QString & | trainingContext | ||
) |
Performs training by using image data directly.
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.
References train().
void Digikam::FacialRecognitionWrapper::train | ( | const Identity & | identityToBeTrained, |
TrainingDataProvider *const | data, | ||
const QString & | trainingContext | ||
) |
References train().
void Digikam::FacialRecognitionWrapper::train | ( | const QList< Identity > & | identitiesToBeTrained, |
TrainingDataProvider *const | data, | ||
const QString & | trainingContext | ||
) |
Performs training. 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.)
References Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::mutex, and Digikam::FacialRecognitionWrapper::Private::trainIdentityBatch().
Referenced by train().
void Digikam::FacialRecognitionWrapper::vacuum | ( | ) |
Shrinks the database.
References Digikam::FaceDbAccess::db(), Digikam::FacialRecognitionWrapper::Private::dbAvailable, Digikam::FacialRecognitionWrapper::Private::mutex, and Digikam::FaceDb::vacuum().
Referenced by Digikam::DatabaseTask::run().