* scribo/toolchain/internal/text_in_picture_functor.hh
(text_in_picture_functor<I>::get_factor): New precondition: ensure
argument `max_dim_size', used as denominator, is non null.
(text_in_picture_functor<I>::operator()): Do not resize the image
if `max_dim_size' is null.
Some cosmetic changes.
---
scribo/ChangeLog | 11 ++++++
.../toolchain/internal/text_in_picture_functor.hh | 36 ++++++++++++--------
2 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 16349b1..00dee14 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,16 @@
2013-07-30 Roland Levillain <roland(a)lrde.epita.fr>
+ Fix resizing code in toolchain::internal::text_in_picture_functor.
+
+ * scribo/toolchain/internal/text_in_picture_functor.hh
+ (text_in_picture_functor<I>::get_factor): New precondition: ensure
+ argument `max_dim_size', used as denominator, is non null.
+ (text_in_picture_functor<I>::operator()): Do not resize the image
+ if `max_dim_size' is null.
+ Some cosmetic changes.
+
+2013-07-30 Roland Levillain <roland(a)lrde.epita.fr>
+
Add missing `mln' namespace qualifiers.
* scribo/filter/object_groups_with_holes.hh
diff --git a/scribo/scribo/toolchain/internal/text_in_picture_functor.hh
b/scribo/scribo/toolchain/internal/text_in_picture_functor.hh
index 7812cc6..a2399ad 100644
--- a/scribo/scribo/toolchain/internal/text_in_picture_functor.hh
+++ b/scribo/scribo/toolchain/internal/text_in_picture_functor.hh
@@ -182,8 +182,11 @@ namespace scribo
template <typename I>
unsigned
- text_in_picture_functor<I>::get_factor(const I& ima, unsigned
max_dim_size)
+ text_in_picture_functor<I>::get_factor(const I& ima,
+ unsigned max_dim_size)
{
+ mln_precondition(max_dim_size != 0);
+
unsigned
nrows = ima.nrows(),
ncols = ima.ncols(),
@@ -233,28 +236,31 @@ namespace scribo
std::cout << "Using lambda = " << lambda << std::endl;
- on_new_progress_label("Resizing image if needed...");
-
+ mln_concrete(I) input_rgb;
if (max_dim_size != 0)
- max_dim_size = max_dim_size;
+ {
+ on_new_progress_label("Resizing image if needed...");
- unsigned factor = get_factor(input_rgb_orig, max_dim_size);
+ unsigned factor = get_factor(input_rgb_orig, max_dim_size);
- if (verbose)
- {
- std::cout << "Reduction Factor : " << factor <<
std::endl;
- std::cout << "Original domain: " << input_rgb_orig.domain()
<< std::endl;
- }
+ if (verbose)
+ std::cout << "Reduction Factor : " << factor
+ << std::endl
+ << "Original domain: " << input_rgb_orig.domain()
+ << std::endl;
- mln_concrete(I)
- input_rgb = mln::subsampling::antialiased(input_rgb_orig, factor);
+ mln_concrete(I)
+ input_rgb = mln::subsampling::antialiased(input_rgb_orig, factor);
- if (verbose)
- std::cout << "Resized domain: " << input_rgb.domain() <<
std::endl;
+ if (verbose)
+ std::cout << "Resized domain: " << input_rgb.domain()
+ << std::endl;
+ }
+ else
+ input_rgb = input_rgb_orig;
on_progress();
-
mln_ch_value(I,value::int_u8) intensity_ima;
if (enable_bg_removal)
{
--
1.7.10.4
Show replies by date