* scribo/binarization/internal/first_pass_functor.hh,
* scribo/binarization/sauvola_ms.hh,
* scribo/binarization/sauvola_threshold_image.hh,
* scribo/binarization/sauvola_threshold_image_debug.hh,
* scribo/postprocessing/fill_object_holes.hh,
* scribo/preprocessing/deskew.hh,
* scribo/primitive/extract/lines_pattern.hh,
* scribo/subsampling/bilinear.hh,
* scribo/subsampling/integral_single_image.hh,
* scribo/text/clean_inplace.hh,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc: explicitly
convert to a specific type when necessary.
---
scribo/ChangeLog | 25 ++++++++++++++++++++
.../binarization/internal/first_pass_functor.hh | 25 +++++++++++--------
scribo/scribo/binarization/sauvola_ms.hh | 6 ++--
.../scribo/binarization/sauvola_threshold_image.hh | 12 ++++----
.../binarization/sauvola_threshold_image_debug.hh | 13 +++++----
scribo/scribo/postprocessing/fill_object_holes.hh | 9 +++----
scribo/scribo/preprocessing/deskew.hh | 8 +++---
scribo/scribo/primitive/extract/lines_pattern.hh | 4 +-
scribo/scribo/subsampling/bilinear.hh | 4 +-
scribo/scribo/subsampling/integral_single_image.hh | 11 ++++----
scribo/scribo/text/clean_inplace.hh | 2 +-
.../src/debug/show_links_several_right_overlap.cc | 4 +-
scribo/src/debug/show_links_single_down.cc | 4 +-
.../debug/show_links_single_down_left_aligned.cc | 2 +-
.../debug/show_links_single_down_right_aligned.cc | 2 +-
scribo/src/debug/show_links_single_left.cc | 5 ++-
scribo/src/debug/show_links_single_right.cc | 4 +-
scribo/src/debug/show_links_single_up.cc | 4 +-
.../src/debug/show_links_single_up_left_aligned.cc | 2 +-
.../debug/show_links_single_up_right_aligned.cc | 2 +-
20 files changed, 89 insertions(+), 59 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f1f4f72..26f8445 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,30 @@
2010-08-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix warnings with g++-4.1 in Scribo.
+
+ * scribo/binarization/internal/first_pass_functor.hh,
+ * scribo/binarization/sauvola_ms.hh,
+ * scribo/binarization/sauvola_threshold_image.hh,
+ * scribo/binarization/sauvola_threshold_image_debug.hh,
+ * scribo/postprocessing/fill_object_holes.hh,
+ * scribo/preprocessing/deskew.hh,
+ * scribo/primitive/extract/lines_pattern.hh,
+ * scribo/subsampling/bilinear.hh,
+ * scribo/subsampling/integral_single_image.hh,
+ * scribo/text/clean_inplace.hh,
+ * src/debug/show_links_several_right_overlap.cc,
+ * src/debug/show_links_single_down.cc,
+ * src/debug/show_links_single_down_left_aligned.cc,
+ * src/debug/show_links_single_down_right_aligned.cc,
+ * src/debug/show_links_single_left.cc,
+ * src/debug/show_links_single_right.cc,
+ * src/debug/show_links_single_up.cc,
+ * src/debug/show_links_single_up_left_aligned.cc,
+ * src/debug/show_links_single_up_right_aligned.cc: explicitly
+ convert to a specific type when necessary.
+
+2010-08-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Regen headers.mk and unit-tests.mk in Scribo.
* headers.mk,
diff --git a/scribo/scribo/binarization/internal/first_pass_functor.hh
b/scribo/scribo/binarization/internal/first_pass_functor.hh
index 96c7cfb..92ccc55 100644
--- a/scribo/scribo/binarization/internal/first_pass_functor.hh
+++ b/scribo/scribo/binarization/internal/first_pass_functor.hh
@@ -115,18 +115,21 @@ namespace scribo
unsigned p = pxl.offset();
# ifdef SCRIBO_SAUVOLA_DEBUG
- value::int_u8
- t_p = sauvola_threshold_formula(mean, stddev,
- K_,
- SCRIBO_DEFAULT_SAUVOLA_R,
- debug_k.element(p),
- debug_s_n.element(p),
- debug_k_l.element(p));
+ value::int_u8 t_p;
+ convert::from_to(
+ sauvola_threshold_formula(mean, stddev,
+ K_,
+ SCRIBO_DEFAULT_SAUVOLA_R,
+ debug_k.element(p),
+ debug_s_n.element(p),
+ debug_k_l.element(p)),
+ t_p);
# else
- value::int_u8
- t_p = sauvola_threshold_formula(mean, stddev,
- K_,
- SCRIBO_DEFAULT_SAUVOLA_R);
+ value::int_u8 t_p;
+ convert::from_to(sauvola_threshold_formula(mean, stddev,
+ K_,
+ SCRIBO_DEFAULT_SAUVOLA_R),
+ t_p);
# endif // SCRIBO_SAUVOLA_DEBUG
diff --git a/scribo/scribo/binarization/sauvola_ms.hh
b/scribo/scribo/binarization/sauvola_ms.hh
index 8964324..e767b86 100644
--- a/scribo/scribo/binarization/sauvola_ms.hh
+++ b/scribo/scribo/binarization/sauvola_ms.hh
@@ -150,7 +150,7 @@ namespace scribo
typedef point2d P;
// Cast to float is needed on MacOS X.
- unsigned ratio = std::pow(float(q), float(i - 2u)); // Ratio in comparison to e_2
+ unsigned ratio = unsigned(std::pow(float(q), float(i - 2u))); // Ratio in comparison to
e_2
unsigned
w_local = w * ratio,
@@ -875,7 +875,7 @@ namespace scribo
{
int i = sub_ima.size() - 1;
// Cast to float is needed on MacOS X.
- unsigned ratio = std::pow(float(q), float(i - 2)); // Ratio compared to e_2
+ unsigned ratio = unsigned(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),
@@ -890,7 +890,7 @@ namespace scribo
for (int i = sub_ima.size() - 2; i > 2; --i)
{
// Cast to float is needed on MacOS X.
- unsigned ratio = std::pow(float(q), float(i - 2)); // Ratio compared to e_2
+ unsigned ratio = unsigned(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/scribo/binarization/sauvola_threshold_image.hh
b/scribo/scribo/binarization/sauvola_threshold_image.hh
index 5382650..0225d37 100644
--- a/scribo/scribo/binarization/sauvola_threshold_image.hh
+++ b/scribo/scribo/binarization/sauvola_threshold_image.hh
@@ -245,7 +245,6 @@ namespace scribo
sauvola_threshold_formula(double m_x_y, double s_x_y)
{
# ifdef SCRIBO_SAUVOLA_DEBUG
-# warning "This overload of sauvola_threshold_formula is disabled in debug
mode!"
std::cout << "This overload of sauvola_threshold_formula is disabled in debug
mode!" << std::endl;
return 0;
# else
@@ -438,11 +437,12 @@ namespace scribo
for(def::coord row = 0; row < nrows; ++row)
for(def::coord col = 0; col < ncols; ++col)
- output.at_(row, col)
- = internal::compute_sauvola_threshold(P(row, col), simple,
- squared, window_size,
- K,
- SCRIBO_DEFAULT_SAUVOLA_R);
+ convert::from_to(
+ internal::compute_sauvola_threshold(P(row, col), simple,
+ squared, window_size,
+ K,
+ SCRIBO_DEFAULT_SAUVOLA_R),
+ output.at_(row, col));
trace::exiting("scribo::binarization::impl::generic::sauvola_threshold");
return output;
diff --git a/scribo/scribo/binarization/sauvola_threshold_image_debug.hh
b/scribo/scribo/binarization/sauvola_threshold_image_debug.hh
index a507920..fd317bc 100644
--- a/scribo/scribo/binarization/sauvola_threshold_image_debug.hh
+++ b/scribo/scribo/binarization/sauvola_threshold_image_debug.hh
@@ -237,12 +237,13 @@ namespace scribo
for(def::coord row = 0; row < nrows; ++row)
for(def::coord col = 0; col < ncols; ++col)
- output.at_(row, col)
- = internal::compute_sauvola_threshold(P(row, col),
- mean, stddev, thres,
- simple, squared,
- window_size, K,
- SCRIBO_DEFAULT_SAUVOLA_R);
+ convert::from_to(
+ internal::compute_sauvola_threshold(P(row, col),
+ mean, stddev, thres,
+ simple, squared,
+ window_size, K,
+ SCRIBO_DEFAULT_SAUVOLA_R),
+ output.at_(row, col));
trace::exiting("scribo::binarization::impl::generic::sauvola_threshold");
return output;
diff --git a/scribo/scribo/postprocessing/fill_object_holes.hh
b/scribo/scribo/postprocessing/fill_object_holes.hh
index 43c02ab..14416be 100644
--- a/scribo/scribo/postprocessing/fill_object_holes.hh
+++ b/scribo/scribo/postprocessing/fill_object_holes.hh
@@ -174,13 +174,12 @@ namespace scribo
L bboxes_ima;
util::array<unsigned> bg_comps(
- static_cast<unsigned>(components.nelements()) + 1, 0);
+ unsigned(components.nelements()) + 1, 0);
util::array<bool> bg_comps_done(
- static_cast<unsigned>(components.nelements()) + 1, false);
+ unsigned(components.nelements()) + 1, false);
mln::fun::i2v::array<bool>
- to_keep(static_cast<unsigned>(components.nelements()) + 1,
- false);
+ to_keep(unsigned(components.nelements()) + 1, false);
const L& lbl = components.labeled_image();
@@ -366,7 +365,7 @@ namespace scribo
util::array<unsigned>& card = res.second().first();
for (unsigned i = 1; i < card.size(); ++i)
- card(i) = card(i) * ratio;
+ card(i) = unsigned(round(card(i) * ratio));
mln_ch_value(I, unsigned)
thres = data::transform(res.first(), card);
diff --git a/scribo/scribo/preprocessing/deskew.hh
b/scribo/scribo/preprocessing/deskew.hh
index 81331a7..9b86ff7 100644
--- a/scribo/scribo/preprocessing/deskew.hh
+++ b/scribo/scribo/preprocessing/deskew.hh
@@ -127,7 +127,7 @@ namespace scribo
height_(height / 2),
max_rho_(sqrt((width * width) + (height * height))),
max_theta_(math::pi),
- max_rho_index_(this->max_rho_ + 1),
+ max_rho_index_(int(this->max_rho_) + 1),
max_theta_index_(500),
acc_(this->max_rho_index_, this->max_theta_index_)
{
@@ -227,7 +227,7 @@ namespace scribo
double rho_index = (0.5 + (rho / hough.mrho() + 0.5)
* hough.mrhoi());
- ++(opt::at(hough.acc(), rho_index, i));
+ ++(opt::at(hough.acc(), static_cast<def::coord>(rho_index), i));
}
}
@@ -379,8 +379,8 @@ namespace scribo
if (tanv <= 25.0 || tanv >= 155.0)
{
++nb_elm;
- vote(j, i, hough, (tanv <= 25.0 ? 250.0 - tanv * 10.0 :
- (180.0 - tanv) * 10.0 + 250.0));
+ vote(j, i, hough, int((tanv <= 25.0 ? 250.0 - tanv * 10.0 :
+ (180.0 - tanv) * 10.0 + 250.0)));
}
}
}
diff --git a/scribo/scribo/primitive/extract/lines_pattern.hh
b/scribo/scribo/primitive/extract/lines_pattern.hh
index c68b577..f96c7b3 100644
--- a/scribo/scribo/primitive/extract/lines_pattern.hh
+++ b/scribo/scribo/primitive/extract/lines_pattern.hh
@@ -171,8 +171,8 @@ namespace scribo
bool is_foreground;
unsigned ncols = geom::ncols(output);
- unsigned hit_ratio = 0.2f * length + 1;
- unsigned miss_ratio = 0.95f * length + 1;
+ unsigned hit_ratio = unsigned(0.2f * length + 1);
+ unsigned miss_ratio = unsigned(0.95f * length + 1);
mln_box_runstart_piter(I) p(output.domain());
for_all(p)
diff --git a/scribo/scribo/subsampling/bilinear.hh
b/scribo/scribo/subsampling/bilinear.hh
index b3d77ee..1717145 100644
--- a/scribo/scribo/subsampling/bilinear.hh
+++ b/scribo/scribo/subsampling/bilinear.hh
@@ -78,8 +78,8 @@ namespace scribo
for_all(p)
{
- int x = round(-0.5 + p.col() * sub_ratio);
- int y = round(-0.5 + p.row() * sub_ratio);
+ int x = int(round(-0.5 + p.col() * sub_ratio));
+ int y = int(round(-0.5 + p.row() * sub_ratio));
if (x < 0)
x = 0;
diff --git a/scribo/scribo/subsampling/integral_single_image.hh
b/scribo/scribo/subsampling/integral_single_image.hh
index cd25fc1..077172a 100644
--- a/scribo/scribo/subsampling/integral_single_image.hh
+++ b/scribo/scribo/subsampling/integral_single_image.hh
@@ -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.
//
@@ -154,7 +155,7 @@ namespace scribo
+ v21*v21 + v22*v22 + v23*v23
+ v31*v31 + v32*v32 + v33*v33;
- *p_sub++ = local_sum / 9;
+ convert::from_to(local_sum / 9, *p_sub++);
h_sum += local_sum;
h_sum_2 += local_sum_2;
@@ -192,7 +193,7 @@ namespace scribo
+ v21*v21 + v22*v22 + v23*v23
+ v31*v31 + v32*v32 + v33*v33;
- *p_sub++ = local_sum / 9;
+ convert::from_to(local_sum / 9, *p_sub++);
h_sum += local_sum;
h_sum_2 += local_sum_2;
@@ -283,7 +284,7 @@ namespace scribo
ptr2 += 2;
S local_sum = v11 + v12 + v21 + v22,
local_sum_2 = v11*v11 + v12*v12 + v21*v21 + v22*v22;
- *p_sub++ = local_sum / 4;
+ convert::from_to(local_sum / 4, *p_sub++);
h_sum += local_sum;
h_sum_2 += local_sum_2;
@@ -318,7 +319,7 @@ namespace scribo
ptr2 += 2;
S local_sum = v11 + v12 + v21 + v22,
local_sum_2 = v11*v11 + v12*v12 + v21*v21 + v22*v22;
- *p_sub++ = local_sum / 4;
+ convert::from_to(local_sum / 4, *p_sub++);
h_sum += local_sum;
h_sum_2 += local_sum_2;
diff --git a/scribo/scribo/text/clean_inplace.hh b/scribo/scribo/text/clean_inplace.hh
index 4be4c29..fe96ff7 100644
--- a/scribo/scribo/text/clean_inplace.hh
+++ b/scribo/scribo/text/clean_inplace.hh
@@ -129,7 +129,7 @@ namespace scribo
{
// std::cout << "subsampling::bilinear" << " - "
// << std::ceil(fact) << std::endl;
- input = subsampling::bilinear(input, std::ceil(fact - 0.5)); // math::floor instead?
+ input = subsampling::bilinear(input, int(std::ceil(fact - 0.5))); // math::floor
instead?
}
// else
diff --git a/scribo/src/debug/show_links_several_right_overlap.cc
b/scribo/src/debug/show_links_several_right_overlap.cc
index 05eb72e..ae27e55 100644
--- a/scribo/src/debug/show_links_several_right_overlap.cc
+++ b/scribo/src/debug/show_links_several_right_overlap.cc
@@ -69,7 +69,7 @@ namespace scribo
several_right_overlap_debug_functor(const I& input,
const component_set<L>& comps,
- float dmax)
+ unsigned dmax)
: super_(comps, dmax)
{
this->anchors_.append(anchor::Top);
@@ -155,7 +155,7 @@ int main(int argc, char* argv[])
// Write debug image.
several_right_overlap_debug_functor<I, L> functor(input,
- comps, atof(argv[2]));
+ comps, atoi(argv[2]));
primitive::link::compute_several(functor);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_down.cc
b/scribo/src/debug/show_links_single_down.cc
index 342a08f..f1ed130 100644
--- a/scribo/src/debug/show_links_single_down.cc
+++ b/scribo/src/debug/show_links_single_down.cc
@@ -67,7 +67,7 @@ namespace scribo
single_down_link_debug_functor(const I& input,
const component_set<L>& comps,
- float dmax)
+ unsigned dmax)
: super_(comps, dmax, anchor::Vertical)
{
output_ = data::convert(value::rgb8(), input);
@@ -151,7 +151,7 @@ int main(int argc, char* argv[])
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_down_link_debug_functor<I, L> functor(input, comps, atof(argv[2]));
+ single_down_link_debug_functor<I, L> functor(input, comps, atoi(argv[2]));
primitive::link::compute(functor);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_down_left_aligned.cc
b/scribo/src/debug/show_links_single_down_left_aligned.cc
index 18eb04e..ea31db7 100644
--- a/scribo/src/debug/show_links_single_down_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_left_aligned.cc
@@ -87,7 +87,7 @@ int main(int argc, char* argv[])
object_links<L>
down_links = primitive::link::with_single_down_link(comps,
- atof(argv[2]),
+ atoi(argv[2]),
anchor::Left);
// Filtering.
diff --git a/scribo/src/debug/show_links_single_down_right_aligned.cc
b/scribo/src/debug/show_links_single_down_right_aligned.cc
index 6c53711..d261e5c 100644
--- a/scribo/src/debug/show_links_single_down_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_down_right_aligned.cc
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
object_links<L>
down_links = primitive::link::with_single_down_link(comps,
- atof(argv[2]),
+ atoi(argv[2]),
anchor::Right);
// Filtering.
diff --git a/scribo/src/debug/show_links_single_left.cc
b/scribo/src/debug/show_links_single_left.cc
index bd79bbb..2211ce1 100644
--- a/scribo/src/debug/show_links_single_left.cc
+++ b/scribo/src/debug/show_links_single_left.cc
@@ -68,7 +68,7 @@ namespace scribo
single_left_link_debug_functor(const I& input,
const component_set<L>& components,
- float dmax)
+ unsigned dmax)
: super_(components, dmax, anchor::Horizontal)
{
output_ = data::convert(value::rgb8(), input);
@@ -152,7 +152,8 @@ int main(int argc, char* argv[])
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
- single_left_link_debug_functor<I, L> functor(input, components, atof(argv[2]));
+ single_left_link_debug_functor<I, L> functor(input, components,
+ atoi(argv[2]));
primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_right.cc
b/scribo/src/debug/show_links_single_right.cc
index 0dd2ea3..632d082 100644
--- a/scribo/src/debug/show_links_single_right.cc
+++ b/scribo/src/debug/show_links_single_right.cc
@@ -68,7 +68,7 @@ namespace scribo
single_right_link_debug_functor(const I& input,
const component_set<L>& components,
- float dmax)
+ unsigned dmax)
: super_(components, dmax, anchor::Horizontal)
{
output_ = data::convert(value::rgb8(), input);
@@ -154,7 +154,7 @@ int main(int argc, char* argv[])
// Write debug image.
single_right_link_debug_functor<I, L>
- functor(input, components, atof(argv[2]));
+ functor(input, components, atoi(argv[2]));
primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_up.cc
b/scribo/src/debug/show_links_single_up.cc
index d71b1fe..db9d3e7 100644
--- a/scribo/src/debug/show_links_single_up.cc
+++ b/scribo/src/debug/show_links_single_up.cc
@@ -67,7 +67,7 @@ namespace scribo
single_up_link_debug_functor(const I& input,
const component_set<L>& components,
- float dmax)
+ unsigned dmax)
: super_(components, dmax, anchor::Vertical)
{
output_ = data::convert(value::rgb8(), input);
@@ -153,7 +153,7 @@ int main(int argc, char* argv[])
// Write debug image.
single_up_link_debug_functor<I, L>
- functor(input, components, atof(argv[2]));
+ functor(input, components, atoi(argv[2]));
primitive::link::compute(functor, anchor::MassCenter);
io::ppm::save(functor.output_, argv[3]);
diff --git a/scribo/src/debug/show_links_single_up_left_aligned.cc
b/scribo/src/debug/show_links_single_up_left_aligned.cc
index 2bb865f..d0df1e4 100644
--- a/scribo/src/debug/show_links_single_up_left_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_left_aligned.cc
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
object_links<L>
up_links = primitive::link::with_single_up_link(comps,
- atof(argv[2]),
+ atoi(argv[2]),
anchor::Left);
diff --git a/scribo/src/debug/show_links_single_up_right_aligned.cc
b/scribo/src/debug/show_links_single_up_right_aligned.cc
index 5cba3b4..3f40daf 100644
--- a/scribo/src/debug/show_links_single_up_right_aligned.cc
+++ b/scribo/src/debug/show_links_single_up_right_aligned.cc
@@ -87,7 +87,7 @@ int main(int argc, char* argv[])
object_links<L>
up_links = primitive::link::with_single_up_link(comps,
- atof(argv[2]),
+ atoi(argv[2]),
anchor::Right);
// Filtering.
--
1.5.6.5