digiKam
imagequalitythread.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 28/08/2021
7  * Description : Image Quality Parser - Abtrait class for detector
8  *
9  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_IMAGEQUALITY_THREAD_H
26 #define DIGIKAM_IMAGEQUALITY_THREAD_H
27 
28 // Qt includes
29 
30 #include <QThread>
31 
32 // Local includes
33 
34 #include "dimg.h"
35 #include "digikam_opencv.h"
36 #include "detector.h"
37 #include "imagequalitycalculator.h"
38 
39 namespace Digikam
40 {
41 
42 class ImageQualityThread : public QThread
43 {
44  Q_OBJECT
45 
46 public:
47 
48  explicit ImageQualityThread(QObject* const parent,
49  DetectorDistortion* const detector,
50  const cv::Mat& image,
51  ImageQualityCalculator* const calculator,
52  float weight_quality);
53  ~ImageQualityThread() = default;
54 
55 public:
56 
57  void run() override;
58 
59 private:
60 
61  DetectorDistortion* m_detector;
62  ImageQualityCalculator* m_calculator;
63  cv::Mat m_image;
64  float m_weight;
65 };
66 
67 // -------------------------------------------------------------------------------------------
68 
69 class ImageQualityThreadPool: public QObject
70 {
71  Q_OBJECT
72 
73 public:
74 
75  explicit ImageQualityThreadPool(QObject* const parent,
76  ImageQualityCalculator* const calculator);
78 
79 public:
80 
81  void addDetector(const cv::Mat& image,
82  float weight_quality,
83  DetectorDistortion* const detector);
84 
85  void start();
86  void end();
87 
88 private:
89 
90  ImageQualityCalculator* m_calculator;
92 };
93 
94 } // namespace Digikam
95 
96 #endif // DIGIKAM_IMAGEQUALITY_THREAD_H
Definition: detector.h:41
Definition: imagequalitycalculator.h:41
Definition: imagequalitythread.h:70
void start()
Definition: imagequalitythread.cpp:86
~ImageQualityThreadPool()
Definition: imagequalitythread.cpp:58
void addDetector(const cv::Mat &image, float weight_quality, DetectorDistortion *const detector)
Definition: imagequalitythread.cpp:70
ImageQualityThreadPool(QObject *const parent, ImageQualityCalculator *const calculator)
Definition: imagequalitythread.cpp:51
void end()
Definition: imagequalitythread.cpp:94
Definition: imagequalitythread.h:43
ImageQualityThread(QObject *const parent, DetectorDistortion *const detector, const cv::Mat &image, ImageQualityCalculator *const calculator, float weight_quality)
Definition: imagequalitythread.cpp:30
void run() override
Definition: imagequalitythread.cpp:43
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43