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

Method SmoothPartnerRuns

deps/tesseract/textord/colfind.cpp:1350–1379  ·  view source on GitHub ↗

Only images remain with multiple types in a run of partners. Sets the type of all in the group to the maximum of the group.

Source from the content-addressed store, hash-verified

1348// Only images remain with multiple types in a run of partners.
1349// Sets the type of all in the group to the maximum of the group.
1350void ColumnFinder::SmoothPartnerRuns() {
1351 // Iterate the ColPartitions in the grid.
1352 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1353 gsearch(&part_grid_);
1354 gsearch.StartFullSearch();
1355 ColPartition* part;
1356 while ((part = gsearch.NextFullSearch()) != NULL) {
1357 ColPartition* partner = part->SingletonPartner(true);
1358 if (partner != NULL) {
1359 if (partner->SingletonPartner(false) != part) {
1360 tprintf("Ooops! Partition:(%d partners)",
1361 part->upper_partners()->length());
1362 part->Print();
1363 tprintf("has singleton partner:(%d partners",
1364 partner->lower_partners()->length());
1365 partner->Print();
1366 tprintf("but its singleton partner is:");
1367 if (partner->SingletonPartner(false) == NULL)
1368 tprintf("NULL\n");
1369 else
1370 partner->SingletonPartner(false)->Print();
1371 }
1372 ASSERT_HOST(partner->SingletonPartner(false) == part);
1373 } else if (part->SingletonPartner(false) != NULL) {
1374 ColPartitionSet* column_set = best_columns_[gsearch.GridY()];
1375 int column_count = column_set->ColumnCount();
1376 part->SmoothPartnerRun(column_count * 2 + 1);
1377 }
1378 }
1379}
1380
1381// Helper functions for TransformToBlocks.
1382// Add the part to the temp list in the correct order.

Callers

nothing calls this directly

Calls 10

StartFullSearchMethod · 0.80
NextFullSearchMethod · 0.80
SingletonPartnerMethod · 0.80
upper_partnersMethod · 0.80
lower_partnersMethod · 0.80
GridYMethod · 0.80
ColumnCountMethod · 0.80
SmoothPartnerRunMethod · 0.80
lengthMethod · 0.45
PrintMethod · 0.45

Tested by

no test coverage detected