Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotseg.h File Reference
#include "states.h"
#include "render.h"

Go to the source code of this file.

Functions

void display_segmentation (TBLOB *chunks, SEARCH_STATE segmentation)
 
void render_segmentation (ScrollView *window, TBLOB *chunks, SEARCH_STATE segmentation)
 

Variables

ScrollViewsegm_window
 
int wordrec_display_segmentations = 0
 

Function Documentation

void display_segmentation ( TBLOB chunks,
SEARCH_STATE  segmentation 
)

Definition at line 58 of file plotseg.cpp.

58  {
59  /* If no window create it */
60  if (segm_window == NULL) {
61  segm_window = c_create_window ("Segmentation", 5, 10,
62  500, 256, -1000.0, 1000.0, 0.0, 256.0);
63  }
64  else {
66  }
67 
68  render_segmentation(segm_window, chunks, segmentation);
69  /* Put data in the window */
71 }
#define NULL
Definition: host.h:144
void render_segmentation(ScrollView *window, TBLOB *chunks, SEARCH_STATE segmentation)
Definition: plotseg.cpp:79
ScrollView * c_create_window(const char *name, inT16 xpos, inT16 ypos, inT16 xsize, inT16 ysize, double xmin, double xmax, double ymin, double ymax)
Definition: callcpp.cpp:56
ScrollView * segm_window
Definition: plotseg.cpp:46
void c_clear_window(void *win)
Definition: callcpp.cpp:105
void c_make_current(void *win)
Definition: callcpp.cpp:98
void render_segmentation ( ScrollView window,
TBLOB chunks,
SEARCH_STATE  segmentation 
)

Definition at line 79 of file plotseg.cpp.

81  {
82  TBLOB *blob;
83  C_COL color = Black;
84  int char_num = -1;
85  int chunks_left = 0;
86 
87  TBOX bbox;
88  if (chunks) bbox = chunks->bounding_box();
89 
90  for (blob = chunks; blob != NULL; blob = blob->next) {
91  bbox += blob->bounding_box();
92  if (chunks_left-- == 0) {
93  color = color_list[++char_num % NUM_COLORS];
94 
95  if (char_num < segmentation[0])
96  chunks_left = segmentation[char_num + 1];
97  else
98  chunks_left = MAX_INT32;
99  }
100  render_outline(window, blob->outlines, color);
101  }
102  window->ZoomToRectangle(bbox.left(), bbox.top(),
103  bbox.right(), bbox.bottom());
104 }
C_COL color_list[]
Definition: render.cpp:45
#define NUM_COLORS
Definition: render.h:44
#define NULL
Definition: host.h:144
inT16 left() const
Definition: rect.h:67
void ZoomToRectangle(int x1, int y1, int x2, int y2)
Definition: scrollview.cpp:760
Definition: rect.h:29
TESSLINE * outlines
Definition: blobs.h:227
inT16 right() const
Definition: rect.h:74
void render_outline(void *window, TESSLINE *outline, C_COL color)
Definition: render.cpp:124
C_COL
Definition: callcpp.h:32
#define MAX_INT32
Definition: host.h:120
Definition: blobs.h:174
inT16 top() const
Definition: rect.h:53
Definition: callcpp.h:33
TBOX bounding_box() const
Definition: blobs.cpp:384
TBLOB * next
Definition: blobs.h:228
inT16 bottom() const
Definition: rect.h:60

Variable Documentation

ScrollView* segm_window

Definition at line 46 of file plotseg.cpp.

int wordrec_display_segmentations = 0

"Display Segmentations"

Definition at line 48 of file plotseg.cpp.