Olena-patches
Threads by month
- ----- 2025 -----
- 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
June 2010
- 9 participants
- 276 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

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
* src/Makefile.am: Add postprocessing subdir.
* src/postprocessing/Makefile.am,
* src/postprocessing/fill_object_holes.cc: New.
* src/preprocessing/denoise.cc: Remove.
* src/preprocessing/denoise_bg.cc,
* src/preprocessing/denoise_fg.cc: New.
---
scribo/ChangeLog | 14 ++++++++++++
scribo/src/Makefile.am | 7 +++--
.../toolchain => src/postprocessing}/Makefile.am | 9 +++++--
.../fill_object_holes.cc} | 22 +++++++++----------
scribo/src/preprocessing/Makefile.am | 6 +++-
.../preprocessing/{denoise.cc => denoise_bg.cc} | 18 +++++++---------
.../preprocessing/{denoise.cc => denoise_fg.cc} | 21 ++++++++----------
7 files changed, 55 insertions(+), 42 deletions(-)
copy scribo/{tests/toolchain => src/postprocessing}/Makefile.am (84%)
copy scribo/src/{preprocessing/denoise.cc => postprocessing/fill_object_holes.cc} (78%)
copy scribo/src/preprocessing/{denoise.cc => denoise_bg.cc} (83%)
rename scribo/src/preprocessing/{denoise.cc => denoise_fg.cc} (78%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index a473c52..f2eb3c3 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,19 @@
2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Update tools in scribo/src.
+
+ * src/Makefile.am: Add postprocessing subdir.
+
+ * src/postprocessing/Makefile.am,
+ * src/postprocessing/fill_object_holes.cc: New.
+
+ * src/preprocessing/denoise.cc: Remove.
+
+ * src/preprocessing/denoise_bg.cc,
+ * src/preprocessing/denoise_fg.cc: New.
+
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add a specific toolchain for Nepomuk integration.
* convert/from_qimage.hh: New. convert an image2d to a QImage.
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index e910f53..b3a7859 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+# (LRDE).
#
# This file is part of Olena.
#
@@ -25,12 +26,12 @@ SUBDIRS = \
primitive \
filter \
misc \
- nuxeo_xwiki \
+ postprocessing \
preprocessing \
table \
text
-bin_PROGRAMS = \
+bin_PROGRAMS = \
pbm_lines_in_doc
diff --git a/scribo/tests/toolchain/Makefile.am b/scribo/src/postprocessing/Makefile.am
similarity index 84%
copy from scribo/tests/toolchain/Makefile.am
copy to scribo/src/postprocessing/Makefile.am
index 826fb86..b21cac2 100644
--- a/scribo/tests/toolchain/Makefile.am
+++ b/scribo/src/postprocessing/Makefile.am
@@ -17,7 +17,10 @@
## Process this file through Automake to create Makefile.in.
-include $(top_srcdir)/scribo/tests/tests.mk
+include $(top_srcdir)/scribo/scribo.mk
-SUBDIRS = \
- nepomuk
\ No newline at end of file
+bin_PROGRAMS = \
+ fill_object_holes
+
+
+fill_object_holes_SOURCES = fill_object_holes.cc
diff --git a/scribo/src/preprocessing/denoise.cc b/scribo/src/postprocessing/fill_object_holes.cc
similarity index 78%
copy from scribo/src/preprocessing/denoise.cc
copy to scribo/src/postprocessing/fill_object_holes.cc
index 0eb567b..280eae5 100644
--- a/scribo/src/preprocessing/denoise.cc
+++ b/scribo/src/postprocessing/fill_object_holes.cc
@@ -28,7 +28,7 @@
#include <mln/io/pbm/all.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/preprocessing/denoise.hh>
+#include <scribo/postprocessing/fill_object_holes.hh>
@@ -36,8 +36,7 @@ const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. 'True' for objects, 'False'\
for the background." },
- { "fg_min_card", "The minimum neighbor count to be set to true." },
- { "bg_min_card", "The minimum neighbor count to be set to false." },
+ { "ratio", "The maximum holes size ratio to allow hole filling." },
{0, 0}
};
@@ -46,12 +45,11 @@ int main(int argc, char *argv[])
{
using namespace mln;
- if (argc != 5)
+ if (argc != 4)
return scribo::debug::usage(argv,
- "Remove noise.",
- "input.pbm fg_min_card bg_min_card output.pbm",
- args_desc,
- "A binary image.");
+ "Fill object holes.",
+ "input.pbm ratio output.pbm",
+ args_desc);
trace::entering("main");
@@ -59,11 +57,11 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- unsigned fg_min_card = atoi(argv[2]);
- unsigned bg_min_card = atoi(argv[3]);
+ float ratio = atof(argv[2]);
- io::pbm::save(scribo::preprocessing::denoise(input, fg_min_card, bg_min_card),
- argv[4]);
+ I output = scribo::postprocessing::fill_object_holes(input, ratio);
+
+ io::pbm::save(output, argv[3]);
trace::exiting("main");
}
diff --git a/scribo/src/preprocessing/Makefile.am b/scribo/src/preprocessing/Makefile.am
index 1f683e4..d080c96 100644
--- a/scribo/src/preprocessing/Makefile.am
+++ b/scribo/src/preprocessing/Makefile.am
@@ -21,13 +21,15 @@
include $(top_srcdir)/scribo/scribo.mk
bin_PROGRAMS = \
- denoise \
+ denoise_bg \
+ denoise_fg \
homogeneous_contrast \
preprocess \
split_bg_fg \
unskew
-denoise_SOURCES = denoise.cc
+denoise_bg_SOURCES = denoise_bg.cc
+denoise_fg_SOURCES = denoise_fg.cc
homogeneous_contrast_SOURCES = homogeneous_contrast.cc
preprocess_SOURCES = preprocess.cc
split_bg_fg_SOURCES = split_bg_fg.cc
diff --git a/scribo/src/preprocessing/denoise.cc b/scribo/src/preprocessing/denoise_bg.cc
similarity index 83%
copy from scribo/src/preprocessing/denoise.cc
copy to scribo/src/preprocessing/denoise_bg.cc
index 0eb567b..e9d83cf 100644
--- a/scribo/src/preprocessing/denoise.cc
+++ b/scribo/src/preprocessing/denoise_bg.cc
@@ -36,7 +36,6 @@ const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. 'True' for objects, 'False'\
for the background." },
- { "fg_min_card", "The minimum neighbor count to be set to true." },
{ "bg_min_card", "The minimum neighbor count to be set to false." },
{0, 0}
};
@@ -46,12 +45,11 @@ int main(int argc, char *argv[])
{
using namespace mln;
- if (argc != 5)
+ if (argc != 4)
return scribo::debug::usage(argv,
- "Remove noise.",
- "input.pbm fg_min_card bg_min_card output.pbm",
- args_desc,
- "A binary image.");
+ "Remove noise in background using c4 neighbor.",
+ "input.pbm bg_min_card output.pbm",
+ args_desc);
trace::entering("main");
@@ -59,11 +57,11 @@ int main(int argc, char *argv[])
I input;
io::pbm::load(input, argv[1]);
- unsigned fg_min_card = atoi(argv[2]);
- unsigned bg_min_card = atoi(argv[3]);
+ unsigned bg_min_card = atoi(argv[2]);
- io::pbm::save(scribo::preprocessing::denoise(input, fg_min_card, bg_min_card),
- argv[4]);
+ I output = scribo::preprocessing::denoise_bg(input, c4(), bg_min_card);
+
+ io::pbm::save(output, argv[3]);
trace::exiting("main");
}
diff --git a/scribo/src/preprocessing/denoise.cc b/scribo/src/preprocessing/denoise_fg.cc
similarity index 78%
rename from scribo/src/preprocessing/denoise.cc
rename to scribo/src/preprocessing/denoise_fg.cc
index 0eb567b..307e8f6 100644
--- a/scribo/src/preprocessing/denoise.cc
+++ b/scribo/src/preprocessing/denoise_fg.cc
@@ -1,5 +1,4 @@
-// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -36,8 +35,7 @@ const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. 'True' for objects, 'False'\
for the background." },
- { "fg_min_card", "The minimum neighbor count to be set to true." },
- { "bg_min_card", "The minimum neighbor count to be set to false." },
+ { "fg_min_card", "The minimum neighbor count to be set to false." },
{0, 0}
};
@@ -46,12 +44,11 @@ int main(int argc, char *argv[])
{
using namespace mln;
- if (argc != 5)
+ if (argc != 4)
return scribo::debug::usage(argv,
- "Remove noise.",
- "input.pbm fg_min_card bg_min_card output.pbm",
- args_desc,
- "A binary image.");
+ "Remove noisy objects using c8 neighbors.",
+ "input.pbm fg_min_card output.pbm",
+ args_desc);
trace::entering("main");
@@ -60,10 +57,10 @@ int main(int argc, char *argv[])
io::pbm::load(input, argv[1]);
unsigned fg_min_card = atoi(argv[2]);
- unsigned bg_min_card = atoi(argv[3]);
- io::pbm::save(scribo::preprocessing::denoise(input, fg_min_card, bg_min_card),
- argv[4]);
+ I output = scribo::preprocessing::denoise_fg(input, c8(), fg_min_card);
+
+ io::pbm::save(output, argv[3]);
trace::exiting("main");
}
--
1.5.6.5
1
0

