Commit b265090a authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

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.
parent c0c3a98d
2010-08-10 Guillaume Lazzara <z@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@lrde.epita.fr>
Regen headers.mk and unit-tests.mk in Scribo.
......
......@@ -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
......
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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)));
}
}
}
......
......@@ -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)
......
......@@ -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;
......
// 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;
......
......@@ -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
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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.
......
......@@ -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.
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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);
......
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment