* scribo/binarization/sauvola_ms.hh,
* scribo/canvas/integral_browsing.hh,
* scribo/draw/line_components.hh,
* scribo/filter/object_groups_with_holes.hh,
* scribo/filter/objects_with_holes.hh,
* scribo/postprocessing/fill_object_holes.hh,
* scribo/preprocessing/rotate_90.hh,
* scribo/primitive/extract/internal/union.hh,
* scribo/primitive/extract/lines_h_thick_and_thin.hh,
* scribo/primitive/extract/lines_pattern.hh,
* scribo/primitive/extract/separators_nonvisible.hh,
* scribo/primitive/internal/rd.hh,
* scribo/subsampling/integral.hh,
* scribo/subsampling/integral_single_image.hh,
* scribo/text/merging.hh,
* scribo/text/merging_hdoc.hh: Rename point_at_index,
delta_index and index_of_point to point_at_offset, delta_offset
and offset_of_point.
---
scribo/ChangeLog | 23 +++++++++++++
scribo/scribo/binarization/sauvola_ms.hh | 34 ++++++++++----------
scribo/scribo/canvas/integral_browsing.hh | 6 ++--
scribo/scribo/draw/line_components.hh | 8 ++--
scribo/scribo/filter/object_groups_with_holes.hh | 2 +-
scribo/scribo/filter/objects_with_holes.hh | 2 +-
scribo/scribo/postprocessing/fill_object_holes.hh | 2 +-
scribo/scribo/preprocessing/rotate_90.hh | 10 +++---
scribo/scribo/primitive/extract/internal/union.hh | 6 ++--
.../primitive/extract/lines_h_thick_and_thin.hh | 8 ++--
scribo/scribo/primitive/extract/lines_pattern.hh | 2 +-
.../primitive/extract/separators_nonvisible.hh | 16 +++++-----
scribo/scribo/primitive/internal/rd.hh | 2 +-
scribo/scribo/subsampling/integral.hh | 8 ++--
scribo/scribo/subsampling/integral_single_image.hh | 8 ++--
scribo/scribo/text/merging.hh | 4 +-
scribo/scribo/text/merging_hdoc.hh | 4 +-
17 files changed, 84 insertions(+), 61 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f8d7491..5561f60 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,26 @@
+2012-05-11 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Rename point_at_index, delta_index and index_of_point.
+
+ * scribo/binarization/sauvola_ms.hh,
+ * scribo/canvas/integral_browsing.hh,
+ * scribo/draw/line_components.hh,
+ * scribo/filter/object_groups_with_holes.hh,
+ * scribo/filter/objects_with_holes.hh,
+ * scribo/postprocessing/fill_object_holes.hh,
+ * scribo/preprocessing/rotate_90.hh,
+ * scribo/primitive/extract/internal/union.hh,
+ * scribo/primitive/extract/lines_h_thick_and_thin.hh,
+ * scribo/primitive/extract/lines_pattern.hh,
+ * scribo/primitive/extract/separators_nonvisible.hh,
+ * scribo/primitive/internal/rd.hh,
+ * scribo/subsampling/integral.hh,
+ * scribo/subsampling/integral_single_image.hh,
+ * scribo/text/merging.hh,
+ * scribo/text/merging_hdoc.hh: Rename point_at_index,
+ delta_index and index_of_point to point_at_offset, delta_offset
+ and offset_of_point.
+
2012-05-10 Guillaume Lazzara <z(a)lrde.epita.fr>
Improve option parser.
diff --git a/scribo/scribo/binarization/sauvola_ms.hh
b/scribo/scribo/binarization/sauvola_ms.hh
index 36629f9..6d8ae59 100644
--- a/scribo/scribo/binarization/sauvola_ms.hh
+++ b/scribo/scribo/binarization/sauvola_ms.hh
@@ -305,23 +305,23 @@ namespace scribo
nrows4 = t_ima[4].nrows(),
ncols4 = t_ima[4].ncols(),
- delta1 = in.delta_index(dpoint2d(+1, -(s - 1))),
- delta1b = in.delta_index(dpoint2d(+1, -(s + s - 1))),
- delta1c = in.delta_index(dpoint2d(-(s + s - 1), +1)),
- delta1d = in.delta_index(dpoint2d(+1, -(s * 4 - 1))),
- delta1e = in.delta_index(dpoint2d(-(s * 4 - 1), +1)),
- delta1f = in.delta_index(dpoint2d(-(s - 1), +1)),
-
- delta2 = t_ima[2].delta_index(dpoint2d(+1, -1)),
- delta2b = t_ima[2].delta_index(dpoint2d(+1, -3)),
- delta2c = t_ima[2].delta_index(dpoint2d(-3, +1)),
-
- delta3 = t_ima[3].delta_index(dpoint2d(+1, -1)),
-
- eor1 = in.delta_index(dpoint2d(+4 * s, - in.ncols())) + more_offset,
- eor2 = t_ima[2].delta_index(dpoint2d(+4,- t_ima[2].ncols())),
- eor3 = t_ima[3].delta_index(dpoint2d(+2,- t_ima[3].ncols())),
- eor4 = t_ima[4].delta_index(dpoint2d(+1,- t_ima[4].ncols()));
+ delta1 = in.delta_offset(dpoint2d(+1, -(s - 1))),
+ delta1b = in.delta_offset(dpoint2d(+1, -(s + s - 1))),
+ delta1c = in.delta_offset(dpoint2d(-(s + s - 1), +1)),
+ delta1d = in.delta_offset(dpoint2d(+1, -(s * 4 - 1))),
+ delta1e = in.delta_offset(dpoint2d(-(s * 4 - 1), +1)),
+ delta1f = in.delta_offset(dpoint2d(-(s - 1), +1)),
+
+ delta2 = t_ima[2].delta_offset(dpoint2d(+1, -1)),
+ delta2b = t_ima[2].delta_offset(dpoint2d(+1, -3)),
+ delta2c = t_ima[2].delta_offset(dpoint2d(-3, +1)),
+
+ delta3 = t_ima[3].delta_offset(dpoint2d(+1, -1)),
+
+ eor1 = in.delta_offset(dpoint2d(+4 * s, - in.ncols())) + more_offset,
+ eor2 = t_ima[2].delta_offset(dpoint2d(+4,- t_ima[2].ncols())),
+ eor3 = t_ima[3].delta_offset(dpoint2d(+2,- t_ima[3].ncols())),
+ eor4 = t_ima[4].delta_offset(dpoint2d(+1,- t_ima[4].ncols()));
mln_value(J) threshold;
for (int row4 = 0; row4 < nrows4; ++row4)
diff --git a/scribo/scribo/canvas/integral_browsing.hh
b/scribo/scribo/canvas/integral_browsing.hh
index 0ec3d83..f8bf484 100644
--- a/scribo/scribo/canvas/integral_browsing.hh
+++ b/scribo/scribo/canvas/integral_browsing.hh
@@ -95,9 +95,9 @@ namespace scribo
col_0 = step / 2;
const int
- offset_down = ima.delta_index(dpoint2d(step, 0)),
- offset_ante = ima.delta_index(dpoint2d(0, -w)),
- offset_below = ima.delta_index(dpoint2d(+h, 0));
+ offset_down = ima.delta_offset(dpoint2d(step, 0)),
+ offset_ante = ima.delta_offset(dpoint2d(0, -w)),
+ offset_below = ima.delta_offset(dpoint2d(+h, 0));
const int
max_row_top = h/2,
diff --git a/scribo/scribo/draw/line_components.hh
b/scribo/scribo/draw/line_components.hh
index 12e7489..6025eef 100644
--- a/scribo/scribo/draw/line_components.hh
+++ b/scribo/scribo/draw/line_components.hh
@@ -78,14 +78,14 @@ namespace scribo
const mln_value(L) v = c;
const box2d& bbox = comp_set(c).bbox();
- const unsigned index = labeled_image.index_of_point(bbox.pmin());
- const unsigned index2 = input.index_of_point(bbox.pmin());
+ const unsigned index = labeled_image.offset_of_point(bbox.pmin());
+ const unsigned index2 = input.offset_of_point(bbox.pmin());
const mln_value(L)* ptr_in = &(labeled_image.element(index));
mln_value(I)* ptr_out = &(input.element(index2));
const unsigned nrows = bbox.height();
const unsigned ncols = bbox.width();
- const int delta = labeled_image.delta_index(dpoint2d(+1, -ncols));
- const int delta2 = input.delta_index(dpoint2d(+1, -ncols));
+ const int delta = labeled_image.delta_offset(dpoint2d(+1, -ncols));
+ const int delta2 = input.delta_offset(dpoint2d(+1, -ncols));
for (unsigned k = 0; k < nrows; ++k)
{
diff --git a/scribo/scribo/filter/object_groups_with_holes.hh
b/scribo/scribo/filter/object_groups_with_holes.hh
index a59beec..495d97e 100644
--- a/scribo/scribo/filter/object_groups_with_holes.hh
+++ b/scribo/scribo/filter/object_groups_with_holes.hh
@@ -119,7 +119,7 @@ namespace scribo
unsigned
nrows = geom::nrows(b),
ncols = geom::ncols(b),
- row_offset = lbl.delta_index(D(+1, -ncols));
+ row_offset = lbl.delta_offset(D(+1, -ncols));
mln_value(L) *ptr = &output(b.pmin());
for (unsigned row = 0; row < nrows; ++row, ptr += row_offset)
diff --git a/scribo/scribo/filter/objects_with_holes.hh
b/scribo/scribo/filter/objects_with_holes.hh
index 09eaad5..1084d87 100644
--- a/scribo/scribo/filter/objects_with_holes.hh
+++ b/scribo/scribo/filter/objects_with_holes.hh
@@ -135,7 +135,7 @@ namespace scribo
unsigned
nrows = b.pmax().row() - b.pmin().row() + 1,
ncols = b.pmax().col() - b.pmin().col() + 1,
- row_offset = lbl.delta_index(D(+1, -ncols));
+ row_offset = lbl.delta_offset(D(+1, -ncols));
mln_value(L) *ptr = &output(b.pmin());
for (unsigned row = 0; row < nrows; ++row, ptr += row_offset)
diff --git a/scribo/scribo/postprocessing/fill_object_holes.hh
b/scribo/scribo/postprocessing/fill_object_holes.hh
index ea77fb6..9552d2c 100644
--- a/scribo/scribo/postprocessing/fill_object_holes.hh
+++ b/scribo/scribo/postprocessing/fill_object_holes.hh
@@ -130,7 +130,7 @@ namespace scribo
unsigned
nrows = b.pmax().row() - b.pmin().row() + 1,
ncols = b.pmax().col() - b.pmin().col() + 1,
- row_offset = lbl.delta_index(D(+1, -ncols));
+ row_offset = lbl.delta_offset(D(+1, -ncols));
mln_value(L) *ptr = &output(b.pmin());
for (unsigned row = 0; row < nrows; ++row, ptr += row_offset)
diff --git a/scribo/scribo/preprocessing/rotate_90.hh
b/scribo/scribo/preprocessing/rotate_90.hh
index e6d68c8..4411439 100644
--- a/scribo/scribo/preprocessing/rotate_90.hh
+++ b/scribo/scribo/preprocessing/rotate_90.hh
@@ -122,18 +122,18 @@ namespace scribo
if (positive) // +90 deg
{
dpoint2d dp(out_nrows, + 1);
- out_next_offset = output.delta_index(dp);
+ out_next_offset = output.delta_offset(dp);
- out_next_p_offset = output.delta_index(dpoint2d(-1, 0));
+ out_next_p_offset = output.delta_offset(dpoint2d(-1, 0));
- out_ptr += output.delta_index(dpoint2d(out_nrows - 1, 0));
+ out_ptr += output.delta_offset(dpoint2d(out_nrows - 1, 0));
}
else // -90 deg
{
dpoint2d dp(- out_nrows, - 1);
- out_next_offset = output.delta_index(dp);
+ out_next_offset = output.delta_offset(dp);
- out_next_p_offset = output.delta_index(dpoint2d(+1, 0));
+ out_next_p_offset = output.delta_offset(dpoint2d(+1, 0));
out_ptr += out_ncols - 1;
}
diff --git a/scribo/scribo/primitive/extract/internal/union.hh
b/scribo/scribo/primitive/extract/internal/union.hh
index 509a7e4..89687d6 100644
--- a/scribo/scribo/primitive/extract/internal/union.hh
+++ b/scribo/scribo/primitive/extract/internal/union.hh
@@ -80,7 +80,7 @@ namespace scribo
{
const unsigned nrows = input.nrows(), ncols = input.ncols();
- unsigned op, on, delta = input.delta_index(dpoint2d(1, 0));
+ unsigned op, on, delta = input.delta_offset(dpoint2d(1, 0));
data::fill(parent, 0);
max_area = 0;
@@ -89,7 +89,7 @@ namespace scribo
// row == 0 and col == 0
- op = input.index_of_point(point2d(0,0));
+ op = input.offset_of_point(point2d(0,0));
if (input.element(op) == lab)
{
area.element(op) = 1;
@@ -131,7 +131,7 @@ namespace scribo
{
// col == 0
- op = input.index_of_point(point2d(row, 0));
+ op = input.offset_of_point(point2d(row, 0));
on = op - delta;
if (input.element(op) == lab)
diff --git a/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh
b/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh
index 45b2ad3..f169a3e 100644
--- a/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh
+++ b/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh
@@ -166,8 +166,8 @@ namespace scribo
dpoint2d up(-delta, 0), down(+delta, 0);
const int
- offset_up = count.delta_index(up),
- offset_down = count.delta_index(down);
+ offset_up = count.delta_offset(up),
+ offset_down = count.delta_offset(down);
typedef const unsigned* ptr_t;
value::int_u8* p_out;
@@ -238,7 +238,7 @@ namespace scribo
// out:
int& row, value::int_u8& next_tag)
{
- int row_offset = input.delta_index(dpoint2d(+1, 0));
+ int row_offset = input.delta_offset(dpoint2d(+1, 0));
const value::int_u8* p = & input.at_(row, col);
while (*p == tag)
{
@@ -251,7 +251,7 @@ namespace scribo
void draw_vertical(image2d<bool>& output, unsigned col, int row_start, int
row_end)
{
- const unsigned offset = output.delta_index(dpoint2d(+1, 0)); // next row
+ const unsigned offset = output.delta_offset(dpoint2d(+1, 0)); // next row
bool* p_out = & output.at_(row_start, col);
for (int row = row_start; row < row_end; ++row, p_out += offset)
*p_out = true;
diff --git a/scribo/scribo/primitive/extract/lines_pattern.hh
b/scribo/scribo/primitive/extract/lines_pattern.hh
index ec24d4f..35e4447 100644
--- a/scribo/scribo/primitive/extract/lines_pattern.hh
+++ b/scribo/scribo/primitive/extract/lines_pattern.hh
@@ -177,7 +177,7 @@ namespace scribo
mln_box_runstart_piter(I) p(output.domain());
for_all(p)
{
- unsigned pi = output.index_of_point(p);
+ unsigned pi = output.offset_of_point(p);
unsigned *tmp_ptr = &tmp.element(pi);
unsigned *end_ptr = tmp_ptr + ncols;
diff --git a/scribo/scribo/primitive/extract/separators_nonvisible.hh
b/scribo/scribo/primitive/extract/separators_nonvisible.hh
index 998d6ec..870804c 100644
--- a/scribo/scribo/primitive/extract/separators_nonvisible.hh
+++ b/scribo/scribo/primitive/extract/separators_nonvisible.hh
@@ -403,21 +403,21 @@ namespace scribo
extension::adjust_fill(tmp, 21, 0);
value::int_u8 *sep_lbl_ptr = sep_lbl.buffer()
- + sep_lbl.index_of_point(sep_lbl.domain().pmin());
+ + sep_lbl.offset_of_point(sep_lbl.domain().pmin());
bool *separators_ptr = separators.buffer()
- + separators.index_of_point(separators.domain().pmin());
- unsigned *tmp_ptr = tmp.buffer() + tmp.index_of_point(tmp.domain().pmin());;
- int idx1 = tmp.delta_index(dp1);
- int idx2 = tmp.delta_index(dp2);
+ + separators.offset_of_point(separators.domain().pmin());
+ unsigned *tmp_ptr = tmp.buffer() + tmp.offset_of_point(tmp.domain().pmin());;
+ int idx1 = tmp.delta_offset(dp1);
+ int idx2 = tmp.delta_offset(dp2);
unsigned
nrows = separators.nrows(),
ncols = separators.ncols();
unsigned
- row_idx_sep_lbl = sep_lbl.delta_index(dpoint2d(+1, - ncols)),
- row_idx_separators = separators.delta_index(dpoint2d(+1, - ncols)),
- row_idx_tmp = tmp.delta_index(dpoint2d(+1, - ncols));
+ row_idx_sep_lbl = sep_lbl.delta_offset(dpoint2d(+1, - ncols)),
+ row_idx_separators = separators.delta_offset(dpoint2d(+1, - ncols)),
+ row_idx_tmp = tmp.delta_offset(dpoint2d(+1, - ncols));
for (unsigned row = 0; row < nrows; ++row)
{
diff --git a/scribo/scribo/primitive/internal/rd.hh
b/scribo/scribo/primitive/internal/rd.hh
index 49b6abb..56d6adc 100644
--- a/scribo/scribo/primitive/internal/rd.hh
+++ b/scribo/scribo/primitive/internal/rd.hh
@@ -123,7 +123,7 @@ namespace scribo
unsigned n = p + dp[j];
if (g.element(n) == true)
{
- mln_invariant(f.domain().has(f.point_at_index(n)));
+ mln_invariant(f.domain().has(f.point_at_offset(n)));
// Do-Union.
unsigned r = Rd_find_root_(parent, n);
if (r != p)
diff --git a/scribo/scribo/subsampling/integral.hh
b/scribo/scribo/subsampling/integral.hh
index b6e97d2..8cb627b 100644
--- a/scribo/scribo/subsampling/integral.hh
+++ b/scribo/scribo/subsampling/integral.hh
@@ -129,14 +129,14 @@ namespace scribo
integral_sum_2.init_(output_domain, border_thickness);
S* p_isum_2 = integral_sum_2.buffer();
- const unsigned up = sub.delta_index(dpoint2d(-1, 0));
+ const unsigned up = sub.delta_offset(dpoint2d(-1, 0));
const unsigned nrows = 3 * output_domain.nrows();
const unsigned ncols = 3 * output_domain.ncols();
unsigned row = 0;
- unsigned b_offset = sub.delta_index(dpoint2d(border_thickness,
+ unsigned b_offset = sub.delta_offset(dpoint2d(border_thickness,
border_thickness));
p_sub += b_offset;
p_isum += b_offset;
@@ -252,14 +252,14 @@ namespace scribo
integral_sum_2.init_(output_domain, border_thickness);
S* p_isum_2 = integral_sum_2.buffer();
- const unsigned up = sub.delta_index(dpoint2d(-1, 0));
+ const unsigned up = sub.delta_offset(dpoint2d(-1, 0));
const unsigned nrows = 2 * output_domain.nrows();
const unsigned ncols = 2 * output_domain.ncols();
extension::fill(sub, 0);
- unsigned b_offset = sub.delta_index(dpoint2d(border_thickness,
+ unsigned b_offset = sub.delta_offset(dpoint2d(border_thickness,
border_thickness));
p_sub += b_offset;
p_isum += b_offset;
diff --git a/scribo/scribo/subsampling/integral_single_image.hh
b/scribo/scribo/subsampling/integral_single_image.hh
index 381f08f..f1c9c18 100644
--- a/scribo/scribo/subsampling/integral_single_image.hh
+++ b/scribo/scribo/subsampling/integral_single_image.hh
@@ -122,14 +122,14 @@ namespace scribo
integral_sum_sum_2.init_(output_domain, border_thickness);
V2* p_integ = integral_sum_sum_2.buffer();
- const int up = sub.delta_index(dpoint2d(-1, 0));
+ const int up = sub.delta_offset(dpoint2d(-1, 0));
const unsigned nrows = 3 * output_domain.nrows();
const unsigned ncols = 3 * output_domain.ncols();
unsigned row = 0;
- unsigned b_offset = sub.delta_index(dpoint2d(border_thickness,
+ unsigned b_offset = sub.delta_offset(dpoint2d(border_thickness,
border_thickness));
p_sub += b_offset;
p_integ += b_offset;
@@ -241,14 +241,14 @@ namespace scribo
integral_sum_sum_2.init_(output_domain, border_thickness);
V2* p_integ = integral_sum_sum_2.buffer();
- const int up = sub.delta_index(dpoint2d(-1, 0));
+ const int up = sub.delta_offset(dpoint2d(-1, 0));
const unsigned nrows = 2 * output_domain.nrows();
const unsigned ncols = 2 * output_domain.ncols();
extension::fill(sub, 0);
- unsigned b_offset = sub.delta_index(dpoint2d(border_thickness,
+ unsigned b_offset = sub.delta_offset(dpoint2d(border_thickness,
border_thickness));
p_sub += b_offset;
p_integ += b_offset;
diff --git a/scribo/scribo/text/merging.hh b/scribo/scribo/text/merging.hh
index 791d4d0..64b64c7 100644
--- a/scribo/scribo/text/merging.hh
+++ b/scribo/scribo/text/merging.hh
@@ -98,7 +98,7 @@ namespace scribo
void draw_box(image2d<T>& input, const box2d& b, T2 l)
{
const unsigned
- delta = input.delta_index(dpoint2d(1,0)),
+ delta = input.delta_offset(dpoint2d(1,0)),
nrows = b.nrows(),
ncols = b.ncols();
T* p_start = & input(b.pmin());
@@ -133,7 +133,7 @@ namespace scribo
if (pmax_col > input_ncols_1) pmax_col = input_ncols_1;
const unsigned
- delta = input.delta_index(dpoint2d(1,0)),
+ delta = input.delta_offset(dpoint2d(1,0)),
nrows = pmax_row - pmin_row + 1,
ncols = pmax_col - pmin_col + 1;
T* p_start = & input.at_(pmin_row, pmin_col);
diff --git a/scribo/scribo/text/merging_hdoc.hh b/scribo/scribo/text/merging_hdoc.hh
index 6f89d2a..a1e4ed9 100644
--- a/scribo/scribo/text/merging_hdoc.hh
+++ b/scribo/scribo/text/merging_hdoc.hh
@@ -99,7 +99,7 @@ namespace scribo
void draw_box(image2d<T>& input, const box2d& b, T2 l)
{
const unsigned
- delta = input.delta_index(dpoint2d(1,0)),
+ delta = input.delta_offset(dpoint2d(1,0)),
nrows = b.nrows(),
ncols = b.ncols();
T* p_start = & input(b.pmin());
@@ -134,7 +134,7 @@ namespace scribo
if (pmax_col > input_ncols_1) pmax_col = input_ncols_1;
const unsigned
- delta = input.delta_index(dpoint2d(1,0)),
+ delta = input.delta_offset(dpoint2d(1,0)),
nrows = pmax_row - pmin_row + 1,
ncols = pmax_col - pmin_col + 1;
T* p_start = & input.at_(pmin_row, pmin_col);
--
1.7.2.5