* demo/xml2doc/image_crop.cc: Abort xml loading if an error
is found.
* scribo/core/line_info.hh: Fix text cleanup.
* scribo/io/img/save.hh: Add documentation.
* scribo/io/xml/internal/extended_page_xml_visitor.hh: Use
internal_gradient.
* scribo/primitive/extract/alignments.hh: Set component type to
whitespaceSeparator.
* src/binarization/sauvola_ms_fg.cc: Fix argument use.
---
scribo/ChangeLog | 19 +++++++++++++++++++
scribo/demo/xml2doc/image_crop.cc | 2 ++
scribo/scribo/core/line_info.hh | 3 ++-
scribo/scribo/io/img/save.hh | 7 +++++++
.../io/xml/internal/extended_page_xml_visitor.hh | 4 ++--
scribo/scribo/primitive/extract/alignments.hh | 2 +-
scribo/src/binarization/sauvola_ms_fg.cc | 6 ++++--
7 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index fc761c3..a213078 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,24 @@
2011-05-04 Guillaume Lazzara <lazzara(a)fidji.lrde.epita.fr>
+ Small fixes in Scribo.
+
+ * demo/xml2doc/image_crop.cc: Abort xml loading if an error
+ is found.
+
+ * scribo/core/line_info.hh: Fix text cleanup.
+
+ * scribo/io/img/save.hh: Add documentation.
+
+ * scribo/io/xml/internal/extended_page_xml_visitor.hh: Use
+ internal_gradient.
+
+ * scribo/primitive/extract/alignments.hh: Set component type to
+ whitespaceSeparator.
+
+ * src/binarization/sauvola_ms_fg.cc: Fix argument use.
+
+2011-05-04 Guillaume Lazzara <lazzara(a)fidji.lrde.epita.fr>
+
Make paragraph extraction work with this branch.
* scribo/core/line_info.hh: Keep few attributes public and update
diff --git a/scribo/demo/xml2doc/image_crop.cc b/scribo/demo/xml2doc/image_crop.cc
index 29a93d8..ba30d8a 100644
--- a/scribo/demo/xml2doc/image_crop.cc
+++ b/scribo/demo/xml2doc/image_crop.cc
@@ -326,6 +326,8 @@ bool ImageCrop::crop_regions(bool temp)
else
{
f.close();
+ qDebug() << "Error while reading XML file!";
+ abort();
return false;
}
}
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index 27dda84..e91e1c3 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -351,7 +351,7 @@ namespace scribo
static std::map<char, std::string> map = init_map();
std::string output = input;
- for (unsigned i = 0; i < input.size(); ++i)
+ for (unsigned i = 0; i < output.size(); ++i)
{
std::map<char, std::string>::iterator it = map.find(output.at(i));
if (it != map.end())
@@ -360,6 +360,7 @@ namespace scribo
i += it->second.size() - 1;
}
}
+
return output;
}
diff --git a/scribo/scribo/io/img/save.hh b/scribo/scribo/io/img/save.hh
index 56300d6..04f0a3c 100644
--- a/scribo/scribo/io/img/save.hh
+++ b/scribo/scribo/io/img/save.hh
@@ -66,6 +66,13 @@ namespace scribo
NonText : Display non-text regions.
Full : Text and non-text regions.
+
+ DebugWoImage : Display all regions onto a subsampled copy of
+ the original image. A dark background is used as background.
+
+ DebugWithImage : Display all regions onto a subsampled copy of
+ the original image. The original image is used as background.
+
*/
enum Format
{
diff --git a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
index b906a4a..b463677 100644
--- a/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
+++ b/scribo/scribo/io/xml/internal/extended_page_xml_visitor.hh
@@ -32,7 +32,7 @@
# include <fstream>
-# include <mln/morpho/elementary/gradient_external.hh>
+# include <mln/morpho/elementary/gradient_internal.hh>
# include <mln/pw/all.hh>
# include <mln/core/image/dmorph/image_if.hh>
@@ -122,7 +122,7 @@ namespace scribo
if (doc.has_elements())
{
// Prepare element edges
- elt_edge = morpho::elementary::gradient_external(doc.elements().labeled_image(),
c4());
+ elt_edge = morpho::elementary::gradient_internal(doc.elements().labeled_image(),
c4());
doc.elements().accept(*this);
}
diff --git a/scribo/scribo/primitive/extract/alignments.hh
b/scribo/scribo/primitive/extract/alignments.hh
index 8d18d93..1e3d835 100644
--- a/scribo/scribo/primitive/extract/alignments.hh
+++ b/scribo/scribo/primitive/extract/alignments.hh
@@ -1085,7 +1085,7 @@ namespace scribo
V ndelim;
component_set<L>
- delim_comps = primitive::extract::components(delimitors, c8(), ndelim);
+ delim_comps = primitive::extract::components(delimitors, c8(), ndelim,
component::WhitespaceSeparator);
mln::util::couple<component_set<L>, mln_ch_value(L,bool)>
output(delim_comps, delimitors);
diff --git a/scribo/src/binarization/sauvola_ms_fg.cc
b/scribo/src/binarization/sauvola_ms_fg.cc
index 7ff9321..2c5e7fa 100644
--- a/scribo/src/binarization/sauvola_ms_fg.cc
+++ b/scribo/src/binarization/sauvola_ms_fg.cc
@@ -58,10 +58,10 @@ bool check_args(int argc, char * argv[])
const char *args_desc[][2] =
{
{ "input.*", "An image." },
- { "output.pbm", "A binary image." },
{ "lambda", "Lambda used to split bg/fg." },
{ "w", "Window size at scale 1. (Common value: 101)" },
{ "s", "First subsampling ratio (Common value: 3)." },
+ { "output.pbm", "A binary image." },
{0, 0}
};
@@ -92,6 +92,8 @@ int main(int argc, char *argv[])
std::cout << "Using w_1=" << w_1 << " - s="
<< s << std::endl;
+ Magick::InitializeMagick(0);
+
// Load
image2d<value::rgb8> input_1;
io::magick::load(input_1, argv[1]);
@@ -108,7 +110,7 @@ int main(int argc, char *argv[])
image2d<bool>
output = scribo::binarization::sauvola_ms(fg_gl, w_1, s, SCRIBO_DEFAULT_SAUVOLA_K);
- io::pbm::save(output, argv[6]);
+ io::pbm::save(output, argv[5]);
}
--
1.5.6.5