| 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 | List of all members
Digikam::HaarIface Class Reference

## Public Types
enum | AlbumTagRelation { NoMix = 0 , Union = 1 , Intersection = 2 , AlbumExclusive = 3 , TagExclusive = 4 }
using | DuplicatesResultsMap = QMap< qlonglong, QPair< double, QList< qlonglong > > >
enum | DuplicatesSearchRestrictions { None = 0 , SameAlbum = 1 , DifferentAlbum = 2 }
enum class | RefImageSelMethod : unsigned int { OlderOrLarger = 0 , PreferFolder = 1 , ExcludeFolder = 2 , NewerCreationDate = 3 , NewerModificationDate = 4 }
| The RefImageSelMethod enum Selection method to determine which image will be the reference in the duplicate search. More...
enum | SketchType { ScannedSketch = 0 , HanddrawnSketch = 1 }

## Public Member Functions
| HaarIface (const QSet< qlonglong > &images2Scan)
QPair< double, QMap< qlonglong, double > > | bestMatchesForImageWithThreshold (const QString &imagePath, double requiredPercentage, double maximumPercentage, const QList< int > &targetAlbums, DuplicatesSearchRestrictions searchResultRestriction=DuplicatesSearchRestrictions::None, SketchType type=ScannedSketch)
| Searches the database for the best matches for the specified query image.
QPair< double, QMap< qlonglong, double > > | bestMatchesForImageWithThreshold (qlonglong imageid, double requiredPercentage, double maximumPercentage, const QList< int > &targetAlbums, DuplicatesSearchRestrictions searchResultRestriction=DuplicatesSearchRestrictions::None, SketchType type=ScannedSketch)
| Searches the database for the best matches for the specified query image.
QMap< qlonglong, double > | bestMatchesForSignature (const QString &signature, const QList< int > &targetAlbums, int numberOfResults=20, SketchType type=ScannedSketch)
DuplicatesResultsMap | findDuplicates (const QSet< qlonglong > &images2Scan, const QSet< qlonglong >::const_iterator &rangeBegin, const QSet< qlonglong >::const_iterator &rangeEnd, RefImageSelMethod refImageSelectionMethod, const QSet< qlonglong > &refs, double requiredPercentage, double maximumPercentage, DuplicatesSearchRestrictions searchResultRestriction=DuplicatesSearchRestrictions::None, HaarProgressObserver *const observer=nullptr)
| Fill a map of duplicates images found over a list of images to scan.
bool | fulfillsRestrictions (qlonglong imageId, int albumId, qlonglong originalImageId, int originalAlbumId, const QList< int > &targetAlbums, DuplicatesSearchRestrictions searchResultRestriction)
| Checks whether the image with the given imageId fulfills all restrictions given in targetAlbums and in respect to searchResultRestriction.
void | getBestAndWorstPossibleScore (Haar::SignatureData *const querySig, SketchType type, double *const lowestAndBestScore, double *const highestAndWorstScore)
| For a given signature, find out the highest and lowest possible score that any other signature could reach, compared to the given signature.
bool | indexImage (const QString &filename)
| Adds an image to the index in the database.
bool | indexImage (const QString &filename, const DImg &image)
bool | indexImage (const QString &filename, const QImage &image)
bool | indexImage (qlonglong imageid, const DImg &image)
bool | indexImage (qlonglong imageid, const QImage &image)
QImage | loadQImage (const QString &filename)
| This method loads a QImage from the given filename.
bool | retrieveSignatureFromDB (qlonglong imageid, Haar::SignatureData &sig)
| Retrieve the Haar signature from database using image id.
void | setAlbumRootsToSearch (const QList< int > &albumRootIds)
| Give a list of albumRoots to which the search shall be limited.
void | setAlbumRootsToSearch (const QSet< int > &albumRootIds)
QString | signatureAsText (const QImage &image)
| Calculates the Haar signature, bring it in a form as stored in the DB, and encode it to Ascii data.