last-svn-commit-135-g40d5180 Add a specific toolchain for Nepomuk integration.
by Guillaume Lazzara 03 Jun '10
by Guillaume Lazzara 03 Jun '10
03 Jun '10
* convert/from_qimage.hh: New. convert an image2d to a QImage.
* core/line_info.hh: Add a new member has_text.
* text/recognition.hh: Remove an invalid precondition.
* toolchain/nepomuk/text_extraction.hh: New. Specific toolchain
for Nepomuk.
* tests/Makefile.am: Add toolchain/* subdirs.
* tests/toolchain/Makefile.am,
* tests/toolchain/nepomuk/Makefile.am: New.
* tests/img/wildly.pbm: New. New test image.
* tests/toolchain/nepomuk/text_extraction.cc: New. New test.
---
scribo/ChangeLog | 22 +++
.../crop.hh => convert/from_qimage.hh} | 68 +++++----
scribo/core/line_info.hh | 8 +
scribo/tests/Makefile.am | 1 +
scribo/tests/img/wildly.pbm | Bin 0 -> 2208 bytes
scribo/tests/{text => toolchain}/Makefile.am | 7 +-
.../{filter => toolchain/nepomuk}/Makefile.am | 27 +++-
.../tests/toolchain/nepomuk/text_extraction.cc | 31 ++---
scribo/text/recognition.hh | 2 -
scribo/toolchain/nepomuk/text_extraction.hh | 160 ++++++++++++++++++++
10 files changed, 265 insertions(+), 61 deletions(-)
copy scribo/{preprocessing/crop.hh => convert/from_qimage.hh} (55%)
create mode 100644 scribo/tests/img/wildly.pbm
copy scribo/tests/{text => toolchain}/Makefile.am (86%)
copy scribo/tests/{filter => toolchain/nepomuk}/Makefile.am (56%)
copy milena/mln/fun/n2v/all.hh => scribo/tests/toolchain/nepomuk/text_extraction.cc (75%)
create mode 100644 scribo/toolchain/nepomuk/text_extraction.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index de7acfa..a473c52 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,25 @@
+2010-06-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add a specific toolchain for Nepomuk integration.
+
+ * convert/from_qimage.hh: New. convert an image2d to a QImage.
+
+ * core/line_info.hh: Add a new member has_text.
+
+ * text/recognition.hh: Remove an invalid precondition.
+
+ * toolchain/nepomuk/text_extraction.hh: New. Specific toolchain
+ for Nepomuk.
+
+ * tests/Makefile.am: Add toolchain/* subdirs.
+
+ * tests/toolchain/Makefile.am,
+ * tests/toolchain/nepomuk/Makefile.am: New.
+
+ * tests/img/wildly.pbm: New. New test image.
+
+ * tests/toolchain/nepomuk/text_extraction.cc: New. New test.
+
2010-05-25 Guillaume Lazzara <z(a)lrde.epita.fr>
Cleanup sample tools.
diff --git a/scribo/preprocessing/crop.hh b/scribo/convert/from_qimage.hh
similarity index 55%
copy from scribo/preprocessing/crop.hh
copy to scribo/convert/from_qimage.hh
index c289f86..b297c2f 100644
--- a/scribo/preprocessing/crop.hh
+++ b/scribo/convert/from_qimage.hh
@@ -23,62 +23,70 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_PREPROCESSING_CROP_HH
-# define SCRIBO_PREPROCESSING_CROP_HH
-# include <mln/core/concept/image.hh>
-# include <mln/data/paste.hh>
+
+#ifndef SCRIBO_CONVERT_FROM_QIMAGE_HH
+# define SCRIBO_CONVERT_FROM_QIMAGE_HH
/// \file
///
-/// \brief Crop an image preserving the localization.
+/// Extract text from a document.
-namespace scribo
-{
+# include <QtGui/QImage>
- namespace preprocessing
- {
+# include <mln/value/qt/rgb32.hh>
- using namespace mln;
+# if QT_VERSION < 0x040000
+# error "Qt library too old. You need at least Qt 4.x."
+# endif // ! QT_VERSION
- /*! \brief crop an image preserving the localization.
+namespace scribo
+{
- \param[in] input An image.
- \param[in] domain A region of interest.
+ namespace convert
+ {
- \return An image defined on the domain \p domain with the
- corresponding data copied from \p input.
+ /*! \brief Convert a QImage to mln::image2d.
+ \param[in] ima A QImage. Prefer using QImage::Format_RGB32
+ image format to avoid conversions.
+
+ \return A RGB8 2D image in Milena's format.
*/
- template <typename I>
- mln_concrete(I)
- crop(const Image<I>& input, const mln_box(I)& domain);
+ mln::image2d<mln::value::qt::rgb32>
+ from_qimage(const QImage& ima);
# ifndef MLN_INCLUDE_ONLY
-
- template <typename I>
- mln_concrete(I)
- crop(const Image<I>& input, const mln_box(I)& domain)
+ mln::image2d<mln::value::qt::rgb32>
+ from_qimage(const QImage& ima)
{
- trace::entering("scribo::preprocessing::crop");
- mln_assertion(exact(input).is_valid());
+ QImage tmp = ima;
+
+ if (ima.format() != QImage::Format_RGB32)
+ tmp = ima.convertToFormat(QImage::Format_RGB32);
- mln_concrete(I) output(domain);
- data::paste(input | domain, output);
+ const int
+ nrows = tmp.height(),
+ ncols = tmp.width();
+
+ mln::image2d<mln::value::qt::rgb32> output(nrows, ncols, 0);
+
+ QImage qima(ncols, nrows, QImage::Format_RGB32);
+ std::memcpy(output.buffer(),
+ tmp.scanLine(0),
+ output.nelements() * 4);
- trace::exiting("scribo::preprocessing::crop");
return output;
}
-
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace scribo::preprocessing
+ } // end of namespace scribo::convert
} // end of namespace scribo
-#endif // ! SCRIBO_PREPROCESSING_CROP_HH
+#endif // ! SCRIBO_CONVERT_FROM_QIMAGE_HH
diff --git a/scribo/core/line_info.hh b/scribo/core/line_info.hh
index d0066c0..55d1430 100644
--- a/scribo/core/line_info.hh
+++ b/scribo/core/line_info.hh
@@ -125,6 +125,7 @@ namespace scribo
bool indented() const;
+ bool has_text() const;
const std::string& text() const;
void update_text(const std::string& str);
@@ -587,6 +588,13 @@ namespace scribo
}
template <typename L>
+ bool
+ line_info<L>::has_text() const
+ {
+ return !text_.empty();
+ }
+
+ template <typename L>
const std::string&
line_info<L>::text() const
{
diff --git a/scribo/tests/Makefile.am b/scribo/tests/Makefile.am
index 61570c8..4ef9ca1 100644
--- a/scribo/tests/Makefile.am
+++ b/scribo/tests/Makefile.am
@@ -25,6 +25,7 @@ SUBDIRS = \
preprocessing \
table \
text \
+ toolchain \
unit_test
# Regen files recursively.
diff --git a/scribo/tests/img/wildly.pbm b/scribo/tests/img/wildly.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..518fbec9b0814bb982ac9d901da02e5af1447d6d
GIT binary patch
literal 2208
zcmeIx-)qxQ6bJAV0|v@iUVSLb1z!}gYt=$G#=>w_go&dJ@v*7RXk|-6R>$^Wl0Pl}
z1^x?x{Q>693_`Bw+}mI2Qt&|(!CM&je)hdL$vMgKi`ql>ve!L0dDq)zAKtS|+rJpQ
z4tw5cHLa(gKA#WVSL3TEU1!AHQ}(RcY~!zmn_k<F?OPLj$OhN!?fA@gEY@l?85>O|
z-tP9cOVT*=hjzpE#uKY?>f^5N@tcza*0V2c%l|lHmNR6B_N9I1dgrz?VMo@$#Y0{H
znmsz|9d;krTAeoQv}^Ex{NW1l7{JK2V&$?5xtZ&~>R@7C&6U+W80bn4E3QS=uE)B}
z2T&TuZ*qA)<gjwS9?^C0I>0~e9i8sqh~@Jt5rD=co*A6e^YRqk;6SZjawY#lUO-4C
zDR8@bLwPOLGYHfSbYv``9xJhlj{iYdGT0;!g&V>#8({B+o9JppZbX<3u-0|T;|a;s
zVc9X6Xh3-rfbs=&D1XNT>3D8>U*z{?K3w>waBMl9V}eKL=<!Zg<yx|nZ7k=Fs84w<
z@v?f^6LK~6@&_f4W9j|8v+Vj;;YykW&9X<7SF$+pmR-A%emnC}-v89GYi1(yrmUO#
zgN^~<(Ta2FA$@Y9p0fV4Pc_5_3!nC7<|d-_Sf%#|8!5&<=+d!2;=P*s7P*NR!S{qm
z1>LL|TcCl;GoGu(9{<i0xRPEMe#>)(r~DgFWm^C?;2u6in)dPi6H(DFxu^8EUs^2|
z$zocXt@F5)nlF?!u151nX|m3>Qfj`Km3a=+iHeo08d&Sff!|)`Sm$a|8UM@p6Ql7>
A$^ZZW
literal 0
HcmV?d00001
diff --git a/scribo/tests/text/Makefile.am b/scribo/tests/toolchain/Makefile.am
similarity index 86%
copy from scribo/tests/text/Makefile.am
copy to scribo/tests/toolchain/Makefile.am
index f6cb0e5..826fb86 100644
--- a/scribo/tests/text/Makefile.am
+++ b/scribo/tests/toolchain/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -19,6 +19,5 @@
include $(top_srcdir)/scribo/tests/tests.mk
-check_PROGRAMS =
-
-TESTS = $(check_PROGRAMS)
+SUBDIRS = \
+ nepomuk
\ No newline at end of file
diff --git a/scribo/tests/filter/Makefile.am b/scribo/tests/toolchain/nepomuk/Makefile.am
similarity index 56%
copy from scribo/tests/filter/Makefile.am
copy to scribo/tests/toolchain/nepomuk/Makefile.am
index a023e4e..4bce3bd 100644
--- a/scribo/tests/filter/Makefile.am
+++ b/scribo/tests/toolchain/nepomuk/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -19,12 +19,27 @@
include $(top_srcdir)/scribo/tests/tests.mk
-check_PROGRAMS = \
- objects_with_holes \
- small_and_large_bboxes
+check_PROGRAMS =
-objects_with_holes_SOURCES = objects_with_holes.cc
-small_and_large_bboxes_SOURCES = small_and_large_bboxes.cc
+
+if HAVE_QT
+if HAVE_TESSERACT
+
+check_PROGRAMS += text_extraction
+text_extraction_SOURCES = text_extraction.cc
+text_extraction_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS)
+text_extraction_CPPFLAGS = $(QT_CPPFLAGS) $(AM_CPPFLAGS) \
+ $(TESSERACT_CPPFLAGS) \
+ $(TIFF_CPPFLAGS)
+text_extraction_LDFLAGS = $(QT_LDFLAGS) $(LDFLAGS) \
+ $(TESSERACT_LDFLAGS) \
+ $(TIFF_LDFLAGS) \
+ -lpthread
+text_extraction_LDADD = $(QT_LIBS) $(LDADD)
+
+endif HAVE_TESSERACT
+endif HAVE_QT
+
TESTS = $(check_PROGRAMS)
diff --git a/milena/mln/fun/n2v/all.hh b/scribo/tests/toolchain/nepomuk/text_extraction.cc
similarity index 75%
copy from milena/mln/fun/n2v/all.hh
copy to scribo/tests/toolchain/nepomuk/text_extraction.cc
index 0e0e55c..c1b51ea 100644
--- a/milena/mln/fun/n2v/all.hh
+++ b/scribo/tests/toolchain/nepomuk/text_extraction.cc
@@ -23,29 +23,22 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_N2V_ALL_HH
-# define MLN_FUN_N2V_ALL_HH
-
/// \file
///
-/// File that includes all functions from nil to value.
-
+/// Test of scribo::toolchain::nepomuk::text_extraction
-namespace mln
-{
+#include <QtGui/QImage>
+#include <QtCore>
+#include <scribo/toolchain/nepomuk/text_extraction.hh>
- namespace fun
- {
+#include <scribo/tests/data.hh>
- /// \brief Namespace of functions from nil to value.
- ///
- /// \ingroup modfun
- namespace n2v {}
+int main()
+{
+ QImage ima(SCRIBO_IMG_DIR "/wildly.pbm");
+ QSet<QString> words = scribo::toolchain::nepomuk::text_extraction(ima);
- }
+ mln_assertion(words.size() == 1);
+ mln_assertion(words.contains("Wildly"));
+ return 0;
}
-
-
-# include <mln/fun/n2v/white_gaussian.hh>
-
-#endif // ! MLN_FUN_N2V_ALL_HH
diff --git a/scribo/text/recognition.hh b/scribo/text/recognition.hh
index f8d8f4f..44533e9 100644
--- a/scribo/text/recognition.hh
+++ b/scribo/text/recognition.hh
@@ -104,8 +104,6 @@ namespace scribo
{
trace::entering("scribo::text::recognition");
- mln_precondition(lines.is_valid());
-
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
diff --git a/scribo/toolchain/nepomuk/text_extraction.hh b/scribo/toolchain/nepomuk/text_extraction.hh
new file mode 100644
index 0000000..ed486f5
--- /dev/null
+++ b/scribo/toolchain/nepomuk/text_extraction.hh
@@ -0,0 +1,160 @@
+// 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_TOOLCHAIN_TEXT_EXTRACTION_HH
+# define SCRIBO_TOOLCHAIN_TEXT_EXTRACTION_HH
+
+/// \file
+///
+/// Extract text from a document.
+
+
+# include <QtCore/QString>
+# include <QtCore/QStringList>
+# include <QtGui/QImage>
+
+# include <mln/core/image/image2d.hh>
+# include <mln/data/transform.hh>
+# include <mln/logical/not.hh>
+# include <mln/value/qt/rgb32.hh>
+# include <mln/fun/v2v/qt_rgb_to_int_u.hh>
+
+# include <scribo/convert/from_qimage.hh>
+# include <scribo/binarization/sauvola_ms.hh>
+# include <scribo/preprocessing/deskew.hh>
+# include <scribo/toolchain/text_in_doc.hh>
+
+
+namespace scribo
+{
+
+ namespace toolchain
+ {
+
+ namespace nepomuk
+ {
+
+ /*! \brief Extract text from a document.
+
+ This is a convenient routine to be used in Nepomuk.
+
+
+
+ \param[in] ima A document image. The
+
+ \return A set of recognized words.
+
+ */
+ QSet<QString>
+ text_extraction(const QImage& input);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ QSet<QString>
+ text_extraction(const QImage& input)
+ {
+ trace::entering("scribo::toolchain::nepomuk::text_extraction");
+
+ mln_precondition(!input.isNull());
+
+ typedef image2d<scribo::def::lbl_type> L;
+
+ // Convert image to Milena's format.
+ mln::image2d<mln::value::qt::rgb32>
+ input_mln = scribo::convert::from_qimage(input);
+
+ image2d<bool> input_bin;
+
+
+ // Preprocess
+ {
+ // Convert to Gray level image.
+ image2d<value::int_u8>
+ input_gl = data::transform(input_mln,
+ mln::fun::v2v::qt_rgb_to_int_u<8>());
+
+ // Deskew if needed.
+ input_gl = preprocessing::deskew(input_gl);
+
+ // Binarize foreground to use it in the processing chain.
+ input_bin = scribo::binarization::sauvola_ms(input_gl, 101, 3);
+ }
+
+
+
+
+ line_set<L> lines_bg, lines_fg;
+ // Process
+ {
+ // Run document toolchain.
+ lines_bg = scribo::toolchain::text_in_doc(input_bin, false, false);
+
+ // Negate document.
+ logical::not_inplace(input_bin);
+
+ // Run document toolchain.
+ lines_fg = scribo::toolchain::text_in_doc(input_bin, false, false);
+ }
+
+
+ QSet<QString> output;
+
+ // Construct output
+ {
+ QTextCodec *codec = QTextCodec::codecForName("UTF-8");
+
+ QString tmp_out;
+ QTextStream stream(&tmp_out, QIODevice::WriteOnly);
+ stream.setCodec("UTF-8");
+
+ for_all_lines(l, lines_bg)
+ if (lines_bg(l).has_text())
+ stream << " " << codec->toUnicode(lines_bg(l).text().c_str());
+
+ for_all_lines(l, lines_fg)
+ if (lines_fg(l).has_text())
+ stream << " " << codec->toUnicode(lines_fg(l).text().c_str());
+
+ QStringList list = tmp_out.split(' ', QString::SkipEmptyParts);
+
+ output = QSet<QString>::fromList(list);
+ }
+
+ trace::exiting("scribo::toolchain::nepomuk::text_extraction");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::toolchain::nepomuk
+
+ } // end of namespace scribo::toolchain
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_TOOLCHAIN_TEXT_EXTRACTION_HH
--
1.5.6.5
1
0

last-svn-commit-163-gbfdea8d lrde-upload.sh: Fix and factor uses of chmod.
by Roland Levillain 02 Jun '10
by Roland Levillain 02 Jun '10
02 Jun '10
---
ChangeLog | 4 ++++
lrde-upload.sh | 22 ++++++++++------------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1e17844..c35f101 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-02 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * lrde-upload.sh: Fix and factor uses of chmod.
+
2010-05-03 Roland Levillain <roland(a)lrde.epita.fr>
* AUTHORS: Update.
diff --git a/lrde-upload.sh b/lrde-upload.sh
index 436beb7..5f61ef2 100755
--- a/lrde-upload.sh
+++ b/lrde-upload.sh
@@ -74,35 +74,30 @@ find $DEST -maxdepth 1 -type f -mtime +1 -name 'olena-*-snapshot-*' \
# Upload the `.tar.gz' tarball.
cp -f olena-$VERSION.tar.gz $DEST/olena-$REV.tar.gz.tmp
mv -f $DEST/olena-$REV.tar.gz.tmp $DEST/olena-$REV.tar.gz
-chmod -R a+r $DEST/olena-$REV.tar.gz
# Upload the `.tar.bz2' tarball.
cp -f olena-$VERSION.tar.bz2 $DEST/olena-$REV.tar.bz2.tmp
mv -f $DEST/olena-$REV.tar.bz2.tmp $DEST/olena-$REV.tar.bz2
-chmod -R a+r $DEST/olena-$REV.tar.bz2
# Upload a copy of the reference manual and other documentation.
mkdir -p $DEST_DOC
# BuildBots' buildslaves set umask to 077 in their default
-# configuration. Set read permissions for all on uploaded files.
-cp milena/doc/ref-guide.pdf $DEST_DOC && chmod a+r $DEST_DOC/ref-guide.pdf
-cp milena/doc/tutorial.pdf $DEST_DOC && chmod a+r $DEST_DOC/tutorial.pdf
-cp milena/doc/user-refman.pdf $DEST_DOC && chmod a+r $DEST_DOC/user-refman.pdf
-cp milena/doc/white-paper.pdf $DEST_DOC && chmod a+r $DEST_DOC/white-paper.pdf
+# configuration.
+cp milena/doc/ref-guide.pdf $DEST_DOC
+cp milena/doc/tutorial.pdf $DEST_DOC
+cp milena/doc/user-refman.pdf $DEST_DOC
+cp milena/doc/white-paper.pdf $DEST_DOC
rm -rf $DEST_DOC/user-refman.tmp
rm -rf $DEST_DOC/white-paper.tmp
-# Upload only the HTML version of the user reference manual.
+# Upload only the HTML version (not the LaTeX sources) of the user
+# reference manual.
cp -pR milena/doc/user-refman/html $DEST_DOC/user-refman.tmp
cp -pR milena/doc/white-paper $DEST_DOC/white-paper.tmp
-# Likewise, set permissions for all on uploaded directories.
-chmod -R a+rX $DEST_DOC/user-refman.tmp
-chmod -R a+rX $DEST_DOC/white-paper.tmp
-
if test -e $DEST_DOC/user-refman; then
rm -rf $DEST_DOC/user-refman.old
mv -f $DEST_DOC/user-refman $DEST_DOC/user-refman.old
@@ -118,6 +113,9 @@ mv -f $DEST_DOC/white-paper.tmp $DEST_DOC/white-paper
rm -rf $DEST_DOC/user-refman.old
rm -rf $DEST_DOC/white-paper.old
+# Expose uploaded files.
+chmod -R a+rX $DEST
+
# We want to be able to modify these files with both the `build' and
# `doc' accounts.
chmod -R g+w $DEST_DOC/user-refman
--
1.5.6.5
1
0