Read@CVL
SuperPixelClassification.h
Go to the documentation of this file.
1 /*******************************************************************************************************
2  ReadFramework is the basis for modules developed at CVL/TU Wien for the EU project READ.
3 
4  Copyright (C) 2016 Markus Diem <diem@caa.tuwien.ac.at>
5  Copyright (C) 2016 Stefan Fiel <fiel@caa.tuwien.ac.at>
6  Copyright (C) 2016 Florian Kleber <kleber@caa.tuwien.ac.at>
7 
8  This file is part of ReadFramework.
9 
10  ReadFramework is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  ReadFramework is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23  The READ project has received funding from the European Union’s Horizon 2020
24  research and innovation programme under grant agreement No 674943
25 
26  related links:
27  [1] http://www.caa.tuwien.ac.at/cvl/
28  [2] https://transkribus.eu/Transkribus/
29  [3] https://github.com/TUWien/
30  [4] http://nomacs.org
31  *******************************************************************************************************/
32 
33 #pragma once
34 
35 #include "BaseModule.h"
36 #include "PixelSet.h"
37 
38 #pragma warning(push, 0) // no warnings from includes
39 
40 #pragma warning(pop)
41 
42 #ifndef DllCoreExport
43 #ifdef DLL_CORE_EXPORT
44 #define DllCoreExport Q_DECL_EXPORT
45 #else
46 #define DllCoreExport Q_DECL_IMPORT
47 #endif
48 #endif
49 
50 // Qt defines
51 
52 namespace rdf {
53 
55 
56 public:
58 
59  virtual QString toString() const override;
60 
61 protected:
62 
63  //void load(const QSettings& settings) override;
64  //void save(QSettings& settings) const override;
65 };
66 
68 
69 public:
70  SuperPixelFeature(const cv::Mat& img, const PixelSet& set);
71 
72  bool isEmpty() const override;
73  bool compute() override;
74  QSharedPointer<SuperPixelFeatureConfig> config() const;
75 
76  cv::Mat draw(const cv::Mat& img) const;
77  QString toString() const override;
78 
79  cv::Mat features() const;
80  PixelSet pixelSet() const;
81 
82 private:
83  cv::Mat mImg;
84  PixelSet mSet;
85 
86  // output
87  cv::Mat mDescriptors;
88 
89  bool checkInput() const override;
90  void syncSuperPixels(const std::vector<cv::KeyPoint>& keyPointsOld, const std::vector<cv::KeyPoint>& keyPointsNew);
91 };
92 
94 
95 public:
97 
98  virtual QString toString() const override;
99 
100  void setClassifierPath(const QString& path);
101  QString classifierPath() const;
102 
103 protected:
104 
106 
107  void load(const QSettings& settings) override;
108  void save(QSettings& settings) const override;
109 };
110 
112 
113 public:
114  SuperPixelClassifier(const cv::Mat& img, const PixelSet& set);
115 
116  bool isEmpty() const override;
117  bool compute() override;
118  QSharedPointer<SuperPixelClassifierConfig> config() const;
119 
120  cv::Mat draw(const cv::Mat& img) const;
121  QString toString() const override;
122 
123  void setModel(const QSharedPointer<SuperPixelModel>& model);
124  PixelSet pixelSet() const;
125 
126 private:
127  cv::Mat mImg;
128  PixelSet mSet;
129  QSharedPointer<SuperPixelModel> mModel;
130 
131  bool checkInput() const override;
132 };
133 
134 
135 
136 }
Definition: SuperPixelClassification.h:111
Definition: SuperPixelClassification.h:93
Definition: BaseModule.h:63
QString mClassifierPath
Definition: SuperPixelClassification.h:105
#define DllCoreExport
Definition: BaseImageElement.h:43
PixelSet stores and manipulates pixel collections.
Definition: PixelSet.h:172
config
Definition: DependencyCollector.py:271
Definition: SuperPixelClassification.h:54
Definition: SuperPixelClassification.h:67
DllCoreExport bool save(const QImage &img, const QString &savePath, int compression=-1)
Saves the specified QImage img.
Definition: Image.cpp:180
DllCoreExport QImage load(const QString &path, bool *ok=0)
Definition: Image.cpp:152
This is the base class for all modules. It provides all functions which are implemented by the module...
Definition: BaseModule.h:126
Definition: Algorithms.cpp:45