Read@CVL
LayoutPlugin.h
Go to the documentation of this file.
1 /*******************************************************************************************************
2 ReadModules are plugins for nomacs 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 ReadModules.
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 "DkPluginInterface.h"
36 #include "LineTrace.h"
37 #include "SuperPixelTrainer.h"
39 
40 // opencv defines
41 namespace cv {
42  class Mat;
43 }
44 
45 namespace rdf {
46  class LineTrace;
47  class PageXmlParser;
48 }
49 
50 namespace rdm {
51 
52 
53 class LayoutInfo : public nmc::DkBatchInfo {
54 
55 public:
56  LayoutInfo(const QString& id = QString(), const QString& filePath = QString());
57 
58  void setFeatureCollectionManager(const rdf::FeatureCollectionManager& manager);
59  rdf::FeatureCollectionManager featureCollectionManager() const;
60 
61 private:
63 };
64 
65 
66 class LayoutPlugin : public QObject, nmc::DkBatchPluginInterface {
67  Q_OBJECT
68  Q_INTERFACES(nmc::DkBatchPluginInterface)
69  Q_PLUGIN_METADATA(IID "com.nomacs.ImageLounge.LayoutPlugin/3.0" FILE "LayoutPlugin.json")
70 
71 public:
72  LayoutPlugin(QObject* parent = 0);
73  ~LayoutPlugin();
74 
75  QString id() const override;
76  QImage image() const override;
77 
78  QList<QAction*> createActions(QWidget* parent) override;
79  QList<QAction*> pluginActions() const override;
80  QSharedPointer<nmc::DkImageContainer> runPlugin(
81  const QString &runID,
82  QSharedPointer<nmc::DkImageContainer> imgC,
83  const nmc::DkSaveInfo& saveInfo,
84  QSharedPointer<nmc::DkBatchInfo>& batchInfo) const override;
85 
86  virtual void preLoadPlugin() const override {};
87  virtual void postLoadPlugin(const QVector<QSharedPointer<nmc::DkBatchInfo> > &) const override;
88 
89  enum {
98  // add actions here
99 
100  id_end
101  };
102 
103 protected:
104  QList<QAction*> mActions;
105  QStringList mRunIDs;
106  QStringList mMenuNames;
107  QStringList mMenuStatusTips;
108 
112 
113  void init();
114 
115  // layout plugin functions
116  cv::Mat compute(const cv::Mat& src, const rdf::PageXmlParser& parser) const;
117  cv::Mat computePageSegmentation(const cv::Mat& src, const rdf::PageXmlParser& parser) const;
118  void collectFeatures(const cv::Mat& src, const rdf::PageXmlParser& parser, QSharedPointer<LayoutInfo>& layoutInfo) const;
119  rdf::LineTrace computeLines(QSharedPointer<nmc::DkImageContainer> imgC) const;
120 };
121 };
Definition: LayoutPlugin.h:91
Definition: SuperPixelClassification.h:93
Manages FeatureCollections. Hence, each label (e.g. printed text) is stored here along with it&#39;s feat...
Definition: SuperPixelTrainer.h:99
Definition: LayoutPlugin.h:93
virtual void preLoadPlugin() const override
Definition: LayoutPlugin.h:86
QStringList mRunIDs
Definition: LayoutPlugin.h:105
Definition: Drawer.h:53
Definition: LineTrace.h:103
Definition: LayoutPlugin.h:94
Definition: LayoutPlugin.h:53
QList< QAction * > mActions
Definition: LayoutPlugin.h:104
Detects Lines in a binary image. The result is a binary image containing all line elements (pixel acc...
Definition: LineTrace.h:151
Definition: LayoutPlugin.h:90
Definition: PageParser.h:60
rdf::LineTraceConfig mLTRConfig
Definition: LayoutPlugin.h:109
Definition: LayoutPlugin.h:66
Definition: LayoutPlugin.h:95
Definition: Algorithms.cpp:45
rdf::SuperPixelLabelerConfig mSplConfig
Definition: LayoutPlugin.h:110
parser
Definition: DependencyCollector.py:216
QStringList mMenuNames
Definition: LayoutPlugin.h:106
Definition: BatchTest.cpp:45
QStringList mMenuStatusTips
Definition: LayoutPlugin.h:107
rdf::SuperPixelClassifierConfig mSpcConfig
Definition: LayoutPlugin.h:111
This class configures the feature collection process. It controls I/O paths for feature labels and fe...
Definition: SuperPixelTrainer.h:135
Definition: LayoutPlugin.h:97
Definition: LayoutPlugin.h:92