last-svn-commit-839-g5b660b4 Small fixes in Scribo.

* scribo/core/component_features_data.hh: Fix default attributes initialization. * scribo/core/line_info.hh: Compute color and boldness if available in components data. * scribo/filter/object_links_left_aligned.hh, * scribo/filter/object_links_right_aligned.hh: Fix doc. * scribo/preprocessing/rotate_90.hh: Disable preconditions. * scribo/primitive/extract/alignments.hh: Avoid a warning. * src/preprocessing/split_bg_fg.cc: Initialize Magick++. --- scribo/ChangeLog | 19 +++++++++++++ scribo/scribo/core/component_features_data.hh | 8 +++++ scribo/scribo/core/line_info.hh | 28 +++++++++++-------- scribo/scribo/filter/object_links_left_aligned.hh | 19 ++++++------- scribo/scribo/filter/object_links_right_aligned.hh | 19 ++++++------- scribo/scribo/preprocessing/rotate_90.hh | 8 ++++- scribo/scribo/primitive/extract/alignments.hh | 1 + scribo/src/preprocessing/split_bg_fg.cc | 6 +++- 8 files changed, 72 insertions(+), 36 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index d223777..a0d4937 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,24 @@ 2011-04-06 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes in Scribo. + + * scribo/core/component_features_data.hh: Fix default + attributes initialization. + + * scribo/core/line_info.hh: Compute color and boldness if + available in components data. + + * scribo/filter/object_links_left_aligned.hh, + * scribo/filter/object_links_right_aligned.hh: Fix doc. + + * scribo/preprocessing/rotate_90.hh: Disable preconditions. + + * scribo/primitive/extract/alignments.hh: Avoid a warning. + + * src/preprocessing/split_bg_fg.cc: Initialize Magick++. + +2011-04-06 Guillaume Lazzara <z@lrde.epita.fr> + Change test image format to pnm. * tests/img/alignment_1.png, diff --git a/scribo/scribo/core/component_features_data.hh b/scribo/scribo/core/component_features_data.hh index f5ba60f..07b3e4a 100644 --- a/scribo/scribo/core/component_features_data.hh +++ b/scribo/scribo/core/component_features_data.hh @@ -38,6 +38,8 @@ namespace scribo struct component_features_data { + component_features_data(); + bool valid; scribo::def::color_type color; float boldness; @@ -50,6 +52,12 @@ namespace scribo # ifndef MLN_INCLUDE_ONLY + component_features_data::component_features_data() + : valid(false) + { + } + + inline std::ostream& operator<<(std::ostream& ostr, const component_features_data& data) diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh index 73d7856..e925db7 100644 --- a/scribo/scribo/core/line_info.hh +++ b/scribo/scribo/core/line_info.hh @@ -1040,19 +1040,23 @@ namespace scribo // incremented. ++used_comps; - // Compute boldness - boldness.take(comp_set(c).features().boldness); - sum2_boldness += mln::math::sqr<float>(comp_set(c).features().boldness); - - // Compute color - color_red.take(comp_set(c).features().color.red()); - color_green.take(comp_set(c).features().color.green()); - color_blue.take(comp_set(c).features().color.blue()); - - sum2_red += mln::math::sqr<unsigned>(comp_set(c).features().color.red()); - sum2_green += mln::math::sqr<unsigned>(comp_set(c).features().color.green()); - sum2_blue += mln::math::sqr<unsigned>(comp_set(c).features().color.blue()); + // COMPUTE FEATURES DATA + if (comp_set(c).has_features()) + { + // Compute boldness + boldness.take(comp_set(c).features().boldness); + sum2_boldness += mln::math::sqr<float>(comp_set(c).features().boldness); + + // Compute color + color_red.take(comp_set(c).features().color.red()); + color_green.take(comp_set(c).features().color.green()); + color_blue.take(comp_set(c).features().color.blue()); + + sum2_red += mln::math::sqr<unsigned>(comp_set(c).features().color.red()); + sum2_green += mln::math::sqr<unsigned>(comp_set(c).features().color.green()); + sum2_blue += mln::math::sqr<unsigned>(comp_set(c).features().color.blue()); + } // FIXME: we must guaranty here that the relationship is from // right to left, otherwise, the space size computed between diff --git a/scribo/scribo/filter/object_links_left_aligned.hh b/scribo/scribo/filter/object_links_left_aligned.hh index 82d4185..830678a 100644 --- a/scribo/scribo/filter/object_links_left_aligned.hh +++ b/scribo/scribo/filter/object_links_left_aligned.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -58,15 +58,14 @@ namespace scribo \verbatim - ~ - ~ ^ - ~ | - ~ | + + ~ ^ + ~ | ~------ | Alpha - ~ | | | - ~ | | | - ~ | | v - ------ ~ ~ ~ | ~ ~| ~ + ~ | | | + ~ | | | + ~ | | v + ~----- ~ ~ ~ | ~ ~| ~ | | | | | x------------x | | | | | diff --git a/scribo/scribo/filter/object_links_right_aligned.hh b/scribo/scribo/filter/object_links_right_aligned.hh index 07ca309..4f854e2 100644 --- a/scribo/scribo/filter/object_links_right_aligned.hh +++ b/scribo/scribo/filter/object_links_right_aligned.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -58,15 +58,14 @@ namespace scribo \verbatim + + ~ - ~ ^ - ~ | - ~ | - ~------ | Alpha - ~ | | | - ~ | | | - ~ | | v - ------ ~ ~ ~ | ~ ~| ~ + -----~ ^ + | ~ | | Alpha + ~| | | + ~ | | v + ------ ~ ~ ~ | ~ ~| ~ ~ | | | | | x------------x | | | | | diff --git a/scribo/scribo/preprocessing/rotate_90.hh b/scribo/scribo/preprocessing/rotate_90.hh index 8db703d..e6d68c8 100644 --- a/scribo/scribo/preprocessing/rotate_90.hh +++ b/scribo/scribo/preprocessing/rotate_90.hh @@ -80,8 +80,12 @@ namespace scribo const I& input = exact(input_); mln_precondition(input.is_valid()); - mln_precondition(input.domain().pmin().row() > 0); - mln_precondition(input.domain().pmin().col() > 0); + + // FIXME: Does this routine accept images with an origin + // different from (0,0) and with negative coordinates? + // + // mln_precondition(input.domain().pmin().row() > 0); + // mln_precondition(input.domain().pmin().col() > 0); // Works only on one block images. mlc_is(mln_trait_image_value_access(I), diff --git a/scribo/scribo/primitive/extract/alignments.hh b/scribo/scribo/primitive/extract/alignments.hh index 5314683..4bd925e 100644 --- a/scribo/scribo/primitive/extract/alignments.hh +++ b/scribo/scribo/primitive/extract/alignments.hh @@ -559,6 +559,7 @@ namespace scribo const object_groups<L>& groups = doc.paragraphs().lines().groups(); const line_set<L>& lines = doc.lines(); + (void) groups; // Avoid warnings when debug is disabled. // 1. Construct an image of group bounding boxes. // diff --git a/scribo/src/preprocessing/split_bg_fg.cc b/scribo/src/preprocessing/split_bg_fg.cc index 270093c..2b68b53 100644 --- a/scribo/src/preprocessing/split_bg_fg.cc +++ b/scribo/src/preprocessing/split_bg_fg.cc @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -49,6 +49,8 @@ int main(int argc, char *argv[]) mln::trace::entering("main"); using namespace mln; + Magick::InitializeMagick(0); + if (argc != 6) return scribo::debug::usage(argv, "Split background and foreground.", -- 1.5.6.5
participants (1)
-
Guillaume Lazzara