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
tesseract::PixelHistogram Class Reference

`#include <devanagari_processing.h>`

List of all members.

## Public Member Functions

| PixelHistogram ()
| ~PixelHistogram ()
void | Clear ()
int *const | hist () const
int | length () const
void | ConstructVerticalCountHist (Pix *pix)
void | ConstructHorizontalCountHist (Pix *pix)
int | GetHistogramMaximum (int *count) const

## Detailed Description

Definition at line 27 of file devanagari_processing.h.

## Constructor & Destructor Documentation

tesseract::PixelHistogram::PixelHistogram | ( |  | ) |

inline

Definition at line 29 of file devanagari_processing.h.

{
hist_ = NULL;
length_ = 0;
}

tesseract::PixelHistogram::~PixelHistogram | ( |  | ) |

inline

Definition at line 34 of file devanagari_processing.h.

{
Clear();
}

## Member Function Documentation

void tesseract::PixelHistogram::Clear | ( |  | ) |

inline

Definition at line 38 of file devanagari_processing.h.

{
if (hist_) {
delete[] hist_;
}
length_ = 0;
}

void tesseract::PixelHistogram::ConstructHorizontalCountHist | ( | Pix * | pix | ) |

Definition at line 486 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 468 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 454 of file devanagari_processing.cpp.

{
int best_value = 0;
for (int i = 0; i < length_; ++i) {
if (hist_[i] > hist_[best_value]) {
best_value = i;
}
}
if (count) {
*count = hist_[best_value];
}
return best_value;
}

int* const tesseract::PixelHistogram::hist | ( |  | ) | const

inline

Definition at line 45 of file devanagari_processing.h.

{
return hist_;
}

int tesseract::PixelHistogram::length | ( |  | ) | const

inline

Definition at line 49 of file devanagari_processing.h.

{
return length_;
}

The documentation for this class was generated from the following files:

- /mnt/data/src/tesseract-ocr/textord/devanagari_processing.h
- /mnt/data/src/tesseract-ocr/textord/devanagari_processing.cpp