Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* binarization/sauvola_ms.hh: Fix compilation issues on MacOS X.
* core/component_set.hh: Add labeled_image_() member.
* debug/save_bboxes_image.hh: Add a missing include.
* preprocessing/split_bg_fg.hh,
* primitive/extract/components.hh: Fix namespace ambiguities.
* src/text_in_article.cc: Rename as...
* src/text_in_article_pbm.cc: ... this.
* src/Makefile.am: Update source file names.
---
scribo/ChangeLog | 18 +++++++++++++++
scribo/binarization/sauvola_ms.hh | 9 +++++--
scribo/core/component_set.hh | 16 +++++++++++++
scribo/debug/save_bboxes_image.hh | 1 +
scribo/preprocessing/split_bg_fg.hh | 2 +-
scribo/primitive/extract/components.hh | 7 +++--
scribo/src/Makefile.am | 8 +++---
.../{text_in_article.cc => text_in_article_pbm.cc} | 23 ++++++++++++-------
8 files changed, 64 insertions(+), 20 deletions(-)
rename scribo/src/{text_in_article.cc => text_in_article_pbm.cc} (94%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 9ce6390..40a5fb4 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,21 @@
+2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Small fixes in Scribo.
+
+ * binarization/sauvola_ms.hh: Fix compilation issues on MacOS X.
+
+ * core/component_set.hh: Add labeled_image_() member.
+
+ * debug/save_bboxes_image.hh: Add a missing include.
+
+ * preprocessing/split_bg_fg.hh,
+ * primitive/extract/components.hh: Fix namespace ambiguities.
+
+ * src/text_in_article.cc: Rename as...
+ * src/text_in_article_pbm.cc: ... this.
+
+ * src/Makefile.am: Update source file names.
+
2010-03-18 Guillaume Lazzara <z(a)lrde.epita.fr>
Cleanup binarization tools.
diff --git a/scribo/binarization/sauvola_ms.hh b/scribo/binarization/sauvola_ms.hh
index ad77660..2717770 100644
--- a/scribo/binarization/sauvola_ms.hh
+++ b/scribo/binarization/sauvola_ms.hh
@@ -125,7 +125,8 @@ namespace scribo
typedef image2d<int_u8> I;
typedef point2d P;
- unsigned ratio = std::pow(q, i - 2); // Ratio in comparison to e_2
+ // Cast to float is needed on MacOS X.
+ unsigned ratio = std::pow(float(q), float(i - 2u)); // Ratio in comparison to e_2
unsigned
w_local = w * ratio,
@@ -832,7 +833,8 @@ namespace scribo
// Highest scale -> no maximum component size.
{
int i = sub_ima.size() - 1;
- unsigned ratio = std::pow(q, i - 2); // Ratio compared to e_2
+ // Cast to float is needed on MacOS X.
+ unsigned ratio = std::pow(float(q), float(i - 2)); // Ratio compared to e_2
t_ima[i] = internal::compute_t_n_and_e_2(sub_ima[i], e_2,
lambda_min_2 / ratio,
mln_max(unsigned),
@@ -845,7 +847,8 @@ namespace scribo
{
for (int i = sub_ima.size() - 2; i > 2; --i)
{
- unsigned ratio = std::pow(q, i - 2); // Ratio compared to e_2
+ // Cast to float is needed on MacOS X.
+ unsigned ratio = std::pow(float(q), float(i - 2)); // Ratio compared to e_2
t_ima[i] = internal::compute_t_n_and_e_2(sub_ima[i], e_2,
lambda_min_2 / ratio,
lambda_max_2 / ratio,
diff --git a/scribo/core/component_set.hh b/scribo/core/component_set.hh
index 14cdc4c..ef7ae4e 100644
--- a/scribo/core/component_set.hh
+++ b/scribo/core/component_set.hh
@@ -191,6 +191,13 @@ namespace scribo
/// Unique set Id.
unsigned id_() const;
+
+ /// Read/Write access to the underlying labeled image.
+ /// Careful! Write in this image at your own risks! It may lead to
+ /// non-synchronised related data.
+ //
+ L& labeled_image_();
+
/// @}
private:
@@ -479,6 +486,15 @@ namespace scribo
template <typename L>
inline
+ L&
+ component_set<L>::labeled_image_()
+ {
+ return this->data_->ima_;
+ }
+
+
+ template <typename L>
+ inline
bool
component_set<L>::has_separators() const
{
diff --git a/scribo/debug/save_bboxes_image.hh b/scribo/debug/save_bboxes_image.hh
index 60f2c8d..f2c34e8 100644
--- a/scribo/debug/save_bboxes_image.hh
+++ b/scribo/debug/save_bboxes_image.hh
@@ -36,6 +36,7 @@
# include <mln/util/array.hh>
# include <mln/io/ppm/save.hh>
+# include <scribo/core/line_set.hh>
# include <scribo/draw/bounding_boxes.hh>
diff --git a/scribo/preprocessing/split_bg_fg.hh b/scribo/preprocessing/split_bg_fg.hh
index f64635b..1ad056a 100644
--- a/scribo/preprocessing/split_bg_fg.hh
+++ b/scribo/preprocessing/split_bg_fg.hh
@@ -326,7 +326,7 @@ namespace scribo
image2d<value::rgb8> fg = internal::inverted_diff_abs(input, bg);
trace::exiting("scribo::preprocessing::split_bg_fg");
- return make::couple(bg, fg);
+ return mln::make::couple(bg, fg);
}
diff --git a/scribo/primitive/extract/components.hh b/scribo/primitive/extract/components.hh
index 3363331..aac54e6 100644
--- a/scribo/primitive/extract/components.hh
+++ b/scribo/primitive/extract/components.hh
@@ -42,6 +42,7 @@
# include <mln/labeling/compute.hh>
# include <mln/util/array.hh>
+# include <mln/util/couple.hh>
# include <mln/extension/fill.hh>
@@ -120,9 +121,9 @@ namespace scribo
// Setting extension value.
extension::fill(input, 0);
- util::couple<L,
- util::couple<util::array<mln_result(pair_accu_t)>,
- util::array<pair_accu_t> > >
+ mln::util::couple<L,
+ mln::util::couple<mln::util::array<mln_result(pair_accu_t)>,
+ mln::util::array<pair_accu_t> > >
results = labeling::blobs_and_compute(input, nbh, ncomponents,
pair_accu_t());
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index 60c60f7..e254689 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -72,16 +72,16 @@ if HAVE_TIFF
-lpthread -lhpdf
- bin_PROGRAMS += text_in_article
- text_in_article_CPPFLAGS = $(AM_CPPFLAGS) \
+ bin_PROGRAMS += text_in_article_pbm
+ text_in_article_pbm_CPPFLAGS = $(AM_CPPFLAGS) \
$(TESSERACT_CPPFLAGS) \
$(TIFF_CPPFLAGS)
- text_in_article_LDFLAGS = $(AM_LDFLAGS) \
+ text_in_article_pbm_LDFLAGS = $(AM_LDFLAGS) \
$(TESSERACT_LDFLAGS) \
$(TIFF_LDFLAGS) \
-lpthread
# -lhpdf
- text_in_article_SOURCES = text_in_article.cc
+ text_in_article_pbm_SOURCES = text_in_article_pbm.cc
text_in_photo_ppm_fast_CPPFLAGS = $(AM_CPPFLAGS) \
diff --git a/scribo/src/text_in_article.cc b/scribo/src/text_in_article_pbm.cc
similarity index 94%
rename from scribo/src/text_in_article.cc
rename to scribo/src/text_in_article_pbm.cc
index 2e6b1a6..3f37529 100644
--- a/scribo/src/text_in_article.cc
+++ b/scribo/src/text_in_article_pbm.cc
@@ -80,6 +80,7 @@ const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. 'False' for object, 'True'\
for the background." },
+ { "denoise", "1 enables denoising, 0 disables it. (enabled by default)" },
{ "debug_dir", "Output directory for debug image" },
{0, 0}
};
@@ -90,15 +91,15 @@ int main(int argc, char* argv[])
using namespace scribo;
using namespace mln;
- if (argc != 3 && argc != 4)
+ if (argc != 3 && argc != 4 && argc != 5)
return scribo::debug::usage(argv,
"Find text lines using left/right validation and display x-height in a binarized article.",
- "input.pbm out.ppm <debug_dir>",
+ "input.pbm out.txt <denoise: 0|1> <debug_dir>",
args_desc,
- "A color image. The following colors are used : dark blue for object bboxes, orange for single object bboxes, purple for group bboxes and light blue for x-height.");
+ "Text output.");
- if (argc == 4)
- scribo::make::internal::debug_filename_prefix = argv[3];
+ if (argc == 5)
+ scribo::make::internal::debug_filename_prefix = argv[4];
trace::entering("main");
@@ -131,8 +132,11 @@ int main(int argc, char* argv[])
// mln::io::pbm::save(input_cleaned, "input_no_separators.pbm");
// Denoise
- std::cout << "Denoise..." << std::endl;
- input_cleaned = preprocessing::denoise_fg(input_cleaned, c8(), 3);
+ if (argc > 3 && atoi(argv[3]) != 0)
+ {
+ std::cout << "Denoise..." << std::endl;
+ input_cleaned = preprocessing::denoise_fg(input_cleaned, c8(), 3);
+ }
// mln::io::pbm::save(input_cleaned, "input_denoised.pbm");
@@ -273,13 +277,14 @@ int main(int argc, char* argv[])
scribo::make::debug_filename("step2_looks_like_a_text_line.ppm"));
// Bboxes image.
- scribo::debug::save_bboxes_image(input, lines, argv[2]);
+ scribo::debug::save_bboxes_image(input, lines,
+ scribo::make::debug_filename("step2_bboxes.ppm"));
//===== END OF DEBUG =====
- scribo::text::recognition(lines, "fra", "out.txt");
+ scribo::text::recognition(lines, "fra", argv[2]);
// // Display median character space.
--
1.5.6.5
1
0
* demo/demat/demat.pro,
* demo/demat/demat.qrc,
* demo/demat/src/doc_type.hh,
* demo/demat/src/main.cc,
* demo/demat/src/main_window.cc,
* demo/demat/src/main_window.hh,
* demo/demat/src/mln_widgets.cc,
* demo/demat/src/preprocessing_task.hh,
* demo/demat/src/process_args.hh,
* demo/demat/src/runner.cc,
* demo/demat/src/runner.hh,
* demo/demat/ui/main_window.ui: New.
* demo/shared/src/crop_item.cc,
* demo/shared/src/crop_item.hh,
* demo/shared/src/image_viewer.cc,
* demo/shared/src/image_viewer.hh,
* demo/shared/ui/image_viewer.ui: Update according the needs of
this new demo.
---
scribo/ChangeLog | 24 ++
scribo/demo/demat/demat.pro | 37 ++
scribo/demo/demat/demat.qrc | 4 +
scribo/demo/{wizard => demat}/src/doc_type.hh | 0
scribo/demo/demat/src/main.cc | 27 ++
scribo/demo/demat/src/main_window.cc | 240 +++++++++++++
scribo/demo/demat/src/main_window.hh | 91 +++++
scribo/demo/demat/src/mln_widgets.cc | 11 +
.../{wizard => demat}/src/preprocessing_task.hh | 0
scribo/demo/demat/src/process_args.hh | 47 +++
scribo/demo/demat/src/runner.cc | 316 +++++++++++++++++
scribo/demo/demat/src/runner.hh | 93 +++++
scribo/demo/demat/ui/main_window.ui | 366 ++++++++++++++++++++
scribo/demo/shared/src/crop_item.cc | 45 ++-
scribo/demo/shared/src/crop_item.hh | 12 +-
scribo/demo/shared/src/image_viewer.cc | 65 +++-
scribo/demo/shared/src/image_viewer.hh | 14 +-
scribo/demo/shared/ui/image_viewer.ui | 34 ++-
18 files changed, 1398 insertions(+), 28 deletions(-)
create mode 100644 scribo/demo/demat/demat.pro
create mode 100644 scribo/demo/demat/demat.qrc
copy scribo/demo/{wizard => demat}/src/doc_type.hh (100%)
create mode 100644 scribo/demo/demat/src/main.cc
create mode 100644 scribo/demo/demat/src/main_window.cc
create mode 100644 scribo/demo/demat/src/main_window.hh
create mode 100644 scribo/demo/demat/src/mln_widgets.cc
copy scribo/demo/{wizard => demat}/src/preprocessing_task.hh (100%)
create mode 100644 scribo/demo/demat/src/process_args.hh
create mode 100644 scribo/demo/demat/src/runner.cc
create mode 100644 scribo/demo/demat/src/runner.hh
create mode 100644 scribo/demo/demat/ui/main_window.ui
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 40a5fb4..68ec602 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,29 @@
2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add a new demo in Scribo.
+
+ * demo/demat/demat.pro,
+ * demo/demat/demat.qrc,
+ * demo/demat/src/doc_type.hh,
+ * demo/demat/src/main.cc,
+ * demo/demat/src/main_window.cc,
+ * demo/demat/src/main_window.hh,
+ * demo/demat/src/mln_widgets.cc,
+ * demo/demat/src/preprocessing_task.hh,
+ * demo/demat/src/process_args.hh,
+ * demo/demat/src/runner.cc,
+ * demo/demat/src/runner.hh,
+ * demo/demat/ui/main_window.ui: New.
+
+ * demo/shared/src/crop_item.cc,
+ * demo/shared/src/crop_item.hh,
+ * demo/shared/src/image_viewer.cc,
+ * demo/shared/src/image_viewer.hh,
+ * demo/shared/ui/image_viewer.ui: Update according the needs of
+ this new demo.
+
+2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes in Scribo.
* binarization/sauvola_ms.hh: Fix compilation issues on MacOS X.
diff --git a/scribo/demo/demat/demat.pro b/scribo/demo/demat/demat.pro
new file mode 100644
index 0000000..4f4af23
--- /dev/null
+++ b/scribo/demo/demat/demat.pro
@@ -0,0 +1,37 @@
+# -*- c++ -*-
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Feb 9 12:02:10 2010
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . src
+INCLUDEPATH += . ../ ../shared $(OLN)/milena $(OLN)
+
+QMAKE_CXXFLAGS += -g
+
+LIBS += `Magick++-config --ldflags --libs`
+
+DEFINES += NDEBUG MLN_INCLUDE_ONLY
+
+# Input
+ HEADERS += \
+ ../shared/src/image_viewer.hh \
+ ../shared/src/internal/interactive_scene.hh \
+ ../shared/src/crop_item.hh \
+ ../shared/src/browse_widget.hh \
+ src/runner.hh \
+ src/main_window.hh
+
+SOURCES += \
+ ../shared/src/crop_item.cc \
+ ../shared/src/internal/interactive_scene.cc \
+ ../shared/src/browse_widget.cc \
+ src/mln_widgets.cc
+
+FORMS += \
+ ../shared/ui/image_viewer.ui \
+ ui/main_window.ui
+
+
+RESOURCES += ../shared/shared.qrc demat.qrc
diff --git a/scribo/demo/demat/demat.qrc b/scribo/demo/demat/demat.qrc
new file mode 100644
index 0000000..68031c7
--- /dev/null
+++ b/scribo/demo/demat/demat.qrc
@@ -0,0 +1,4 @@
+<RCC>
+ <qresource prefix="images" >
+ </qresource>
+</RCC>
diff --git a/scribo/demo/wizard/src/doc_type.hh b/scribo/demo/demat/src/doc_type.hh
similarity index 100%
copy from scribo/demo/wizard/src/doc_type.hh
copy to scribo/demo/demat/src/doc_type.hh
diff --git a/scribo/demo/demat/src/main.cc b/scribo/demo/demat/src/main.cc
new file mode 100644
index 0000000..ee35a48
--- /dev/null
+++ b/scribo/demo/demat/src/main.cc
@@ -0,0 +1,27 @@
+#include <QtGui>
+#include <src/main_window.hh>
+#include <src/preprocessing_task.hh>
+
+namespace scribo { namespace demo {extern QString basedir_; } }
+
+int main(int argc, char* argv[])
+{
+ QApplication app(argc, argv);
+
+ qRegisterMetaType<preprocessing_task_set_t>("preprocessing_task_set_t");
+
+ if (argc == 2)
+ {
+ scribo::demo::basedir_ = argv[1];
+ }
+ else
+ {
+ qDebug() << "Usage: " << argv[0] << " <path_to_scribo/src>";
+ return 1;
+ }
+
+ scribo::demo::demat::main_window win;
+ win.show();
+
+ return app.exec();
+}
diff --git a/scribo/demo/demat/src/main_window.cc b/scribo/demo/demat/src/main_window.cc
new file mode 100644
index 0000000..ee82ca1
--- /dev/null
+++ b/scribo/demo/demat/src/main_window.cc
@@ -0,0 +1,240 @@
+// 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/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <src/main_window.hh>
+
+#include <src/doc_type.hh>
+#include <src/preprocessing_task.hh>
+#include <src/process_args.hh>
+
+#include <mln/data/convert.hh>
+#include <mln/convert/to_qimage_nocopy.hh>
+#include <mln/core/routine/duplicate.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/paste.hh>
+#include <mln/io/magick/load.hh>
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+ namespace demat
+ {
+
+ // FIXME: move it as attribute.
+ static mln::image2d<mln::value::rgb8> input_;
+
+
+ main_window::main_window()
+ {
+ setupUi(this);
+
+ text_->hide();
+
+ connect(action_Open, SIGNAL(activated()),
+ this, SLOT(open_file_slot()));
+
+ connect(run_btn, SIGNAL(clicked()), this, SLOT(run()));
+
+
+ // Connections to/from task runner.
+ connect(&runner_, SIGNAL(new_progress_label(const QString&)),
+ this, SLOT(update_progress_label_slot(const QString&)));
+
+ connect(&runner_, SIGNAL(progress(unsigned)),
+ this, SLOT(progress_slot(unsigned)));
+ connect(&runner_, SIGNAL(finished()),
+ this, SLOT(process_finished_slot()));
+
+ // Connections for dock windows.
+ connect(advanced_dock_, SIGNAL(visibilityChanged(bool)),
+ actionAdvanced_options, SLOT(setChecked(bool)));
+ connect(options_dock_, SIGNAL(visibilityChanged(bool)),
+ actionOptions, SLOT(setChecked(bool)));
+
+ connect(actionAdvanced_options, SIGNAL(triggered(bool)),
+ advanced_dock_, SLOT(setVisible(bool)));
+ connect(actionOptions, SIGNAL(triggered(bool)),
+ options_dock_, SLOT(setVisible(bool)));
+
+ progress_ = new QProgressDialog();
+ progress_->setLabelText("Processing...");
+ progress_->setCancelButton(0);
+ progress_->setAutoClose(true);
+
+ // Setup crop tool.
+ viewer_->set_selection_enabled(true);
+ connect(viewer_, SIGNAL(ready_for_crop()), this, SLOT(crop_slot()));
+ }
+
+
+ void main_window::open_file_slot()
+ {
+ QFileDialog dialog;
+ QStringList filters;
+ filters << tr("Image (*.ppm *.pbm *.pgm *.png *.jpg)");
+ dialog.setNameFilters(filters);
+
+ dialog.setFileMode(QFileDialog::ExistingFile);
+ dialog.setLabelText(QFileDialog::LookIn,
+ tr("Choose an existing file"));
+
+ if (dialog.exec() && current_image_ != dialog.selectedFiles().at(0))
+ {
+ current_image_ = dialog.selectedFiles().at(0);
+ load();
+ }
+
+ }
+
+
+ void main_window::load()
+ {
+ text_->hide();
+
+ mln::io::magick::load(input_, current_image_.toStdString());
+
+ input_dsp_ = QPixmap::fromImage(mln::convert::to_qimage_nocopy(input_));
+
+ viewer_->draw_image(input_dsp_);
+ }
+
+
+ void main_window::run()
+ {
+ preprocessing_task_set_t tasks = get_tasks();
+
+ prepare_progress_bar(tasks.size());
+
+ process_args args; // Nothing for now.
+
+ runner_.start(current_image_, input_, Text_Doc, tasks, args);
+ }
+
+
+ preprocessing_task_set_t main_window::get_tasks()
+ {
+ preprocessing_task_set_t tasks;
+
+ if (removeBg->isChecked())
+ tasks.insert(RemoveBg);
+
+ if (unskew->isChecked())
+ tasks.insert(Unskew);
+
+ if (removeNoise->isChecked())
+ tasks.insert(RemoveNoise);
+
+ if (improveContrast->isChecked())
+ tasks.insert(ImproveContrast);
+
+ if (reduceSize->isChecked())
+ tasks.insert(ReduceSize);
+
+ if (binarizationCBox->currentIndex() == 0)
+ tasks.insert(BinarizationSimple);
+ else if (binarizationCBox->currentIndex() == 1)
+ tasks.insert(BinarizationSauvola);
+ else if (binarizationCBox->currentIndex() == 2)
+ tasks.insert(BinarizationSauvolaMs);
+
+ return tasks;
+ }
+
+
+ void main_window::prepare_progress_bar(unsigned max)
+ {
+ progress_->show();
+ progress_->setValue(0);
+ progress_->setMaximum(max + 3);
+ }
+
+
+ void main_window::progress_slot(unsigned i)
+ {
+ progress_->setValue(progress_->value() + i);
+ }
+
+
+ void main_window::update_progress_label_slot(const QString& msg)
+ {
+ progress_->setLabelText(msg);
+ }
+
+
+ void main_window::process_finished_slot()
+ {
+ text_->clear();
+
+ QFile file("/tmp/out.txt");
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return;
+
+ QTextStream in(&file);
+ in.setCodec("UTF-8");
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ text_->append(line);
+ }
+
+
+ text_->show();
+ }
+
+
+ void main_window::crop_slot()
+ {
+ mln::box2d b = input_.domain();
+ QRectF selection = viewer_->selection();
+
+ mln::box2d sbox = mln::make::box2d(selection.topLeft().y(),
+ selection.topLeft().x(),
+ selection.bottomRight().y(),
+ selection.bottomRight().x());
+
+ sbox.crop_wrt(b);
+
+ if (sbox.is_valid())
+ {
+ // Update underlying data.
+ mln::image2d<mln::value::rgb8> output(sbox);
+ mln::data::fill(output, input_);
+ input_ = output;
+
+ // Update display
+ viewer_->draw_image(input_);
+ }
+
+ viewer_->enable_crop_tool(false); // Disable crop tool
+ }
+
+ } // end of namespace scribo::demo::demat
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
diff --git a/scribo/demo/demat/src/main_window.hh b/scribo/demo/demat/src/main_window.hh
new file mode 100644
index 0000000..f52f171
--- /dev/null
+++ b/scribo/demo/demat/src/main_window.hh
@@ -0,0 +1,91 @@
+// 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/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH
+# define SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH
+
+# include <QtGui/QMainWindow>
+# include <ui_main_window.h>
+# include <src/doc_type.hh>
+# include <src/preprocessing_task.hh>
+# include <src/runner.hh>
+
+# include <mln/core/image/image2d.hh>
+# include <mln/core/image/dmorph/image_if.hh>
+# include <mln/pw/all.hh>
+# include <mln/value/rgb8.hh>
+
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+ namespace demat
+ {
+
+
+ class main_window : public QMainWindow, private Ui::MainWindow
+ {
+ Q_OBJECT;
+
+ public:
+ main_window();
+
+ private slots:
+ void run();
+ void open_file_slot();
+ void progress_slot(unsigned i);
+ void update_progress_label_slot(const QString&);
+ void process_finished_slot();
+
+ void crop_slot();
+
+ private: // members
+ void load();
+
+ void prepare_progress_bar(unsigned max);
+ Doc_Type get_doc_type();
+ preprocessing_task_set_t get_tasks();
+
+ private: // attributes
+ QPixmap input_dsp_;
+
+ QString current_image_;
+
+ QProgressDialog* progress_;
+ runner runner_;
+ };
+
+
+ } // end of namespace scribo::demo::demat
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH
diff --git a/scribo/demo/demat/src/mln_widgets.cc b/scribo/demo/demat/src/mln_widgets.cc
new file mode 100644
index 0000000..079fc7f
--- /dev/null
+++ b/scribo/demo/demat/src/mln_widgets.cc
@@ -0,0 +1,11 @@
+#undef MLN_INCLUDE_ONLY
+
+// Windows
+#include <src/main_window.cc>
+
+// Widgets
+#include <shared/src/image_viewer.cc>
+
+// Misc
+#include <src/main.cc>
+#include <src/runner.cc>
diff --git a/scribo/demo/wizard/src/preprocessing_task.hh b/scribo/demo/demat/src/preprocessing_task.hh
similarity index 100%
copy from scribo/demo/wizard/src/preprocessing_task.hh
copy to scribo/demo/demat/src/preprocessing_task.hh
diff --git a/scribo/demo/demat/src/process_args.hh b/scribo/demo/demat/src/process_args.hh
new file mode 100644
index 0000000..5ca72cf
--- /dev/null
+++ b/scribo/demo/demat/src/process_args.hh
@@ -0,0 +1,47 @@
+// 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/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH
+# define SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH
+
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+ struct process_args
+ {
+ unsigned scale;
+ };
+
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
+
+
+#endif // !SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH
diff --git a/scribo/demo/demat/src/runner.cc b/scribo/demo/demat/src/runner.cc
new file mode 100644
index 0000000..6972902
--- /dev/null
+++ b/scribo/demo/demat/src/runner.cc
@@ -0,0 +1,316 @@
+#include <src/runner.hh>
+
+#include <shared/src/to_mln_image.hh>
+#include <src/preprocessing_task.hh>
+#include <src/doc_type.hh>
+
+#include <mln/convert/to_qimage.hh>
+#include <mln/convert/to_qimage_nocopy.hh>
+#include <mln/fun/v2v/rgb_to_int_u.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/data/convert.hh>
+#include <mln/data/paste_without_localization.hh>
+#include <mln/io/pbm/save.hh>
+#include <mln/io/magick/load.hh>
+#include <mln/subsampling/antialiased.hh>
+
+#include <scribo/preprocessing/split_bg_fg.hh>
+#include <scribo/preprocessing/denoise.hh>
+#include <scribo/preprocessing/homogeneous_contrast.hh>
+#include <scribo/preprocessing/unskew.hh>
+#include <scribo/binarization/sauvola.hh>
+#include <scribo/binarization/sauvola_ms.hh>
+#include <scribo/binarization/simple.hh>
+
+#include <mln/logical/not.hh>
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+ QString basedir_ = "";
+
+ // FIXME: move as attribute.
+ mln::image2d<mln::value::rgb8> input_;
+
+
+ runner::runner(QObject *parent)
+ : QThread(parent)
+ {
+ process_.moveToThread(this);
+ }
+
+
+ void runner::start(const QString& filename,
+ const mln::image2d<mln::value::rgb8>& input,
+ const Doc_Type& doc_type,
+ const preprocessing_task_set_t& tasks,
+ const process_args& args)
+ {
+ filename_ = filename;
+ doc_type_ = doc_type;
+ tasks_ = tasks;
+ args_ = args;
+ input_ = input;
+
+ QThread::start();
+ }
+
+
+ void runner::run()
+ {
+ // Notification of the number of tasks.
+ emit new_progress_max_value(tasks_.size() + 2);
+
+ qDebug() << "progress steps : " << tasks_.size() + 2;
+
+ image2d<value::rgb8> ima = load();
+
+ preprocess(ima);
+
+ process();
+ }
+
+
+ image2d<value::rgb8> runner::load()
+ {
+ emit new_progress_label("Loading image");
+
+ image2d<value::rgb8> output(input_.nrows(), input_.ncols(),
+ input_.border());
+ data::paste_without_localization(input_, output);
+
+// io::magick::load(output, filename_.toStdString());
+
+ emit progress(1);
+
+ return output;
+ }
+
+
+ void runner::preprocess(const image2d<value::rgb8>& ima)
+ {
+
+ image2d<value::rgb8> tmp_color = duplicate(ima);
+
+
+ //==================
+ // Remove background
+ //==================
+ if (tasks_.contains(RemoveBg))
+ {
+ std::cout << "Foreground extraction" << std::endl;
+ emit new_progress_label("Foreground Extraction");
+
+ tmp_color = scribo::preprocessing::split_bg_fg(tmp_color, 10000, 32).second();
+
+ emit progress(1);
+ }
+
+
+ //=============================================
+ // Convert to grayscale image (always happens).
+ //=============================================
+ emit new_progress_label("Convert to gray-scale image");
+ image2d<value::int_u8>
+ intensity_ima = data::transform(tmp_color,
+ mln::fun::v2v::rgb_to_int_u<8>());
+ emit progress(1);
+
+
+ // FIXME: SUbsampling should be done at the very beginning!!!!
+ //
+ //==========
+ // Subsample
+ //==========
+ if (tasks_.contains(ReduceSize))
+ {
+ emit new_progress_label("Subsampling input image");
+ intensity_ima = mln::subsampling::antialiased(intensity_ima,
+ find_best_scale(intensity_ima));
+ emit progress(1);
+ }
+
+
+ //=============================
+ // Improve contrast homogeneity
+ //=============================
+ if (tasks_.contains(ImproveContrast))
+ {
+ std::cout << "Improve contrast homogeneity" << std::endl;
+ emit new_progress_label("Improve contrast homogeneity");
+
+ intensity_ima = arith::revert(preprocessing::homogeneous_contrast(intensity_ima, 75));
+
+ emit progress(1);
+ }
+
+
+ std::cout << intensity_ima.domain() << std::endl;
+ io::pgm::save(intensity_ima, "intensity_ima.pgm");
+
+ //==============================
+ // Binarization (always happens)
+ //==============================
+ image2d<bool> out_bool;
+ emit new_progress_label("Binarization");
+
+ if (tasks_.contains(BinarizationSauvola))
+ {
+ // FIXME: sauvola should not negate the image.
+ std::cout << "Binarization Sauvola" << std::endl;
+ out_bool = binarization::sauvola(intensity_ima);
+ }
+ else if (tasks_.contains(BinarizationSauvolaMs))
+ {
+ // FIXME: sauvola should not negate the image.
+ std::cout << "Binarization Sauvola_ms" << std::endl;
+ out_bool = binarization::sauvola_ms(intensity_ima, 51, 2, 67);
+ }
+ else if (tasks_.contains(BinarizationSimple))
+ {
+ std::cout << "Binarization Simple" << std::endl;
+ out_bool = scribo::binarization::simple(intensity_ima);
+ }
+ else
+ {
+ std::cout << "Binary image conversion" << std::endl;
+ out_bool = data::convert(bool(), intensity_ima);
+ }
+
+ emit progress(1);
+
+
+ // FIXME: remove!
+// logical::not_inplace(out_bool);
+
+ //========
+ // Denoise
+ //========
+// if (tasks_.contains(RemoveNoise))
+// {
+// std::cout << "Remove noise" << std::endl;
+// emit new_progress_label("Remove noise");
+
+// out_bool = preprocessing::denoise(out_bool, c8(), 2, 2);
+
+// emit progress(1);
+// }
+
+ //=======
+ // Unskew
+ //=======
+ if (tasks_.contains(Unskew))
+ {
+ std::cout << "Unskew" << std::endl;
+ emit new_progress_label("Unskew");
+
+ out_bool = scribo::preprocessing::unskew(out_bool).first();
+
+ emit progress(1);
+ }
+
+
+ //=========================
+ // Save preprocessed image.
+ //=========================
+ io::pbm::save(out_bool, "/tmp/tmp.pbm");
+ }
+
+
+ void runner::process()
+ {
+ QStringList args;
+
+
+ // FIXME: require binaries to ask for a filename for bboxes
+ // output files.
+ switch(doc_type_)
+ {
+ case Text_Doc:
+ emit new_progress_label("Finding text in document...");
+ qDebug() << "Running text_in_article_pbm";
+ args << "/tmp/tmp.pbm" << "/tmp/out.txt";
+
+ // Denoise.
+ if (! tasks_.contains(RemoveNoise))
+ args << "0";
+ else
+ {
+ args << "1";
+ emit progress(1); // Consider denoising as done even though it is performed later.
+ }
+
+ args << "/tmp/";
+
+ if (process_.execute(basedir_ + "/text_in_article_pbm", args))
+ {
+ qDebug() << "Error while running text_in_article_pbm.";
+ return;
+ }
+ break;
+
+ case Picture:
+ emit new_progress_label("Finding text in picture...");
+ qDebug() << "Running text_in_photo_pbm_fast";
+ args << "/tmp/tmp.pbm" << "/tmp/out.ppm" << "1" << "1" << "1";
+ if (process_.execute(basedir_ + "/text_in_photo_pbm_fast", args))
+ {
+ qDebug() << "Error while running text_in_photo_pbm_fast.";
+ return;
+ }
+ break;
+
+ case Mixed_Doc:
+ qDebug() << "Running pbm_text_in_mixed_doc";
+ if (process_.execute(basedir_ + "/pbm_text_in_mixed_doc", args))
+ {
+ qDebug() << "Error while running pbm_text_in_mixed_doc.";
+ return;
+ }
+ break;
+
+ default:
+ case Invalid_Doc:
+ qDebug() << "runner - Invalid doc type...";
+ return;
+ }
+
+ process_.waitForFinished(-1);
+
+ emit progress(1);
+
+ emit finished();
+ qDebug() << "Done";
+ }
+
+
+ void runner::stop()
+ {
+ process_.kill();
+ terminate();
+ }
+
+
+ template <typename V>
+ unsigned runner::find_best_scale(const image2d<V>& ima)
+ {
+ if (ima.nrows() > 2500
+ && ima.nrows() < 5000
+ && ima.ncols() > 2500
+ && ima.ncols() < 5000)
+ return 2;
+
+ if (ima.nrows() > 5000
+ && ima.ncols() > 5000)
+ return 3;
+
+ return 1;
+ }
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
diff --git a/scribo/demo/demat/src/runner.hh b/scribo/demo/demat/src/runner.hh
new file mode 100644
index 0000000..93e91bc
--- /dev/null
+++ b/scribo/demo/demat/src/runner.hh
@@ -0,0 +1,93 @@
+// 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/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_DEMO_SHARED_SRC_RUNNER_HH
+# define SCRIBO_DEMO_SHARED_SRC_RUNNER_HH
+
+# include <QtGui>
+# include <QProcess>
+
+# include <src/preprocessing_task.hh>
+# include <src/doc_type.hh>
+
+# include <mln/core/image/image2d.hh>
+# include <mln/value/qt/rgb32.hh>
+
+#include <src/process_args.hh>
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+
+ class runner : public QThread
+ {
+ Q_OBJECT;
+
+ public:
+ runner(QObject *parent = 0);
+
+ void start(const QString& filename,
+ const mln::image2d<mln::value::rgb8>& input,
+ const Doc_Type& doc_type,
+ const preprocessing_task_set_t& tasks,
+ const process_args& args);
+
+ void stop();
+
+ signals:
+ void new_intermediate_result(const QImage& ima);
+ void new_progress_max_value(unsigned i);
+ void new_progress_label(const QString& msg);
+ void progress(unsigned i);
+ void finished();
+
+ private: // members
+ mln::image2d<mln::value::rgb8> load();
+ void preprocess(const mln::image2d<mln::value::rgb8>& ima);
+ void process();
+ virtual void run();
+
+ template <typename V>
+ unsigned find_best_scale(const mln::image2d<V>& ima);
+
+ private: // attributes
+ QProcess process_;
+ Doc_Type doc_type_;
+ QSet<Preprocessing_Task> tasks_;
+ QString filename_;
+ process_args args_;
+ };
+
+
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_DEMO_SHARED_SRC_RUNNER_HH
diff --git a/scribo/demo/demat/ui/main_window.ui b/scribo/demo/demat/ui/main_window.ui
new file mode 100644
index 0000000..a552500
--- /dev/null
+++ b/scribo/demo/demat/ui/main_window.ui
@@ -0,0 +1,366 @@
+<ui version="4.0" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>666</width>
+ <height>647</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QSplitter" name="splitter" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="scribo::demo::shared::image_viewer" name="viewer_" />
+ <widget class="QTextEdit" name="text_" />
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="run_btn" >
+ <property name="text" >
+ <string>&Run</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>666</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_File" >
+ <property name="title" >
+ <string>&File</string>
+ </property>
+ <addaction name="action_Open" />
+ <addaction name="separator" />
+ <addaction name="action_Quit" />
+ </widget>
+ <widget class="QMenu" name="menuWindow" >
+ <property name="title" >
+ <string>&Dialogs</string>
+ </property>
+ <addaction name="actionOptions" />
+ <addaction name="actionAdvanced_options" />
+ </widget>
+ <addaction name="menu_File" />
+ <addaction name="menuWindow" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <widget class="QDockWidget" name="options_dock_" >
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="floating" >
+ <bool>false</bool>
+ </property>
+ <property name="features" >
+ <set>QDockWidget::AllDockWidgetFeatures</set>
+ </property>
+ <property name="allowedAreas" >
+ <set>Qt::AllDockWidgetAreas</set>
+ </property>
+ <property name="windowTitle" >
+ <string>Options</string>
+ </property>
+ <attribute name="dockWidgetArea" >
+ <number>1</number>
+ </attribute>
+ <widget class="QWidget" name="dockWidgetContents" >
+ <layout class="QVBoxLayout" name="verticalLayout_7" >
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4" >
+ <item>
+ <widget class="QCheckBox" name="removeBg" >
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Remove background (slow)</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="unskew" >
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Unskew</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="removeNoise" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Remove noise</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="improveContrast" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Improve brightness/contrast</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3" >
+ <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>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QDockWidget" name="advanced_dock_" >
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="windowTitle" >
+ <string>Advanced options</string>
+ </property>
+ <attribute name="dockWidgetArea" >
+ <number>1</number>
+ </attribute>
+ <widget class="QWidget" name="dockWidgetContents_3" >
+ <layout class="QVBoxLayout" name="verticalLayout_8" >
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QCheckBox" name="reduceSize" >
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Run on subsampled image</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_6" >
+ <item>
+ <widget class="QLabel" name="binarizeLbl" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Binarization method:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="binarizationCBox" >
+ <property name="font" >
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="currentIndex" >
+ <number>2</number>
+ </property>
+ <item>
+ <property name="text" >
+ <string>Global threshold</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Local threshold</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Local threshold multi-scale</string>
+ </property>
+ </item>
+ </widget>
+ </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>
+ </widget>
+ <action name="action_Open" >
+ <property name="text" >
+ <string>&Open</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="action_Quit" >
+ <property name="text" >
+ <string>&Quit</string>
+ </property>
+ </action>
+ <action name="actionDocument_Type" >
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Document Type</string>
+ </property>
+ </action>
+ <action name="actionOptions" >
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Options</string>
+ </property>
+ </action>
+ <action name="actionAdvanced_options" >
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Advanced options</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>scribo::demo::shared::image_viewer</class>
+ <extends>QGraphicsView</extends>
+ <header location="global" >shared/src/image_viewer.hh</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>action_Quit</sender>
+ <signal>activated()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>332</x>
+ <y>298</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/scribo/demo/shared/src/crop_item.cc b/scribo/demo/shared/src/crop_item.cc
index 100ac7d..70598fa 100644
--- a/scribo/demo/shared/src/crop_item.cc
+++ b/scribo/demo/shared/src/crop_item.cc
@@ -46,6 +46,11 @@ namespace scribo
grabMouse();
}
+ crop_item::~crop_item()
+ {
+
+ }
+
void crop_item::reset()
{
if (parentItem())
@@ -54,15 +59,15 @@ namespace scribo
cropRect_ = QRectF(20, 20, 100, 70);
}
- const QRectF& crop_item::cropRect() const
+ QRectF crop_item::cropRect() const
{
- return cropRect_;
+ return mapToScene(cropRect_).boundingRect();
}
QRectF crop_item::boundingRect() const
{
- return parentItem()->boundingRect();
+ return scene()->sceneRect();
}
void crop_item::paint(QPainter *painter,
@@ -84,15 +89,16 @@ namespace scribo
painter->fillPath(windowPath, QColor(0x33, 0x33, 0x33, 0xcc));
// Draw Crop Rect
- painter->setPen(QPen(QColor(0xdd, 0xdd, 0xdd), 1));
+ // QColor(0xdd, 0xdd, 0xdd)
+ painter->setPen(QPen(Qt::magenta, 3));
painter->drawPath(cropPath);
int topRightX = cropRect_.x() + cropRect_.width();
int bottomY = cropRect_.y() + cropRect_.height();
QPainterPath borderPath;
- int corner_width = cropRect_.width() / 6.f;
- int corner_height = cropRect_.height() / 6.f;
+ int corner_width = std::min(int(cropRect_.width() / 6.f), 80);
+ int corner_height = std::min(int(cropRect_.height() / 6.f), 80);
// Top-Left Corner
painter->drawRect(QRectF(cropRect_.x(), cropRect_.y(),
@@ -128,8 +134,8 @@ namespace scribo
cropResize_ = CropItemResizeNone;
if (event->buttons() & Qt::LeftButton)
{
- int wsize = cropRect_.width() / 6.f;
- int hsize = cropRect_.height() / 6.f;
+ int wsize = std::min(int(cropRect_.width() / 6.f), 80);
+ int hsize = std::min(int(cropRect_.height() / 6.f), 80);
int rightX = cropRect_.x() + cropRect_.width() - wsize;
int leftX = cropRect_.x();
@@ -305,6 +311,29 @@ namespace scribo
}
+ void crop_item::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
+ {
+ QGraphicsItem::mouseDoubleClickEvent(event);
+
+ switch (cropResize_)
+ {
+ case CropItemResizeNone:
+ if (!cropRect_.contains(event->pos()))
+ return;
+
+ setCursor(Qt::SizeAllCursor);
+
+ if (!(event->buttons() & Qt::LeftButton))
+ return;
+
+ emit ready_for_crop();
+ break;
+
+ default:
+ break;
+ }
+ }
+
} // end of namespace scribo::demo::shared
} // end of namespace scribo::demo
diff --git a/scribo/demo/shared/src/crop_item.hh b/scribo/demo/shared/src/crop_item.hh
index c0b1394..d342f23 100644
--- a/scribo/demo/shared/src/crop_item.hh
+++ b/scribo/demo/shared/src/crop_item.hh
@@ -50,11 +50,15 @@ namespace scribo
namespace shared
{
- class crop_item : public QGraphicsItem
+ class crop_item : public QObject, public QGraphicsItem
{
+ Q_OBJECT;
+
public:
crop_item(QGraphicsItem *parent);
- const QRectF& cropRect() const;
+ virtual ~crop_item();
+
+ QRectF cropRect() const;
QRectF boundingRect() const;
void paint (QPainter *painter,
@@ -67,9 +71,13 @@ namespace scribo
void mousePressEvent (QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event);
// void updateCursor(QGraphicsSceneMouseEvent *event);
+ signals:
+ void ready_for_crop();
+
private:
enum CropItemResize
{
diff --git a/scribo/demo/shared/src/image_viewer.cc b/scribo/demo/shared/src/image_viewer.cc
index b61f86b..f9467dc 100644
--- a/scribo/demo/shared/src/image_viewer.cc
+++ b/scribo/demo/shared/src/image_viewer.cc
@@ -38,7 +38,8 @@ namespace scribo
{
image_viewer::image_viewer(QWidget *parent)
- : QWidget(parent), image_(0), selection_(0), angle_(0)
+ : QWidget(parent), image_(0), selection_(0), angle_(0),
+ zoom_fixed_(false)
{
setupUi(this);
@@ -87,7 +88,8 @@ namespace scribo
viewer_->show();
}
- void image_viewer::draw_image(const mln::image2d<dsp_data_t>& ima)
+ template <typename V>
+ void image_viewer::draw_image(const mln::image2d<V>& ima)
{
QImage
qima = mln::convert::to_qimage_nocopy(ima);
@@ -127,18 +129,15 @@ namespace scribo
if (pixmap.width() > viewer_->maximumViewportSize().width())
viewer_->fitInView(image_->boundingRect(), Qt::KeepAspectRatio);
- zoomLabel->setEnabled(true);
- zoomIn->setEnabled(true);
- zoomOut->setEnabled(true);
- zoomFixed->setEnabled(true);
- zoomOriginal->setEnabled(true);
+ enable_widgets(true);
image_->translate(origin.x(), origin.y());
+
viewer_->setSceneRect(image_->sceneBoundingRect());
// Restore selection mode if needed
- set_selection_enabled(restore_selection);
+ on_crop_btn_toggled(restore_selection);
}
@@ -150,8 +149,11 @@ namespace scribo
void image_viewer::resizeEvent(QResizeEvent * event)
{
- if (image_ != 0)
- resize_image(image_->boundingRect());
+ if (zoom_fixed_)
+ on_zoomFixed_clicked();
+ else
+ on_zoomOriginal_clicked();
+
event->ignore();
}
@@ -238,12 +240,14 @@ namespace scribo
void image_viewer::on_zoomFixed_clicked()
{
+ zoom_fixed_ = true;
if (image_ != 0)
resize_image(image_->boundingRect());
}
void image_viewer::on_zoomOriginal_clicked()
{
+ zoom_fixed_ = false;
if (image_ != 0)
resize_image(viewer_->viewport()->geometry());
}
@@ -259,12 +263,17 @@ namespace scribo
}
}
- void image_viewer::set_selection_enabled(bool b)
+ void image_viewer::on_crop_btn_toggled(bool b)
{
if (b)
{
if (selection_ == 0)
+ {
selection_ = new crop_item(image_);
+ connect(selection_, SIGNAL(ready_for_crop()),
+ this, SIGNAL(ready_for_crop()));
+
+ }
}
else
{
@@ -274,6 +283,18 @@ namespace scribo
}
+ void image_viewer::enable_crop_tool(bool b)
+ {
+ crop_btn->setChecked(b);
+ }
+
+
+ void image_viewer::set_selection_enabled(bool b)
+ {
+ crop_btn->setVisible(b);
+ }
+
+
void image_viewer::set_rotation_enabled(bool b)
{
angle_ = 0;
@@ -290,12 +311,11 @@ namespace scribo
}
- const QRectF& image_viewer::selection() const
+ QRectF image_viewer::selection() const
{
static QRectF invalid_selection;
- mln_assertion(has_selection());
- if (selection_)
+ if (has_selection())
return selection_->cropRect();
return invalid_selection;
@@ -337,6 +357,23 @@ namespace scribo
on_slider_valueChanged(sli);
}
+
+ void image_viewer::enable_widgets(bool b)
+ {
+ zoomLabel->setEnabled(b);
+ zoomIn->setEnabled(b);
+ zoomOut->setEnabled(b);
+ zoomFixed->setEnabled(b);
+ zoomOriginal->setEnabled(b);
+
+ rotate_ccw_btn->setEnabled(b);
+ rotate_cw_btn->setEnabled(b);
+ rotate_lbl->setEnabled(b);
+
+ crop_btn->setEnabled(b);
+ }
+
+
} // end of namespace scribo::demo::shared
} // end of namespace scribo::demo
diff --git a/scribo/demo/shared/src/image_viewer.hh b/scribo/demo/shared/src/image_viewer.hh
index 628f5d4..3fe23ab 100644
--- a/scribo/demo/shared/src/image_viewer.hh
+++ b/scribo/demo/shared/src/image_viewer.hh
@@ -60,7 +60,8 @@ namespace scribo
image_viewer(QWidget *parent = 0);
~image_viewer();
- void draw_image(const mln::image2d<dsp_data_t>& ima);
+ template <typename V>
+ void draw_image(const mln::image2d<V>& ima);
void draw_image(const QPixmap& pixmap);
void draw_image(const QPixmap& pixmap, const QPoint& origin);
@@ -76,7 +77,7 @@ namespace scribo
bool has_selection() const;
- const QRectF& selection() const;
+ QRectF selection() const;
bool has_rotation() const;
qreal rotation() const;
@@ -91,12 +92,16 @@ namespace scribo
void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent * event);
+ void enable_widgets(bool b);
+
private slots:
void visible_slider(bool b);
void move_vertical_sliders(int value);
void move_horizontal_sliders(int value);
+ void on_crop_btn_toggled(bool b);
+
void on_slider_valueChanged(int sli);
void on_rotate_cw_btn_clicked();
@@ -111,10 +116,11 @@ namespace scribo
public slots:
void set_image_layer_count(unsigned nslis);
void update_image(const mln::image2d<dsp_data_t>& ima);
-
+ void enable_crop_tool(bool b);
signals:
void slider_valueChanged(int sli);
+ void ready_for_crop();
private: // attributes
QGraphicsPixmapItem* image_;
@@ -122,6 +128,8 @@ namespace scribo
bool mouse_moving_;
QPoint p_start_;
qreal angle_;
+
+ bool zoom_fixed_;
};
diff --git a/scribo/demo/shared/ui/image_viewer.ui b/scribo/demo/shared/ui/image_viewer.ui
index d6f80cb..c129b97 100644
--- a/scribo/demo/shared/ui/image_viewer.ui
+++ b/scribo/demo/shared/ui/image_viewer.ui
@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>464</width>
+ <width>529</width>
<height>350</height>
</rect>
</property>
@@ -37,7 +37,33 @@
</spacer>
</item>
<item>
+ <widget class="QPushButton" name="crop_btn" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Crop</string>
+ </property>
+ <property name="icon" >
+ <iconset resource="../shared.qrc" >
+ <normaloff>:/icons/icons/crop-icon.png</normaloff>:/icons/icons/crop-icon.png</iconset>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QLabel" name="rotate_lbl" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Rotate:</string>
</property>
@@ -45,6 +71,9 @@
</item>
<item>
<widget class="QPushButton" name="rotate_cw_btn" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="toolTip" >
<string>Rotate clock-wise</string>
</property>
@@ -59,6 +88,9 @@
</item>
<item>
<widget class="QPushButton" name="rotate_ccw_btn" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="toolTip" >
<string>Rotate counter-clock-wise</string>
</property>
--
1.5.6.5
1
0
03 Jun '10
* demo/wizard/src/crop_widget.cc,
* demo/wizard/src/main.cc,
* demo/wizard/src/main_window.cc,
* demo/wizard/src/main_window.hh,
* demo/wizard/src/preprocessing_widget.cc,
* demo/wizard/src/process_page.cc,
* demo/wizard/src/result_page.cc,
* demo/wizard/src/result_page.hh,
* demo/wizard/src/result_widget.cc,
* demo/wizard/src/result_widget.hh,
* demo/wizard/src/runner.cc,
* demo/wizard/ui/preprocessing_widget.ui,
* demo/wizard/wizard.pro: Add support for text recognition and
display results.
---
scribo/ChangeLog | 19 +++++++
scribo/demo/wizard/src/crop_widget.cc | 2 +-
scribo/demo/wizard/src/main.cc | 13 +++++
scribo/demo/wizard/src/main_window.cc | 23 ++++++--
scribo/demo/wizard/src/main_window.hh | 2 +
scribo/demo/wizard/src/preprocessing_widget.cc | 10 +++-
scribo/demo/wizard/src/process_page.cc | 5 --
scribo/demo/wizard/src/result_page.cc | 43 +++++++++++++++
.../wizard/src/{crop_page.hh => result_page.hh} | 18 +++---
scribo/demo/wizard/src/result_widget.cc | 43 +++++++++++++++
.../wizard/src/{crop_page.hh => result_widget.hh} | 18 +++----
scribo/demo/wizard/src/runner.cc | 55 +++++++++++++-------
scribo/demo/wizard/ui/preprocessing_widget.ui | 4 +-
scribo/demo/wizard/wizard.pro | 48 +++++++++--------
14 files changed, 228 insertions(+), 75 deletions(-)
create mode 100644 scribo/demo/wizard/src/result_page.cc
copy scribo/demo/wizard/src/{crop_page.hh => result_page.hh} (81%)
create mode 100644 scribo/demo/wizard/src/result_widget.cc
copy scribo/demo/wizard/src/{crop_page.hh => result_widget.hh} (79%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 68ec602..bc1c87a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,24 @@
2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Improve dematerialization wizard.
+
+ * demo/wizard/src/crop_widget.cc,
+ * demo/wizard/src/main.cc,
+ * demo/wizard/src/main_window.cc,
+ * demo/wizard/src/main_window.hh,
+ * demo/wizard/src/preprocessing_widget.cc,
+ * demo/wizard/src/process_page.cc,
+ * demo/wizard/src/result_page.cc,
+ * demo/wizard/src/result_page.hh,
+ * demo/wizard/src/result_widget.cc,
+ * demo/wizard/src/result_widget.hh,
+ * demo/wizard/src/runner.cc,
+ * demo/wizard/ui/preprocessing_widget.ui,
+ * demo/wizard/wizard.pro: Add support for text recognition and
+ display results.
+
+2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add a new demo in Scribo.
* demo/demat/demat.pro,
diff --git a/scribo/demo/wizard/src/crop_widget.cc b/scribo/demo/wizard/src/crop_widget.cc
index 37a9e80..8067fda 100644
--- a/scribo/demo/wizard/src/crop_widget.cc
+++ b/scribo/demo/wizard/src/crop_widget.cc
@@ -29,7 +29,7 @@ namespace scribo
QPixmap crop_widget::image() const
{
- return viewer_->image().copy(crop_area().toRect());
+ return viewer_->image().copy(crop_area().toRect().intersected(viewer_->image().rect()));
}
} // end of namespace scribo::demo
diff --git a/scribo/demo/wizard/src/main.cc b/scribo/demo/wizard/src/main.cc
index 12f024a..5b771e2 100644
--- a/scribo/demo/wizard/src/main.cc
+++ b/scribo/demo/wizard/src/main.cc
@@ -2,12 +2,25 @@
#include <src/main_window.hh>
#include <src/preprocessing_task.hh>
+namespace scribo { namespace demo {extern QString basedir_; } }
+
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
qRegisterMetaType<preprocessing_task_set_t>("preprocessing_task_set_t");
+
+ if (argc == 2)
+ {
+ scribo::demo::basedir_ = argv[1];
+ }
+ else
+ {
+ qDebug() << "Usage: " << argv[0] << " <path_to_scribo/src>";
+ return 1;
+ }
+
scribo::demo::wizard::main_window win;
win.show();
diff --git a/scribo/demo/wizard/src/main_window.cc b/scribo/demo/wizard/src/main_window.cc
index 35aa8c7..7f44ec5 100644
--- a/scribo/demo/wizard/src/main_window.cc
+++ b/scribo/demo/wizard/src/main_window.cc
@@ -31,6 +31,7 @@
#include <src/preprocessing_page.hh>
#include <src/process_page.hh>
#include <src/rotate_page.hh>
+#include <src/result_page.hh>
namespace scribo
{
@@ -44,15 +45,15 @@ namespace scribo
main_window::main_window()
{
- setOptions(QWizard::NoBackButtonOnStartPage
- | QWizard::DisabledBackButtonOnLastPage
- | QWizard::NoCancelButton);
-
QPixmap bg_pixmap(":/images/images/dematerialization.png");
setPixmap(QWizard::WatermarkPixmap, bg_pixmap);
setPixmap(QWizard::BackgroundPixmap, bg_pixmap);
+ connect(this, SIGNAL(currentIdChanged(int)),
+ this, SLOT(showCustomButton_slot(int)));
+
+
// Page_Load
load_page* page_load = new load_page(this);
addPage(page_load);
@@ -78,7 +79,7 @@ namespace scribo
addPage(new process_page(this));
// Page_Result
- addPage(new QWizardPage(this));
+ addPage(new result_page(this));
}
@@ -122,6 +123,18 @@ namespace scribo
}
+ void main_window::showCustomButton_slot(int id)
+ {
+ if (id == Page_Result)
+ setOptions(options() | QWizard::HaveCustomButton1);
+ else
+ {
+ setOptions(QWizard::NoBackButtonOnStartPage
+// | QWizard::DisabledBackButtonOnLastPage
+ | QWizard::NoCancelButton);
+ }
+ }
+
} // end of namespace scribo::demo::wizard
} // end of namespace scribo::demo
diff --git a/scribo/demo/wizard/src/main_window.hh b/scribo/demo/wizard/src/main_window.hh
index af4c113..44e6d92 100644
--- a/scribo/demo/wizard/src/main_window.hh
+++ b/scribo/demo/wizard/src/main_window.hh
@@ -48,6 +48,8 @@ namespace scribo
virtual int nextId() const;
+ private slots:
+ void showCustomButton_slot(int id);
private:
enum { Page_Load,
diff --git a/scribo/demo/wizard/src/preprocessing_widget.cc b/scribo/demo/wizard/src/preprocessing_widget.cc
index 7a2c9fa..7c66719 100644
--- a/scribo/demo/wizard/src/preprocessing_widget.cc
+++ b/scribo/demo/wizard/src/preprocessing_widget.cc
@@ -35,8 +35,11 @@ namespace scribo
{
qDebug() << "setup text doc";
- removeBg->setChecked(true);
- unskew->setChecked(true);
+ // Disabled
+ removeBg->setChecked(false);
+ unskew->setChecked(false);
+
+ // Enabled
removeNoise->setChecked(true);
improveContrast->setChecked(true);
}
@@ -44,6 +47,9 @@ namespace scribo
void preprocessing_widget::clear_checked()
{
+ // Enabled
+
+ // Disabled
removeBg->setChecked(false);
unskew->setChecked(false);
removeNoise->setChecked(false);
diff --git a/scribo/demo/wizard/src/process_page.cc b/scribo/demo/wizard/src/process_page.cc
index bbba0e3..bff087a 100644
--- a/scribo/demo/wizard/src/process_page.cc
+++ b/scribo/demo/wizard/src/process_page.cc
@@ -21,11 +21,6 @@ namespace scribo
setSubTitle("Processing...");
setTitle("Please wait while computing results.");
-
- void progress(unsigned i);
-
- void progress(unsigned i);
-
connect(&runner_, SIGNAL(new_intermediate_result(const QImage&)),
widget_, SLOT(update_pixmap(const QImage&)));
diff --git a/scribo/demo/wizard/src/result_page.cc b/scribo/demo/wizard/src/result_page.cc
new file mode 100644
index 0000000..1bb08d8
--- /dev/null
+++ b/scribo/demo/wizard/src/result_page.cc
@@ -0,0 +1,43 @@
+#include <src/result_page.hh>
+#include <src/result_widget.hh>
+
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+
+ result_page::result_page(QWidget *parent)
+ : QWizardPage(parent)
+ {
+ widget_ = new result_widget(this);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(widget_);
+ setLayout(layout);
+
+ setTitle("Result");
+ setSubTitle("Copy and paste the recognized text.");
+
+ connect(parent, SIGNAL(customButtonClicked(int)),
+ parent, SLOT(restart()));
+ }
+
+
+ void result_page::cleanupPage()
+ {
+ widget_->reset();
+ }
+
+
+ void result_page::initializePage()
+ {
+ setButtonText(QWizard::CustomButton1, "restart");
+ widget_->load("/tmp/out.txt");
+ }
+
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
diff --git a/scribo/demo/wizard/src/crop_page.hh b/scribo/demo/wizard/src/result_page.hh
similarity index 81%
copy from scribo/demo/wizard/src/crop_page.hh
copy to scribo/demo/wizard/src/result_page.hh
index 9891a7e..c6f02b9 100644
--- a/scribo/demo/wizard/src/crop_page.hh
+++ b/scribo/demo/wizard/src/result_page.hh
@@ -23,11 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
-# define SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
+#ifndef SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH
+# define SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH
# include <QtGui>
-# include <src/crop_widget.hh>
+# include <src/result_widget.hh>
+# include <src/runner.hh>
namespace scribo
{
@@ -36,19 +37,18 @@ namespace scribo
{
- class crop_page : public QWizardPage
+ class result_page : public QWizardPage
{
Q_OBJECT;
public:
- crop_page(QWidget *parent = 0);
+ result_page(QWidget *parent = 0);
virtual void cleanupPage();
virtual void initializePage();
- virtual bool validatePage();
- private:
- crop_widget *widget_;
+ private: // attributes
+ result_widget* widget_;
};
@@ -57,4 +57,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
+#endif // ! SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH
diff --git a/scribo/demo/wizard/src/result_widget.cc b/scribo/demo/wizard/src/result_widget.cc
new file mode 100644
index 0000000..889ba4b
--- /dev/null
+++ b/scribo/demo/wizard/src/result_widget.cc
@@ -0,0 +1,43 @@
+#include <src/result_widget.hh>
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+
+ result_widget::result_widget(QWidget *parent)
+ : QWidget(parent)
+ {
+ text_ = new QTextEdit(this);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(text_);
+ setLayout(layout);
+ }
+
+ void result_widget::load(const QString& filename)
+ {
+ QFile file(filename);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return;
+
+ QTextStream in(&file);
+ in.setCodec("UTF-8");
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ text_->append(line);
+ }
+
+ }
+
+ void result_widget::reset()
+ {
+ text_->clear();
+ }
+
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
diff --git a/scribo/demo/wizard/src/crop_page.hh b/scribo/demo/wizard/src/result_widget.hh
similarity index 79%
copy from scribo/demo/wizard/src/crop_page.hh
copy to scribo/demo/wizard/src/result_widget.hh
index 9891a7e..4472238 100644
--- a/scribo/demo/wizard/src/crop_page.hh
+++ b/scribo/demo/wizard/src/result_widget.hh
@@ -23,11 +23,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
-# define SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
+#ifndef SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH
+# define SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH
# include <QtGui>
-# include <src/crop_widget.hh>
namespace scribo
{
@@ -36,19 +35,18 @@ namespace scribo
{
- class crop_page : public QWizardPage
+ class result_widget : public QWidget
{
Q_OBJECT;
public:
- crop_page(QWidget *parent = 0);
+ result_widget(QWidget *parent = 0);
+ void reset();
- virtual void cleanupPage();
- virtual void initializePage();
- virtual bool validatePage();
+ void load(const QString& filename);
private:
- crop_widget *widget_;
+ QTextEdit *text_;
};
@@ -57,4 +55,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH
+#endif // ! SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH
diff --git a/scribo/demo/wizard/src/runner.cc b/scribo/demo/wizard/src/runner.cc
index 162f1cb..dd9ad9c 100644
--- a/scribo/demo/wizard/src/runner.cc
+++ b/scribo/demo/wizard/src/runner.cc
@@ -27,7 +27,7 @@ namespace scribo
namespace demo
{
- QString basedir_ = "/home/lazzara/build/scribo/src";
+ QString basedir_ = "";
runner::runner(QObject *parent)
: QThread(parent)
@@ -53,6 +53,8 @@ namespace scribo
// Notification of the number of tasks.
emit new_progress_max_value(tasks_.size() + 2);
+ qDebug() << "progress steps : " << tasks_.size() + 2;
+
image2d<value::qt::rgb32> ima = load();
preprocess(ima);
@@ -131,10 +133,10 @@ namespace scribo
std::cout << "Improve contrast homogeneity" << std::endl;
emit new_progress_label("Improve contrast homogeneity");
- intensity_ima = preprocessing::homogeneous_contrast(intensity_ima, 75);
+ intensity_ima = arith::revert(preprocessing::homogeneous_contrast(intensity_ima, 75));
image2d<value::qt::rgb32>
- tmp_color32 = data::convert(value::qt::rgb32(), out_bool);
+ tmp_color32 = data::convert(value::qt::rgb32(), intensity_ima);
emit new_intermediate_result(convert::to_qimage(tmp_color32));
emit progress(1);
}
@@ -149,14 +151,13 @@ namespace scribo
{
// FIXME: sauvola should not negate the image.
std::cout << "Binarization Sauvola" << std::endl;
- out_bool = logical::not_(binarization::sauvola(intensity_ima));
+ out_bool = binarization::sauvola(intensity_ima);
}
else if (tasks_.contains(BinarizationSauvolaMs))
{
// FIXME: sauvola should not negate the image.
std::cout << "Binarization Sauvola_ms" << std::endl;
- out_bool = logical::not_(binarization::sauvola_ms(intensity_ima,
- 51, 2, 67));
+ out_bool = binarization::sauvola_ms(intensity_ima, 51, 2, 67);
}
else if (tasks_.contains(BinarizationSimple))
{
@@ -175,22 +176,24 @@ namespace scribo
emit progress(1);
+ // FIXME: remove!
+ logical::not_inplace(out_bool);
+
//========
// Denoise
//========
- if (tasks_.contains(RemoveNoise))
- {
- std::cout << "Remove noise" << std::endl;
- emit new_progress_label("Remove noise");
+// if (tasks_.contains(RemoveNoise))
+// {
+// std::cout << "Remove noise" << std::endl;
+// emit new_progress_label("Remove noise");
- out_bool = preprocessing::denoise(out_bool, c8(), 2, 2);
-
- image2d<value::qt::rgb32>
- tmp_color32 = data::convert(value::qt::rgb32(), out_bool);
- emit new_intermediate_result(convert::to_qimage(tmp_color32));
- emit progress(1);
- }
+// out_bool = preprocessing::denoise(out_bool, c8(), 2, 2);
+// image2d<value::qt::rgb32>
+// tmp_color32 = data::convert(value::qt::rgb32(), out_bool);
+// emit new_intermediate_result(convert::to_qimage(tmp_color32));
+// emit progress(1);
+// }
//=======
// Unskew
@@ -226,8 +229,21 @@ namespace scribo
switch(doc_type_)
{
case Text_Doc:
+ emit new_progress_label("Finding text in document...");
qDebug() << "Running text_in_article_pbm";
- args << "/tmp/tmp.pbm" << "/tmp/out.ppm";
+ args << "/tmp/tmp.pbm" << "/tmp/out.txt";
+
+ // Denoise.
+ if (! tasks_.contains(RemoveNoise))
+ args << "0";
+ else
+ {
+ args << "1";
+ emit progress(1); // Consider denoising as done even though it is performed later.
+ }
+
+ args << "/tmp/";
+
if (process_.execute(basedir_ + "/text_in_article_pbm", args))
{
qDebug() << "Error while running text_in_article_pbm.";
@@ -236,6 +252,7 @@ namespace scribo
break;
case Picture:
+ emit new_progress_label("Finding text in picture...");
qDebug() << "Running text_in_photo_pbm_fast";
args << "/tmp/tmp.pbm" << "/tmp/out.ppm" << "1" << "1" << "1";
if (process_.execute(basedir_ + "/text_in_photo_pbm_fast", args))
@@ -263,7 +280,7 @@ namespace scribo
process_.waitForFinished(-1);
emit progress(1);
- emit new_intermediate_result(QImage("/tmp/out.ppm"));
+ emit new_intermediate_result(QImage("/tmp/_09_step2_bboxes.ppm"));
qDebug() << "Done";
}
diff --git a/scribo/demo/wizard/ui/preprocessing_widget.ui b/scribo/demo/wizard/ui/preprocessing_widget.ui
index 17225a8..6b9c178 100644
--- a/scribo/demo/wizard/ui/preprocessing_widget.ui
+++ b/scribo/demo/wizard/ui/preprocessing_widget.ui
@@ -70,7 +70,7 @@
<item>
<widget class="QCheckBox" name="removeNoise" >
<property name="enabled" >
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="text" >
<string>Remove noise</string>
@@ -83,7 +83,7 @@
<item>
<widget class="QCheckBox" name="improveContrast" >
<property name="enabled" >
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="text" >
<string>Improve brightness/contrast</string>
diff --git a/scribo/demo/wizard/wizard.pro b/scribo/demo/wizard/wizard.pro
index c7ab290..9dd5296 100644
--- a/scribo/demo/wizard/wizard.pro
+++ b/scribo/demo/wizard/wizard.pro
@@ -11,27 +11,29 @@ INCLUDEPATH += . ../ ../shared $(OLN)/milena $(OLN)
DEFINES += NDEBUG MLN_INCLUDE_ONLY
# Input
-HEADERS += \
- ../shared/src/image_viewer.hh \
- ../shared/src/internal/interactive_scene.hh \
- ../shared/src/crop_item.hh \
+ HEADERS += \
+ ../shared/src/image_viewer.hh \
+ ../shared/src/internal/interactive_scene.hh \
+ ../shared/src/crop_item.hh \
../shared/src/browse_widget.hh \
- src/load_page.hh \
- src/load_widget.hh \
- src/doc_type_widget.hh \
- src/doc_type_page.hh \
- src/crop_widget.hh \
- src/crop_page.hh \
- src/rotate_widget.hh \
- src/rotate_page.hh \
- src/preprocessing_widget.hh \
- src/preprocessing_page.hh \
- src/process_page.hh \
- src/process_widget.hh \
- src/runner.hh \
- src/preprocessing_task.hh \
- src/doc_type.hh \
- src/main_window.hh
+ src/load_page.hh \
+ src/load_widget.hh \
+ src/doc_type_widget.hh \
+ src/doc_type_page.hh \
+ src/crop_widget.hh \
+ src/crop_page.hh \
+ src/rotate_widget.hh \
+ src/rotate_page.hh \
+ src/preprocessing_widget.hh \
+ src/preprocessing_page.hh \
+ src/process_page.hh \
+ src/process_widget.hh \
+ src/runner.hh \
+ src/preprocessing_task.hh \
+ src/doc_type.hh \
+ src/main_window.hh \
+ src/result_page.hh \
+ src/result_widget.hh
SOURCES += \
@@ -40,7 +42,7 @@ SOURCES += \
../shared/src/browse_widget.cc \
src/main.cc \
src/main_window.cc \
- src/doc_type_widget.cc \
+ src/doc_type_widget.cc \
src/doc_type_page.cc \
src/load_page.cc \
src/load_widget.cc \
@@ -52,7 +54,9 @@ SOURCES += \
src/preprocessing_page.cc \
src/process_page.cc \
src/process_widget.cc \
- src/mln_widgets.cc
+ src/mln_widgets.cc \
+ src/result_page.cc \
+ src/result_widget.cc
FORMS += \
../shared/ui/browse_widget.ui \
--
1.5.6.5
1
0
last-svn-commit-99-gb1a4d27 Add support for various image types in text_in_photo_fast.
by Guillaume Lazzara 03 Jun '10
by Guillaume Lazzara 03 Jun '10
03 Jun '10
* src/Makefile.am: Add ImageMagick CPPFLAGS and LDFLAGS.
* src/text_in_photo_ppm_fast.cc: Rename as...
* src/text_in_photo_fast.cc: ... this. Use ImageMagick to load images.
---
scribo/ChangeLog | 9 ++++
scribo/src/Makefile.am | 18 ++++----
..._in_photo_ppm_fast.cc => text_in_photo_fast.cc} | 42 ++++++++++++++++---
3 files changed, 53 insertions(+), 16 deletions(-)
rename scribo/src/{text_in_photo_ppm_fast.cc => text_in_photo_fast.cc} (94%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index bc1c87a..50f9d86 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-29 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add support for various image types in text_in_photo_fast.
+
+ * src/Makefile.am: Add ImageMagick CPPFLAGS and LDFLAGS.
+
+ * src/text_in_photo_ppm_fast.cc: Rename as...
+ * src/text_in_photo_fast.cc: ... this. Use ImageMagick to load images.
+
2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
Improve dematerialization wizard.
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index e254689..80dc782 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -34,7 +34,6 @@ bin_PROGRAMS = \
pbm_lines_in_doc \
text_in_photo \
text_in_photo_ppm \
- text_in_photo_ppm_fast \
text_in_photo_pbm_fast \
text_in_photo_invert
@@ -42,7 +41,6 @@ bin_PROGRAMS = \
pbm_lines_in_doc_SOURCES = pbm_lines_in_doc.cc
text_in_photo_SOURCES = text_in_photo.cc
text_in_photo_ppm_SOURCES = text_in_photo_ppm.cc
-text_in_photo_ppm_fast_SOURCES = text_in_photo_ppm_fast.cc
text_in_photo_pbm_fast_SOURCES = text_in_photo_pbm_fast.cc
text_in_photo_invert_SOURCES = text_in_photo_invert.cc
@@ -84,13 +82,15 @@ if HAVE_TIFF
text_in_article_pbm_SOURCES = text_in_article_pbm.cc
- text_in_photo_ppm_fast_CPPFLAGS = $(AM_CPPFLAGS) \
- $(TESSERACT_CPPFLAGS) \
- $(TIFF_CPPFLAGS)
- text_in_photo_ppm_fast_LDFLAGS = $(AM_LDFLAGS) \
- $(TESSERACT_LDFLAGS) \
- $(TIFF_LDFLAGS) \
- -lpthread
+ bin_PROGRAMS += text_in_photo_fast
+ text_in_photo_fast_SOURCES = text_in_photo_fast.cc
+ text_in_photo_fast_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(TESSERACT_CPPFLAGS) \
+ `Magick++-config --cppflags`
+
+ text_in_photo_fast_LDFLAGS = $(AM_LDFLAGS) \
+ $(TESSERACT_LDFLAGS) \
+ -lpthread `Magick++-config --libs`
endif HAVE_TIFF
endif HAVE_TESSERACT
diff --git a/scribo/src/text_in_photo_ppm_fast.cc b/scribo/src/text_in_photo_fast.cc
similarity index 94%
rename from scribo/src/text_in_photo_ppm_fast.cc
rename to scribo/src/text_in_photo_fast.cc
index d534161..68b2014 100644
--- a/scribo/src/text_in_photo_ppm_fast.cc
+++ b/scribo/src/text_in_photo_fast.cc
@@ -37,6 +37,7 @@
#include <mln/io/pbm/all.hh>
#include <mln/io/ppm/save.hh>
+#include <mln/io/magick/all.hh>
#include <mln/math/min.hh>
@@ -54,6 +55,10 @@
#include <mln/geom/translate.hh>
+#include <mln/subsampling/antialiased.hh>
+
+#include <mln/subsampling/antialiased_rgb.hh>
+
#include <scribo/draw/bounding_boxes.hh>
#include <scribo/draw/groups_bboxes.hh>
@@ -101,8 +106,8 @@
#include <scribo/src/afp/link.hh>
#include <scribo/src/afp/regroup.hh>
-#include <scribo/core/line_set.hh>
-#include <scribo/text/recognition.hh>
+// #include <scribo/core/line_set.hh>
+// #include <scribo/text/recognition.hh>
const char *args_desc[][2] =
{
@@ -210,6 +215,19 @@ namespace mln
return output;
}
+
+ template <typename I>
+ unsigned get_factor(const I& ima)
+ {
+ unsigned
+ nrows = ima.nrows(),
+ ncols = ima.ncols(),
+ max_dim = std::max(nrows, ncols),
+ factor = max_dim / 512;
+
+ return factor ? factor : 1;
+ }
+
} // end of namespace mln
@@ -238,8 +256,17 @@ Common usage: ./ppm_text_in_photo input.ppm output.ppm 1 1 1 1 1",
trace::entering("main");
image2d<value::rgb8> input_rgb;
- io::ppm::load(input_rgb, argv[1]);
+ io::magick::load(input_rgb, argv[1]);
+
+ unsigned factor = get_factor(input_rgb);
+
+ std::cout << "Reduction Factor : " << factor << std::endl;
+
+ std::cout << "Original domain: " << input_rgb.domain() << std::endl;
+
+ input_rgb = mln::subsampling::impl::antialiased_2d_rgb(input_rgb, factor);
+ std::cout << "Resized domain: " << input_rgb.domain() << std::endl;
unsigned lambda;
if (argc == 10)
@@ -291,7 +318,7 @@ Common usage: ./ppm_text_in_photo input.ppm output.ppm 1 1 1 1 1",
unsigned w = std::min(intensity_ima.nrows() / 3, intensity_ima.ncols() / 3);
if (! w % 2)
++w;
- w = std::min(w, 101u);
+ w = std::min(w, 51u);
if (argc > 4 && atoi(argv[4]) != 0)
{
std::cout << "** Using sauvola_ms with w_1 = " << w << std::endl;
@@ -311,6 +338,7 @@ Common usage: ./ppm_text_in_photo input.ppm output.ppm 1 1 1 1 1",
#endif // !NOUT
+ logical::not_inplace(input);
// if (debug)
// io::pbm::save(input, "input.pbm");
@@ -626,9 +654,9 @@ Common usage: ./ppm_text_in_photo input.ppm output.ppm 1 1 1 1 1",
- scribo::line_set<L>
- lines = scribo::make::line_set(groups);
- text::recognition(lines, "fra", "out.txt");
+// scribo::line_set<L>
+// lines = scribo::make::line_set(groups);
+// text::recognition(lines, "fra", "out.txt");
trace::exiting("main");
return comps.nelements() != 0;
--
1.5.6.5
1
0
03 Jun '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/scribo-z has been updated
discards ce69474de3375928b3bd460111356d419f6a966c (commit)
discards 7b922a208b3587cd49009a40570556a7489e6d67 (commit)
discards f97f87ab21572b65556b8ce6ad3e85e45bdade54 (commit)
discards 3d900b511f6ae7a69e94fca37496b08001a5af26 (commit)
discards fa4e901d4f50eaf5e6722fe1f59f3e31a6c6cad6 (commit)
discards c79a06f6e3c83a117c2351a92b6ae285ce1bcddf (commit)
discards d4c8eff509fe8cdd929bc870285d6f541cb0a1c3 (commit)
discards 5da79fec92fd6243d7fcb18b6d82ee409e3db88d (commit)
discards 38d6f4b283b93c22ab87f5af48022805fe3ac417 (commit)
discards 939d9227392236f0140ee4f209c7f4de0610a495 (commit)
discards 945a59425d822a366559fc6902c8fa7ba029bf7a (commit)
discards 540f63088ec1703dd7549216a114bd78e337ea36 (commit)
discards 0242b33a1e464b02a883109c413eb00fea7cec81 (commit)
discards 8c3d422c9ba5d83d82bbb8d7934d8da13745f85c (commit)
discards 8a4ccc7b6030e056d4fcb34d0b5e2d523df39007 (commit)
discards 8ffa2cd611274d87846dfc38a901a0f57c86d667 (commit)
discards 7a85156e4c3599dce998b6cf744a248cb00f45e2 (commit)
discards 76fe8ddaa93e30ee334eef94a0e5e59805eb27dc (commit)
discards 40008b1e746b1fd15007f8e67f5fe5670c088ada (commit)
discards 916ce2389f402e615da841dc61ff9748175228a1 (commit)
discards 00f283bf45bb76c8bc2b5890a410c711893164c5 (commit)
discards c8df55aa82c119ef4a74dbf0329f734c28990154 (commit)
discards 0c1fecd0788ea5b0d9201274118294edc1d0d017 (commit)
discards 51911f2b8c73b9637fcb985f06d60c8d92c44a62 (commit)
discards 9257884ecf526dc7da611db4864e0ad7b154271f (commit)
discards 4f7c875dd1b5f3388e7f99694501e7f4683b8ed2 (commit)
discards 44705979ad01252039fcaf8cdf90e04e1dea4e1c (commit)
discards 8655a111b01696082f97d02d80d3ab4c7f29d9a5 (commit)
discards f0b6bc87ebe17e8e37964a466c7e5f0813d4e262 (commit)
via a6a8d2a44d746824876f24c53af69f83036ddaf3 (commit)
via 810f0413346986f6e7fc86f513ee1df28f142418 (commit)
via 33ffff60e3846bf4499c3eafaa2dfd37791fb4e2 (commit)
via 31216d34c0c51609cbe6921cd0d285701d583e3b (commit)
via db55e631a5d4be26186cf58f23d63c9ae8a1a88e (commit)
via 080134d6115e902c66ee0eb866008d7ad8e161f8 (commit)
via 40d518005c478e2b5640a04019fdbf84c6858d27 (commit)
via cbbdf4e015a418723730e0173ae88377ab365f1e (commit)
via ff15d075512aadb2cfa4e99d36d3fa080809822f (commit)
via 12ddb9702902e9c12be67d23fad1053e320f151e (commit)
via b8aaebae9a034fa3b39de284bd2677801bc15471 (commit)
via cbbbffd5c0c474d94fdab9e79c90e0ea92ec185c (commit)
via 99e2b8fc744f5ab029cee5c4fa8eb465750101af (commit)
via 41c82626a63b343f4d54e620c3055c1db6bf91de (commit)
via 8c069f07986676a26ea14a1daa4e623d75302cbc (commit)
via ca67a57fcb8149672ea524e5d20cab138c9147d6 (commit)
via 21af64ad3a6645b7c1e7afa3347ba545911affa1 (commit)
via 24e4f689ffc6598a646431b8344fe3c7b6c73da5 (commit)
via 04aef4bf80daa8b02650ad3b2479dfea0bfa666c (commit)
via 3b8335a122ff4d071759346847666d62c702f2b4 (commit)
via ff1e5aae555fb905fa33369c85c94b0b0108feaf (commit)
via c7cb9f3cfb759b353cb92e62c9154c0607b9faa8 (commit)
via 28453cfc46940eb2fa4e6bf993d0378a97b396a3 (commit)
via f256a61a4a6aaabab1806c9f644bfd0005c3e857 (commit)
via 464d58f97a427e842a704e17a6c50ca6a88e11f5 (commit)
via 9c5c48319714b54f41adc49d4b5417294e8b6079 (commit)
via 9d7a1cca8578a712714a94258d081b1a4e3d5d95 (commit)
via a184c8106407ea7b3ce30dc14b1d548ac93813f2 (commit)
via b826d4152097bfcb1138f05f647862c69f739769 (commit)
via 32401e08eb7edab00e58069690e7371af8346fdd (commit)
via 622c2395fcf4ecd00991ba4dfda4eddc49604ba1 (commit)
via 752d8cae10e26fae6500a073893aa6aad2c85403 (commit)
via d02047f7f328aa892cb80f57374f3c6ba6a3fdc1 (commit)
via 8d47be1577e975889b17016f2fda968d79780b57 (commit)
via 548b72e33fc2b5352a5ca511693a5ae43fd94cba (commit)
via 11701a0cb30bfb85d57a07a94e88485ebd7c0c4a (commit)
via 53a98117e4a7985a38bf6b708d99069ba17353aa (commit)
via b54300a5ba958e308a8ff9edb32f685247999e2a (commit)
via 6143a5ecb90ebfec07d7f7e4605e086f7bc61f83 (commit)
via 2c6947d729838521895b4ef091210d1f82ad66fa (commit)
via 4dad6c9aa0df1dddd07a4fa53cecc05b7287ff4a (commit)
via d10f1a65daf8af9a90af3c937226f5c4d5b4750a (commit)
via b1a4d275224ac708a9b05dae7915a27109886cc9 (commit)
via 9f724b07283be1b79455a1b1a80c87205db7415d (commit)
via 6adbc43e3b823f9eeb385911e3a47e5ec8c963e9 (commit)
via 4a19598794bc2ebec9d40f2bdd02afe17e9c4f85 (commit)
via c5e55142e34779d78be4944489e03949fa03551f (commit)
via 1c596f64a2ca06f073d0a6d3e37fb334bc5f64c9 (commit)
via 70ca845540984efeee0654cf989389d19dc9166b (commit)
via 1f9aa31e2c16defebcda3f4a5689caf779756c2a (commit)
via 8e0ab28cbc07882bc55a6e633928a7c46be9d018 (commit)
via 643c15954419858896b0cd759737e7620c541fe8 (commit)
via 899f6280731edf03ae30f23dcdd4745ecbe9a1f2 (commit)
via 98cab34716892c5b65385589ab6c3edbd46f9710 (commit)
via 482527bb90e7b716941dc1a9061a217c7ae8891d (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (ce69474de3375928b3bd460111356d419f6a966c)
\
N -- N -- N (a6a8d2a44d746824876f24c53af69f83036ddaf3)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
a6a8d2a src/README: New.
810f041 configure.ac: configure several directories in scribo/.
33ffff6 Improve Scribo demo.
31216d3 Small fixes.
db55e63 Add the binarization tool submitted to H-DIBCO 2010.
080134d Update tools in scribo/src.
40d5180 Add a specific toolchain for Nepomuk integration.
cbbdf4e Cleanup sample tools.
ff15d07 toolchain/text_in_doc.hh: Introduce a new routine for extracting text in a document.
12ddb97 core/def/lbl_type.hh: Introduce a global label type.
b8aaeba Improve line detection.
cbbbffd io/text_boxes/save.hh: New. Save text boxes information.
99e2b8f Add a new deskew algorithm.
41c8262 Add crop tools.
8c069f0 Small fixes.
ca67a57 Store OCR results in the line_info structure.
21af64a Improve debug outputs in Sauvola and make binarization tools compile again.
24e4f68 * mln/io/magick/load.hh: set minimum resolution for PDF files to 300DPI.
04aef4b Small fixes for Nuxeo/XWiki.
3b8335a text/merging.hh: Disable some debug.
ff1e5aa Prepare DIA tools for Nuxeo/XWiki.
c7cb9f3 Improve OCR recognition.
28453cf postprocessing/fill_object_holes.hh: New routine.
f256a61 Add new routines to detect separators.
464d58f Add A first draft of a README in Scribo.
9c5c483 Move AFP's GUI into Scribo's demo directory.
9d7a1cc Introduce dmax_functor concept.
a184c81 Small fixes in Scribo.
b826d41 Fix few bugs.
32401e0 Improve the usability of AFP's GUI.
622c239 Add support for more image types.
752d8ca Improve options menu and progress dialog.
d02047f Add a GUI for AFP's use case.
8d47be1 Improve dematerialization wizard.
548b72e Add a new demo in Scribo.
11701a0 io/xml/save_text_lines.hh: Fix XML output.
53a9811 debug/decision_image.hh: Add the anchor::Type as argument.
b54300a Use anchor::Type in alignment routines' dispatch.
6143a5e Small fixes related to object_groups.
2c6947d Add init() member to object_links structure.
4dad6c9 scribo/src/text_in_photo_fast.cc: Group routine parameters in a global structure.
d10f1a6 Add new Sauvola overloads and update examples.
b1a4d27 Add support for various image types in text_in_photo_fast.
9f724b0 Improve dematerialization wizard.
6adbc43 Add a new demo in Scribo.
4a19598 Small fixes in Scribo.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 +
build-aux/autotroll.mk | 108 +++
configure.ac | 11 +-
m4/autotroll.m4 | 563 ++++++++++++++++
milena/ChangeLog | 189 ++++--
milena/mln/border/thickness.hh | 4 +
milena/mln/canvas/labeling/blobs.hh | 17 +-
milena/mln/core/alias/dpoint1d.hh | 4 +
milena/mln/core/alias/dpoint2d.hh | 4 +
milena/mln/core/alias/dpoint3d.hh | 4 +
milena/mln/core/image/imorph/interpolated.hh | 13 +-
milena/mln/core/point.hh | 51 ++-
milena/mln/core/routine/extend.hh | 57 ++-
milena/mln/fun/internal/x2x_linear_impl.hh | 20 +-
milena/mln/fun/v2v/hsl_to_rgb.hh | 3 +
milena/mln/fun/v2v/qt_rgb_to_int_u.hh | 71 ++
milena/mln/fun/x2x/composed.hh | 18 +-
milena/mln/fun/x2x/rotation.hh | 5 +-
milena/mln/fun/x2x/translation.hh | 6 +-
milena/mln/geom/rotate.hh | 13 +-
milena/mln/labeling/blobs.hh | 4 +-
milena/mln/labeling/blobs_and_compute.hh | 31 +-
milena/mln/labeling/compute.hh | 1 +
milena/mln/literal/black.hh | 4 +
milena/mln/literal/colors.hh | 7 +-
milena/mln/literal/identity.hh | 4 +
milena/mln/literal/one.hh | 3 +
milena/mln/literal/origin.hh | 6 +-
milena/mln/literal/white.hh | 4 +
milena/mln/literal/zero.hh | 4 +
milena/mln/subsampling/antialiased.hh | 19 +-
milena/mln/tag/init.hh | 4 +
milena/mln/trace/entering.hh | 3 +
milena/mln/trace/quiet.hh | 5 +-
milena/mln/value/internal/make_generic_name.hh | 1 +
milena/mln/value/qt/rgb32.hh | 6 +-
milena/mln/value/rgb.hh | 3 +
milena/mln/value/sign.hh | 10 +-
milena/tests/fun/v2v/Makefile.am | 9 +
milena/tests/fun/v2v/qt_rgb_to_int_u.cc | 44 ++
scribo/ChangeLog | 243 +++++++
scribo/binarization/internal/first_pass_functor.hh | 31 +-
scribo/binarization/sauvola_ms.hh | 98 +--
scribo/binarization/sauvola_ms_split.hh | 23 +-
scribo/binarization/sauvola_threshold_image.hh | 120 ++++-
.../binarization/sauvola_threshold_image_debug.hh | 29 +-
scribo/convert/from_qimage.hh | 92 +++
scribo/core/def/lbl_type.hh | 48 ++
scribo/core/line_info.hh | 36 +-
scribo/core/object_groups.hh | 14 +-
scribo/debug/save_bboxes_image.hh | 2 +-
scribo/demo/demat/demat.pro | 19 +-
scribo/demo/demat/src/main.cc | 4 +
scribo/demo/demat/src/main_window.cc | 48 +-
scribo/demo/demat/src/main_window.hh | 5 +
scribo/demo/demat/src/preprocessing_task.hh | 1 +
scribo/demo/demat/src/runner.cc | 91 ++--
scribo/demo/demat/src/runner.hh | 1 +
scribo/demo/demat/ui/main_window.ui | 15 +
scribo/demo/review/src/main.cc | 13 +-
scribo/demo/review/src/mainwindow.cc | 58 +-
scribo/demo/review/src/mainwindow.hh | 2 +-
scribo/demo/shared/src/crop_item.cc | 84 ++-
scribo/demo/shared/src/crop_item.hh | 8 +
scribo/demo/shared/src/image_viewer.cc | 79 ++-
scribo/demo/shared/src/image_viewer.hh | 9 +-
scribo/demo/shared/src/image_viewer.hxx | 31 +
.../demo/shared/src/internal/interactive_scene.cc | 11 +-
.../demo/shared/src/internal/interactive_scene.hh | 1 +
scribo/demo/shared/ui/image_viewer.ui | 34 +-
scribo/demo/wizard/src/load_page.cc | 1 +
scribo/demo/wizard/src/main_window.cc | 10 +-
scribo/demo/wizard/src/runner.cc | 6 +-
scribo/filter/object_links_non_aligned_simple.hh | 4 +-
scribo/io/text_boxes/save.hh | 102 +++
scribo/postprocessing/fill_object_holes.hh | 20 +-
scribo/preprocessing/crop.hh | 84 +++
scribo/preprocessing/crop_without_localization.hh | 97 +++
scribo/preprocessing/denoise_bg.hh | 6 +-
scribo/preprocessing/deskew.hh | 437 ++++++++++++
scribo/preprocessing/deskew_crop.hh | 187 ++++++
scribo/preprocessing/rotate_90.hh | 1 +
scribo/preprocessing/unskew.hh | 115 ----
scribo/primitive/extract/lines_h_pattern.hh | 40 +-
scribo/primitive/extract/lines_pattern.hh | 227 ++++++-
scribo/primitive/extract/lines_v_pattern.hh | 39 +-
scribo/primitive/group/from_double_link.hh | 1 -
scribo/primitive/group/from_single_link.hh | 8 +-
scribo/primitive/internal/find_root.hh | 9 +-
.../link/with_single_right_link_dmax_ratio.hh | 1 +
scribo/primitive/remove/separators.hh | 14 +-
scribo/src/Makefile.am | 84 +--
scribo/src/README | 13 +
scribo/src/binarization/Makefile.am | 11 +-
scribo/src/binarization/fg_sauvola_ms.cc | 17 +-
scribo/src/binarization/pgm_sauvola_ms.cc | 7 +-
scribo/src/binarization/ppm_fg_sauvola_ms.cc | 16 +-
scribo/src/binarization/ppm_sauvola_ms.cc | 13 +-
scribo/src/binarization/ppm_sauvola_ms_split.cc | 8 +-
scribo/src/binarization/sauvola_debug.cc | 19 +-
scribo/src/binarization/sauvola_ms.cc | 15 +-
scribo/src/binarization/sauvola_ms_debug.cc | 147 ++++
scribo/src/binarization/sauvola_ms_split.cc | 6 +-
scribo/src/contest/Makefile.am | 23 +
scribo/src/contest/hdibco-2010/Makefile.am | 27 +
.../src/contest/hdibco-2010/sauvola_ms_hdibco.cc | 85 +++
scribo/src/multi_scale/Makefile.am | 26 -
scribo/src/multi_scale/find_lines.cc | 180 -----
scribo/src/pbm_text_in_doc.cc | 132 ++++
scribo/src/postprocessing/Makefile.am | 26 +
scribo/src/postprocessing/fill_object_holes.cc | 67 ++
scribo/src/preprocessing/Makefile.am | 32 +-
scribo/src/preprocessing/denoise.cc | 69 --
scribo/src/preprocessing/denoise_bg.cc | 67 ++
scribo/src/preprocessing/denoise_fg.cc | 66 ++
scribo/src/preprocessing/subsample.cc | 16 +-
scribo/src/text/Makefile.am | 18 +-
scribo/src/text/pbm_lines_recognition.cc | 107 +++
scribo/src/text/pbm_recognition.cc | 20 +-
scribo/src/text/recognition.cc | 101 ---
scribo/src/text_in_article_pbm.cc | 381 -----------
scribo/src/text_in_article_preprocess.cc | 91 ---
scribo/src/text_in_doc.cc | 304 ---------
scribo/src/text_in_doc_ppm.cc | 322 ---------
scribo/src/text_in_doc_preprocess.cc | 103 +++
scribo/src/text_in_photo.cc | 250 -------
scribo/src/text_in_photo_fast.cc | 704 -------------------
scribo/src/text_in_photo_invert.cc | 245 -------
scribo/src/text_in_photo_pbm_fast.cc | 441 ------------
scribo/src/text_in_photo_ppm.cc | 532 ---------------
scribo/src/text_in_picture.cc | 706 ++++++++++++++++++++
scribo/subsampling/bilinear.hh | 2 +-
scribo/test.cc | 44 --
scribo/tests/Makefile.am | 1 +
scribo/tests/img/text_to_group.pgm | Bin 0 -> 3053 bytes
scribo/tests/img/wildly.pbm | Bin 0 -> 2208 bytes
scribo/tests/preprocessing/Makefile.am | 10 +-
scribo/tests/preprocessing/crop.cc | 51 ++
.../preprocessing/crop_without_localization.cc | 55 ++
scribo/tests/preprocessing/deskew.cc | 52 ++
scribo/tests/preprocessing/unskew.cc | 44 --
scribo/tests/toolchain/Makefile.am | 23 +
scribo/tests/toolchain/nepomuk/Makefile.am | 45 ++
scribo/tests/toolchain/nepomuk/text_extraction.cc | 44 ++
scribo/text/merging.hh | 2 +-
scribo/text/recognition.hh | 55 +--
scribo/toolchain/nepomuk/text_extraction.hh | 160 +++++
scribo/toolchain/text_in_doc.hh | 294 ++++++++
scribo/upsampling/bs2x.hh | 4 +-
149 files changed, 5915 insertions(+), 4472 deletions(-)
create mode 100644 build-aux/autotroll.mk
create mode 100644 m4/autotroll.m4
create mode 100644 milena/mln/fun/v2v/qt_rgb_to_int_u.hh
create mode 100644 milena/tests/fun/v2v/qt_rgb_to_int_u.cc
create mode 100644 scribo/convert/from_qimage.hh
create mode 100644 scribo/core/def/lbl_type.hh
create mode 100644 scribo/demo/shared/src/image_viewer.hxx
create mode 100644 scribo/io/text_boxes/save.hh
create mode 100644 scribo/preprocessing/crop.hh
create mode 100644 scribo/preprocessing/crop_without_localization.hh
create mode 100644 scribo/preprocessing/deskew.hh
create mode 100644 scribo/preprocessing/deskew_crop.hh
delete mode 100644 scribo/preprocessing/unskew.hh
create mode 100644 scribo/src/README
create mode 100644 scribo/src/binarization/sauvola_ms_debug.cc
create mode 100644 scribo/src/contest/Makefile.am
create mode 100644 scribo/src/contest/hdibco-2010/Makefile.am
create mode 100644 scribo/src/contest/hdibco-2010/sauvola_ms_hdibco.cc
delete mode 100644 scribo/src/multi_scale/Makefile.am
delete mode 100644 scribo/src/multi_scale/find_lines.cc
create mode 100644 scribo/src/pbm_text_in_doc.cc
create mode 100644 scribo/src/postprocessing/Makefile.am
create mode 100644 scribo/src/postprocessing/fill_object_holes.cc
delete mode 100644 scribo/src/preprocessing/denoise.cc
create mode 100644 scribo/src/preprocessing/denoise_bg.cc
create mode 100644 scribo/src/preprocessing/denoise_fg.cc
create mode 100644 scribo/src/text/pbm_lines_recognition.cc
delete mode 100644 scribo/src/text/recognition.cc
delete mode 100644 scribo/src/text_in_article_pbm.cc
delete mode 100644 scribo/src/text_in_article_preprocess.cc
delete mode 100644 scribo/src/text_in_doc.cc
delete mode 100644 scribo/src/text_in_doc_ppm.cc
create mode 100644 scribo/src/text_in_doc_preprocess.cc
delete mode 100644 scribo/src/text_in_photo.cc
delete mode 100644 scribo/src/text_in_photo_fast.cc
delete mode 100644 scribo/src/text_in_photo_invert.cc
delete mode 100644 scribo/src/text_in_photo_pbm_fast.cc
delete mode 100644 scribo/src/text_in_photo_ppm.cc
create mode 100644 scribo/src/text_in_picture.cc
delete mode 100644 scribo/test.cc
create mode 100644 scribo/tests/img/text_to_group.pgm
create mode 100644 scribo/tests/img/wildly.pbm
create mode 100644 scribo/tests/preprocessing/crop.cc
create mode 100644 scribo/tests/preprocessing/crop_without_localization.cc
create mode 100644 scribo/tests/preprocessing/deskew.cc
delete mode 100644 scribo/tests/preprocessing/unskew.cc
create mode 100644 scribo/tests/toolchain/Makefile.am
create mode 100644 scribo/tests/toolchain/nepomuk/Makefile.am
create mode 100644 scribo/tests/toolchain/nepomuk/text_extraction.cc
create mode 100644 scribo/toolchain/nepomuk/text_extraction.hh
create mode 100644 scribo/toolchain/text_in_doc.hh
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
03 Jun '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/milena-z has been updated
via c5e55142e34779d78be4944489e03949fa03551f (commit)
via 1c596f64a2ca06f073d0a6d3e37fb334bc5f64c9 (commit)
via 70ca845540984efeee0654cf989389d19dc9166b (commit)
via 1f9aa31e2c16defebcda3f4a5689caf779756c2a (commit)
via 8e0ab28cbc07882bc55a6e633928a7c46be9d018 (commit)
via 643c15954419858896b0cd759737e7620c541fe8 (commit)
via 899f6280731edf03ae30f23dcdd4745ecbe9a1f2 (commit)
via 98cab34716892c5b65385589ab6c3edbd46f9710 (commit)
via 482527bb90e7b716941dc1a9061a217c7ae8891d (commit)
from 902b12ce4df4c7292fa491510241c46ca99e9e2b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
No new revisions were added by this update.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 +
build-aux/autotroll.mk | 108 ++++
configure.ac | 6 +-
m4/autotroll.m4 | 563 ++++++++++++++++++++
milena/ChangeLog | 189 +++++--
milena/mln/border/thickness.hh | 4 +
milena/mln/canvas/labeling/blobs.hh | 17 +-
milena/mln/core/alias/dpoint1d.hh | 4 +
milena/mln/core/alias/dpoint2d.hh | 4 +
milena/mln/core/alias/dpoint3d.hh | 4 +
milena/mln/core/image/imorph/interpolated.hh | 13 +-
milena/mln/core/point.hh | 51 ++-
milena/mln/core/routine/extend.hh | 57 ++-
milena/mln/fun/internal/x2x_linear_impl.hh | 20 +-
milena/mln/fun/v2v/hsl_to_rgb.hh | 3 +
.../v2v/{rgb_to_int_u.hh => qt_rgb_to_int_u.hh} | 23 +-
milena/mln/fun/x2x/composed.hh | 18 +-
milena/mln/fun/x2x/rotation.hh | 5 +-
milena/mln/fun/x2x/translation.hh | 6 +-
milena/mln/geom/rotate.hh | 13 +-
milena/mln/labeling/blobs.hh | 4 +-
milena/mln/labeling/blobs_and_compute.hh | 31 +-
milena/mln/labeling/compute.hh | 1 +
milena/mln/literal/black.hh | 4 +
milena/mln/literal/colors.hh | 7 +-
milena/mln/literal/identity.hh | 4 +
milena/mln/literal/one.hh | 3 +
milena/mln/literal/origin.hh | 6 +-
milena/mln/literal/white.hh | 4 +
milena/mln/literal/zero.hh | 4 +
milena/mln/subsampling/antialiased.hh | 19 +-
milena/mln/tag/init.hh | 4 +
milena/mln/trace/entering.hh | 3 +
milena/mln/trace/quiet.hh | 5 +-
milena/mln/value/internal/make_generic_name.hh | 1 +
milena/mln/value/qt/rgb32.hh | 6 +-
milena/mln/value/rgb.hh | 3 +
milena/mln/value/sign.hh | 10 +-
milena/tests/fun/v2v/Makefile.am | 9 +
.../site_set/box.cc => fun/v2v/qt_rgb_to_int_u.cc} | 18 +-
40 files changed, 1146 insertions(+), 116 deletions(-)
create mode 100644 build-aux/autotroll.mk
create mode 100644 m4/autotroll.m4
copy milena/mln/fun/v2v/{rgb_to_int_u.hh => qt_rgb_to_int_u.hh} (74%)
copy milena/tests/{core/site_set/box.cc => fun/v2v/qt_rgb_to_int_u.cc} (82%)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
---
scribo/ChangeLog | 4 ++++
scribo/src/README | 13 +++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
create mode 100644 scribo/src/README
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index cacdf4d..f91986a 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,9 @@
2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * src/README: New.
+
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Improve Scribo demo.
* demo/demat/demat.pro: Add new flags.
diff --git a/scribo/src/README b/scribo/src/README
new file mode 100644
index 0000000..db346ca
--- /dev/null
+++ b/scribo/src/README
@@ -0,0 +1,13 @@
+In this directory, you can find several small tools.
+
+Here is a description of some of them:
+
+./
+
+ pbm_text_in_doc: Localize and recognize text in a document.
+
+ text_in_doc_preprocess: Preprocess a document image in order
+ to extract its text.
+
+ text_in_picture: Localize text in pictures (Do NOT extract and
+ recognize text)
\ No newline at end of file
--
1.5.6.5
1
0
last-svn-commit-140-g810f041 configure.ac: configure several directories in scribo/.
by Guillaume Lazzara 03 Jun '10
by Guillaume Lazzara 03 Jun '10
03 Jun '10
---
ChangeLog | 4 ++++
configure.ac | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a2493ff..4f43922 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * configure.ac: configure several directories in scribo/.
+
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* configure.ac: Check for Qt library using AutoTroll.
2010-05-25 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/configure.ac b/configure.ac
index 0bdaa3b..9b633cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,9 +218,12 @@ AC_CONFIG_FILES([
scribo/demo/review/Makefile
scribo/src/Makefile
scribo/src/binarization/Makefile
+ scribo/src/contest/Makefile
+ scribo/src/contest/hdibco-2010/Makefile
scribo/src/debug/Makefile
scribo/src/filter/Makefile
scribo/src/misc/Makefile
+ scribo/src/postprocessing/Makefile
scribo/src/preprocessing/Makefile
scribo/src/primitive/Makefile
scribo/src/primitive/extract/Makefile
@@ -240,6 +243,8 @@ AC_CONFIG_FILES([
scribo/tests/preprocessing/Makefile
scribo/tests/table/Makefile
scribo/tests/text/Makefile
+ scribo/tests/toolchain/Makefile
+ scribo/tests/toolchain/nepomuk/Makefile
scribo/tests/unit_test/Makefile
])
dnl>>
--
1.5.6.5
1
0
* demo/demat/demat.pro: Add new flags.
* demo/demat/src/main.cc: Make use of MLN_WO_GLOBALS_VARS.
* demo/demat/src/main_window.cc,
* demo/demat/src/main_window.hh: Cropping is not required
anymore. Improve visualization speed.
* demo/demat/src/preprocessing_task.hh,
* demo/demat/src/runner.cc,
* demo/demat/src/runner.hh,
* demo/demat/ui/main_window.ui: Add a new task for Sauvola ms
split.
* demo/review/src/main.cc,
* demo/review/src/mainwindow.cc,
* demo/review/src/mainwindow.hh: Start updating executable names
and arguments.
* demo/shared/src/crop_item.cc,
* demo/shared/src/crop_item.hh,
* demo/shared/src/image_viewer.cc,
* demo/shared/src/image_viewer.hh,
* demo/shared/src/image_viewer.hxx,
* demo/shared/src/internal/interactive_scene.cc,
* demo/shared/src/internal/interactive_scene.hh,
* demo/shared/ui/image_viewer.ui: Improve look and feel and
drawing speed of these components.
* demo/wizard/src/load_page.cc,
* demo/wizard/src/main_window.cc,
* demo/wizard/src/runner.cc: Fix compilation.
---
scribo/ChangeLog | 37 ++++++++
scribo/demo/demat/demat.pro | 19 +++--
scribo/demo/demat/src/main.cc | 4 +
scribo/demo/demat/src/main_window.cc | 48 ++++++++---
scribo/demo/demat/src/main_window.hh | 5 +
scribo/demo/demat/src/preprocessing_task.hh | 1 +
scribo/demo/demat/src/runner.cc | 91 +++++++++++---------
scribo/demo/demat/src/runner.hh | 1 +
scribo/demo/demat/ui/main_window.ui | 15 +++
scribo/demo/review/src/main.cc | 13 ++-
scribo/demo/review/src/mainwindow.cc | 58 +++++++------
scribo/demo/review/src/mainwindow.hh | 2 +-
scribo/demo/shared/src/crop_item.cc | 84 +++++++++++++++---
scribo/demo/shared/src/crop_item.hh | 8 ++
scribo/demo/shared/src/image_viewer.cc | 79 ++++++++++++------
scribo/demo/shared/src/image_viewer.hh | 9 ++-
scribo/demo/shared/src/image_viewer.hxx | 31 +++++++
.../demo/shared/src/internal/interactive_scene.cc | 11 ++-
.../demo/shared/src/internal/interactive_scene.hh | 1 +
scribo/demo/shared/ui/image_viewer.ui | 34 ++------
scribo/demo/wizard/src/load_page.cc | 1 +
scribo/demo/wizard/src/main_window.cc | 10 ++-
scribo/demo/wizard/src/runner.cc | 6 +-
23 files changed, 400 insertions(+), 168 deletions(-)
create mode 100644 scribo/demo/shared/src/image_viewer.hxx
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 8835298..cacdf4d 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,42 @@
2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Improve Scribo demo.
+
+ * demo/demat/demat.pro: Add new flags.
+
+ * demo/demat/src/main.cc: Make use of MLN_WO_GLOBALS_VARS.
+
+ * demo/demat/src/main_window.cc,
+ * demo/demat/src/main_window.hh: Cropping is not required
+ anymore. Improve visualization speed.
+
+ * demo/demat/src/preprocessing_task.hh,
+ * demo/demat/src/runner.cc,
+ * demo/demat/src/runner.hh,
+ * demo/demat/ui/main_window.ui: Add a new task for Sauvola ms
+ split.
+
+ * demo/review/src/main.cc,
+ * demo/review/src/mainwindow.cc,
+ * demo/review/src/mainwindow.hh: Start updating executable names
+ and arguments.
+
+ * demo/shared/src/crop_item.cc,
+ * demo/shared/src/crop_item.hh,
+ * demo/shared/src/image_viewer.cc,
+ * demo/shared/src/image_viewer.hh,
+ * demo/shared/src/image_viewer.hxx,
+ * demo/shared/src/internal/interactive_scene.cc,
+ * demo/shared/src/internal/interactive_scene.hh,
+ * demo/shared/ui/image_viewer.ui: Improve look and feel and
+ drawing speed of these components.
+
+ * demo/wizard/src/load_page.cc,
+ * demo/wizard/src/main_window.cc,
+ * demo/wizard/src/runner.cc: Fix compilation.
+
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes.
* binarization/sauvola_threshold_image.hh: Add ifdefs.
diff --git a/scribo/demo/demat/demat.pro b/scribo/demo/demat/demat.pro
index 4f4af23..92fbe74 100644
--- a/scribo/demo/demat/demat.pro
+++ b/scribo/demo/demat/demat.pro
@@ -8,26 +8,31 @@ TARGET =
DEPENDPATH += . src
INCLUDEPATH += . ../ ../shared $(OLN)/milena $(OLN)
-QMAKE_CXXFLAGS += -g
+QMAKE_CXXFLAGS += -g -O0
-LIBS += `Magick++-config --ldflags --libs`
+LIBS +=/usr/lib/libMagick++.so
-DEFINES += NDEBUG MLN_INCLUDE_ONLY
+# `Magick++-config --ldflags --libs`
+
+DEFINES += NDEBUG MLN_WO_GLOBAL_VARS
# Input
HEADERS += \
+ ../shared/src/crop_item.hh \
../shared/src/image_viewer.hh \
../shared/src/internal/interactive_scene.hh \
- ../shared/src/crop_item.hh \
../shared/src/browse_widget.hh \
- src/runner.hh \
- src/main_window.hh
+ src/main_window.hh \
+ src/runner.hh
SOURCES += \
../shared/src/crop_item.cc \
+ ../shared/src/image_viewer.cc \
../shared/src/internal/interactive_scene.cc \
../shared/src/browse_widget.cc \
- src/mln_widgets.cc
+ src/main_window.cc \
+ src/main.cc \
+ src/runner.cc
FORMS += \
../shared/ui/image_viewer.ui \
diff --git a/scribo/demo/demat/src/main.cc b/scribo/demo/demat/src/main.cc
index ee35a48..231cd9d 100644
--- a/scribo/demo/demat/src/main.cc
+++ b/scribo/demo/demat/src/main.cc
@@ -1,3 +1,7 @@
+#undef MLN_WO_GLOBAL_VARS
+#include <mln/core/image/image2d.hh>
+#include <mln/trace/all.hh>
+
#include <QtGui>
#include <src/main_window.hh>
#include <src/preprocessing_task.hh>
diff --git a/scribo/demo/demat/src/main_window.cc b/scribo/demo/demat/src/main_window.cc
index ee82ca1..5d3a54b 100644
--- a/scribo/demo/demat/src/main_window.cc
+++ b/scribo/demo/demat/src/main_window.cc
@@ -45,10 +45,6 @@ namespace scribo
namespace demat
{
- // FIXME: move it as attribute.
- static mln::image2d<mln::value::rgb8> input_;
-
-
main_window::main_window()
{
setupUi(this);
@@ -86,6 +82,9 @@ namespace scribo
progress_->setCancelButton(0);
progress_->setAutoClose(true);
+ action_Reload->setEnabled(false);
+ run_btn->setEnabled(false);
+
// Setup crop tool.
viewer_->set_selection_enabled(true);
connect(viewer_, SIGNAL(ready_for_crop()), this, SLOT(crop_slot()));
@@ -114,13 +113,16 @@ namespace scribo
void main_window::load()
{
- text_->hide();
+ text_->hide();
- mln::io::magick::load(input_, current_image_.toStdString());
+ mln::io::magick::load(input_, current_image_.toStdString());
input_dsp_ = QPixmap::fromImage(mln::convert::to_qimage_nocopy(input_));
viewer_->draw_image(input_dsp_);
+
+ action_Reload->setEnabled(true);
+ run_btn->setEnabled(true);
}
@@ -132,7 +134,8 @@ namespace scribo
process_args args; // Nothing for now.
- runner_.start(current_image_, input_, Text_Doc, tasks, args);
+ runner_.start(current_image_, get_crop_image(), Text_Doc, tasks, args);
+ setEnabled(false);
}
@@ -161,6 +164,8 @@ namespace scribo
tasks.insert(BinarizationSauvola);
else if (binarizationCBox->currentIndex() == 2)
tasks.insert(BinarizationSauvolaMs);
+ else if (binarizationCBox->currentIndex() == 3)
+ tasks.insert(BinarizationSauvolaMsSplit);
return tasks;
}
@@ -199,15 +204,24 @@ namespace scribo
while (!in.atEnd())
{
QString line = in.readLine();
+ line = line.section(' ', 4);
text_->append(line);
}
text_->show();
+ setEnabled(true);
}
- void main_window::crop_slot()
+ void main_window::on_action_Reload_triggered(bool)
+ {
+ load();
+ }
+
+
+ mln::image2d<mln::value::rgb8>
+ main_window::get_crop_image() const
{
mln::box2d b = input_.domain();
QRectF selection = viewer_->selection();
@@ -224,15 +238,27 @@ namespace scribo
// Update underlying data.
mln::image2d<mln::value::rgb8> output(sbox);
mln::data::fill(output, input_);
- input_ = output;
+ return output;
+ }
+
+ // No crop performed.
+ return input_;
+ }
+
+
+ void main_window::crop_slot()
+ {
+ mln::image2d<mln::value::rgb8> tmp = get_crop_image();
+ if (tmp.buffer() != input_.buffer()) // A crop has been performed.
+ {
+ input_ = tmp;
// Update display
viewer_->draw_image(input_);
}
-
- viewer_->enable_crop_tool(false); // Disable crop tool
}
+
} // end of namespace scribo::demo::demat
} // end of namespace scribo::demo
diff --git a/scribo/demo/demat/src/main_window.hh b/scribo/demo/demat/src/main_window.hh
index f52f171..dc23ccb 100644
--- a/scribo/demo/demat/src/main_window.hh
+++ b/scribo/demo/demat/src/main_window.hh
@@ -64,12 +64,15 @@ namespace scribo
void crop_slot();
+ void on_action_Reload_triggered(bool b);
+
private: // members
void load();
void prepare_progress_bar(unsigned max);
Doc_Type get_doc_type();
preprocessing_task_set_t get_tasks();
+ mln::image2d<mln::value::rgb8> get_crop_image() const;
private: // attributes
QPixmap input_dsp_;
@@ -78,6 +81,8 @@ namespace scribo
QProgressDialog* progress_;
runner runner_;
+
+ mln::image2d<mln::value::rgb8> input_;
};
diff --git a/scribo/demo/demat/src/preprocessing_task.hh b/scribo/demo/demat/src/preprocessing_task.hh
index 5c335b7..5c287c4 100644
--- a/scribo/demo/demat/src/preprocessing_task.hh
+++ b/scribo/demo/demat/src/preprocessing_task.hh
@@ -46,6 +46,7 @@ namespace scribo
BinarizationSimple,
BinarizationSauvola,
BinarizationSauvolaMs,
+ BinarizationSauvolaMsSplit,
PREPROCESSING_TASK_COUNT // Invalid task.
};
diff --git a/scribo/demo/demat/src/runner.cc b/scribo/demo/demat/src/runner.cc
index 6972902..0ab591c 100644
--- a/scribo/demo/demat/src/runner.cc
+++ b/scribo/demo/demat/src/runner.cc
@@ -18,10 +18,11 @@
#include <scribo/preprocessing/split_bg_fg.hh>
#include <scribo/preprocessing/denoise.hh>
#include <scribo/preprocessing/homogeneous_contrast.hh>
-#include <scribo/preprocessing/unskew.hh>
+#include <scribo/preprocessing/deskew.hh>
#include <scribo/binarization/sauvola.hh>
#include <scribo/binarization/sauvola_ms.hh>
-#include <scribo/binarization/simple.hh>
+#include <scribo/binarization/sauvola_ms_split.hh>
+#include <scribo/binarization/global_threshold_auto.hh>
#include <mln/logical/not.hh>
@@ -33,9 +34,6 @@ namespace scribo
QString basedir_ = "";
- // FIXME: move as attribute.
- mln::image2d<mln::value::rgb8> input_;
-
runner::runner(QObject *parent)
: QThread(parent)
@@ -97,6 +95,19 @@ namespace scribo
image2d<value::rgb8> tmp_color = duplicate(ima);
+ //
+ //==========
+ // Subsample
+ //==========
+ if (tasks_.contains(ReduceSize))
+ {
+ emit new_progress_label("Subsampling input image");
+ tmp_color = mln::subsampling::antialiased(tmp_color,
+ find_best_scale(tmp_color));
+ emit progress(1);
+ }
+
+
//==================
// Remove background
//==================
@@ -121,16 +132,16 @@ namespace scribo
emit progress(1);
- // FIXME: SUbsampling should be done at the very beginning!!!!
- //
- //==========
- // Subsample
- //==========
- if (tasks_.contains(ReduceSize))
+ //=======
+ // Deskew
+ //=======
+ if (tasks_.contains(Unskew))
{
- emit new_progress_label("Subsampling input image");
- intensity_ima = mln::subsampling::antialiased(intensity_ima,
- find_best_scale(intensity_ima));
+ std::cout << "Deskew" << std::endl;
+ emit new_progress_label("Deskew");
+
+ intensity_ima = scribo::preprocessing::deskew(intensity_ima);
+
emit progress(1);
}
@@ -168,12 +179,20 @@ namespace scribo
{
// FIXME: sauvola should not negate the image.
std::cout << "Binarization Sauvola_ms" << std::endl;
- out_bool = binarization::sauvola_ms(intensity_ima, 51, 2, 67);
+ out_bool = binarization::sauvola_ms(intensity_ima, 51, 2);
+ }
+ else if (tasks_.contains(BinarizationSauvolaMsSplit))
+ {
+ // FIXME: sauvola should not negate the image.
+ // FIXME: WARNING: work directly on the color image -> it is
+ // NOT deskewed nor contrast improved.
+ std::cout << "Binarization Sauvola_ms_split" << std::endl;
+ out_bool = binarization::sauvola_ms_split(tmp_color, 51, 2, 2);
}
else if (tasks_.contains(BinarizationSimple))
{
std::cout << "Binarization Simple" << std::endl;
- out_bool = scribo::binarization::simple(intensity_ima);
+ out_bool = scribo::binarization::global_threshold_auto(intensity_ima);
}
else
{
@@ -185,30 +204,18 @@ namespace scribo
// FIXME: remove!
-// logical::not_inplace(out_bool);
+ logical::not_inplace(out_bool);
+
//========
// Denoise
//========
-// if (tasks_.contains(RemoveNoise))
-// {
-// std::cout << "Remove noise" << std::endl;
-// emit new_progress_label("Remove noise");
-
-// out_bool = preprocessing::denoise(out_bool, c8(), 2, 2);
-
-// emit progress(1);
-// }
-
- //=======
- // Unskew
- //=======
- if (tasks_.contains(Unskew))
+ if (tasks_.contains(RemoveNoise))
{
- std::cout << "Unskew" << std::endl;
- emit new_progress_label("Unskew");
+ std::cout << "Remove noise" << std::endl;
+ emit new_progress_label("Remove noise");
- out_bool = scribo::preprocessing::unskew(out_bool).first();
+ out_bool = preprocessing::denoise(out_bool, c8(), 2, 2);
emit progress(1);
}
@@ -232,7 +239,7 @@ namespace scribo
{
case Text_Doc:
emit new_progress_label("Finding text in document...");
- qDebug() << "Running text_in_article_pbm";
+ qDebug() << "Running pbm_text_in_doc";
args << "/tmp/tmp.pbm" << "/tmp/out.txt";
// Denoise.
@@ -246,20 +253,24 @@ namespace scribo
args << "/tmp/";
- if (process_.execute(basedir_ + "/text_in_article_pbm", args))
+ qDebug() << "Running:"
+ << basedir_ + "/pbm_text_in_doc"
+ << args;
+
+ if (process_.execute(basedir_ + "/pbm_text_in_doc", args))
{
- qDebug() << "Error while running text_in_article_pbm.";
+ qDebug() << "Error while running pbm_text_in_doc.";
return;
}
break;
case Picture:
emit new_progress_label("Finding text in picture...");
- qDebug() << "Running text_in_photo_pbm_fast";
+ qDebug() << "Running text_in_picture";
args << "/tmp/tmp.pbm" << "/tmp/out.ppm" << "1" << "1" << "1";
- if (process_.execute(basedir_ + "/text_in_photo_pbm_fast", args))
+ if (process_.execute(basedir_ + "/text_in_picture", args))
{
- qDebug() << "Error while running text_in_photo_pbm_fast.";
+ qDebug() << "Error while running text_in_picture.";
return;
}
break;
diff --git a/scribo/demo/demat/src/runner.hh b/scribo/demo/demat/src/runner.hh
index 93e91bc..be32e5a 100644
--- a/scribo/demo/demat/src/runner.hh
+++ b/scribo/demo/demat/src/runner.hh
@@ -81,6 +81,7 @@ namespace scribo
QSet<Preprocessing_Task> tasks_;
QString filename_;
process_args args_;
+ mln::image2d<mln::value::rgb8> input_;
};
diff --git a/scribo/demo/demat/ui/main_window.ui b/scribo/demo/demat/ui/main_window.ui
index a552500..349d43a 100644
--- a/scribo/demo/demat/ui/main_window.ui
+++ b/scribo/demo/demat/ui/main_window.ui
@@ -64,6 +64,8 @@
</property>
<addaction name="action_Open" />
<addaction name="separator" />
+ <addaction name="action_Reload" />
+ <addaction name="separator" />
<addaction name="action_Quit" />
</widget>
<widget class="QMenu" name="menuWindow" >
@@ -270,6 +272,11 @@
<string>Local threshold multi-scale</string>
</property>
</item>
+ <item>
+ <property name="text" >
+ <string>Local threshold multi-scale (3-channels)</string>
+ </property>
+ </item>
</widget>
</item>
</layout>
@@ -336,6 +343,14 @@
<string>Advanced options</string>
</property>
</action>
+ <action name="action_Reload" >
+ <property name="text" >
+ <string>&Reload</string>
+ </property>
+ <property name="shortcut" >
+ <string>F5, Ctrl+R</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/scribo/demo/review/src/main.cc b/scribo/demo/review/src/main.cc
index ad9c28d..2a6acaf 100644
--- a/scribo/demo/review/src/main.cc
+++ b/scribo/demo/review/src/main.cc
@@ -30,12 +30,19 @@
int main(int argc, char *argv[])
{
+ if (argc < 2 || argc > 4)
+ {
+ qDebug() << "Usage: "
+ << argv[0] << " <path_to_scribo_src> [base_img_dir]";
+ return 0;
+ }
+
QApplication app(argc, argv);
- scribo::demo::MainWindow win;
+ scribo::demo::MainWindow win(argv[1]);
- if (argc == 2)
- win.set_base_img_dir(argv[1]);
+ if (argc == 3)
+ win.set_base_img_dir(argv[2]);
win.show();
return app.exec();
diff --git a/scribo/demo/review/src/mainwindow.cc b/scribo/demo/review/src/mainwindow.cc
index 4a12359..f2d10a2 100644
--- a/scribo/demo/review/src/mainwindow.cc
+++ b/scribo/demo/review/src/mainwindow.cc
@@ -34,41 +34,41 @@
const char * modes[][4] = {
- { "Text in pictures", "pics", "../src/text_in_photo_ppm", "image-x-generic.png" },
- { "Text in docs", "doc", "../src/text_in_doc", "edit-find.png" },
+ { "Text in pictures", "pics", "text_in_picture", "image-x-generic.png" },
+ { "Text in docs", "doc", "text_in_doc", "edit-find.png" },
{ (const char *)(1), 0, 0, 0}, // Separator
{ "Handwritten text lines", "hsc", "../../milena/sandbox/icdar/2009/hsc/input_to_lines", "text-x-generic.png" },
{ "Handwritten text words", "hsc", "../../milena/sandbox/icdar/2009/hsc/input_to_words", "text-x-generic.png" },
{ (const char *)(1), 0, 0, 0}, // Separator
- { "Horizontal and Vertical Lines", "hvl", "../src/extract/primitive/find_discontinued_lines", "list-add.png" },
- { "Tables", "hvl", "../src/table/extract", "x-office-spreadsheet.png" },
- { "Pre-processing", "pproc", "../src/preprocess", "format-indent-more.png" },
- { "OCR", "ocr", "../src/recognition", "edit-find.png" },
+ { "Horizontal and Vertical Lines", "hvl", "extract/primitive/find_discontinued_lines", "list-add.png" },
+ { "Tables", "hvl", "table/extract", "x-office-spreadsheet.png" },
+ { "Pre-processing", "pproc", "preprocess", "format-indent-more.png" },
+ { "OCR", "ocr", "recognition", "edit-find.png" },
{ 0, 0, 0 } // Empty line, do NOT delete.
};
-// Allow to set up to 3 extra arguments to the binaries.
+// Allow to set up to 5 extra arguments to the binaries.
//
// A program will be launched as follow:
//
-// ./my_program input.pbm <arg1> <arg2> <arg3> output.ppm
+// ./my_program input.pbm output <arg1> <arg2> <arg3> <arg4> <arg5>
//
// Unused arguments are set to 0.
// Each line must be mapped to the related on in the previous
// array "modes". So DO preserve the order.
//
-const char *args_list[][3] = {
- { 0, 0, 0 }, // Text in Pictures
- { 0, 0, 0 }, // Text in Docs
- { (const char *)(1), 0, 0}, // Separator
- { "/dev/null", 0, 0 }, // Handwritten text lines
- { "/dev/null", 0, 0 }, // Handwritten text words
- { (const char *)(1), 0, 0}, // Separator
- { "51", 0, 0 }, // Horizontal and Vertical lines
- { "/dev/null", 0, 0 }, // Tables
- { 0, 0, 0 }, // Pre-processing
- { 0, 0, 0 }, // OCR
+const char *args_list[][6] = {
+ { "1", "1", "1", "1", "1", 0 }, // Text in Pictures
+ { 0, 0, 0, 0, 0, 0 }, // Text in Docs
+ { (const char *)(1), 0, 0, 0, 0, 0 }, // Separator
+ { "/dev/null", 0, 0, 0, 0, 0 }, // Handwritten text lines
+ { "/dev/null", 0, 0, 0, 0, 0 }, // Handwritten text words
+ { (const char *)(1), 0, 0, 0, 0, 0 }, // Separator
+ { "51", 0, 0, 0, 0, 0 }, // Horizontal and Vertical lines
+ { "/dev/null", 0, 0, 0, 0, 0 }, // Tables
+ { 0, 0, 0, 0, 0, 0 }, // Pre-processing
+ { 0, 0, 0, 0, 0, 0 }, // OCR
// Not empty line needed.
};
@@ -80,8 +80,8 @@ namespace scribo
namespace demo
{
- MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent), context_(this)
+ MainWindow::MainWindow(const QString& exec_prefix, QWidget *parent)
+ : QMainWindow(parent), exec_prefix_(exec_prefix + "/"), context_(this)
{
setupUi(this);
@@ -92,7 +92,6 @@ namespace scribo
cached_result_.resize(nmodes);
mainRefItem_ = 0;
mainResultItem_ = 0;
- exec_prefix_ = "";
base_img_dir_ = QCoreApplication::applicationDirPath();
pdialog_.setRange(0,0);
@@ -165,7 +164,7 @@ namespace scribo
action->setCheckable(true);
action->setData(i);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0 + i));
- action->setEnabled(QFile::exists(modes[i][2]));
+ action->setEnabled(QFile::exists(exec_prefix_ + modes[i][2]));
if (modes[i][3] != 0)
action->setIcon(QIcon(QString(":/icons/") + modes[i][3]));
@@ -185,7 +184,7 @@ namespace scribo
filename = QFileDialog::getOpenFileName(this,
tr("Open Image."),
base_img_dir_ + "/" + current_dir,
- tr("Images (*.pbm *.pgm *.ppm)"));
+ tr("Images (*.pbm *.pgm *.ppm *.jpg *.png *.tiff)"));
prepare_for_run(filename);
}
@@ -221,18 +220,21 @@ namespace scribo
QString input = filepath->text();
args << input;
+ QTemporaryFile f;
+ f.open();
+ args << f.fileName();
+ last_output_ = f.fileName();
+
for (unsigned i = 0; args_list[mode_][i]; ++i)
args << args_list[mode_][i];
// if (!is_in_ocr_mode())
// {
- QTemporaryFile f;
- f.open();
- args << f.fileName();
- last_output_ = f.fileName();
// }
// reset_progress_dialog();
+ qDebug() << "Running " << exec_prefix_ + modes[mode_][2]
+ << " " << args;
exec_.start(exec_prefix_ + modes[mode_][2], args);
}
diff --git a/scribo/demo/review/src/mainwindow.hh b/scribo/demo/review/src/mainwindow.hh
index 90ed991..cb32e30 100644
--- a/scribo/demo/review/src/mainwindow.hh
+++ b/scribo/demo/review/src/mainwindow.hh
@@ -45,7 +45,7 @@ namespace scribo
public:
- MainWindow(QWidget *parent = 0);
+ MainWindow(const QString& exec_prefix, QWidget *parent = 0);
~MainWindow();
void set_base_img_dir(const QString& dir);
diff --git a/scribo/demo/shared/src/crop_item.cc b/scribo/demo/shared/src/crop_item.cc
index 70598fa..579eb65 100644
--- a/scribo/demo/shared/src/crop_item.cc
+++ b/scribo/demo/shared/src/crop_item.cc
@@ -35,17 +35,36 @@ namespace scribo
namespace shared
{
+
crop_item::crop_item(QGraphicsItem *parent)
: QGraphicsItem(parent)
{
mousePress_ = false;
setAcceptHoverEvents(true);
+// draw_rect_ = scene()->sceneRect();
reset();
grabMouse();
}
+
+ // Mouse is pressed. The rectangle must be created and about to
+ // be enlarged.
+ crop_item::crop_item(const QPointF& p, QGraphicsItem *parent)
+ : QGraphicsItem(parent)
+ {
+ mousePress_ = true;
+ setAcceptHoverEvents(true);
+
+// draw_rect_ = scene()->sceneRect();
+
+ cropRect_ = QRectF(p, QSize(4, 4));
+ cropResize_ = CropItemResizeBottomRight;
+
+ grabMouse();
+ }
+
crop_item::~crop_item()
{
@@ -53,10 +72,11 @@ namespace scribo
void crop_item::reset()
{
- if (parentItem())
- cropRect_ = parentItem()->boundingRect();
- else
- cropRect_ = QRectF(20, 20, 100, 70);
+ cropRect_ = QRect();
+// if (parentItem())
+// cropRect_ = parentItem()->boundingRect();
+// else
+// cropRect_ = QRectF(20, 20, 100, 70);
}
QRectF crop_item::cropRect() const
@@ -68,6 +88,7 @@ namespace scribo
QRectF crop_item::boundingRect() const
{
return scene()->sceneRect();
+// return draw_rect_;
}
void crop_item::paint(QPainter *painter,
@@ -83,6 +104,7 @@ namespace scribo
QPainterPath windowPath;
windowPath.addRect(option->rect);
+// windowPath.addRect(draw_rect_);
windowPath = windowPath.subtracted(cropPath);
// Draw Alpha-Black Background.
@@ -134,6 +156,15 @@ namespace scribo
cropResize_ = CropItemResizeNone;
if (event->buttons() & Qt::LeftButton)
{
+ if (!cropRect_.isValid())
+ {
+ cropRect_ = QRectF(event->pos(), QSize(4, 4));
+ cropResize_ = CropItemResizeBottomRight;
+ update();
+ return;
+ }
+
+
int wsize = std::min(int(cropRect_.width() / 6.f), 80);
int hsize = std::min(int(cropRect_.height() / 6.f), 80);
@@ -237,22 +268,35 @@ namespace scribo
QGraphicsItem::mouseMoveEvent(event);
- qreal minSize = 4 + (CROP_BORDER_LINE << 1);
-
QPointF delta = event->pos() - event->lastPos();
- switch (cropResize_)
+
+ if (cropResize_ == CropItemResizeNone)
{
- case CropItemResizeNone:
- if (!cropRect_.contains(event->pos()))
- return;
+ if (//!cropRect_.contains(event->pos())
+ (!(event->buttons() & Qt::LeftButton)))
+ return;
- setCursor(Qt::SizeAllCursor);
+ // Moving existing rectangle
+ setCursor(Qt::SizeAllCursor);
+ cropRect_.translate(delta);
- if (!(event->buttons() & Qt::LeftButton))
- return;
+// draw_rect_.translate(delta);
+ update();
+ return;
+ }
- cropRect_.translate(delta);
- break;
+ resize(delta);
+ }
+
+
+ void crop_item::resize(const QPointF& delta_)
+ {
+ qreal minSize = 4 + (CROP_BORDER_LINE << 1);
+ QPointF delta = delta_;
+
+ QRectF tmp = cropRect_;
+ switch (cropResize_)
+ {
case CropItemResizeTopLeft:
delta.setY(qMin(cropRect_.height() - minSize, delta.y()));
delta.setX(qMin(cropRect_.width() - minSize, delta.x()));
@@ -275,11 +319,14 @@ namespace scribo
cropRect_.translate(delta.x(), 0);
setCursor(Qt::SizeBDiagCursor);
break;
+
+ default:
case CropItemResizeBottomRight:
cropRect_.setWidth(cropRect_.width() + delta.x());
cropRect_.setHeight(cropRect_.height() + delta.y());
setCursor(Qt::SizeFDiagCursor);
break;
+
case CropItemResizeLeft:
delta.setX(qMin(cropRect_.width() - minSize, delta.x()));
cropRect_.setWidth(cropRect_.width() - delta.x());
@@ -307,6 +354,13 @@ namespace scribo
if (cropRect_.height() < minSize)
cropRect_.setHeight(minSize);
+
+ // Updating bounding rect.
+// if ((cropRect_.width() * cropRect_.height()) < (tmp.width() * tmp.height()))
+// draw_rect_ = tmp;
+// else
+// draw_rect_ = cropRect_;
+
update();
}
diff --git a/scribo/demo/shared/src/crop_item.hh b/scribo/demo/shared/src/crop_item.hh
index d342f23..7978538 100644
--- a/scribo/demo/shared/src/crop_item.hh
+++ b/scribo/demo/shared/src/crop_item.hh
@@ -56,6 +56,11 @@ namespace scribo
public:
crop_item(QGraphicsItem *parent);
+
+ // Mouse is pressed. The rectangle must be created and about
+ // to be enlarged.
+ crop_item(const QPointF& p, QGraphicsItem *parent);
+
virtual ~crop_item();
QRectF cropRect() const;
@@ -67,6 +72,8 @@ namespace scribo
void reset();
+ void resize(const QPointF& delta);
+
protected:
void mousePressEvent (QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
@@ -97,6 +104,7 @@ namespace scribo
private:
CropItemResize cropResize_;
QRectF cropRect_;
+ QRectF draw_rect_;
bool mousePress_;
};
diff --git a/scribo/demo/shared/src/image_viewer.cc b/scribo/demo/shared/src/image_viewer.cc
index f9467dc..416f822 100644
--- a/scribo/demo/shared/src/image_viewer.cc
+++ b/scribo/demo/shared/src/image_viewer.cc
@@ -55,6 +55,9 @@ namespace scribo
set_selection_enabled(false);
set_rotation_enabled(false);
+
+ // Set cache limit to 20Mb.
+ QPixmapCache::setCacheLimit(20480);
}
@@ -88,17 +91,6 @@ namespace scribo
viewer_->show();
}
- template <typename V>
- void image_viewer::draw_image(const mln::image2d<V>& ima)
- {
- QImage
- qima = mln::convert::to_qimage_nocopy(ima);
- QPixmap pixmap = QPixmap::fromImage(qima);
-
- draw_image(pixmap, QPoint(ima.domain().pmin().col(),
- ima.domain().pmin().row()));
- }
-
void image_viewer::draw_image(const QPixmap& pixmap)
{
@@ -124,6 +116,8 @@ namespace scribo
}
image_ = viewer_->scene()->addPixmap(pixmap);
+ image_->setCacheMode(QGraphicsItem::DeviceCoordinateCache,
+ QSize(100,100));
viewer_->scene()->setSceneRect(image_->boundingRect());
if (pixmap.width() > viewer_->maximumViewportSize().width())
@@ -137,7 +131,7 @@ namespace scribo
viewer_->setSceneRect(image_->sceneBoundingRect());
// Restore selection mode if needed
- on_crop_btn_toggled(restore_selection);
+ setup_selection_tool(restore_selection);
}
@@ -252,6 +246,32 @@ namespace scribo
resize_image(viewer_->viewport()->geometry());
}
+
+ void image_viewer::new_mouse_selection_slot(const QPointF& p)
+ {
+ if (selection_)
+ {
+ if (selection_->cropRect().contains(p))
+ return;
+ else
+ {
+ setup_selection_tool(false);
+ return;
+ }
+ }
+
+ setup_selection_tool(false); // Remove previous selection.
+ setup_selection_tool(true, p); // Create new selection.
+ }
+
+
+ void image_viewer::new_mouse_released_slot(const QPointF&)
+ {
+ if (selection_ && !selection_->cropRect().isValid()) // CAS POURRI!!
+ setup_selection_tool(false);
+ }
+
+
void image_viewer::clear()
{
visible_slider(false);
@@ -263,16 +283,20 @@ namespace scribo
}
}
- void image_viewer::on_crop_btn_toggled(bool b)
+ void image_viewer::setup_selection_tool(bool b, const QPointF& p)
{
if (b)
{
- if (selection_ == 0)
+ if (viewer_->scene() && selection_ == 0)
{
- selection_ = new crop_item(image_);
+ if (!p.isNull())
+ selection_ = new crop_item(p, image_);
+ else
+ selection_ = new crop_item(image_);
+
+ // Enable cropping on double click.
connect(selection_, SIGNAL(ready_for_crop()),
this, SIGNAL(ready_for_crop()));
-
}
}
else
@@ -283,15 +307,22 @@ namespace scribo
}
- void image_viewer::enable_crop_tool(bool b)
- {
- crop_btn->setChecked(b);
- }
-
-
void image_viewer::set_selection_enabled(bool b)
{
- crop_btn->setVisible(b);
+ if (b)
+ {
+ connect(viewer_->scene(), SIGNAL(mouse_pressed(const QPointF&)),
+ this, SLOT(new_mouse_selection_slot(const QPointF&)));
+ connect(viewer_->scene(), SIGNAL(mouse_released(const QPointF&)),
+ this, SLOT(new_mouse_released_slot(const QPointF&)));
+ }
+ else
+ {
+ disconnect(viewer_->scene(), SIGNAL(mouse_pressed(const QPointF&)),
+ this, SLOT(new_mouse_selection_slot(const QPointF&)));
+ disconnect(viewer_->scene(), SIGNAL(mouse_released(const QPointF&)),
+ this, SLOT(new_mouse_released_slot(const QPointF&)));
+ }
}
@@ -369,8 +400,6 @@ namespace scribo
rotate_ccw_btn->setEnabled(b);
rotate_cw_btn->setEnabled(b);
rotate_lbl->setEnabled(b);
-
- crop_btn->setEnabled(b);
}
diff --git a/scribo/demo/shared/src/image_viewer.hh b/scribo/demo/shared/src/image_viewer.hh
index 3fe23ab..539e17d 100644
--- a/scribo/demo/shared/src/image_viewer.hh
+++ b/scribo/demo/shared/src/image_viewer.hh
@@ -73,6 +73,7 @@ namespace scribo
void clear();
void set_selection_enabled(bool b);
+// void set_mouse_selection_enabled(bool b);
void set_rotation_enabled(bool b);
@@ -100,7 +101,7 @@ namespace scribo
void move_vertical_sliders(int value);
void move_horizontal_sliders(int value);
- void on_crop_btn_toggled(bool b);
+ void setup_selection_tool(bool b, const QPointF& p = QPointF());
void on_slider_valueChanged(int sli);
@@ -112,11 +113,13 @@ namespace scribo
void on_zoomFixed_clicked();
void on_zoomOriginal_clicked();
+ void new_mouse_selection_slot(const QPointF&);
+ void new_mouse_released_slot(const QPointF& p);
+// void selection_mouse_moved_slot(const QPointF& p);
public slots:
void set_image_layer_count(unsigned nslis);
void update_image(const mln::image2d<dsp_data_t>& ima);
- void enable_crop_tool(bool b);
signals:
void slider_valueChanged(int sli);
@@ -140,4 +143,6 @@ namespace scribo
} // end of namespace scribo
+# include <shared/src/image_viewer.hxx>
+
#endif // ! SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH
diff --git a/scribo/demo/shared/src/image_viewer.hxx b/scribo/demo/shared/src/image_viewer.hxx
new file mode 100644
index 0000000..c7008a7
--- /dev/null
+++ b/scribo/demo/shared/src/image_viewer.hxx
@@ -0,0 +1,31 @@
+#ifndef SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH
+# error "This file cannot be included directly."
+#endif
+
+
+namespace scribo
+{
+
+ namespace demo
+ {
+
+ namespace shared
+ {
+
+
+ template <typename V>
+ void image_viewer::draw_image(const mln::image2d<V>& ima)
+ {
+ QImage
+ qima = mln::convert::to_qimage_nocopy(ima);
+ QPixmap pixmap = QPixmap::fromImage(qima);
+
+ draw_image(pixmap, QPoint(ima.domain().pmin().col(),
+ ima.domain().pmin().row()));
+ }
+
+ } // end of namespace scribo::demo::shared
+
+ } // end of namespace scribo::demo
+
+} // end of namespace scribo
diff --git a/scribo/demo/shared/src/internal/interactive_scene.cc b/scribo/demo/shared/src/internal/interactive_scene.cc
index a56517b..e49b855 100644
--- a/scribo/demo/shared/src/internal/interactive_scene.cc
+++ b/scribo/demo/shared/src/internal/interactive_scene.cc
@@ -47,13 +47,18 @@ namespace scribo
{
super_::mouseMoveEvent(e);
+
+// qDebug() << "interactiveScene::mouseMoveEvent";
+
if (e->buttons() & Qt::LeftButton)
{
- emit mouse_pressed(e->scenePos());
+ emit mouse_moved_and_pressed(e->scenePos());
mouse_moved_ = true;
}
emit mouse_moved(e->scenePos());
+
+ e->ignore();
}
void interactiveScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
@@ -64,6 +69,7 @@ namespace scribo
pressed_point_ = e->scenePos();
emit mouse_pressed(e->scenePos());
+ e->ignore();
}
void interactiveScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
@@ -75,7 +81,8 @@ namespace scribo
emit mouse_released(e->scenePos());
- e->accept();
+// qDebug() << "crop_item::mouseReleaseEvent";
+ e->ignore();
}
} // end of namespace mln::demo::shared::internal
diff --git a/scribo/demo/shared/src/internal/interactive_scene.hh b/scribo/demo/shared/src/internal/interactive_scene.hh
index ba9e9e4..7099265 100644
--- a/scribo/demo/shared/src/internal/interactive_scene.hh
+++ b/scribo/demo/shared/src/internal/interactive_scene.hh
@@ -64,6 +64,7 @@ namespace scribo
void mouse_click(const QPointF& p);
void mouse_moved(const QPointF& p);
void mouse_pressed(const QPointF& p);
+ void mouse_moved_and_pressed(const QPointF& p);
void mouse_released(const QPointF& p);
private:
diff --git a/scribo/demo/shared/ui/image_viewer.ui b/scribo/demo/shared/ui/image_viewer.ui
index c129b97..fcf1239 100644
--- a/scribo/demo/shared/ui/image_viewer.ui
+++ b/scribo/demo/shared/ui/image_viewer.ui
@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>529</width>
+ <width>553</width>
<height>350</height>
</rect>
</property>
@@ -37,29 +37,6 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="crop_btn" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="maximumSize" >
- <size>
- <width>16777215</width>
- <height>20</height>
- </size>
- </property>
- <property name="text" >
- <string>Crop</string>
- </property>
- <property name="icon" >
- <iconset resource="../shared.qrc" >
- <normaloff>:/icons/icons/crop-icon.png</normaloff>:/icons/icons/crop-icon.png</iconset>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
<widget class="QLabel" name="rotate_lbl" >
<property name="enabled" >
<bool>false</bool>
@@ -236,12 +213,15 @@
<property name="interactive" >
<bool>true</bool>
</property>
- <property name="renderHints" >
- <set>QPainter::Antialiasing</set>
- </property>
<property name="dragMode" >
<enum>QGraphicsView::NoDrag</enum>
</property>
+ <property name="viewportUpdateMode" >
+ <enum>QGraphicsView::BoundingRectViewportUpdate</enum>
+ </property>
+ <property name="optimizationFlags" >
+ <set>QGraphicsView::DontAdjustForAntialiasing|QGraphicsView::DontClipPainter|QGraphicsView::DontSavePainterState</set>
+ </property>
</widget>
</item>
<item>
diff --git a/scribo/demo/wizard/src/load_page.cc b/scribo/demo/wizard/src/load_page.cc
index 2d9ed43..69c2f7f 100644
--- a/scribo/demo/wizard/src/load_page.cc
+++ b/scribo/demo/wizard/src/load_page.cc
@@ -45,6 +45,7 @@ namespace scribo
void load_page::initializePage()
{
+ cleanupPage();
}
diff --git a/scribo/demo/wizard/src/main_window.cc b/scribo/demo/wizard/src/main_window.cc
index 7f44ec5..2af6c82 100644
--- a/scribo/demo/wizard/src/main_window.cc
+++ b/scribo/demo/wizard/src/main_window.cc
@@ -44,10 +44,11 @@ namespace scribo
main_window::main_window()
+ : QWizard(0, Qt::Window)
{
- QPixmap bg_pixmap(":/images/images/dematerialization.png");
- setPixmap(QWizard::WatermarkPixmap, bg_pixmap);
- setPixmap(QWizard::BackgroundPixmap, bg_pixmap);
+// QPixmap bg_pixmap(":/images/images/dematerialization.png");
+// setPixmap(QWizard::WatermarkPixmap, bg_pixmap);
+// setPixmap(QWizard::BackgroundPixmap, bg_pixmap);
connect(this, SIGNAL(currentIdChanged(int)),
@@ -76,7 +77,8 @@ namespace scribo
addPage(page_preprocessing);
// Page_Processing
- addPage(new process_page(this));
+ process_page *page_process = new process_page(this);
+ addPage(page_process);
// Page_Result
addPage(new result_page(this));
diff --git a/scribo/demo/wizard/src/runner.cc b/scribo/demo/wizard/src/runner.cc
index dd9ad9c..7e888f6 100644
--- a/scribo/demo/wizard/src/runner.cc
+++ b/scribo/demo/wizard/src/runner.cc
@@ -17,7 +17,7 @@
#include <scribo/preprocessing/unskew.hh>
#include <scribo/binarization/sauvola.hh>
#include <scribo/binarization/sauvola_ms.hh>
-#include <scribo/binarization/simple.hh>
+#include <scribo/binarization/global_threshold_auto.hh>
#include <mln/logical/not.hh>
@@ -157,12 +157,12 @@ namespace scribo
{
// FIXME: sauvola should not negate the image.
std::cout << "Binarization Sauvola_ms" << std::endl;
- out_bool = binarization::sauvola_ms(intensity_ima, 51, 2, 67);
+ out_bool = binarization::sauvola_ms(intensity_ima, 51, 2);
}
else if (tasks_.contains(BinarizationSimple))
{
std::cout << "Binarization Simple" << std::endl;
- out_bool = scribo::binarization::simple(intensity_ima);
+ out_bool = scribo::binarization::global_threshold_auto(intensity_ima);
}
else
{
--
1.5.6.5
1
0
* binarization/sauvola_threshold_image.hh: Add ifdefs.
* core/object_groups.hh: Fix a wrong assertion.
* postprocessing/fill_object_holes.hh: Disable debug output.
* preprocessing/denoise_bg.hh: Do not negate the image anymore.
---
scribo/ChangeLog | 12 ++++++++++++
scribo/binarization/sauvola_threshold_image.hh | 7 ++++++-
scribo/core/object_groups.hh | 2 +-
scribo/postprocessing/fill_object_holes.hh | 20 ++++++++++++++++----
scribo/preprocessing/denoise_bg.hh | 6 +++---
5 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 3888981..8835298 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,17 @@
2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Small fixes.
+
+ * binarization/sauvola_threshold_image.hh: Add ifdefs.
+
+ * core/object_groups.hh: Fix a wrong assertion.
+
+ * postprocessing/fill_object_holes.hh: Disable debug output.
+
+ * preprocessing/denoise_bg.hh: Do not negate the image anymore.
+
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add the binarization tool submitted to H-DIBCO 2010.
* src/Makefile.am,
diff --git a/scribo/binarization/sauvola_threshold_image.hh b/scribo/binarization/sauvola_threshold_image.hh
index c45fc98..5382650 100644
--- a/scribo/binarization/sauvola_threshold_image.hh
+++ b/scribo/binarization/sauvola_threshold_image.hh
@@ -127,7 +127,6 @@ namespace scribo
# endif // ! SCRIBO_SAUVOLA_DEBUG
-
/*! \brief compute Sauvola's threshold applying directly the formula.
\param[in] m_x_y Mean value.
@@ -170,20 +169,26 @@ namespace scribo
// if (s_N < 0.1f)
// {
// K_2 = 0.1f;
+// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 0;
// dbg_s_n = s_N;
+// # endif // !SCRIBO_SAUVOLA_DEBUG
// }
// else if (s_N > 0.34)
// {
// K_2 = 0.34;
+// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 255;
// dbg_s_n = s_N;
+// # endif // !SCRIBO_SAUVOLA_DEBUG
// }
// else
// {
// K_2 = s_N;
+// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 150;
// dbg_s_n = s_N;
+// # endif // !SCRIBO_SAUVOLA_DEBUG
// }
diff --git a/scribo/core/object_groups.hh b/scribo/core/object_groups.hh
index a7bb403..9d9fb25 100644
--- a/scribo/core/object_groups.hh
+++ b/scribo/core/object_groups.hh
@@ -183,7 +183,7 @@ namespace scribo
bool
object_groups<L>::is_valid() const
{
- mln_assertion(data_->components_.nelements() == (nelements()));
+ mln_assertion(data_->components_.nelements() == (nelements() - 1));
return data_->links_.is_valid();
}
diff --git a/scribo/postprocessing/fill_object_holes.hh b/scribo/postprocessing/fill_object_holes.hh
index 4771844..7dc53eb 100644
--- a/scribo/postprocessing/fill_object_holes.hh
+++ b/scribo/postprocessing/fill_object_holes.hh
@@ -41,7 +41,11 @@
# include <mln/core/routine/extend.hh>
# include <mln/core/image/dmorph/extended.hh>
+# include <mln/data/fill.hh>
+# include <mln/data/transform.hh>
+
# include <mln/extension/duplicate.hh>
+# include <mln/extension/adjust_fill.hh>
# include <mln/draw/box_plain.hh>
# include <mln/util/array.hh>
@@ -50,6 +54,14 @@
# include <mln/fun/i2v/array.hh>
+# include <mln/value/int_u16.hh>
+
+# include <mln/labeling/blobs_and_compute.hh>
+
+# include <mln/logical/not.hh>
+
+# include <mln/transform/influence_zone_geodesic.hh>
+
# include <scribo/core/macros.hh>
# include <scribo/core/object_groups.hh>
# include <scribo/primitive/group/apply.hh>
@@ -331,7 +343,7 @@ namespace scribo
// Holes card Image
- std::cout << "> Holes card image" << std::endl;
+// std::cout << "> Holes card image" << std::endl;
L nlabels;
@@ -345,7 +357,7 @@ namespace scribo
// Threshold Image
- std::cout << "> Threshold image" << std::endl;
+// std::cout << "> Threshold image" << std::endl;
I input_i = logical::not_(input);
@@ -363,7 +375,7 @@ namespace scribo
// Thresholding
- std::cout << "> Thresholding" << std::endl;
+// std::cout << "> Thresholding" << std::endl;
I hole_mask;
initialize(hole_mask, holes);
@@ -376,7 +388,7 @@ namespace scribo
// Cleanup
- std::cout << "> Cleanup" << std::endl;
+// std::cout << "> Cleanup" << std::endl;
data::fill((output | pw::value(hole_mask)).rw(), false);
diff --git a/scribo/preprocessing/denoise_bg.hh b/scribo/preprocessing/denoise_bg.hh
index 9242f36..14837bb 100644
--- a/scribo/preprocessing/denoise_bg.hh
+++ b/scribo/preprocessing/denoise_bg.hh
@@ -131,11 +131,11 @@ namespace scribo
util::array<unsigned>
result = labeling::compute(accu::meta::math::count(), lbl, nlabels);
- mln::fun::i2v::array<bool> f(nlabels + 1, true);
- f(0) = false;
+ mln::fun::i2v::array<bool> f(nlabels + 1, false);
+ f(0) = true;
for (unsigned i = 1; i <= nlabels; ++i)
if (result(i) < min_card)
- f(i) = false;
+ f(i) = true;
scribo::fun::v2b::label_to_bool<unsigned> relabel_f(f);
mln_concrete(I)
--
1.5.6.5
1
0