File indexing completed on 2025-01-05 03:56:31
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 28/08/2021 0007 * Description : Extraction of focus points by exiftool data 0008 * 0009 * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_FOCUSPOINTS_EXTRACTOR_H 0017 #define DIGIKAM_FOCUSPOINTS_EXTRACTOR_H 0018 0019 // Qt includes 0020 0021 #include <QObject> 0022 #include <QVariant> 0023 #include <QStringList> 0024 0025 // Local includes 0026 0027 #include "digikam_export.h" 0028 #include "focuspoint.h" 0029 #include "metaengine.h" 0030 0031 namespace Digikam 0032 { 0033 0034 class DIGIKAM_EXPORT FocusPointsExtractor : public QObject 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 /** 0041 * A list used to store focus points of a image extracted from meta data 0042 * 0043 * With extract() function, an exiftool parser is used to read data from 0044 * metadata and lists all focus points. Each focus point is defined by their 0045 * relative centers coordinate and relative size. Each point has own 0046 * type (Inactive, Infocus, Selected, SelectedInFocus) 0047 */ 0048 using ListAFPoints = QList<FocusPoint>; 0049 0050 public: 0051 0052 explicit FocusPointsExtractor(QObject* const parent, const QString& path); 0053 ~FocusPointsExtractor(); 0054 0055 public: 0056 0057 ListAFPoints get_af_points(); 0058 ListAFPoints get_af_points(FocusPoint::TypePoint type); 0059 0060 bool isAFPointsReadOnly() const; 0061 QString make() const; 0062 QString model() const; 0063 QSize originalSize() const; 0064 MetaEngine::ImageOrientation orientation() const; 0065 0066 private: 0067 0068 QVariant findValue(const QString& tagName, bool isList = false) const; 0069 QVariant findValue(const QString& tagNameRoot, const QString& key, bool isList = false) const; 0070 QVariant findValueFirstMatch(const QStringList& listTagNames, bool isList = false) const; 0071 QVariant findValueFirstMatch(const QString& tagNameRoot, const QStringList& keys, bool isList = false) const; 0072 QVariant findNumValue(const QString& tagName) const; 0073 0074 void setAFPointsReadOnly(bool readOnly) const; 0075 void setOriginalSize(const QSize& size) const; 0076 0077 ListAFPoints findAFPoints() const; 0078 0079 ListAFPoints getAFPoints_canon() const; 0080 ListAFPoints getAFPoints_exif() const; 0081 ListAFPoints getAFPoints_nikon() const; 0082 ListAFPoints getAFPoints_panasonic() const; 0083 ListAFPoints getAFPoints_sony() const; 0084 ListAFPoints getAFPoints_xmp() const; 0085 0086 private: 0087 0088 class Private; 0089 Private* const d; 0090 }; 0091 0092 } // namespace Digikam 0093 0094 #endif // DIGIKAM_FOCUSPOINTS_EXTRACTOR_H