digiKam
Digikam::SimilarityDb Class Reference

Public Member Functions

void copySimilarityAttributes (qlonglong srcId, qlonglong destId)
 
QList< qlonglong > getDirtyOrMissingFingerprints (const QList< ItemInfo > &imageInfos, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
QStringList getDirtyOrMissingFingerprintURLs (const QList< ItemInfo > &imageInfos, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
double getImageSimilarity (qlonglong imageID1, qlonglong imageID2, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
QList< FuzzyAlgorithmgetImageSimilarityAlgorithms (qlonglong imageID1, qlonglong imageID2)
 
QString getLegacySetting (const QString &keyword)
 
QString getSetting (const QString &keyword)
 
bool hasDirtyOrMissingFingerprint (const ItemInfo &imageInfo, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar) const
 
bool hasFingerprint (qlonglong imageId, FuzzyAlgorithm algorithm) const
 
bool hasFingerprints ()
 
bool hasFingerprints (FuzzyAlgorithm algorithm) const
 
bool integrityCheck ()
 
QSet< qlonglong > registeredImageIds () const
 
void removeImageFingerprint (qlonglong imageID, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
void removeImageSimilarity (qlonglong imageID, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
void removeImageSimilarity (qlonglong imageID1, qlonglong imageID2, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
void setImageSimilarity (qlonglong imageID1, qlonglong imageID2, double value, FuzzyAlgorithm algorithm=FuzzyAlgorithm::Haar)
 
bool setSetting (const QString &keyword, const QString &value)
 
void vacuum ()
 

Friends

class SimilarityDbAccess
 

Member Function Documentation

◆ copySimilarityAttributes()

void Digikam::SimilarityDb::copySimilarityAttributes ( qlonglong  srcId,
qlonglong  destId 
)

Copies all similarity-specific information, from image srcId to destId.

Referenced by Digikam::ItemScanner::commitCopyImageAttributes().

◆ getDirtyOrMissingFingerprints()

QList< qlonglong > Digikam::SimilarityDb::getDirtyOrMissingFingerprints ( const QList< ItemInfo > &  imageInfos,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

Returns a list of all item ids (images, videos,...) where either no fingerprint for the given algorithm exists or is outdated because the file is identified as changed since the generation of the fingerprint.

Parameters
imageInfosThe image info objects representing the items.
algorithmThe algorithm.
Returns
The ids of the items whose fingerprints are dirty or missing.

References Digikam::ItemInfo::id(), Digikam::ItemInfo::modDateTime(), and Digikam::ItemInfo::uniqueHash().

◆ getDirtyOrMissingFingerprintURLs()

QStringList Digikam::SimilarityDb::getDirtyOrMissingFingerprintURLs ( const QList< ItemInfo > &  imageInfos,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

Returns a list of the URLs of all items (images, videos,...) where either no fingerprint for the given algorithm exists or is outdated because the file is identified as changed since the generation of the fingerprint.

Parameters
imageInfosThe image info objects representing the items.
algorithmThe algorithm.
Returns
The URLs of the items whose fingerprints are dirty or missing.

References Digikam::ItemInfo::filePath(), Digikam::ItemInfo::id(), Digikam::ItemInfo::modDateTime(), and Digikam::ItemInfo::uniqueHash().

◆ getImageSimilarity()

double Digikam::SimilarityDb::getImageSimilarity ( qlonglong  imageID1,
qlonglong  imageID2,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

Returns the similarity value for two images. A value of -1 means nonexistence. A value of -2 means that there is a value that cannot be converted into a double

Referenced by Digikam::ItemLister::listSearch(), and Digikam::ItemExtendedProperties::similarityTo().

◆ getImageSimilarityAlgorithms()

QList< FuzzyAlgorithm > Digikam::SimilarityDb::getImageSimilarityAlgorithms ( qlonglong  imageID1,
qlonglong  imageID2 
)

Returns the algorithms for which a similarity value exists for the given image ids.

Parameters
imageID1The first image id.
imageID2The second image id.
Returns
a list of all algorithms for which a similarity value exists.

◆ getLegacySetting()

QString Digikam::SimilarityDb::getLegacySetting ( const QString &  keyword)

Returns the legacy settings with the keyword name.

Parameters
keywordThe setting entry name.
Returns
The setting value.

◆ getSetting()

QString Digikam::SimilarityDb::getSetting ( const QString &  keyword)

Returns the setting with the keyword name.

Parameters
keywordThe setting entry name.
Returns
The setting value.

◆ hasDirtyOrMissingFingerprint()

bool Digikam::SimilarityDb::hasDirtyOrMissingFingerprint ( const ItemInfo imageInfo,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
) const

Checks if the given image has a dirty fingerprint or even none for the given algorithm.

Parameters
imageInfoThe image info object representing the item.
algorithmThe algorithm used for the fingerprint.
Returns
True, if the image either has no or a dirty fingerprint.

References Digikam::ItemInfo::id(), Digikam::ItemInfo::modDateTime(), and Digikam::ItemInfo::uniqueHash().

◆ hasFingerprint()

bool Digikam::SimilarityDb::hasFingerprint ( qlonglong  imageId,
FuzzyAlgorithm  algorithm 
) const

This method checks if the given image has a fingerprint for the given algorithm.

Parameters
imageIdThe Id of the image to check.
algorithmThe algorithm.
Returns
True, if there is a fingerprint.

◆ hasFingerprints() [1/2]

bool Digikam::SimilarityDb::hasFingerprints ( )

This method checks if there are any fingerprints for any algorithm present.

Returns
True, if fingerprints exist.

◆ hasFingerprints() [2/2]

bool Digikam::SimilarityDb::hasFingerprints ( FuzzyAlgorithm  algorithm) const

This method checks if there are any fingerprints for the given algorithm.

Parameters
algorithmThe algorithm.
Returns
true, if there are fingerprints and false, otherwise.

◆ integrityCheck()

bool Digikam::SimilarityDb::integrityCheck ( )

This method checks the integrity of the similarity database.

Returns
true, if the integrity check was passed and false, else.

◆ registeredImageIds()

QSet< qlonglong > Digikam::SimilarityDb::registeredImageIds ( ) const

This method returns all image ids that are present in the similarity db tables.

Returns
a set of all present image ids.

◆ removeImageFingerprint()

void Digikam::SimilarityDb::removeImageFingerprint ( qlonglong  imageID,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

This method removes the fingerprint entry for the given imageId and algorithm. Also, this automatically removes the entries in the ImageSimilarities table for the given algorithm and image id.

Parameters
imageIDThe image id.
algorithmThe algorithm.

◆ removeImageSimilarity() [1/2]

void Digikam::SimilarityDb::removeImageSimilarity ( qlonglong  imageID,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

This method removes the image similarity entries for the imageID and algorithm.

Parameters
imageIDThe image id.
algorithmThe algorithm.

Referenced by Digikam::HaarIface::bestMatchesForImageWithThreshold(), and Digikam::ItemExtendedProperties::removeSimilarityTo().

◆ removeImageSimilarity() [2/2]

void Digikam::SimilarityDb::removeImageSimilarity ( qlonglong  imageID1,
qlonglong  imageID2,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

This method removes the image similarity entry for the imageIDs and algorithm.

Parameters
imageID1The first image id.
imageID2The second image id.
algorithmThe algorithm.

◆ setImageSimilarity()

void Digikam::SimilarityDb::setImageSimilarity ( qlonglong  imageID1,
qlonglong  imageID2,
double  value,
FuzzyAlgorithm  algorithm = FuzzyAlgorithm::Haar 
)

◆ setSetting()

bool Digikam::SimilarityDb::setSetting ( const QString &  keyword,
const QString &  value 
)

Set the database setting entry given by keyword to the given value.

Parameters
keywordThe keyword, i.e. setting name.
valueThe value.
Returns
True, if the value was set and false, else..

References value.

◆ vacuum()

void Digikam::SimilarityDb::vacuum ( )

This method shrinks the database.

Referenced by Digikam::DatabaseTask::run().

Friends And Related Function Documentation

◆ SimilarityDbAccess

friend class SimilarityDbAccess
friend

The documentation for this class was generated from the following files: