#include <bbgrid.h>
List of all members.
Public Member Functions |
| IntGrid () |
| IntGrid (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
virtual | ~IntGrid () |
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 () |
| GridBase (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
virtual | ~GridBase () |
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 |
Detailed Description
Definition at line 102 of file bbgrid.h.
Constructor & Destructor Documentation
tesseract::IntGrid::IntGrid |
( |
| ) |
|
tesseract::IntGrid::IntGrid |
( |
int |
gridsize, |
|
|
const ICOORD & |
bleft, |
|
|
const ICOORD & |
tright |
|
) |
| |
tesseract::IntGrid::~IntGrid |
( |
| ) |
|
|
virtual |
Member Function Documentation
bool tesseract::IntGrid::AnyZeroInRect |
( |
const TBOX & |
rect | ) |
const |
Definition at line 178 of file bbgrid.cpp.
{
int min_x, min_y, max_x, max_y;
for (int y = min_y; y <= max_y; ++y) {
for (int x = min_x; x <= max_x; ++x) {
return true;
}
}
return false;
}
void tesseract::IntGrid::Clear |
( |
| ) |
|
int tesseract::IntGrid::GridCellValue |
( |
int |
grid_x, |
|
|
int |
grid_y |
|
) |
| const |
|
inline |
void tesseract::IntGrid::Init |
( |
int |
gridsize, |
|
|
const ICOORD & |
bleft, |
|
|
const ICOORD & |
tright |
|
) |
| |
IntGrid * tesseract::IntGrid::NeighbourhoodSum |
( |
| ) |
const |
Definition at line 136 of file bbgrid.cpp.
{
int cell_count = 0;
for (int yoffset = -1; yoffset <= 1; ++yoffset) {
for (int xoffset = -1; xoffset <= 1; ++xoffset) {
int grid_x = x + xoffset;
int grid_y = y + yoffset;
}
}
sumgrid->SetGridCell(x, y, cell_count);
}
}
return sumgrid;
}
bool tesseract::IntGrid::RectMostlyOverThreshold |
( |
const TBOX & |
rect, |
|
|
int |
threshold |
|
) |
| const |
Definition at line 158 of file bbgrid.cpp.
{
int min_x, min_y, max_x, max_y;
int total_area = 0;
for (int y = min_y; y <= max_y; ++y) {
for (int x = min_x; x <= max_x; ++x) {
if (value > threshold) {
(x + 1) * gridsize_, (y + 1) * gridsize_);
cell_box &= rect;
total_area += cell_box.
area();
}
}
}
return total_area * 2 > rect.
area();
}
void tesseract::IntGrid::Rotate |
( |
const FCOORD & |
rotation | ) |
|
Definition at line 103 of file bbgrid.cpp.
{
box.rotate(rotation);
int* old_grid = grid_;
int oldi = 0;
for (int oldy = 0; oldy < old_height; ++oldy) {
for (int oldx = 0; oldx < old_width; ++oldx, line_pos += x_step, ++oldi) {
int grid_x, grid_y;
static_cast<int>(line_pos.y() + 0.5),
&grid_x, &grid_y);
grid_[grid_y *
gridwidth() + grid_x] = old_grid[oldi];
}
}
delete [] old_grid;
}
void tesseract::IntGrid::SetGridCell |
( |
int |
grid_x, |
|
|
int |
grid_y, |
|
|
int |
value |
|
) |
| |
|
inline |
Pix * tesseract::IntGrid::ThresholdToPix |
( |
int |
threshold | ) |
const |
Definition at line 194 of file bbgrid.cpp.
{
pixRasterop(pix, x * cellsize,
tright().y() - ((y + 1) * cellsize),
cellsize, cellsize, PIX_SET,
NULL, 0, 0);
}
}
}
return pix;
}
The documentation for this class was generated from the following files:
- /mnt/data/src/tesseract-ocr/textord/bbgrid.h
- /mnt/data/src/tesseract-ocr/textord/bbgrid.cpp