#include <devanagari_processing.h>
Definition at line 36 of file devanagari_processing.h.
◆ PixelHistogram()
tesseract::PixelHistogram::PixelHistogram |
( |
| ) |
|
|
inline |
◆ ~PixelHistogram()
tesseract::PixelHistogram::~PixelHistogram |
( |
| ) |
|
|
inline |
◆ Clear()
void tesseract::PixelHistogram::Clear |
( |
| ) |
|
|
inline |
◆ ConstructHorizontalCountHist()
void tesseract::PixelHistogram::ConstructHorizontalCountHist |
( |
Pix * |
pix | ) |
|
Definition at line 487 of file devanagari_processing.cpp.
487 {
489 Numa* counts = pixCountPixelsByRow(pix, nullptr);
490 length_ = numaGetCount(counts);
491 hist_ = new int[length_];
492 for (int i = 0; i < length_; ++i) {
493 l_int32 val = 0;
494 numaGetIValue(counts, i, &val);
495 hist_[i] = val;
496 }
497 numaDestroy(&counts);
498}
◆ ConstructVerticalCountHist()
void tesseract::PixelHistogram::ConstructVerticalCountHist |
( |
Pix * |
pix | ) |
|
Definition at line 469 of file devanagari_processing.cpp.
469 {
471 int width = pixGetWidth(pix);
472 int height = pixGetHeight(pix);
473 hist_ = new int[width];
474 length_ = width;
475 int wpl = pixGetWpl(pix);
476 l_uint32 *data = pixGetData(pix);
477 for (int i = 0; i < width; ++i)
478 hist_[i] = 0;
479 for (int i = 0; i < height; ++i) {
480 l_uint32 *line = data + i * wpl;
481 for (int j = 0; j < width; ++j)
482 if (GET_DATA_BIT(line, j))
483 ++(hist_[j]);
484 }
485}
◆ GetHistogramMaximum()
int tesseract::PixelHistogram::GetHistogramMaximum |
( |
int * |
count | ) |
const |
Definition at line 455 of file devanagari_processing.cpp.
455 {
456 int best_value = 0;
457 for (int i = 0; i < length_; ++i) {
458 if (hist_[i] > hist_[best_value]) {
459 best_value = i;
460 }
461 }
463 *
count = hist_[best_value];
464 }
465 return best_value;
466}
◆ hist()
int * tesseract::PixelHistogram::hist |
( |
| ) |
const |
|
inline |
◆ length()
int tesseract::PixelHistogram::length |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: