Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes
tesseract::GridBase Class Reference

`#include <bbgrid.h>`

Inheritance diagram for tesseract::GridBase:

List of all members.

## Public Member Functions
| GridBase ()
| 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

## Protected Attributes
int | gridsize_
int | gridwidth_
int | gridheight_
int | gridbuckets_
ICOORD | bleft_
ICOORD | tright_

## Detailed Description

Definition at line 57 of file bbgrid.h.

## Constructor & Destructor Documentation

tesseract::GridBase::GridBase | ( |  | ) |

Definition at line 30 of file bbgrid.cpp.

{
}

tesseract::GridBase::GridBase | ( | int | gridsize,
|  | const ICOORD & | bleft,
|  | const ICOORD & | tright
| ) |  |

Definition at line 33 of file bbgrid.cpp.

{
Init(gridsize, bleft, tright);
}

tesseract::GridBase::~GridBase | ( |  | ) |
| virtual

Definition at line 37 of file bbgrid.cpp.

{
}

## Member Function Documentation

const ICOORD& tesseract::GridBase::bleft | ( |  | ) | const
| inline

Definition at line 77 of file bbgrid.h.

{
return bleft_;
}

void tesseract::GridBase::ClipGridCoords | ( | int * | x,
|  | int * | y
| ) |  | const

Definition at line 61 of file bbgrid.cpp.

{
*x = ClipToRange(*x, 0, gridwidth_ - 1);
*y = ClipToRange(*y, 0, gridheight_ - 1);
}

void tesseract::GridBase::GridCoords | ( | int | x,
|  | int | y,
|  | int * | grid_x,
|  | int * | grid_y
| ) |  | const

Definition at line 54 of file bbgrid.cpp.

{
*grid_x = (x - bleft_.x()) / gridsize_;
*grid_y = (y - bleft_.y()) / gridsize_;
ClipGridCoords(grid_x, grid_y);
}

int tesseract::GridBase::gridheight | ( |  | ) | const
| inline

Definition at line 74 of file bbgrid.h.

{
return gridheight_;
}

int tesseract::GridBase::gridsize | ( |  | ) | const
| inline

Definition at line 68 of file bbgrid.h.

{
return gridsize_;
}

int tesseract::GridBase::gridwidth | ( |  | ) | const
| inline

Definition at line 71 of file bbgrid.h.

{
return gridwidth_;
}

void tesseract::GridBase::Init | ( | int | gridsize,
|  | const ICOORD & | bleft,
|  | const ICOORD & | tright
| ) |  |

Reimplemented in tesseract::BBGrid< BBC, BBC_CLIST, BBC_C_IT >, tesseract::BBGrid< ColSegment, ColSegment_CLIST, ColSegment_C_IT >, tesseract::BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT >, tesseract::BBGrid< ColPartition, ColPartition_CLIST, ColPartition_C_IT >, and tesseract::IntGrid.

Definition at line 42 of file bbgrid.cpp.

{
gridsize_ = gridsize;
bleft_ = bleft;
tright_ = tright;
if (gridsize_ == 0)
gridsize_ = 1;
gridwidth_ = (tright.x() - bleft.x() + gridsize_ - 1) / gridsize_;
gridheight_ = (tright.y() - bleft.y() + gridsize_ - 1) / gridsize_;
gridbuckets_ = gridwidth_ * gridheight_;
}

const ICOORD& tesseract::GridBase::tright | ( |  | ) | const
| inline

Definition at line 80 of file bbgrid.h.

{
return tright_;
}

## Member Data Documentation

ICOORD tesseract::GridBase::bleft_
| protected

Definition at line 95 of file bbgrid.h.

int tesseract::GridBase::gridbuckets_
| protected

Definition at line 94 of file bbgrid.h.

int tesseract::GridBase::gridheight_
| protected

Definition at line 93 of file bbgrid.h.

int tesseract::GridBase::gridsize_
| protected

Definition at line 91 of file bbgrid.h.

int tesseract::GridBase::gridwidth_
| protected

Definition at line 92 of file bbgrid.h.

ICOORD tesseract::GridBase::tright_
| protected

Definition at line 96 of file bbgrid.h.

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