digiKam
|
Public Types | |
enum | FaceRecognitionSteps { DetectFaceRegions , DetectAndRecognize } |
Public Member Functions | |
void | add (const FaceTagsIface &face, bool trainFace=true) |
FaceTagsIface | add (qlonglong imageid, int tagId, const TagRegion ®ion, bool trainFace=true) |
FaceTagsIface | addManually (const FaceTagsIface &face) |
FaceTagsIface | changeRegion (const FaceTagsIface &face, const TagRegion &newRegion) |
FaceTagsIface | changeSuggestedName (const FaceTagsIface &previousEntry, int unconfirmedNameTagId) |
FaceTagsIface | changeTag (const FaceTagsIface &face, int newTagId, ItemInfo &info) |
QList< FaceTagsIface > | confirmedFaceTagsIfaces (qlonglong imageid) const |
FaceTagsIface | confirmName (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion()) |
QList< FaceTagsIface > | databaseFaces (qlonglong imageid) const |
QList< FaceTagsIface > | databaseFaces (qlonglong imageId, FaceTagsIface::TypeFlags flags) const |
QList< FaceTagsIface > | databaseFacesForTraining (qlonglong imageid) const |
int | faceCountForPersonInImage (qlonglong imageid, int tagId) const |
QList< ItemTagPair > | faceItemTagPairs (qlonglong imageid, FaceTagsIface::TypeFlags flags) const |
FaceUtils (QObject *const parent=nullptr) | |
QMap< QString, QString > | getSuggestedNames (qlonglong id) const |
QList< QRect > | getTagRects (qlonglong imageid) const |
bool | hasBeenScanned (const ItemInfo &info) const |
bool | hasBeenScanned (qlonglong imageid) const |
Identity | identityForTag (int tagId, FacialRecognitionWrapper &recognizer) const |
QList< FaceTagsIface > | ignoredFaceTagsIfaces (qlonglong imageid) const |
void | markAsScanned (const ItemInfo &info, bool hasBeenScanned=true) const |
void | markAsScanned (qlonglong imageid, bool hasBeenScanned=true) const |
int | numberOfFaces (qlonglong imageid) const |
void | removeAllFaces (qlonglong imageid) |
void | removeFace (const FaceTagsIface &face, bool touchTags=true) |
void | removeFace (qlonglong imageid, const QRect &rect) |
void | removeFaces (const QList< FaceTagsIface > &faces) |
QSize | rotateFaces (const ItemInfo &info, int newOrientation, int oldOrientation) |
void | storeThumbnails (ThumbnailLoadThread *const thread, const QString &filePath, const QList< FaceTagsIface > &databaseFaces, const DImg &image) |
int | tagForIdentity (const Identity &identity) const |
QList< FaceTagsIface > | toFaceTagsIfaces (qlonglong imageid, const QList< QRectF > &detectedFaces, const QList< Identity > &recognitionResults, const QSize &fullSize) const |
QList< FaceTagsIface > | unconfirmedFaceTagsIfaces (qlonglong imageid) const |
QList< FaceTagsIface > | unconfirmedNameFaceTagsIfaces (qlonglong imageid) const |
QList< FaceTagsIface > | writeUnconfirmedResults (qlonglong imageid, const QList< QRectF > &detectedFaces, const QList< Identity > &recognitionResults, const QSize &fullSize) |
~FaceUtils () override | |
Static Public Member Functions | |
static FaceTagsIface | confirmedEntry (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion()) |
static int | faceRectDisplayMargin (const QRect &rect) |
static FaceTagsIface | unconfirmedEntry (qlonglong imageId, int tagId, const TagRegion ®ion) |
static FaceTagsIface | unknownPersonEntry (qlonglong imageId, const TagRegion ®ion) |
Protected Member Functions | |
void | addFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, const QStringList &properties, bool addTag) |
void | addNormalTag (qlonglong imageid, int tagId) override |
void | removeFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, bool touchTags) |
void | removeNormalTag (qlonglong imageid, int tagId) override |
void | removeNormalTags (qlonglong imageid, const QList< int > &tagId) override |
|
explicit |
|
override |
|
inherited |
Adds a new entry to the database. The convenience wrapper will return the newly created entry. If trainFace is true, the face will also be listed in the db as needing training. The tag of the face will, if necessary, be converted to a person tag.
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::FaceForTraining, Digikam::FaceTagsIface::imageId(), and Digikam::FaceTagsIface::tagId().
Referenced by Digikam::FaceTagsEditor::add(), Digikam::ItemScanner::commitFaces(), and Digikam::AlbumManager::mergeTAlbum().
|
inherited |
|
protectedinherited |
References Digikam::FaceTagsEditor::addNormalTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTags::ensureIsPerson(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsIface::tagId(), and Digikam::TagRegion::toXml().
Referenced by Digikam::FaceTagsEditor::add(), Digikam::FaceTagsEditor::addManually(), Digikam::FaceTagsEditor::changeRegion(), Digikam::FaceTagsEditor::changeSuggestedName(), Digikam::FaceTagsEditor::changeTag(), Digikam::FaceTagsEditor::confirmName(), and writeUnconfirmedResults().
|
inherited |
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::tagId(), and Digikam::FaceTagsIface::type().
Referenced by Digikam::ItemScanner::commitFaces(), Digikam::AlbumManager::deleteTAlbum(), and Digikam::DatabaseWriter::process().
|
overrideprotectedvirtual |
Implementation for automatic assigning of face as Tag Icon, if no icon exists currently. Utilising a QTimer to ensure that a new TAlbum is given time to be created, before assigning Icon.
Reimplemented from Digikam::FaceTagsEditor.
References Digikam::FileActionMngr::assignTag(), Digikam::AlbumManager::findTAlbum(), Digikam::TAlbum::iconId(), Digikam::AlbumManager::instance(), Digikam::FileActionMngr::instance(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), and Digikam::FaceTags::isTheUnknownPerson().
|
inherited |
Changes the region of the given entry. Returns the face with the new region set.
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::FaceTagsIface::getAutodetectedPersonString(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsEditor::removeFaceAndTag(), Digikam::FaceTagsIface::setRegion(), Digikam::FaceTagsIface::tagId(), Digikam::FaceTagsIface::type(), Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::DatabaseWriter::process(), and rotateFaces().
|
inherited |
Switches an unknownPersonEntry or unconfirmedEntry to an unconfirmedEntry (with a different suggested name)
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::FaceTagsIface::getAutodetectedPersonString(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isConfirmedName(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsEditor::removeFace(), Digikam::FaceTagsIface::tagId(), Digikam::FaceTagsEditor::unconfirmedEntry(), Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::DatabaseWriter::process().
|
inherited |
Changes the tag of the given entry. Returns the face with the new Tag.
Since a new Tag is going to be assigned to the Face, it's important to remove the association between the face and the old tagId.
If the face is being ignored and it was an unconfirmed face, don't remove a possible tag. See bug 449142
NOTE: Ignored Tag is being associated with the Images. This is to allow storing Ignored information in the metadata of the image. We store metadata of FaceTags, if it's a confirmed or ignored person.
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTags::isPerson(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::FaceTagsEditor::removeFace(), Digikam::FaceTagsIface::setTagId(), Digikam::FaceTagsIface::setType(), Digikam::FaceTagsIface::tagId(), Digikam::FaceTagsIface::type(), Digikam::FaceTagsIface::typeForId(), and Digikam::FaceTagsIface::UnconfirmedName.
Referenced by Digikam::DatabaseWriter::process().
|
staticinherited |
Returns the entry that would be added if the given face is confirmed.
References Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::imageId(), Digikam::TagRegion::isValid(), Digikam::FaceTagsIface::region(), and Digikam::FaceTagsIface::tagId().
Referenced by Digikam::FacePipeline::confirm(), and Digikam::FaceTagsEditor::confirmName().
|
inherited |
References Digikam::FaceTagsIface::ConfirmedName, and Digikam::FaceTagsEditor::databaseFaces().
Referenced by Digikam::ScanStateFilter::filter(), and Digikam::MetadataHub::loadFaceTags().
|
inherited |
Assign the name tag for given face entry. Pass the tagId if it changed or was newly assigned (UnknownName). Pass the new, corrected region if it changed. If the default values are passed, tag id or region are taken from the given face. The given face should be an unchanged entry read from the database. The confirmed tag will, if necessary, be converted to a person tag. Returns the newly inserted entry.
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsEditor::confirmedEntry(), Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::FaceForTraining, Digikam::FaceTagsIface::imageId(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::FaceTagsEditor::removeFaceAndTag(), and Digikam::FaceTagsIface::tagId().
Referenced by Digikam::DatabaseWriter::process().
|
inherited |
Reads the FaceTagsIfaces for the given image id from the database
References Digikam::FaceTagsIface::NormalFaces.
Referenced by Digikam::ItemScanner::commitFaces(), Digikam::FaceTagsEditor::confirmedFaceTagsIfaces(), Digikam::FaceTagsEditor::databaseFacesForTraining(), Digikam::AlbumManager::deleteTAlbum(), Digikam::ItemInfo::faceCount(), Digikam::FaceTagsEditor::ignoredFaceTagsIfaces(), Digikam::FaceGroup::load(), Digikam::AlbumManager::mergeTAlbum(), Digikam::DetectionBenchmarker::process(), rotateFaces(), Digikam::DatabaseTask::run(), storeThumbnails(), Digikam::FaceTagsEditor::unconfirmedFaceTagsIfaces(), Digikam::FaceTagsEditor::unconfirmedNameFaceTagsIfaces(), and writeUnconfirmedResults().
|
inherited |
|
inherited |
References Digikam::FaceTagsEditor::databaseFaces(), and Digikam::FaceTagsIface::FaceForTraining.
Referenced by Digikam::ScanStateFilter::filter().
|
inherited |
Returns the number of faces a particular person has in the specified image
References Digikam::ImageTagPropertyName::tagRegion(), and Digikam::ItemTagPair::values().
|
inherited |
References Digikam::FaceTagsIface::attributesForFlags(), Digikam::ItemTagPair::availablePairs(), Digikam::ItemTagPair::hasAnyProperty(), Digikam::FaceTags::isPerson(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::ItemTagPair::tagId(), and Digikam::FaceTagsIface::UnknownName.
Referenced by Digikam::FaceTagsEditor::databaseFaces(), Digikam::FaceTagsEditor::removeAllFaces(), and Digikam::FaceTagsEditor::removeFace().
|
static |
For display, it may be desirable to display a slightly larger region than the strict face rectangle. This returns a pixel margin commonly used to increase the rectangle size in all four directions.
Referenced by Digikam::ItemFaceDelegate::largerFaceRect(), Digikam::DatabaseTask::run(), and storeThumbnails().
|
inherited |
Returns a Map of Tag Regions (in XML format) to Suggested Name (from Face Recognition) for the given image. This function makes read operations to the database, and hence can be inefficient when called repeatedly. A cached version is provided in ItemInfo, and should be preferred for intensive operations such as sorting, categorizing etc.
For Unconfirmed Results, the value is stored as a tuple of (SuggestedId, Property, Region). Look at the digikam.db file for more details.
References Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::ItemTagPair::availablePairs(), Digikam::FaceTags::faceNameForTag(), and Digikam::ItemTagPair::values().
Referenced by Digikam::ItemInfo::getSuggestedNames().
|
inherited |
Returns a list of all tag rectangles for the image. Unlike findAndTagFaces, this does not take a DImg, because it returns only a QRect, not a Face, so no need of cropping a face rectangle.
References Digikam::ItemTagPair::availablePairs(), Digikam::ImageTagPropertyName::tagRegion(), Digikam::TagRegion::toRect(), and Digikam::ItemTagPair::values().
bool Digikam::FaceUtils::hasBeenScanned | ( | const ItemInfo & | info | ) | const |
Tells if the image has been scanned for faces or not
References Digikam::FaceTags::scannedForFacesTagId(), and Digikam::ItemInfo::tagIds().
Referenced by Digikam::ScanStateFilter::filter(), hasBeenScanned(), and markAsScanned().
bool Digikam::FaceUtils::hasBeenScanned | ( | qlonglong | imageid | ) | const |
References hasBeenScanned().
Identity Digikam::FaceUtils::identityForTag | ( | int | tagId, |
FacialRecognitionWrapper & | recognizer | ||
) | const |
References Digikam::FaceTags::identityAttributes().
|
inherited |
References Digikam::FaceTagsEditor::databaseFaces(), and Digikam::FaceTagsIface::IgnoredName.
Referenced by Digikam::MetadataHub::loadFaceTags().
void Digikam::FaceUtils::markAsScanned | ( | const ItemInfo & | info, |
bool | hasBeenScanned = true |
||
) | const |
void Digikam::FaceUtils::markAsScanned | ( | qlonglong | imageid, |
bool | hasBeenScanned = true |
||
) | const |
Marks the image as scanned for faces.
References hasBeenScanned().
Referenced by Digikam::DatabaseWriter::process().
|
inherited |
Returns the number of faces present in an image.
References Digikam::ItemTagPair::availablePairs(), Digikam::ImageTagPropertyName::tagRegion(), and Digikam::ItemTagPair::values().
|
inherited |
Unassigns all face tags from the image and sets it's scanned property to false.
References Digikam::FaceTagsIface::AllTypes, Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsEditor::faceItemTagPairs(), Digikam::ItemTagPair::isAssigned(), Digikam::FaceTagsEditor::removeNormalTags(), Digikam::ItemTagPair::removeProperties(), and Digikam::ItemTagPair::tagId().
Referenced by Digikam::FaceGroup::rejectAll().
|
inherited |
Remove the given face. If appropriate, the tag is also removed.
References Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTagsEditor::removeFaceAndTag(), and Digikam::FaceTagsIface::tagId().
Referenced by Digikam::FaceTagsEditor::changeSuggestedName(), Digikam::FaceTagsEditor::changeTag(), Digikam::ItemScanner::commitFaces(), Digikam::AlbumManager::deleteTAlbum(), Digikam::AlbumManager::mergeTAlbum(), and Digikam::DatabaseWriter::process().
|
inherited |
Remove a face or the face for a certain rect from an image.
References Digikam::FaceTagsIface::AllTypes, Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsEditor::faceItemTagPairs(), Digikam::ItemTagPair::isAssigned(), Digikam::FaceTagsEditor::removeNormalTags(), Digikam::ItemTagPair::removeProperty(), Digikam::ItemTagPair::tagId(), and Digikam::ItemTagPair::values().
|
protectedinherited |
References Digikam::FaceTagsEditor::addNormalTag(), Digikam::FaceTagsIface::attributeForType(), Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::FaceForTraining, Digikam::FaceTagsIface::getAutodetectedPersonString(), Digikam::ItemTagPair::hasProperty(), Digikam::FaceTagsIface::imageId(), Digikam::ItemTagPair::isAssigned(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsEditor::removeNormalTag(), Digikam::ItemTagPair::removeProperty(), Digikam::ItemTagPair::tagId(), Digikam::TagRegion::toRect(), Digikam::TagRegion::toXml(), Digikam::FaceTagsIface::type(), and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::FaceTagsEditor::changeRegion(), Digikam::FaceTagsEditor::confirmName(), Digikam::FaceTagsEditor::removeFace(), and Digikam::FaceTagsEditor::removeFaces().
|
inherited |
|
overrideprotectedvirtual |
If the face just removed was the final face associated with that Tag, reset Tag Icon.
Reimplemented from Digikam::FaceTagsEditor.
References Digikam::CoreDbAccess::db(), Digikam::AlbumManager::findTAlbum(), Digikam::CoreDB::getNumberOfImagesInTagProperties(), Digikam::TAlbum::iconId(), Digikam::AlbumManager::instance(), Digikam::FileActionMngr::instance(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::FileActionMngr::removeTag(), and Digikam::ImageTagPropertyName::tagRegion().
|
overrideprotectedvirtual |
Reimplemented from Digikam::FaceTagsEditor.
References Digikam::FileActionMngr::instance(), and Digikam::FileActionMngr::removeTags().
QSize Digikam::FaceUtils::rotateFaces | ( | const ItemInfo & | info, |
int | newOrientation, | ||
int | oldOrientation | ||
) |
Rotate face tags
Get all faces from database and rotate them
References Digikam::TagRegion::adjustToOrientation(), Digikam::FaceTagsEditor::changeRegion(), Digikam::FaceTagsEditor::databaseFaces(), Digikam::ItemInfo::dimensions(), Digikam::ItemInfo::id(), Digikam::FaceTagsIface::region(), Digikam::TagRegion::reverseToOrientation(), and Digikam::TagRegion::toRect().
Referenced by Digikam::FileActionMngrDatabaseWorker::setExifOrientation(), and Digikam::FileActionMngrFileWorker::transform().
void Digikam::FaceUtils::storeThumbnails | ( | ThumbnailLoadThread *const | thread, |
const QString & | filePath, | ||
const QList< FaceTagsIface > & | databaseFaces, | ||
const DImg & | image | ||
) |
This uses a thumbnail load thread to load the image detail. If requested, the faces will be scaled to the given (fixed) size. Store the needed thumbnails for the given faces. This can be a huge optimization when the has already been loaded anyway.
References Digikam::DImg::copyQImage(), Digikam::FaceTagsEditor::databaseFaces(), faceRectDisplayMargin(), Digikam::TagRegion::mapFromOriginalSize(), Digikam::FaceTagsIface::region(), Digikam::ThumbnailLoadThread::storeDetailThumbnail(), and Digikam::TagRegion::toRect().
Referenced by Digikam::DatabaseWriter::process().
int Digikam::FaceUtils::tagForIdentity | ( | const Identity & | identity | ) | const |
QList< FaceTagsIface > Digikam::FaceUtils::toFaceTagsIfaces | ( | qlonglong | imageid, |
const QList< QRectF > & | detectedFaces, | ||
const QList< Identity > & | recognitionResults, | ||
const QSize & | fullSize | ||
) | const |
Conversion
Referenced by Digikam::DetectionBenchmarker::process(), and writeUnconfirmedResults().
|
staticinherited |
Returns the entry that would be added if the given face is autodetected. If tagId is -1, the unknown person will be taken.
References Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unknownPersonTagId().
Referenced by Digikam::FacePipeline::addManually(), Digikam::FaceTagsEditor::changeSuggestedName(), Digikam::DatabaseWriter::process(), and Digikam::FaceTagsEditor::unknownPersonEntry().
|
inherited |
Returns list of Unconfirmed and Unknown faces in the Image. If you want just Unconfirmed Faces,
References Digikam::FaceTagsEditor::databaseFaces(), and Digikam::FaceTagsIface::UnconfirmedTypes.
Referenced by Digikam::ScanStateFilter::filter(), and Digikam::DatabaseWriter::process().
|
inherited |
Returns a list of UnconfirmedFaces in the Image. Different from
References Digikam::FaceTagsEditor::databaseFaces(), and Digikam::FaceTagsIface::UnconfirmedName.
Referenced by Digikam::ItemInfo::unconfirmedFaceCount().
|
staticinherited |
References Digikam::FaceTagsEditor::unconfirmedEntry().
QList< FaceTagsIface > Digikam::FaceUtils::writeUnconfirmedResults | ( | qlonglong | imageid, |
const QList< QRectF > & | detectedFaces, | ||
const QList< Identity > & | recognitionResults, | ||
const QSize & | fullSize | ||
) |
The given face list is a result of automatic detection and possibly recognition. The results are written to the database and merged with existing entries. The returned list contains the faces written to the database and has the same size as the given list. If a face was skipped (because of an existing entry), a null FaceTagsIface will be at this place.
References Digikam::FaceTagsEditor::addFaceAndTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::FaceTagsEditor::databaseFaces(), Digikam::FaceTagsIface::getAutodetectedPersonString(), Digikam::TagRegion::intersects(), Digikam::FaceTagsIface::isConfirmedName(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTags::isTheUnknownPerson(), Digikam::FaceTagsIface::isUnconfirmedName(), Digikam::FaceTagsIface::isUnconfirmedType(), Digikam::FaceTagsIface::isUnknownName(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsEditor::removeFaces(), Digikam::FaceTagsIface::tagId(), toFaceTagsIfaces(), Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::DatabaseWriter::process().