MCPcopy Create free account
hub / github.com/creatale/node-dv / compress

Method compress

deps/tesseract/ccstruct/ocrblock.cpp:132–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 */
131
132void BLOCK::compress() { // squash it up
133 #define ROW_SPACING 5
134
135 ROW_IT row_it(&rows);
136 ROW *row;
137 ICOORD row_spacing (0, ROW_SPACING);
138
139 ICOORDELT_IT icoordelt_it;
140
141 sort_rows();
142
143 box = TBOX (box.topleft (), box.topleft ());
144 box.move_bottom_edge (ROW_SPACING);
145 for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ()) {
146 row = row_it.data ();
147 row->move (box.botleft () - row_spacing -
148 row->bounding_box ().topleft ());
149 box += row->bounding_box ();
150 }
151
152 leftside.clear ();
153 icoordelt_it.set_to_list (&leftside);
154 icoordelt_it.add_to_end (new ICOORDELT (box.left (), box.bottom ()));
155 icoordelt_it.add_to_end (new ICOORDELT (box.left (), box.top ()));
156 rightside.clear ();
157 icoordelt_it.set_to_list (&rightside);
158 icoordelt_it.add_to_end (new ICOORDELT (box.right (), box.bottom ()));
159 icoordelt_it.add_to_end (new ICOORDELT (box.right (), box.top ()));
160}
161
162
163/**

Callers

nothing calls this directly

Calls 11

compressFunction · 0.85
dataMethod · 0.80
TBOXClass · 0.70
mark_cycle_ptMethod · 0.45
cycled_listMethod · 0.45
forwardMethod · 0.45
moveMethod · 0.45
bounding_boxMethod · 0.45
clearMethod · 0.45
set_to_listMethod · 0.45
add_to_endMethod · 0.45

Tested by

no test coverage detected