digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::FaceTagsEditor Class Reference
+ Inheritance diagram for Digikam::FaceTagsEditor:

Public Member Functions

void add (const FaceTagsIface &face, bool trainFace=true)
 Adds a new entry to the database.
 
FaceTagsIface add (qlonglong imageid, int tagId, const TagRegion &region, bool trainFace=true)
 
FaceTagsIface addManually (const FaceTagsIface &face)
 
FaceTagsIface changeRegion (const FaceTagsIface &face, const TagRegion &newRegion)
 Changes the region of the given entry.
 
FaceTagsIface changeSuggestedName (const FaceTagsIface &previousEntry, int unconfirmedNameTagId)
 Switches an unknownPersonEntry or unconfirmedEntry to an unconfirmedEntry (with a different suggested name).
 
FaceTagsIface changeTag (const FaceTagsIface &face, int newTagId)
 Changes the tag of the given entry.
 
QList< FaceTagsIfaceconfirmedFaceTagsIfaces (qlonglong imageid) const
 
FaceTagsIface confirmName (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion())
 Assign the name tag for given face entry.
 
QList< FaceTagsIfacedatabaseFaces (qlonglong imageid) const
 Reads the FaceTagsIfaces for the given image id from the database.
 
QList< FaceTagsIfacedatabaseFaces (qlonglong imageId, FaceTagsIface::TypeFlags flags) const
 
QList< FaceTagsIfacedatabaseFacesForTraining (qlonglong imageid) const
 
int faceCountForPersonInImage (qlonglong imageid, int tagId) const
 Returns the number of faces a particular person has in the specified image.
 
QList< ItemTagPairfaceItemTagPairs (qlonglong imageid, FaceTagsIface::TypeFlags flags) const
 
QMap< QString, QString > getSuggestedNames (qlonglong id) const
 Returns a Map of Tag Regions (in XML format) to Suggested Name (from Face Recognition) for the given image.
 
QList< QRect > getTagRects (qlonglong imageid) const
 Returns a list of all tag rectangles for the image.
 
QList< FaceTagsIfaceignoredFaceTagsIfaces (qlonglong imageid) const
 
int numberOfFaces (qlonglong imageid) const
 Returns the number of faces present in an image.
 
FaceTagsIface rejectSuggestedTag (const FaceTagsIface &face)
 Changes the tag of the given entry to the unknown person tag and adds the existing tag to the list of rejected face tags.
 
void removeAllFaces (qlonglong imageid)
 Unassigns all face tags from the image and sets it's scanned property to false.
 
void removeAllRejectedFaceTags ()
 
void removeFace (const FaceTagsIface &face, bool touchTags=true)
 Remove the given face.
 
void removeFace (qlonglong imageid, const QRect &rect)
 Remove a face or the face for a certain rect from an image.
 
void removeFaces (const QList< FaceTagsIface > &faces)
 
FaceTagsIface removeRejectedFaceTagList (const FaceTagsIface &face)
 
bool rotateFaces (qlonglong imageId, const QSize &size, int oldOrientation, int newOrientation)
 Rotate face tags.
 
QList< FaceTagsIfaceunconfirmedFaceTagsIfaces (qlonglong imageid) const
 Returns list of Unconfirmed and Unknown faces in the Image.
 
QList< FaceTagsIfaceunconfirmedNameFaceTagsIfaces (qlonglong imageid) const
 Returns a list of UnconfirmedFaces in the Image.
 

Static Public Member Functions

static FaceTagsIface confirmedEntry (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion(), const QList< int > &rejectedFaceTagList=QList< int >())
 Returns the entry that would be added if the given face is confirmed.
 
static FaceTagsIface unconfirmedEntry (qlonglong imageId, int tagId, const TagRegion &region, const QList< int > &rejectedFaceTagList)
 Returns the entry that would be added if the given face is autodetected.
 
static FaceTagsIface unknownPersonEntry (qlonglong imageId, const TagRegion &region, const QList< int > &rejectedFaceTagList)
 

Protected Member Functions

void addFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, const QStringList &properties, bool addTag)
 
void addFaceTagExtendedDataProperty (ItemTagPair &pair, const FaceTagsIface &face)
 
virtual void addNormalTag (qlonglong imageId, int tagId)
 
QList< int > getRejectedFaceTagList (const ItemTagPair &pair, const QString &regionString) const
 
void removeFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, bool touchTags)
 
void removeFaceTagExtendedDataProperty (ItemTagPair &pair, const QString &regionString)
 
virtual void removeNormalTag (qlonglong imageId, int tagId)
 
virtual void removeNormalTags (qlonglong imageId, const QList< int > &tagIds)
 

Member Function Documentation

◆ add()

void Digikam::FaceTagsEditor::add ( const FaceTagsIface face,
bool  trainFace = true 
)

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.

◆ addNormalTag()

void Digikam::FaceTagsEditor::addNormalTag ( qlonglong  imageId,
int  tagId 
)
protectedvirtual

Reimplemented in Digikam::FaceUtils.

◆ changeRegion()

FaceTagsIface Digikam::FaceTagsEditor::changeRegion ( const FaceTagsIface face,
const TagRegion newRegion 
)

Returns the face with the new region set.

◆ changeTag()

FaceTagsIface Digikam::FaceTagsEditor::changeTag ( const FaceTagsIface face,
int  newTagId 
)

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 or unknown face don't remove a possible tag. See bug 449142.

We store metadata of FaceTags, if it's a confirmed person.

◆ confirmName()

FaceTagsIface Digikam::FaceTagsEditor::confirmName ( const FaceTagsIface face,
int  tagId = -1,
const TagRegion confirmedRegion = TagRegion() 
)

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.

Compare the original face tagId with the new one if the face was suggested but a different tag was chosen add the suggested face tag to the rejected list.

◆ getSuggestedNames()

QMap< QString, QString > Digikam::FaceTagsEditor::getSuggestedNames ( qlonglong  id) const

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.

◆ getTagRects()

QList< QRect > Digikam::FaceTagsEditor::getTagRects ( qlonglong  imageid) const

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.

◆ rejectSuggestedTag()

FaceTagsIface Digikam::FaceTagsEditor::rejectSuggestedTag ( const FaceTagsIface face)

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 or unknown face don't remove a possible tag. See bug 449142.

◆ removeFace()

void Digikam::FaceTagsEditor::removeFace ( const FaceTagsIface face,
bool  touchTags = true 
)

If appropriate, the tag is also removed.

◆ removeNormalTag()

void Digikam::FaceTagsEditor::removeNormalTag ( qlonglong  imageId,
int  tagId 
)
protectedvirtual

Reimplemented in Digikam::FaceUtils.

◆ unconfirmedEntry()

FaceTagsIface Digikam::FaceTagsEditor::unconfirmedEntry ( qlonglong  imageId,
int  tagId,
const TagRegion region,
const QList< int > &  rejectedFaceTagList 
)
static

If tagId is -1, the unknown person will be taken.

◆ unconfirmedFaceTagsIfaces()

QList< FaceTagsIface > Digikam::FaceTagsEditor::unconfirmedFaceTagsIfaces ( qlonglong  imageid) const

If you want just Unconfirmed Faces,

See also
unconfirmedNameFaceTagsIfaces.

◆ unconfirmedNameFaceTagsIfaces()

QList< FaceTagsIface > Digikam::FaceTagsEditor::unconfirmedNameFaceTagsIfaces ( qlonglong  imageid) const

Different from

See also
unconfirmedFaceTagsIfaces.