digiKam Developer Documentation: Digikam::FaceUtils Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Digikam::FaceUtils Class Reference
Inheritance diagram for Digikam::FaceUtils:

## Public Types
enum | FaceRecognitionSteps { DetectFaceRegions , DetectAndRecognize }

## Public Member Functions
| FaceUtils (QObject *const parent=nullptr)
bool | hasBeenScanned (const ItemInfo &info) const
| Tells if the image has been scanned for faces or not.
bool | hasBeenScanned (qlonglong imageid) const
Identity | identityForTag (int tagId) const
void | markAsScanned (const ItemInfo &info, bool hasBeenScanned=true) const
void | markAsScanned (qlonglong imageid, bool hasBeenScanned=true) const
| Marks the image as scanned for faces.
bool | normalTagChanged () const
void | 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.
int | tagForIdentity (const Identity &identity) const
QList< FaceTagsIface > | toFaceTagsIfaces (qlonglong imageid, const QList< QRectF > &detectedFaces, const QList< Identity > &recognitionResults, const QSize &fullSize) const
| Conversion.
QList< FaceTagsIface > | 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.
QList< FaceTagsIface > | writeUnconfirmedResults (qlonglong imageid, QList< FaceTagsIface > &detectedFaces)
QList< FaceTagsIface > | writeUnconfirmedResults (qlonglong imageid, QList< FaceTagsIface > &detectedFaces, const QList< Identity > &recognitionResults)
Public Member Functions inherited from Digikam::FaceTagsEditor
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< FaceTagsIface > | confirmedFaceTagsIfaces (qlonglong imageid) const
FaceTagsIface | confirmName (const FaceTagsIface &face, int tagId=-1, const TagRegion &confirmedRegion=TagRegion())
| Assign the name tag for given face entry.
QList< FaceTagsIface > | databaseFaces (qlonglong imageid) const
| Reads the FaceTagsIfaces for the given image id from the database.
QList< FaceTagsIface > | databaseFaces (qlonglong imageId, FaceTagsIface::TypeFlags flags) const
QList< FaceTagsIface > | databaseFacesForTraining (qlonglong imageid) const
int | faceCountForPersonInImage (qlonglong imageid, int tagId) const
| Returns the number of faces a particular person has in the specified image.
QList< ItemTagPair > | faceItemTagPairs (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< FaceTagsIface > | ignoredFaceTagsIfaces (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< FaceTagsIface > | unconfirmedFaceTagsIfaces (qlonglong imageid) const
| Returns list of Unconfirmed and Unknown faces in the Image.
QList< FaceTagsIface > | unconfirmedNameFaceTagsIfaces (qlonglong imageid) const
| Returns a list of UnconfirmedFaces in the Image.

## Static Public Member Functions
static QRect | faceRectToDisplayRect (const QRect &rect)
| For display, it may be desirable to display a slightly larger region than the strict face rectangle.
Static Public Member Functions inherited from Digikam::FaceTagsEditor
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 | addNormalTag (qlonglong imageId, int tagId) override
| Reimplemented from parent class.
void | removeNormalTag (qlonglong imageId, int tagId) override
void | removeNormalTags (qlonglong imageId, const QList< int > &tagIds) override
Protected Member Functions inherited from Digikam::FaceTagsEditor
void | addFaceAndTag (ItemTagPair &pair, const FaceTagsIface &face, const QStringList &properties, bool addTag)
void | addFaceTagExtendedDataProperty (ItemTagPair &pair, const FaceTagsIface &face)
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)

## Member Function Documentation

## ◆ addNormalTag()

void Digikam::FaceUtils::addNormalTag | ( | qlonglong | imageId,
|  | int | tagId
| ) |  |
| overrideprotectedvirtual

Reimplemented from Digikam::FaceTagsEditor.

## ◆ faceRectToDisplayRect()

QRect Digikam::FaceUtils::faceRectToDisplayRect | ( | const QRect & | rect | ) |
| static

This returns a pixel margin commonly used to increase the rectangle size in all four directions.

Do not change that value unless you know what you do. There are a lot of pregenerated thumbnails in user's databases, expensive to regenerate, depending on this very value.

## ◆ removeNormalTag()

void Digikam::FaceUtils::removeNormalTag | ( | qlonglong | imageId,
|  | int | tagId
| ) |  |
| overrideprotectedvirtual

If the face just removed was the final face associated with that Tag, reset Tag Icon.

Reimplemented from Digikam::FaceTagsEditor.

## ◆ removeNormalTags()

void Digikam::FaceUtils::removeNormalTags | ( | qlonglong | imageId,
|  | const QList< int > & | tagIds
| ) |  |
| overrideprotectedvirtual

Reimplemented from Digikam::FaceTagsEditor.

## ◆ storeThumbnails()

void Digikam::FaceUtils::storeThumbnails | ( | ThumbnailLoadThread *const | thread,
|  | const QString & | filePath,
|  | const QList< FaceTagsIface > & | databaseFaces,
|  | const DImg & | image
| ) |  |

Images in faces and thumbnails.

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.

## ◆ toFaceTagsIfaces()

QList< FaceTagsIface > Digikam::FaceUtils::toFaceTagsIfaces | ( | qlonglong | imageid,
|  | const QList< QRectF > & | detectedFaces,
|  | const QList< Identity > & | recognitionResults,
|  | const QSize & | fullSize
| ) |  | const

Convert between FacesEngine results and FaceTagsIface.

## ◆ writeUnconfirmedResults()

QList< FaceTagsIface > Digikam::FaceUtils::writeUnconfirmedResults | ( | qlonglong | imageid,
|  | const QList< QRectF > & | detectedFaces,
|  | const QList< Identity > & | recognitionResults,
|  | const QSize & | fullSize
| ) |  |

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.