digiKam
noise_detector.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 - noise detection
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_NOISE_DETECTOR_H
26 #define DIGIKAM_NOISE_DETECTOR_H
27 
28 // Local includes
29 
30 #include "dimg.h"
31 #include "digikam_opencv.h"
32 #include "detector.h"
33 
34 namespace Digikam
35 {
36 
38 {
39  Q_OBJECT
40 
41 public:
42 
44 
45 public:
46 
47  explicit NoiseDetector();
49 
50  float detect(const cv::Mat& image) const override;
51 
52 public:
53 
54  static const Mat3D filtersHaar;
55 
56 private:
57 
58  Mat3D decompose_by_filter(const cv::Mat& image, const Mat3D& filters) const;
59  void calculate_variance_kurtosis(const Mat3D& channels,
60  cv::Mat& variance,
61  cv::Mat& kurtosis) const;
62  float noise_variance(const cv::Mat& variance, const cv::Mat& kurtosis) const;
63  float normalize(const float number) const;
64 
65  cv::Mat raw_moment(const NoiseDetector::Mat3D& mat, int order) const;
66  cv::Mat pow_mat(const cv::Mat& mat, float ordre) const;
67  float mean_mat(const cv::Mat& mat) const;
68 
69 private:
70 
71  class Private;
72  Private* const d;
73 };
74 
75 } // namespace Digikam
76 
77 #endif // DIGIKAM_NOISE_DETECTOR_H
Definition: detector.h:41
Definition: noise_detector.h:38
QList< cv::Mat > Mat3D
Definition: noise_detector.h:43
static const Mat3D filtersHaar
Definition: noise_detector.h:54
NoiseDetector()
Definition: noise_detector.cpp:90
float detect(const cv::Mat &image) const override
Definition: noise_detector.cpp:101
~NoiseDetector()
Definition: noise_detector.cpp:96
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43