Commit 3151875d authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix object links filters.

	* filter/object_links_bottom_aligned.hh,
	* filter/object_links_center_aligned.hh,
	* filter/object_links_non_aligned_simple.hh,
	* filter/object_links_top_aligned.hh: Pass the proper dimension as
	routine argument.
parent 74ae8cb3
2009-12-14 Guillaume Lazzara <z@lrde.epita.fr>
Fix object links filters.
* filter/object_links_bottom_aligned.hh,
* filter/object_links_center_aligned.hh,
* filter/object_links_non_aligned_simple.hh,
* filter/object_links_top_aligned.hh: Pass the proper dimension as
routine argument.
2009-12-14 Guillaume Lazzara <z@lrde.epita.fr>
Cleanup Sauvola's binarization code.
......
......@@ -102,7 +102,7 @@ namespace scribo
object_links<L>
output = object_links_non_aligned_simple(objects, links,
1, max_alpha);
2, max_alpha);
trace::exiting("scribo::filter::object_links_bottom_aligned");
return output;
......
......@@ -95,7 +95,7 @@ namespace scribo
object_links<L>
output = object_links_non_aligned_simple(objects, links,
2, max_alpha);
0, max_alpha);
trace::exiting("scribo::filter::object_links_center_aligned");
return output;
......
......@@ -81,9 +81,9 @@ namespace scribo
The angle between the two bottoms must be lower than \p alpha.
edge values :
0 = top
1 = bottom
2 = center
0 = center
1 = top
2 = bottom
*/
template <typename L>
......@@ -117,14 +117,15 @@ namespace scribo
float max_alpha_rad = (max_alpha / 180.0f) * math::pi;
// Top
// Center
if (edge == 0)
{
for_all_components(i, objects.bboxes())
{
if (links[i] != i)
{
dr = math::abs(bboxes[i].pmin().row()
- bboxes[links[i]].pmin().row());
dr = math::abs(bboxes[i].center().row()
- bboxes[links[i]].center().row());
dc = math::abs(bboxes[i].center().col()
- bboxes[links[i]].center().col());
......@@ -132,14 +133,15 @@ namespace scribo
output[i] = i;
}
}
// Bottom
}
// Top
else if (edge == 1)
for_all_components(i, objects.bboxes())
{
for_all_components(i, objects.bboxes())
if (links[i] != i)
{
dr = math::abs(bboxes[i].pmax().row()
- bboxes[links[i]].pmax().row());
dr = math::abs(bboxes[i].pmin().row()
- bboxes[links[i]].pmin().row());
dc = math::abs(bboxes[i].center().col()
- bboxes[links[i]].center().col());
......@@ -147,14 +149,15 @@ namespace scribo
output[i] = i;
}
}
// Center
// Bottom
else if (edge == 2)
{
for_all_components(i, objects.bboxes())
{
if (links[i] != i)
{
dr = math::abs(bboxes[i].center().row()
- bboxes[links[i]].center().row());
dr = math::abs(bboxes[i].pmax().row()
- bboxes[links[i]].pmax().row());
dc = math::abs(bboxes[i].center().col()
- bboxes[links[i]].center().col());
......@@ -162,6 +165,7 @@ namespace scribo
output[i] = i;
}
}
}
else
{
trace::warning("Invalid edge value... Aborting computation.");
......
......@@ -102,7 +102,7 @@ namespace scribo
object_links<L>
output = object_links_non_aligned_simple(objects, links,
0,
1,
max_alpha);
trace::exiting("scribo::filter::object_links_top_aligned");
......
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