#include <bbgrid.h>
|
| IntGrid () |
|
| IntGrid (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
| ~IntGrid () override |
|
void | Init (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
void | Clear () |
|
void | Rotate (const FCOORD &rotation) |
|
IntGrid * | NeighbourhoodSum () const |
|
int | GridCellValue (int grid_x, int grid_y) const |
|
void | SetGridCell (int grid_x, int grid_y, int value) |
|
bool | RectMostlyOverThreshold (const TBOX &rect, int threshold) const |
|
bool | AnyZeroInRect (const TBOX &rect) const |
|
Pix * | ThresholdToPix (int threshold) const |
|
| GridBase ()=default |
|
| GridBase (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
virtual | ~GridBase () |
|
void | Init (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
int | gridsize () const |
|
int | gridwidth () const |
|
int | gridheight () const |
|
const ICOORD & | bleft () const |
|
const ICOORD & | tright () const |
|
void | GridCoords (int x, int y, int *grid_x, int *grid_y) const |
|
void | ClipGridCoords (int *x, int *y) const |
|
Definition at line 97 of file bbgrid.h.
◆ IntGrid() [1/2]
tesseract::IntGrid::IntGrid |
( |
| ) |
|
◆ IntGrid() [2/2]
tesseract::IntGrid::IntGrid |
( |
int |
gridsize, |
|
|
const ICOORD & |
bleft, |
|
|
const ICOORD & |
tright |
|
) |
| |
◆ ~IntGrid()
tesseract::IntGrid::~IntGrid |
( |
| ) |
|
|
override |
◆ AnyZeroInRect()
bool tesseract::IntGrid::AnyZeroInRect |
( |
const TBOX & |
rect | ) |
const |
Definition at line 174 of file bbgrid.cpp.
175 int min_x, min_y, max_x, max_y;
178 for (
int y = min_y; y <= max_y; ++y) {
179 for (
int x = min_x; x <= max_x; ++x) {
◆ Clear()
void tesseract::IntGrid::Clear |
( |
| ) |
|
◆ GridCellValue()
int tesseract::IntGrid::GridCellValue |
( |
int |
grid_x, |
|
|
int |
grid_y |
|
) |
| const |
|
inline |
◆ Init()
void tesseract::IntGrid::Init |
( |
int |
gridsize, |
|
|
const ICOORD & |
bleft, |
|
|
const ICOORD & |
tright |
|
) |
| |
◆ NeighbourhoodSum()
IntGrid * tesseract::IntGrid::NeighbourhoodSum |
( |
| ) |
const |
Definition at line 132 of file bbgrid.cpp.
137 for (
int yoffset = -1; yoffset <= 1; ++yoffset) {
138 for (
int xoffset = -1; xoffset <= 1; ++xoffset) {
139 int grid_x = x + xoffset;
140 int grid_y = y + yoffset;
146 sumgrid->SetGridCell(x, y, cell_count);
◆ RectMostlyOverThreshold()
bool tesseract::IntGrid::RectMostlyOverThreshold |
( |
const TBOX & |
rect, |
|
|
int |
threshold |
|
) |
| const |
Definition at line 154 of file bbgrid.cpp.
155 int min_x, min_y, max_x, max_y;
159 for (
int y = min_y; y <= max_y; ++y) {
160 for (
int x = min_x; x <= max_x; ++x) {
162 if (value > threshold) {
166 total_area += cell_box.
area();
170 return total_area * 2 > rect.
area();
◆ Rotate()
void tesseract::IntGrid::Rotate |
( |
const FCOORD & |
rotation | ) |
|
Definition at line 99 of file bbgrid.cpp.
106 box.rotate(rotation);
107 int* old_grid = grid_;
114 for (
int oldy = 0; oldy < old_height; ++oldy) {
115 FCOORD line_pos(old_bleft.x(), old_bleft.y() +
gridsize() * oldy);
116 line_pos.
rotate(rotation);
117 for (
int oldx = 0; oldx < old_width; ++oldx, line_pos += x_step, ++oldi) {
119 GridCoords(static_cast<int>(line_pos.x() + 0.5),
120 static_cast<int>(line_pos.y() + 0.5),
122 grid_[grid_y *
gridwidth() + grid_x] = old_grid[oldi];
◆ SetGridCell()
void tesseract::IntGrid::SetGridCell |
( |
int |
grid_x, |
|
|
int |
grid_y, |
|
|
int |
value |
|
) |
| |
|
inline |
◆ ThresholdToPix()
Pix * tesseract::IntGrid::ThresholdToPix |
( |
int |
threshold | ) |
const |
Definition at line 190 of file bbgrid.cpp.
199 pixRasterop(pix, x * cellsize,
tright().y() - ((y + 1) * cellsize),
200 cellsize, cellsize, PIX_SET,
nullptr, 0, 0);
The documentation for this class was generated from the following files: