#include "blobs.h"
#include "ccstruct.h"
#include "clst.h"
#include "emalloc.h"
#include "helpers.h"
#include "linlsq.h"
#include "normalis.h"
#include "ocrblock.h"
#include "ocrrow.h"
#include "points.h"
#include "polyaprx.h"
#include "structures.h"
#include "werd.h"
#include <algorithm>
Go to the source code of this file.
◆ divide_blobs()
void divide_blobs |
( |
TBLOB * |
blob, |
|
|
TBLOB * |
other_blob, |
|
|
bool |
italic_blob, |
|
|
const TPOINT & |
location |
|
) |
| |
Definition at line 972 of file blobs.cpp.
981 int location_prod =
CROSS(location, vertical);
983 while (outline !=
nullptr) {
987 int mid_prod =
CROSS(mid_pt, vertical);
988 if (mid_prod < location_prod) {
991 outline1->
next = outline;
998 outline2->
next = outline;
1003 outline = outline->
next;
1006 if (outline1) outline1->
next =
nullptr;
1007 if (outline2) outline2->
next =
nullptr;
const TPOINT kDivisibleVerticalUpright(0, 1)
const TPOINT kDivisibleVerticalItalic(1, 5)
◆ divisible_blob()
bool divisible_blob |
( |
TBLOB * |
blob, |
|
|
bool |
italic_blob, |
|
|
TPOINT * |
location |
|
) |
| |
Definition at line 923 of file blobs.cpp.
930 outline1 = outline1->
next) {
931 if (outline1->is_hole)
continue;
933 static_cast<int16_t>((outline1->topleft.x + outline1->botright.x) / 2),
934 static_cast<int16_t>((outline1->topleft.y + outline1->botright.y) / 2));
935 int mid_prod1 =
CROSS(mid_pt1, vertical);
936 int min_prod1, max_prod1;
937 outline1->MinMaxCrossProduct(vertical, &min_prod1, &max_prod1);
938 for (
TESSLINE* outline2 = outline1->
next; outline2 !=
nullptr;
939 outline2 = outline2->
next) {
940 if (outline2->is_hole)
continue;
941 TPOINT mid_pt2(static_cast<int16_t>(
942 (outline2->topleft.x + outline2->botright.x) / 2),
943 static_cast<int16_t>(
944 (outline2->topleft.y + outline2->botright.y) / 2));
945 int mid_prod2 =
CROSS(mid_pt2, vertical);
946 int min_prod2, max_prod2;
947 outline2->MinMaxCrossProduct(vertical, &min_prod2, &max_prod2);
948 int mid_gap = abs(mid_prod2 - mid_prod1);
950 std::min(max_prod1, max_prod2) - std::max(min_prod1, min_prod2);
951 if (mid_gap - overlap / 4 > max_gap) {
952 max_gap = mid_gap - overlap / 4;
954 *location += mid_pt2;
961 return max_gap > vertical.
y;
const TPOINT kDivisibleVerticalUpright(0, 1)
const TPOINT kDivisibleVerticalItalic(1, 5)
◆ kDivisibleVerticalItalic
const TPOINT kDivisibleVerticalItalic(1, 5) |
◆ kDivisibleVerticalUpright
const TPOINT kDivisibleVerticalUpright(0, 1) |