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

Method SmoothPartnerRun

deps/tesseract/textord/colpartition.cpp:1815–1850  ·  view source on GitHub ↗

Sets the types of all partitions in the run to be the max of the types.

Source from the content-addressed store, hash-verified

1813
1814// Sets the types of all partitions in the run to be the max of the types.
1815void ColPartition::SmoothPartnerRun(int working_set_count) {
1816 STATS left_stats(0, working_set_count);
1817 STATS right_stats(0, working_set_count);
1818 PolyBlockType max_type = type_;
1819 ColPartition* partner;
1820 for (partner = SingletonPartner(false); partner != NULL;
1821 partner = partner->SingletonPartner(false)) {
1822 if (partner->type_ > max_type)
1823 max_type = partner->type_;
1824 if (column_set_ == partner->column_set_) {
1825 left_stats.add(partner->first_column_, 1);
1826 right_stats.add(partner->last_column_, 1);
1827 }
1828 }
1829 type_ = max_type;
1830 // TODO(rays) Either establish that it isn't necessary to set the columns,
1831 // or find a way to do it that does not cause an assert failure in
1832 // AddToWorkingSet.
1833#if 0
1834 first_column_ = left_stats.mode();
1835 last_column_ = right_stats.mode();
1836 if (last_column_ < first_column_)
1837 last_column_ = first_column_;
1838#endif
1839
1840 for (partner = SingletonPartner(false); partner != NULL;
1841 partner = partner->SingletonPartner(false)) {
1842 partner->type_ = max_type;
1843#if 0 // See TODO above
1844 if (column_set_ == partner->column_set_) {
1845 partner->first_column_ = first_column_;
1846 partner->last_column_ = last_column_;
1847 }
1848#endif
1849 }
1850}
1851
1852// ======= Scenario common to all Refine*Partners* functions =======
1853// ColPartitions are aiming to represent textlines, or horizontal slices

Callers 1

SmoothPartnerRunsMethod · 0.80

Calls 3

SingletonPartnerMethod · 0.80
modeMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected