#include <stdlib.h>
#include <memory>
#include "blckerr.h"
#include "ocrblock.h"
#include "stepblob.h"
#include "tprintf.h"
Go to the source code of this file.
◆ BLOCK_LABEL_HEIGHT
#define BLOCK_LABEL_HEIGHT 150 |
◆ ROW_SPACING
◆ decreasing_top_order()
int decreasing_top_order |
( |
const void * |
row1, |
|
|
const void * |
row2 |
|
) |
| |
decreasing_top_order
Sort Comparator: Return <0 if row1 top < row2 top
Definition at line 72 of file ocrblock.cpp.
75 return (*(
ROW **) row2)->bounding_box ().top () -
76 (*(
ROW **) row1)->bounding_box ().top ();
◆ ExtractBlobsFromSegmentation()
void ExtractBlobsFromSegmentation |
( |
BLOCK_LIST * |
blocks, |
|
|
C_BLOB_LIST * |
output_blob_list |
|
) |
| |
Definition at line 443 of file ocrblock.cpp.
445 C_BLOB_IT return_list_it(output_blob_list);
446 BLOCK_IT block_it(blocks);
447 for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
448 BLOCK* block = block_it.data();
450 for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
451 ROW* row = row_it.data();
454 for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
455 WERD* werd = werd_it.data();
456 return_list_it.move_to_last();
457 return_list_it.add_list_after(werd->
cblob_list());
458 return_list_it.move_to_last();
C_BLOB_LIST * cblob_list()
C_BLOB_LIST * rej_cblob_list()
ROW_LIST * row_list()
get rows
◆ LeftMargin()
bool LeftMargin |
( |
ICOORDELT_LIST * |
segments, |
|
|
int |
x, |
|
|
int * |
margin |
|
) |
| |
Definition at line 256 of file ocrblock.cpp.
259 if (segments->empty())
261 ICOORDELT_IT seg_it(segments);
262 for (seg_it.mark_cycle_pt(); !seg_it.cycled_list(); seg_it.forward()) {
263 int cur_margin = x - seg_it.data()->x();
264 if (cur_margin >= 0) {
266 *margin = cur_margin;
267 }
else if (cur_margin < *margin) {
268 *margin = cur_margin;
◆ PrintSegmentationStats()
void PrintSegmentationStats |
( |
BLOCK_LIST * |
block_list | ) |
|
Definition at line 410 of file ocrblock.cpp.
415 BLOCK_IT block_it(block_list);
416 for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
417 BLOCK* block = block_it.data();
420 for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
422 ROW* row = row_it.data();
425 for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
426 WERD* werd = werd_it.data();
432 tprintf(
"Block list stats:\nBlocks = %d\nRows = %d\nWords = %d\nBlobs = %d\n",
433 num_blocks, num_rows, num_words, num_blobs);
C_BLOB_LIST * cblob_list()
ROW_LIST * row_list()
get rows
◆ RefreshWordBlobsFromNewBlobs()
void RefreshWordBlobsFromNewBlobs |
( |
BLOCK_LIST * |
block_list, |
|
|
C_BLOB_LIST * |
new_blobs, |
|
|
C_BLOB_LIST * |
not_found_blobs |
|
) |
| |
Definition at line 478 of file ocrblock.cpp.
483 BLOCK_IT block_it(block_list);
484 for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
485 BLOCK* block = block_it.data();
490 for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
491 ROW* row = row_it.data();
495 WERD_IT new_words_it(&new_words);
496 for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
497 WERD* werd = werd_it.extract();
503 new_words_it.add_after_then_move(new_werd);
509 new_words_it.add_after_then_move(werd);
514 werd_it.move_to_first();
515 werd_it.add_list_after(&new_words);
WERD * ConstructWerdWithNewBlobs(C_BLOB_LIST *all_blobs, C_BLOB_LIST *orphan_blobs)
POLY_BLOCK * poly_block() const
ROW_LIST * row_list()
get rows
◆ RightMargin()
bool RightMargin |
( |
ICOORDELT_LIST * |
segments, |
|
|
int |
x, |
|
|
int * |
margin |
|
) |
| |
Definition at line 286 of file ocrblock.cpp.
289 if (segments->empty())
291 ICOORDELT_IT seg_it(segments);
292 for (seg_it.mark_cycle_pt(); !seg_it.cycled_list(); seg_it.forward()) {
293 int cur_margin = seg_it.data()->x() + seg_it.data()->y() - x;
294 if (cur_margin >= 0) {
296 *margin = cur_margin;
297 }
else if (cur_margin < *margin) {
298 *margin = cur_margin;