* demo/viewer/Makefile.am: Add new files.
* demo/viewer/config.cc,
* demo/viewer/config.hh: Add OCR settings.
* demo/viewer/toolchain_options.cc,
* demo/viewer/toolchain_options.hh,
* demo/viewer/toolchain_options.ui: Remove.
* demo/viewer/ocr_options.cc,
* demo/viewer/ocr_options.hh,
* demo/viewer/ocr_options.ui,
* demo/viewer/preprocessing_options.cc,
* demo/viewer/preprocessing_options.hh,
* demo/viewer/preprocessing_options.ui,
* demo/viewer/segmentation_options.cc,
* demo/viewer/segmentation_options.hh,
* demo/viewer/segmentation_options.ui: New option widgets.
* demo/viewer/preferences_dialog.cc: Insert new widgets.
* demo/viewer/runner.cc: Take OCR settings into account.
---
scribo/ChangeLog | 30 +++++++-
scribo/demo/viewer/Makefile.am | 20 ++++-
scribo/demo/viewer/config.cc | 28 ++++++-
scribo/demo/viewer/config.hh | 11 ++-
scribo/demo/viewer/ocr_options.cc | 74 ++++++++++++++++
scribo/demo/viewer/ocr_options.hh | 40 +++++++++
scribo/demo/viewer/ocr_options.ui | 62 ++++++++++++++
scribo/demo/viewer/preferences_dialog.cc | 26 +++++-
scribo/demo/viewer/preprocessing_options.cc | 66 +++++++++++++++
scribo/demo/viewer/preprocessing_options.hh | 38 +++++++++
scribo/demo/viewer/preprocessing_options.ui | 76 +++++++++++++++++
scribo/demo/viewer/runner.cc | 3 +-
scribo/demo/viewer/segmentation_options.cc | 56 ++++++++++++
scribo/demo/viewer/segmentation_options.hh | 37 ++++++++
scribo/demo/viewer/segmentation_options.ui | 52 ++++++++++++
scribo/demo/viewer/toolchain_options.cc | 75 -----------------
scribo/demo/viewer/toolchain_options.hh | 37 --------
scribo/demo/viewer/toolchain_options.ui | 121 ---------------------------
18 files changed, 605 insertions(+), 247 deletions(-)
create mode 100644 scribo/demo/viewer/ocr_options.cc
create mode 100644 scribo/demo/viewer/ocr_options.hh
create mode 100644 scribo/demo/viewer/ocr_options.ui
create mode 100644 scribo/demo/viewer/preprocessing_options.cc
create mode 100644 scribo/demo/viewer/preprocessing_options.hh
create mode 100644 scribo/demo/viewer/preprocessing_options.ui
create mode 100644 scribo/demo/viewer/segmentation_options.cc
create mode 100644 scribo/demo/viewer/segmentation_options.hh
create mode 100644 scribo/demo/viewer/segmentation_options.ui
delete mode 100644 scribo/demo/viewer/toolchain_options.cc
delete mode 100644 scribo/demo/viewer/toolchain_options.hh
delete mode 100644 scribo/demo/viewer/toolchain_options.ui
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f870519..98076cf 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,6 +1,34 @@
2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
- * scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR step optional.
+ Make OCR step optional in viewer.
+
+ * demo/viewer/Makefile.am: Add new files.
+
+ * demo/viewer/config.cc,
+ * demo/viewer/config.hh: Add OCR settings.
+
+ * demo/viewer/toolchain_options.cc,
+ * demo/viewer/toolchain_options.hh,
+ * demo/viewer/toolchain_options.ui: Remove.
+
+ * demo/viewer/ocr_options.cc,
+ * demo/viewer/ocr_options.hh,
+ * demo/viewer/ocr_options.ui,
+ * demo/viewer/preprocessing_options.cc,
+ * demo/viewer/preprocessing_options.hh,
+ * demo/viewer/preprocessing_options.ui,
+ * demo/viewer/segmentation_options.cc,
+ * demo/viewer/segmentation_options.hh,
+ * demo/viewer/segmentation_options.ui: New option widgets.
+
+ * demo/viewer/preferences_dialog.cc: Insert new widgets.
+
+ * demo/viewer/runner.cc: Take OCR settings into account.
+
+2011-03-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * scribo/toolchain/internal/content_in_doc_functor.hh: Make OCR
+ step optional.
2011-03-03 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/demo/viewer/Makefile.am b/scribo/demo/viewer/Makefile.am
index 2c5e4cf..09d9ecc 100644
--- a/scribo/demo/viewer/Makefile.am
+++ b/scribo/demo/viewer/Makefile.am
@@ -30,7 +30,9 @@ scribo_viewer_SOURCES = viewer.cc \
image_region.cc \
help_dialog.cc \
step_widget.cc \
- toolchain_options.cc \
+ preprocessing_options.cc\
+ segmentation_options.cc \
+ ocr_options.cc \
runner.cc \
preprocess.cc \
process.cc \
@@ -65,8 +67,12 @@ BUILT_SOURCES = viewer.moc.cc \
image_region.moc.cc \
help_dialog.ui.h \
step_widget.moc.cc \
- toolchain_options.moc.cc \
- toolchain_options.ui.h \
+ preprocessing_options.moc.cc \
+ preprocessing_options.ui.h \
+ segmentation_options.moc.cc \
+ segmentation_options.ui.h \
+ ocr_options.moc.cc \
+ ocr_options.ui.h \
runner.moc.cc \
preprocess.moc.cc \
process.moc.cc \
@@ -91,7 +97,9 @@ noinst_HEADERS = viewer.hh \
common.hh \
help_dialog.hh \
step_widget.hh \
- toolchain_options.hh \
+ preprocessing_options.hh\
+ segmentation_options.hh\
+ ocr_options.hh \
runner.hh \
preprocess.hh \
process.hh \
@@ -121,7 +129,9 @@ EXTRA_DIST = \
general_options.ui \
preferences_dialog.ui \
README \
- toolchain_options.ui \
+ preprocessing_options.ui\
+ segmentation_options.ui \
+ ocr_options.ui \
help_dialog.ui \
demodir.hh.in
diff --git a/scribo/demo/viewer/config.cc b/scribo/demo/viewer/config.cc
index bf12e95..6bdcd35 100644
--- a/scribo/demo/viewer/config.cc
+++ b/scribo/demo/viewer/config.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -108,6 +109,31 @@ void config::set_segmentation_find_seps(int seps)
}
+// OCR
+
+bool config::ocr_enabled()
+{
+ return value("ocr/enabled", true).toBool();
+}
+
+void config::set_ocr_enabled(bool b)
+{
+ setValue("ocr/enabled", b);
+}
+
+
+
+QString config::ocr_language()
+{
+ return value("ocr/language", 0).toString();
+}
+
+void config::set_ocr_language(const QString& lang)
+{
+ setValue("ocr/language", lang);
+}
+
+
// General options
diff --git a/scribo/demo/viewer/config.hh b/scribo/demo/viewer/config.hh
index 07d193c..74dab3b 100644
--- a/scribo/demo/viewer/config.hh
+++ b/scribo/demo/viewer/config.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -49,6 +50,14 @@ public:
void set_segmentation_find_seps(int seps);
+ // OCR
+ bool ocr_enabled();
+ void set_ocr_enabled(bool b);
+
+ QString ocr_language();
+ void set_ocr_language(const QString& lang);
+
+
// General options
bool general_save_xml_enabled();
void set_general_save_xml_enabled(bool b);
diff --git a/scribo/demo/viewer/ocr_options.cc b/scribo/demo/viewer/ocr_options.cc
new file mode 100644
index 0000000..0ff09d9
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "defs.hh"
+#include "ocr_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+
+static const char *language[][2] = {
+ { "English", "eng" },
+ { "French", "fra" },
+ { 0, 0 }
+};
+
+
+ocr_options::ocr_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ for (unsigned i = 0; language[i][0]; ++i)
+ ocr_language->insertItem(i, language[i][0]);
+
+ load_config();
+}
+
+ocr_options::~ocr_options()
+{
+}
+
+
+int ocr_options::find_index(const QString& lang)
+{
+ for (unsigned i = 0; language[i][0]; ++i)
+ if (lang == language[i][1])
+ return i;
+ return 0;
+}
+
+
+void ocr_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ enable_ocr->setChecked(conf->ocr_enabled());
+ ocr_language->setCurrentIndex(find_index(conf->ocr_language()));
+}
+
+
+void ocr_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_ocr_enabled(enable_ocr->isChecked());
+ conf->set_ocr_language(language[ocr_language->currentIndex()][1]);
+}
diff --git a/scribo/demo/viewer/ocr_options.hh b/scribo/demo/viewer/ocr_options.hh
new file mode 100644
index 0000000..67ab4ef
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.hh
@@ -0,0 +1,40 @@
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
+
+# include <QtGui>
+# include <ocr_options.ui.h>
+# include "option_widget.hh"
+
+class ocr_options : public OptionWidget, private Ui::OcrOptions
+{
+ Q_OBJECT;
+
+public:
+ ocr_options(QWidget *parent = 0);
+ ~ocr_options();
+
+ void load_config();
+ void save_config();
+
+private:
+ int find_index(const QString& lang);
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_OCR_OPTIONS_HH
diff --git a/scribo/demo/viewer/ocr_options.ui b/scribo/demo/viewer/ocr_options.ui
new file mode 100644
index 0000000..d001c64
--- /dev/null
+++ b/scribo/demo/viewer/ocr_options.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OcrOptions</class>
+ <widget class="QWidget" name="OcrOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>366</width>
+ <height>112</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="enable_ocr">
+ <property name="title">
+ <string>Enable OCR</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Language</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="ocr_language"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/preferences_dialog.cc
b/scribo/demo/viewer/preferences_dialog.cc
index dfd6061..1eb80a7 100644
--- a/scribo/demo/viewer/preferences_dialog.cc
+++ b/scribo/demo/viewer/preferences_dialog.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -15,8 +16,10 @@
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
#include "preferences_dialog.hh"
-#include "toolchain_options.hh"
#include "general_options.hh"
+#include "ocr_options.hh"
+#include "preprocessing_options.hh"
+#include "segmentation_options.hh"
@@ -41,7 +44,7 @@ preferences_dialog::~preferences_dialog()
void preferences_dialog::load_option_list()
{
- static const char *options[] = { "General", "Toolchain", 0 };
+ static const char *options[] = { "General", "Preprocessing",
"Segmentation", "OCR", 0 };
int i;
for (i = 0; options[i]; ++i)
@@ -66,19 +69,32 @@ void preferences_dialog::select_option_widget(int row)
if (!widgets_[row])
{
+ QWidget *widget = 0;
+
switch (row)
{
case 0:
- widgets_[0] = new general_options(this);
+ widget = new general_options(this);
break;
case 1:
- widgets_[1] = new toolchain_options(this);
+ widget = new preprocessing_options(this);
+ break;
+
+ case 2:
+ widget = new segmentation_options(this);
+ break;
+
+ case 3:
+ widget = new ocr_options(this);
break;
default:
qDebug() << "select_option_widget - Hu? Something wrong...";
}
+
+ if (widget)
+ widgets_[row] = widget;
}
if (horizontalLayout_2->count() == 2)
diff --git a/scribo/demo/viewer/preprocessing_options.cc
b/scribo/demo/viewer/preprocessing_options.cc
new file mode 100644
index 0000000..2d55fea
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.cc
@@ -0,0 +1,66 @@
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "defs.hh"
+#include "preprocessing_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+preprocessing_options::preprocessing_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ bin_algoCbox->insertItem(Convert, "Violent convert");
+ bin_algoCbox->insertItem(Sauvola, "Local threshold");
+ bin_algoCbox->insertItem(SauvolaMs,
+ "Local threshold multiscale");
+
+ load_config();
+}
+
+preprocessing_options::~preprocessing_options()
+{
+}
+
+
+void preprocessing_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ subsampleCb->setChecked(conf->preprocessing_subsample());
+ remove_bgCb->setChecked(conf->preprocessing_remove_bg());
+ deskewCb->setChecked(conf->preprocessing_deskew());
+ remove_noiseCb->setChecked(conf->preprocessing_remove_noise());
+ bin_algoCbox->setCurrentIndex(conf->preprocessing_bin_algo());
+}
+
+
+void preprocessing_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_preprocessing_subsample(subsampleCb->isChecked());
+ conf->set_preprocessing_remove_bg(remove_bgCb->isChecked());
+ conf->set_preprocessing_deskew(deskewCb->isChecked());
+ conf->set_preprocessing_remove_noise(remove_noiseCb->isChecked());
+ conf->set_preprocessing_bin_algo(bin_algoCbox->currentIndex());
+}
diff --git a/scribo/demo/viewer/preprocessing_options.hh
b/scribo/demo/viewer/preprocessing_options.hh
new file mode 100644
index 0000000..c676880
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.hh
@@ -0,0 +1,38 @@
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
+
+# include <QtGui>
+# include <preprocessing_options.ui.h>
+# include "option_widget.hh"
+
+class preprocessing_options : public OptionWidget, private Ui::PreprocessingOptions
+{
+ Q_OBJECT;
+
+public:
+ preprocessing_options(QWidget *parent = 0);
+ ~preprocessing_options();
+
+ void load_config();
+ void save_config();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_PREPROCESSING_OPTIONS_HH
diff --git a/scribo/demo/viewer/preprocessing_options.ui
b/scribo/demo/viewer/preprocessing_options.ui
new file mode 100644
index 0000000..962cf49
--- /dev/null
+++ b/scribo/demo/viewer/preprocessing_options.ui
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreprocessingOptions</class>
+ <widget class="QWidget" name="PreprocessingOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>466</width>
+ <height>198</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure toolchain</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Binarization method:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="bin_algoCbox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="subsampleCb">
+ <property name="text">
+ <string>Run on subsampled image</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="remove_bgCb">
+ <property name="text">
+ <string>Remove background (slow)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="deskewCb">
+ <property name="text">
+ <string>Deskew</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="remove_noiseCb">
+ <property name="text">
+ <string>Remove noise</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>48</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/runner.cc b/scribo/demo/viewer/runner.cc
index a3cc883..e923db7 100644
--- a/scribo/demo/viewer/runner.cc
+++ b/scribo/demo/viewer/runner.cc
@@ -156,7 +156,8 @@ void runner::process(const image2d<value::rgb8>&
original_ima,
|| find_seps == defs::LinesAndWhitespaces);
f.enable_whitespace_seps = (find_seps == defs::Whitespaces
|| find_seps == defs::LinesAndWhitespaces);
-
+ f.enable_ocr = conf->ocr_enabled();
+ f.ocr_language = conf->ocr_language().toAscii().data();
f.xml_format = scribo::io::xml::PageExtended;
diff --git a/scribo/demo/viewer/segmentation_options.cc
b/scribo/demo/viewer/segmentation_options.cc
new file mode 100644
index 0000000..c120879
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.cc
@@ -0,0 +1,56 @@
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "defs.hh"
+#include "segmentation_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+segmentation_options::segmentation_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ find_sepsCbox->insertItem(defs::Lines, "Lines");
+ find_sepsCbox->insertItem(defs::Whitespaces, "Whitespaces");
+ find_sepsCbox->insertItem(defs::LinesAndWhitespaces, "Lines and
whitespaces");
+
+ load_config();
+}
+
+segmentation_options::~segmentation_options()
+{
+}
+
+
+void segmentation_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ find_sepsCbox->setCurrentIndex(conf->segmentation_find_seps());
+}
+
+
+void segmentation_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_segmentation_find_seps(find_sepsCbox->currentIndex());
+}
diff --git a/scribo/demo/viewer/segmentation_options.hh
b/scribo/demo/viewer/segmentation_options.hh
new file mode 100644
index 0000000..bdf65f9
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.hh
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
+
+# include <QtGui>
+# include <segmentation_options.ui.h>
+# include "option_widget.hh"
+
+class segmentation_options : public OptionWidget, private Ui::SegmentationOptions
+{
+ Q_OBJECT;
+
+public:
+ segmentation_options(QWidget *parent = 0);
+ ~segmentation_options();
+
+ void load_config();
+ void save_config();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_SEGMENTATION_OPTIONS_HH
diff --git a/scribo/demo/viewer/segmentation_options.ui
b/scribo/demo/viewer/segmentation_options.ui
new file mode 100644
index 0000000..485e448
--- /dev/null
+++ b/scribo/demo/viewer/segmentation_options.ui
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SegmentationOptions</class>
+ <widget class="QWidget" name="SegmentationOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Find separators</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="find_sepsCbox">
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>258</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/toolchain_options.cc
b/scribo/demo/viewer/toolchain_options.cc
deleted file mode 100644
index 6024ff3..0000000
--- a/scribo/demo/viewer/toolchain_options.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-
-#include "defs.hh"
-#include "toolchain_options.hh"
-#include "config.hh"
-
-// Defines enum of binarization algorithms
-# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
-
-using namespace scribo::toolchain::internal;
-
-toolchain_options::toolchain_options(QWidget *parent)
- : OptionWidget(parent)
-{
- setupUi(this);
-
- bin_algoCbox->insertItem(Convert, "Violent convert");
- bin_algoCbox->insertItem(Sauvola, "Local threshold");
- bin_algoCbox->insertItem(SauvolaMs,
- "Local threshold multiscale");
-
- find_sepsCbox->insertItem(defs::Lines, "Lines");
- find_sepsCbox->insertItem(defs::Whitespaces, "Whitespaces");
- find_sepsCbox->insertItem(defs::LinesAndWhitespaces, "Lines and
whitespaces");
-
- load_config();
-}
-
-toolchain_options::~toolchain_options()
-{
-}
-
-
-void toolchain_options::load_config()
-{
- config * const conf = config::get_instance();
-
- // Preprocessing
- subsampleCb->setChecked(conf->preprocessing_subsample());
- remove_bgCb->setChecked(conf->preprocessing_remove_bg());
- deskewCb->setChecked(conf->preprocessing_deskew());
- remove_noiseCb->setChecked(conf->preprocessing_remove_noise());
- bin_algoCbox->setCurrentIndex(conf->preprocessing_bin_algo());
-
- // Page segmentation
- find_sepsCbox->setCurrentIndex(conf->segmentation_find_seps());
-}
-
-
-void toolchain_options::save_config()
-{
- config * const conf = config::get_instance();
-
- conf->set_preprocessing_subsample(subsampleCb->isChecked());
- conf->set_preprocessing_remove_bg(remove_bgCb->isChecked());
- conf->set_preprocessing_deskew(deskewCb->isChecked());
- conf->set_preprocessing_remove_noise(remove_noiseCb->isChecked());
- conf->set_preprocessing_bin_algo(bin_algoCbox->currentIndex());
-
- conf->set_segmentation_find_seps(find_sepsCbox->currentIndex());
-}
diff --git a/scribo/demo/viewer/toolchain_options.hh
b/scribo/demo/viewer/toolchain_options.hh
deleted file mode 100644
index afad3e7..0000000
--- a/scribo/demo/viewer/toolchain_options.hh
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
-//
-// This file is part of Olena.
-//
-// Olena is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation, version 2 of the License.
-//
-// Olena is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
-# define SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
-
-# include <QtGui>
-# include <toolchain_options.ui.h>
-# include "option_widget.hh"
-
-class toolchain_options : public OptionWidget, private Ui::ToolchainOptions
-{
- Q_OBJECT;
-
-public:
- toolchain_options(QWidget *parent = 0);
- ~toolchain_options();
-
- void load_config();
- void save_config();
-
-};
-
-#endif // ! SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
diff --git a/scribo/demo/viewer/toolchain_options.ui
b/scribo/demo/viewer/toolchain_options.ui
deleted file mode 100644
index 748696d..0000000
--- a/scribo/demo/viewer/toolchain_options.ui
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ToolchainOptions</class>
- <widget class="QWidget" name="ToolchainOptions">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>492</width>
- <height>264</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Configure toolchain</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Preprocessing</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="subsampleCb">
- <property name="text">
- <string>Run on subsampled image</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="remove_bgCb">
- <property name="text">
- <string>Remove background (slow)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="deskewCb">
- <property name="text">
- <string>Deskew</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="remove_noiseCb">
- <property name="text">
- <string>Remove noise</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Binarization method:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="bin_algoCbox"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Page segmentation</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Find separators</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="find_sepsCbox"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
--
1.5.6.5