#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 |
|
Image | 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 |
|
) |
| |
Definition at line 69 of file bbgrid.cpp.
const ICOORD & bleft() const
const ICOORD & tright() const
void Init(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 173 of file bbgrid.cpp.
174 int min_x, min_y, max_x, max_y;
175 GridCoords(rect.left(), rect.bottom(), &min_x, &min_y);
176 GridCoords(rect.right(), rect.top(), &max_x, &max_y);
177 for (
int y = min_y; y <= max_y; ++y) {
178 for (
int x = min_x; x <= max_x; ++x) {
void GridCoords(int x, int y, int *grid_x, int *grid_y) const
int GridCellValue(int grid_x, int grid_y) const
◆ Clear()
void tesseract::IntGrid::Clear |
( |
| ) |
|
◆ GridCellValue()
int tesseract::IntGrid::GridCellValue |
( |
int |
grid_x, |
|
|
int |
grid_y |
|
) |
| const |
|
inline |
Definition at line 120 of file bbgrid.h.
void ClipGridCoords(int *x, int *y) const
◆ Init()
void tesseract::IntGrid::Init |
( |
int |
gridsize, |
|
|
const ICOORD & |
bleft, |
|
|
const ICOORD & |
tright |
|
) |
| |
Definition at line 79 of file bbgrid.cpp.
void Init(int gridsize, const ICOORD &bleft, const ICOORD &tright)
◆ NeighbourhoodSum()
IntGrid * tesseract::IntGrid::NeighbourhoodSum |
( |
| ) |
const |
Definition at line 131 of file bbgrid.cpp.
136 for (
int yoffset = -1; yoffset <= 1; ++yoffset) {
137 for (
int xoffset = -1; xoffset <= 1; ++xoffset) {
138 int grid_x = x + xoffset;
139 int grid_y = y + yoffset;
145 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;
156 GridCoords(rect.left(), rect.bottom(), &min_x, &min_y);
157 GridCoords(rect.right(), rect.top(), &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) {
165 total_area += cell_box.area();
169 return total_area * 2 > rect.area();
◆ Rotate()
void tesseract::IntGrid::Rotate |
( |
const FCOORD & |
rotation | ) |
|
Definition at line 99 of file bbgrid.cpp.
100 ASSERT_HOST(rotation.x() == 0.0f || rotation.y() == 0.0f);
101 ICOORD old_bleft(
bleft());
106 box.rotate(rotation);
107 int *old_grid = grid_;
112 FCOORD x_step(rotation);
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),
static_cast<int>(line_pos.y() + 0.5),
121 grid_[grid_y *
gridwidth() + grid_x] = old_grid[oldi];
◆ SetGridCell()
void tesseract::IntGrid::SetGridCell |
( |
int |
grid_x, |
|
|
int |
grid_y, |
|
|
int |
value |
|
) |
| |
|
inline |
◆ ThresholdToPix()
Image tesseract::IntGrid::ThresholdToPix |
( |
int |
threshold | ) |
const |
Definition at line 190 of file bbgrid.cpp.
198 pixRasterop(pix, x * cellsize,
tright().y() - ((y + 1) * cellsize), cellsize, cellsize,
199 PIX_SET,
nullptr, 0, 0);
The documentation for this class was generated from the following files: