#include <stepblob.h>
Definition at line 40 of file stepblob.h.
◆ C_BLOB() [1/3]
tesseract::C_BLOB::C_BLOB |
( |
| ) |
|
|
default |
◆ C_BLOB() [2/3]
tesseract::C_BLOB::C_BLOB |
( |
C_OUTLINE_LIST * |
outline_list | ) |
|
|
explicit |
Definition at line 162 of file stepblob.cpp.
163 for (C_OUTLINE_IT ol_it(outline_list); !ol_it.empty(); ol_it.forward()) {
164 C_OUTLINE *outline = ol_it.extract();
166 position_outline(outline, &outlines);
void CheckInverseFlagAndDirection()
◆ C_BLOB() [3/3]
tesseract::C_BLOB::C_BLOB |
( |
C_OUTLINE * |
outline | ) |
|
|
explicit |
Definition at line 173 of file stepblob.cpp.
174 C_OUTLINE_IT it(&outlines);
175 it.add_to_end(outline);
◆ area()
int32_t tesseract::C_BLOB::area |
( |
| ) |
|
Definition at line 268 of file stepblob.cpp.
269 C_OUTLINE_IT it = &outlines;
272 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
273 C_OUTLINE *outline = it.data();
274 total += outline->area();
◆ bounding_box()
TBOX tesseract::C_BLOB::bounding_box |
( |
| ) |
const |
Definition at line 250 of file stepblob.cpp.
252 C_OUTLINE_IT it =
const_cast<C_OUTLINE_LIST *
>(&outlines);
255 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
256 C_OUTLINE *outline = it.data();
257 box += outline->bounding_box();
◆ CheckInverseFlagAndDirection()
void tesseract::C_BLOB::CheckInverseFlagAndDirection |
( |
| ) |
|
Definition at line 222 of file stepblob.cpp.
223 C_OUTLINE_IT ol_it(&outlines);
224 for (ol_it.mark_cycle_pt(); !ol_it.cycled_list(); ol_it.forward()) {
225 C_OUTLINE *outline = ol_it.data();
226 if (outline->turn_direction() < 0) {
228 reverse_outline_list(outline->child());
◆ ComputeEdgeOffsets()
void tesseract::C_BLOB::ComputeEdgeOffsets |
( |
int |
threshold, |
|
|
Image |
pix |
|
) |
| |
Definition at line 398 of file stepblob.cpp.
399 ComputeEdgeOffsetsOutlineList(threshold, pix, &outlines);
◆ ConstructBlobsFromOutlines()
void tesseract::C_BLOB::ConstructBlobsFromOutlines |
( |
bool |
good_blob, |
|
|
C_OUTLINE_LIST * |
outline_list, |
|
|
C_BLOB_IT * |
good_blobs_it, |
|
|
C_BLOB_IT * |
bad_blobs_it |
|
) |
| |
|
static |
Definition at line 188 of file stepblob.cpp.
191 C_OUTLINE_LIST nested_outlines;
192 for (C_OUTLINE_IT ol_it(outline_list); !ol_it.empty(); ol_it.forward()) {
193 C_OUTLINE *outline = ol_it.extract();
195 position_outline(outline, &nested_outlines);
198 for (C_OUTLINE_IT ol_it(&nested_outlines); !ol_it.empty(); ol_it.forward()) {
199 C_OUTLINE *outline = ol_it.extract();
200 bool blob_is_good = good_blob;
201 if (!outline->IsLegallyNested()) {
204 blob_is_good =
false;
205 ol_it.add_list_after(outline->child());
207 auto *blob =
new C_BLOB(outline);
209 blob->CheckInverseFlagAndDirection();
211 if (!blob_is_good && bad_blobs_it !=
nullptr) {
212 bad_blobs_it->add_after_then_move(blob);
214 good_blobs_it->add_after_then_move(blob);
◆ count_transitions()
int32_t tesseract::C_BLOB::count_transitions |
( |
int32_t |
threshold | ) |
|
Definition at line 320 of file stepblob.cpp.
323 C_OUTLINE_IT it = &outlines;
326 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
327 C_OUTLINE *outline = it.data();
328 total += outline->count_transitions(threshold);
◆ deep_copy()
static C_BLOB* tesseract::C_BLOB::deep_copy |
( |
const C_BLOB * |
src | ) |
|
|
inlinestatic |
◆ EstimateBaselinePosition()
int16_t tesseract::C_BLOB::EstimateBaselinePosition |
( |
| ) |
|
Definition at line 416 of file stepblob.cpp.
418 int left = box.left();
419 int width = box.width();
420 int bottom = box.bottom();
425 std::vector<int> y_mins(width + 1, box.top());
426 C_OUTLINE_IT it(&outlines);
427 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
428 C_OUTLINE *outline = it.data();
429 ICOORD pos = outline->start_pos();
430 for (
int s = 0; s < outline->pathlength(); ++s) {
431 if (pos.y() < y_mins[pos.x() - left]) {
432 y_mins[pos.x() - left] = pos.y();
434 pos += outline->step(s);
438 int bottom_extent = 0;
439 for (
int x = 0; x <= width; ++x) {
440 if (y_mins[x] == bottom || y_mins[x] == bottom + 1) {
445 int best_min = box.top();
447 int prev_y = box.top();
448 int prev_prev_y = box.top();
449 for (
int x = 0; x < width; x += prev_run) {
451 int y_at_x = y_mins[x];
453 while (x + run <= width && y_mins[x + run] == y_at_x) {
456 if (y_at_x > bottom + 1) {
460 while (x + total_run <= width &&
461 (y_mins[x + total_run] == y_at_x || y_mins[x + total_run] == y_at_x + 1)) {
465 if (prev_prev_y > y_at_x + 1 || x + total_run > width || y_mins[x + total_run] > y_at_x + 1) {
468 if (prev_run > 0 && prev_y == y_at_x + 1) {
469 total_run += prev_run;
471 if (total_run > bottom_extent && y_at_x < best_min) {
477 prev_prev_y = prev_y;
480 return best_min == box.top() ? bottom : best_min;
const double kMaxPerimeterWidthRatio
TBOX bounding_box() const
◆ FakeBlob()
C_BLOB * tesseract::C_BLOB::FakeBlob |
( |
const TBOX & |
box | ) |
|
|
static |
Definition at line 238 of file stepblob.cpp.
239 C_OUTLINE_LIST outlines;
241 return new C_BLOB(&outlines);
static void FakeOutline(const TBOX &box, C_OUTLINE_LIST *outlines)
◆ move()
void tesseract::C_BLOB::move |
( |
const ICOORD |
vec | ) |
|
Definition at line 339 of file stepblob.cpp.
342 C_OUTLINE_IT it(&outlines);
344 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
345 it.data()->move(vec);
◆ operator=()
C_BLOB& tesseract::C_BLOB::operator= |
( |
const C_BLOB & |
source | ) |
|
|
inline |
Definition at line 110 of file stepblob.h.
111 if (!outlines.empty()) {
static C_OUTLINE * deep_copy(const C_OUTLINE *src)
◆ out_list()
C_OUTLINE_LIST* tesseract::C_BLOB::out_list |
( |
| ) |
|
|
inline |
◆ outer_area()
int32_t tesseract::C_BLOB::outer_area |
( |
| ) |
|
Definition at line 302 of file stepblob.cpp.
303 C_OUTLINE_IT it = &outlines;
306 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
307 C_OUTLINE *outline = it.data();
308 total += outline->outer_area();
◆ perimeter()
int32_t tesseract::C_BLOB::perimeter |
( |
| ) |
|
Definition at line 285 of file stepblob.cpp.
286 C_OUTLINE_IT it = &outlines;
289 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
290 C_OUTLINE *outline = it.data();
291 total += outline->perimeter();
◆ plot()
Definition at line 526 of file stepblob.cpp.
529 plot_outline_list(&outlines, window, blob_colour, child_colour);
◆ plot_normed()
Definition at line 534 of file stepblob.cpp.
536 plot_normed_outline_list(denorm, &outlines, blob_colour, child_colour, window);
◆ render()
Image tesseract::C_BLOB::render |
( |
| ) |
|
Definition at line 503 of file stepblob.cpp.
505 Image pix = pixCreate(box.width(), box.height(), 1);
506 render_outline_list(&outlines, box.left(), box.top(), pix);
◆ render_outline()
Image tesseract::C_BLOB::render_outline |
( |
| ) |
|
Definition at line 512 of file stepblob.cpp.
514 Image pix = pixCreate(box.width(), box.height(), 1);
515 render_outline_list_outline(&outlines, box.left(), box.top(), pix);
◆ rotate()
void tesseract::C_BLOB::rotate |
( |
const FCOORD & |
rotation | ) |
|
Definition at line 375 of file stepblob.cpp.
376 RotateOutlineList(rotation, &outlines);
◆ SortByXMiddle()
static int tesseract::C_BLOB::SortByXMiddle |
( |
const void * |
v1, |
|
|
const void * |
v2 |
|
) |
| |
|
inlinestatic |
Definition at line 124 of file stepblob.h.
125 const C_BLOB *blob1 = *
static_cast<const C_BLOB *
const *
>(v1);
126 const C_BLOB *blob2 = *
static_cast<const C_BLOB *
const *
>(v2);
127 return blob1->bounding_box().x_middle() - blob2->bounding_box().x_middle();
The documentation for this class was generated from the following files: