|
tesseract 3.04.01
|
#include <devanagari_processing.h>
Public Member Functions | |
| PixelHistogram () | |
| ~PixelHistogram () | |
| void | Clear () |
| int * | hist () const |
| int | length () const |
| void | ConstructVerticalCountHist (Pix *pix) |
| void | ConstructHorizontalCountHist (Pix *pix) |
| int | GetHistogramMaximum (int *count) const |
Definition at line 26 of file devanagari_processing.h.
| tesseract::PixelHistogram::PixelHistogram | ( | ) | [inline] |
Definition at line 28 of file devanagari_processing.h.
{
hist_ = NULL;
length_ = 0;
}
| tesseract::PixelHistogram::~PixelHistogram | ( | ) | [inline] |
Definition at line 33 of file devanagari_processing.h.
{
Clear();
}
| void tesseract::PixelHistogram::Clear | ( | ) | [inline] |
Definition at line 37 of file devanagari_processing.h.
{
if (hist_) {
delete[] hist_;
}
length_ = 0;
}
| void tesseract::PixelHistogram::ConstructHorizontalCountHist | ( | Pix * | pix | ) |
Definition at line 489 of file devanagari_processing.cpp.
{
Clear();
Numa* counts = pixCountPixelsByRow(pix, NULL);
length_ = numaGetCount(counts);
hist_ = new int[length_];
for (int i = 0; i < length_; ++i) {
l_int32 val = 0;
numaGetIValue(counts, i, &val);
hist_[i] = val;
}
numaDestroy(&counts);
}
| void tesseract::PixelHistogram::ConstructVerticalCountHist | ( | Pix * | pix | ) |
Definition at line 471 of file devanagari_processing.cpp.
{
Clear();
int width = pixGetWidth(pix);
int height = pixGetHeight(pix);
hist_ = new int[width];
length_ = width;
int wpl = pixGetWpl(pix);
l_uint32 *data = pixGetData(pix);
for (int i = 0; i < width; ++i)
hist_[i] = 0;
for (int i = 0; i < height; ++i) {
l_uint32 *line = data + i * wpl;
for (int j = 0; j < width; ++j)
if (GET_DATA_BIT(line, j))
++(hist_[j]);
}
}
| int tesseract::PixelHistogram::GetHistogramMaximum | ( | int * | count | ) | const |
Definition at line 457 of file devanagari_processing.cpp.
| int* tesseract::PixelHistogram::hist | ( | ) | const [inline] |
Definition at line 44 of file devanagari_processing.h.
{
return hist_;
}
| int tesseract::PixelHistogram::length | ( | ) | const [inline] |
Definition at line 48 of file devanagari_processing.h.
{
return length_;
}