#include "blobbox.h"
#include <algorithm>
#include <cstdint>
#include "allheaders.h"
#include "blobs.h"
#include "coutln.h"
#include "environ.h"
#include "helpers.h"
#include "host.h"
#include "points.h"
Go to the source code of this file.
|
void | find_cblob_limits (C_BLOB *blob, float leftx, float rightx, FCOORD rotation, float &ymin, float &ymax) |
|
void | find_cblob_vlimits (C_BLOB *blob, float leftx, float rightx, float &ymin, float &ymax) |
|
void | find_cblob_hlimits (C_BLOB *blob, float bottomy, float topy, float &xmin, float &xmax) |
|
C_BLOB * | crotate_cblob (C_BLOB *blob, FCOORD rotation) |
|
TBOX | box_next (BLOBNBOX_IT *it) |
|
TBOX | box_next_pre_chopped (BLOBNBOX_IT *it) |
|
void | vertical_cblob_projection (C_BLOB *blob, STATS *stats) |
|
void | vertical_coutline_projection (C_OUTLINE *outline, STATS *stats) |
|
void | plot_blob_list (ScrollView *win, BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour) |
|
◆ PROJECTION_MARGIN
#define PROJECTION_MARGIN 10 |
◆ box_next()
TBOX box_next |
( |
BLOBNBOX_IT * |
it | ) |
|
Definition at line 637 of file blobbox.cpp.
648 if (blob->
cblob() ==
nullptr)
bool joined_to_prev() const
const TBOX & bounding_box() const
◆ box_next_pre_chopped()
TBOX box_next_pre_chopped |
( |
BLOBNBOX_IT * |
it | ) |
|
Definition at line 666 of file blobbox.cpp.
bool joined_to_prev() const
const TBOX & bounding_box() const
◆ crotate_cblob()
Definition at line 612 of file blobbox.cpp.
616 C_OUTLINE_LIST out_list;
618 C_OUTLINE_IT in_it = blob->
out_list ();
620 C_OUTLINE_IT out_it = &out_list;
622 for (in_it.mark_cycle_pt (); !in_it.cycled_list (); in_it.forward ()) {
623 out_it.add_after_then_move (
new C_OUTLINE (in_it.data (), rotation));
625 return new C_BLOB (&out_list);
C_OUTLINE_LIST * out_list()
◆ find_cblob_hlimits()
void find_cblob_hlimits |
( |
C_BLOB * |
blob, |
|
|
float |
bottomy, |
|
|
float |
topy, |
|
|
float & |
xmin, |
|
|
float & |
xmax |
|
) |
| |
Definition at line 577 of file blobbox.cpp.
588 C_OUTLINE_IT out_it = blob->
out_list ();
590 xmin = (float) INT32_MAX;
591 xmax = (float) -INT32_MAX;
592 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
593 outline = out_it.data ();
595 for (stepindex = 0; stepindex < outline->
pathlength (); stepindex++) {
597 if (pos.
y () >= bottomy && pos.
y () <= topy) {
600 vec = outline->
step (stepindex);
int16_t y() const
access_function
const ICOORD & start_pos() const
int16_t x() const
access function
int32_t pathlength() const
C_OUTLINE_LIST * out_list()
ICOORD step(int index) const
void UpdateRange(const T1 &x, T2 *lower_bound, T2 *upper_bound)
◆ find_cblob_limits()
void find_cblob_limits |
( |
C_BLOB * |
blob, |
|
|
float |
leftx, |
|
|
float |
rightx, |
|
|
FCOORD |
rotation, |
|
|
float & |
ymin, |
|
|
float & |
ymax |
|
) |
| |
Definition at line 500 of file blobbox.cpp.
512 C_OUTLINE_IT out_it = blob->
out_list ();
514 ymin = (float) INT32_MAX;
515 ymax = (float) -INT32_MAX;
516 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
517 outline = out_it.data ();
520 for (stepindex = 0; stepindex < outline->
pathlength (); stepindex++) {
522 if (pos.
x () >= leftx && pos.
x () <= rightx) {
525 vec = outline->
step (stepindex);
int16_t y() const
access_function
const ICOORD & start_pos() const
int16_t x() const
access function
int32_t pathlength() const
void rotate(const FCOORD &vec)
C_OUTLINE_LIST * out_list()
ICOORD step(int index) const
void UpdateRange(const T1 &x, T2 *lower_bound, T2 *upper_bound)
◆ find_cblob_vlimits()
void find_cblob_vlimits |
( |
C_BLOB * |
blob, |
|
|
float |
leftx, |
|
|
float |
rightx, |
|
|
float & |
ymin, |
|
|
float & |
ymax |
|
) |
| |
Definition at line 540 of file blobbox.cpp.
551 C_OUTLINE_IT out_it = blob->
out_list ();
553 ymin = (float) INT32_MAX;
554 ymax = (float) -INT32_MAX;
555 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
556 outline = out_it.data ();
558 for (stepindex = 0; stepindex < outline->
pathlength (); stepindex++) {
560 if (pos.
x () >= leftx && pos.
x () <= rightx) {
563 vec = outline->
step (stepindex);
int16_t y() const
access_function
const ICOORD & start_pos() const
int16_t x() const
access function
int32_t pathlength() const
C_OUTLINE_LIST * out_list()
ICOORD step(int index) const
void UpdateRange(const T1 &x, T2 *lower_bound, T2 *upper_bound)
◆ plot_blob_list()
Definition at line 1087 of file blobbox.cpp.
1091 BLOBNBOX_IT it = list;
1092 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
1093 it.data()->plot(win, body_colour, child_colour);
◆ vertical_cblob_projection()
void vertical_cblob_projection |
( |
C_BLOB * |
blob, |
|
|
STATS * |
stats |
|
) |
| |
Definition at line 869 of file blobbox.cpp.
874 C_OUTLINE_IT out_it = blob->
out_list ();
876 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
C_OUTLINE_LIST * out_list()
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
◆ vertical_coutline_projection()
void vertical_coutline_projection |
( |
C_OUTLINE * |
outline, |
|
|
STATS * |
stats |
|
) |
| |
Definition at line 889 of file blobbox.cpp.
897 C_OUTLINE_IT out_it = outline->
child ();
901 for (stepindex = 0; stepindex < length; stepindex++) {
902 step = outline->
step (stepindex);
904 stats->
add (pos.
x (), -pos.
y ());
905 }
else if (step.
x () < 0) {
906 stats->
add (pos.
x () - 1, pos.
y ());
911 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
int16_t y() const
access_function
const ICOORD & start_pos() const
int16_t x() const
access function
int32_t pathlength() const
void add(int32_t value, int32_t count)
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
ICOORD step(int index) const
◆ kComplexShapePerimeterRatio
const double kComplexShapePerimeterRatio = 1.5 |
◆ kCosSmallAngle
const double kCosSmallAngle = 0.866 |
◆ kDefiniteAspectRatio
const double kDefiniteAspectRatio = 2.0 |
◆ kMaxMediumSizeRatio
const double kMaxMediumSizeRatio = 4.0 |
◆ kMinMediumSizeRatio
const double kMinMediumSizeRatio = 0.25 |