digiKam
|
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 |
FaceTagsEditor () | |
QMap< QString, QString > | getSuggestedNames (qlonglong id) const |
QList< QRect > | getTagRects (qlonglong imageid) const |
QList< FaceTagsIface > | ignoredFaceTagsIfaces (qlonglong imageid) 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) |
QList< FaceTagsIface > | unconfirmedFaceTagsIfaces (qlonglong imageid) const |
QList< FaceTagsIface > | unconfirmedNameFaceTagsIfaces (qlonglong imageid) const |
virtual | ~FaceTagsEditor () |
Static Public Member Functions | |
static FaceTagsIface | confirmedEntry (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion()) |
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) |
virtual void | addNormalTag (qlonglong imageid, int tagId) |
void | removeFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, bool touchTags) |
virtual void | removeNormalTag (qlonglong imageid, int tagId) |
virtual void | removeNormalTags (qlonglong imageid, const QList< int > &tagId) |
Digikam::FaceTagsEditor::FaceTagsEditor | ( | ) |
|
virtual |
void Digikam::FaceTagsEditor::add | ( | const FaceTagsIface & | face, |
bool | trainFace = true |
||
) |
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 addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::FaceForTraining, Digikam::FaceTagsIface::imageId(), and Digikam::FaceTagsIface::tagId().
Referenced by add(), Digikam::ItemScanner::commitFaces(), and Digikam::AlbumManager::mergeTAlbum().
FaceTagsIface Digikam::FaceTagsEditor::add | ( | qlonglong | imageid, |
int | tagId, | ||
const TagRegion & | region, | ||
bool | trainFace = true |
||
) |
References add(), Digikam::FaceTagsIface::ConfirmedName, and Digikam::TagRegion::toRect().
|
protected |
References addNormalTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTags::ensureIsPerson(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::region(), Digikam::FaceTagsIface::tagId(), and Digikam::TagRegion::toXml().
Referenced by add(), addManually(), changeRegion(), changeSuggestedName(), changeTag(), confirmName(), and Digikam::FaceUtils::writeUnconfirmedResults().
FaceTagsIface Digikam::FaceTagsEditor::addManually | ( | const FaceTagsIface & | face | ) |
References 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().
|
protectedvirtual |
Reimplemented in Digikam::FaceUtils.
References Digikam::ItemInfo::setTag().
Referenced by addFaceAndTag(), and removeFaceAndTag().
FaceTagsIface Digikam::FaceTagsEditor::changeRegion | ( | const FaceTagsIface & | face, |
const TagRegion & | newRegion | ||
) |
Changes the region of the given entry. Returns the face with the new region set.
References addFaceAndTag(), Digikam::ItemTagPair::addProperty(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::ImageTagPropertyName::autodetectedPerson(), Digikam::FaceTagsIface::getAutodetectedPersonString(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTagsIface::region(), removeFaceAndTag(), Digikam::FaceTagsIface::setRegion(), Digikam::FaceTagsIface::tagId(), Digikam::FaceTagsIface::type(), Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::DatabaseWriter::process(), and Digikam::FaceUtils::rotateFaces().
FaceTagsIface Digikam::FaceTagsEditor::changeSuggestedName | ( | const FaceTagsIface & | previousEntry, |
int | unconfirmedNameTagId | ||
) |
Switches an unknownPersonEntry or unconfirmedEntry to an unconfirmedEntry (with a different suggested name)
References 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(), removeFace(), Digikam::FaceTagsIface::tagId(), unconfirmedEntry(), Digikam::FaceTagsIface::UnconfirmedName, and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by Digikam::DatabaseWriter::process().
FaceTagsIface Digikam::FaceTagsEditor::changeTag | ( | const FaceTagsIface & | face, |
int | newTagId, | ||
ItemInfo & | info | ||
) |
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 addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), Digikam::FaceTags::isPerson(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), 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().
|
static |
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 confirmName().
QList< FaceTagsIface > Digikam::FaceTagsEditor::confirmedFaceTagsIfaces | ( | qlonglong | imageid | ) | const |
References Digikam::FaceTagsIface::ConfirmedName, and databaseFaces().
Referenced by Digikam::ScanStateFilter::filter(), and Digikam::MetadataHub::loadFaceTags().
FaceTagsIface Digikam::FaceTagsEditor::confirmName | ( | const FaceTagsIface & | face, |
int | tagId = -1 , |
||
const TagRegion & | confirmedRegion = TagRegion() |
||
) |
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 addFaceAndTag(), Digikam::FaceTagsIface::attributesForFlags(), confirmedEntry(), Digikam::FaceTagsIface::ConfirmedName, Digikam::FaceTagsIface::FaceForTraining, Digikam::FaceTagsIface::imageId(), Digikam::FaceTags::isTheIgnoredPerson(), Digikam::FaceTags::isTheUnconfirmedPerson(), Digikam::FaceTags::isTheUnknownPerson(), removeFaceAndTag(), and Digikam::FaceTagsIface::tagId().
Referenced by Digikam::DatabaseWriter::process().
QList< FaceTagsIface > Digikam::FaceTagsEditor::databaseFaces | ( | qlonglong | imageid | ) | const |
Reads the FaceTagsIfaces for the given image id from the database
References Digikam::FaceTagsIface::NormalFaces.
Referenced by Digikam::ItemScanner::commitFaces(), confirmedFaceTagsIfaces(), databaseFacesForTraining(), Digikam::AlbumManager::deleteTAlbum(), Digikam::ItemInfo::faceCount(), ignoredFaceTagsIfaces(), Digikam::FaceGroup::load(), Digikam::AlbumManager::mergeTAlbum(), Digikam::DetectionBenchmarker::process(), Digikam::FaceUtils::rotateFaces(), Digikam::DatabaseTask::run(), Digikam::FaceUtils::storeThumbnails(), unconfirmedFaceTagsIfaces(), unconfirmedNameFaceTagsIfaces(), and Digikam::FaceUtils::writeUnconfirmedResults().
QList< FaceTagsIface > Digikam::FaceTagsEditor::databaseFaces | ( | qlonglong | imageId, |
FaceTagsIface::TypeFlags | flags | ||
) | const |
QList< FaceTagsIface > Digikam::FaceTagsEditor::databaseFacesForTraining | ( | qlonglong | imageid | ) | const |
References databaseFaces(), and Digikam::FaceTagsIface::FaceForTraining.
Referenced by Digikam::ScanStateFilter::filter().
int Digikam::FaceTagsEditor::faceCountForPersonInImage | ( | qlonglong | imageid, |
int | tagId | ||
) | const |
Returns the number of faces a particular person has in the specified image
References Digikam::ImageTagPropertyName::tagRegion(), and Digikam::ItemTagPair::values().
QList< ItemTagPair > Digikam::FaceTagsEditor::faceItemTagPairs | ( | qlonglong | imageid, |
FaceTagsIface::TypeFlags | flags | ||
) | const |
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 databaseFaces(), removeAllFaces(), and removeFace().
QMap< QString, QString > Digikam::FaceTagsEditor::getSuggestedNames | ( | qlonglong | id | ) | const |
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().
QList< QRect > Digikam::FaceTagsEditor::getTagRects | ( | qlonglong | imageid | ) | const |
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().
QList< FaceTagsIface > Digikam::FaceTagsEditor::ignoredFaceTagsIfaces | ( | qlonglong | imageid | ) | const |
References databaseFaces(), and Digikam::FaceTagsIface::IgnoredName.
Referenced by Digikam::MetadataHub::loadFaceTags().
int Digikam::FaceTagsEditor::numberOfFaces | ( | qlonglong | imageid | ) | const |
Returns the number of faces present in an image.
References Digikam::ItemTagPair::availablePairs(), Digikam::ImageTagPropertyName::tagRegion(), and Digikam::ItemTagPair::values().
void Digikam::FaceTagsEditor::removeAllFaces | ( | qlonglong | imageid | ) |
Unassigns all face tags from the image and sets it's scanned property to false.
References Digikam::FaceTagsIface::AllTypes, Digikam::FaceTagsIface::attributesForFlags(), faceItemTagPairs(), Digikam::ItemTagPair::isAssigned(), removeNormalTags(), Digikam::ItemTagPair::removeProperties(), and Digikam::ItemTagPair::tagId().
Referenced by Digikam::FaceGroup::rejectAll().
void Digikam::FaceTagsEditor::removeFace | ( | const FaceTagsIface & | face, |
bool | touchTags = true |
||
) |
Remove the given face. If appropriate, the tag is also removed.
References Digikam::FaceTagsIface::imageId(), Digikam::FaceTagsIface::isNull(), removeFaceAndTag(), and Digikam::FaceTagsIface::tagId().
Referenced by changeSuggestedName(), changeTag(), Digikam::ItemScanner::commitFaces(), Digikam::AlbumManager::deleteTAlbum(), Digikam::AlbumManager::mergeTAlbum(), and Digikam::DatabaseWriter::process().
void Digikam::FaceTagsEditor::removeFace | ( | qlonglong | imageid, |
const QRect & | rect | ||
) |
Remove a face or the face for a certain rect from an image.
References Digikam::FaceTagsIface::AllTypes, Digikam::FaceTagsIface::attributesForFlags(), faceItemTagPairs(), Digikam::ItemTagPair::isAssigned(), removeNormalTags(), Digikam::ItemTagPair::removeProperty(), Digikam::ItemTagPair::tagId(), and Digikam::ItemTagPair::values().
|
protected |
References 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(), removeNormalTag(), Digikam::ItemTagPair::removeProperty(), Digikam::ItemTagPair::tagId(), Digikam::TagRegion::toRect(), Digikam::TagRegion::toXml(), Digikam::FaceTagsIface::type(), and Digikam::FaceTags::unconfirmedPersonTagId().
Referenced by changeRegion(), confirmName(), removeFace(), and removeFaces().
void Digikam::FaceTagsEditor::removeFaces | ( | const QList< FaceTagsIface > & | faces | ) |
|
protectedvirtual |
Reimplemented in Digikam::FaceUtils.
References Digikam::ItemInfo::removeTag().
Referenced by removeFaceAndTag().
|
protectedvirtual |
Reimplemented in Digikam::FaceUtils.
References Digikam::CoreDbOperationGroup::allowLift(), Digikam::ItemInfo::removeTag(), and Digikam::CoreDbOperationGroup::setMaximumTime().
Referenced by removeAllFaces(), and removeFace().
|
static |
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(), changeSuggestedName(), Digikam::DatabaseWriter::process(), and unknownPersonEntry().
QList< FaceTagsIface > Digikam::FaceTagsEditor::unconfirmedFaceTagsIfaces | ( | qlonglong | imageid | ) | const |
Returns list of Unconfirmed and Unknown faces in the Image. If you want just Unconfirmed Faces,
References databaseFaces(), and Digikam::FaceTagsIface::UnconfirmedTypes.
Referenced by Digikam::ScanStateFilter::filter(), and Digikam::DatabaseWriter::process().
QList< FaceTagsIface > Digikam::FaceTagsEditor::unconfirmedNameFaceTagsIfaces | ( | qlonglong | imageid | ) | const |
Returns a list of UnconfirmedFaces in the Image. Different from
References databaseFaces(), and Digikam::FaceTagsIface::UnconfirmedName.
Referenced by Digikam::ItemInfo::unconfirmedFaceCount().
|
static |
References unconfirmedEntry().