MCPcopy Create free account
hub / github.com/creatale/node-dv / ExpandImageDir

Function ExpandImageDir

deps/tesseract/textord/imagefind.cpp:927–951  ·  view source on GitHub ↗

Expands the image box in the given direction until it hits text, limiting the expansion to the given limit box, returning the result in the expanded box, and returning the increase in area resulting from the expansion.

Source from the content-addressed store, hash-verified

925// in the expanded box, and
926// returning the increase in area resulting from the expansion.
927static int ExpandImageDir(BlobNeighbourDir dir, const TBOX& im_box,
928 const TBOX& limit_box,
929 ColPartitionGrid* part_grid, TBOX* expanded_box) {
930 *expanded_box = im_box;
931 switch (dir) {
932 case BND_LEFT:
933 expanded_box->set_left(ExpandImageLeft(im_box, limit_box.left(),
934 part_grid));
935 break;
936 case BND_RIGHT:
937 expanded_box->set_right(ExpandImageRight(im_box, limit_box.right(),
938 part_grid));
939 break;
940 case BND_ABOVE:
941 expanded_box->set_top(ExpandImageTop(im_box, limit_box.top(), part_grid));
942 break;
943 case BND_BELOW:
944 expanded_box->set_bottom(ExpandImageBottom(im_box, limit_box.bottom(),
945 part_grid));
946 break;
947 default:
948 return 0;
949 }
950 return expanded_box->area() - im_box.area();
951}
952
953// Expands the image partition into any non-text until it touches text.
954// The expansion proceeds in the order of increasing increase in area

Callers 1

MaximalImageBoundingBoxFunction · 0.85

Calls 9

ExpandImageLeftFunction · 0.85
ExpandImageRightFunction · 0.85
ExpandImageTopFunction · 0.85
ExpandImageBottomFunction · 0.85
set_leftMethod · 0.80
set_rightMethod · 0.80
set_topMethod · 0.80
set_bottomMethod · 0.80
areaMethod · 0.45

Tested by

no test coverage detected