## Static Public Member Functions
static QSet< qlonglong > | imagesFromAlbumsAndTags (const QList< int > &albums2Scan, const QList< int > &tags2Scan, AlbumTagRelation relation)
| Collects all images from the given album and tag ids according to their relation.
static int | preferredSize ()
static void | rebuildDuplicatesAlbums (const DuplicatesResultsMap &results, bool isAlbumUpdate)
| This method rebuilds the given SAlbums using the given results.

## Member Enumeration Documentation

## ◆ RefImageSelMethod

enum class Digikam::HaarIface::RefImageSelMethod : unsigned int
| strong

When adding method here, update also HaarIface::findDuplicates()

Enumerator
OlderOrLarger | Original.
PreferFolder | Prefer select folder to be the reference.
ExcludeFolder | Prefer image not in the selected folder.
NewerCreationDate | Prefer newer creation date image.
NewerModificationDate | Prefer newer modification date image.

## Member Function Documentation

## ◆ bestMatchesForImageWithThreshold() [1/2]

QPair< double, QMap< qlonglong, double > > Digikam::HaarIface::bestMatchesForImageWithThreshold | ( | const QString & | imagePath,
|  | double | requiredPercentage,
|  | double | maximumPercentage,
|  | const QList< int > & | targetAlbums,
|  | DuplicatesSearchRestrictions | searchResultRestriction = `DuplicatesSearchRestrictions::None`,
|  | SketchType | type = `ScannedSketch`
| ) |  |

All matches with a similarity in a given threshold interval are returned. The threshold is in the range requiredPercentage..maximumPercentage.

## ◆ bestMatchesForImageWithThreshold() [2/2]

QPair< double, QMap< qlonglong, double > > Digikam::HaarIface::bestMatchesForImageWithThreshold | ( | qlonglong | imageid,
|  | double | requiredPercentage,
|  | double | maximumPercentage,
|  | const QList< int > & | targetAlbums,
|  | DuplicatesSearchRestrictions | searchResultRestriction = `DuplicatesSearchRestrictions::None`,
|  | SketchType | type = `ScannedSketch`
| ) |  |

All matches with a similarity in a given threshold interval are returned. The threshold is in the range requiredPercentage..maximumPercentage.

## ◆ findDuplicates()

HaarIface::DuplicatesResultsMap Digikam::HaarIface::findDuplicates | ( | const QSet< qlonglong > & | images2Scan,
|  | const QSet< qlonglong >::const_iterator & | rangeBegin,
|  | const QSet< qlonglong >::const_iterator & | rangeEnd,
|  | RefImageSelMethod | refImageSelectionMethod,
|  | const QSet< qlonglong > & | refs,
|  | double | requiredPercentage,
|  | double | maximumPercentage,
|  | DuplicatesSearchRestrictions | searchResultRestriction = `DuplicatesSearchRestrictions::None`,
|  | HaarProgressObserver *const | observer = `nullptr`
| ) |  |

For each map item, the result values is list of candidate images which are duplicates of the key image. All images are referenced by id from database. The threshold is in the range 0..1, with 1 meaning identical signature.

## ◆ loadQImage()

QImage Digikam::HaarIface::loadQImage | ( | const QString & | filename | ) |

Parameters

  filename | the name of the file (path)

Returns
  A QImage, non-null on success.

## ◆ rebuildDuplicatesAlbums()

void Digikam::HaarIface::rebuildDuplicatesAlbums | ( | const DuplicatesResultsMap & | results,
|  | bool | isAlbumUpdate
| ) |  |
| static

Parameters

  results | Map of duplicates images found over a list of images.
  isAlbumUpdate | if true update the SAlbums in the database.

## ◆ retrieveSignatureFromDB()

bool Digikam::HaarIface::retrieveSignatureFromDB | ( | qlonglong | imageid,
|  | Haar::SignatureData & | sig
| ) |  |

Returns
  true if item signature exist else false.

## ◆ setAlbumRootsToSearch()

void Digikam::HaarIface::setAlbumRootsToSearch | ( | const QList< int > & | albumRootIds | ) |

Calling with an empty list will disable filtering.

## ◆ signatureAsText()

QString Digikam::HaarIface::signatureAsText | ( | const QImage & | image | ) |

Can be used for bestMatchesForSignature.