本文整理汇总了C++中TESSLINE::FindBestStartPt方法的典型用法代码示例。如果您正苦于以下问题:C++ TESSLINE::FindBestStartPt方法的具体用法?C++ TESSLINE::FindBestStartPt怎么用?C++ TESSLINE::FindBestStartPt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TESSLINE
的用法示例。
在下文中一共展示了TESSLINE::FindBestStartPt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractFeatures
// Extracts sets of 3-D features of length kStandardFeatureLength (=12.8), as
// (x,y) position and angle as measured counterclockwise from the vector
// <-1, 0>, from blob using two normalizations defined by bl_denorm and
// cn_denorm. See SetpuBLCNDenorms for definitions.
// If outline_cn_counts is not nullptr, on return it contains the cumulative
// number of cn features generated for each outline in the blob (in order).
// Thus after the first outline, there were (*outline_cn_counts)[0] features,
// after the second outline, there were (*outline_cn_counts)[1] features etc.
void Classify::ExtractFeatures(const TBLOB& blob,
bool nonlinear_norm,
GenericVector<INT_FEATURE_STRUCT>* bl_features,
GenericVector<INT_FEATURE_STRUCT>* cn_features,
INT_FX_RESULT_STRUCT* results,
GenericVector<int>* outline_cn_counts) {
DENORM bl_denorm, cn_denorm;
tesseract::Classify::SetupBLCNDenorms(blob, nonlinear_norm,
&bl_denorm, &cn_denorm, results);
if (outline_cn_counts != nullptr)
outline_cn_counts->truncate(0);
// Iterate the outlines.
for (TESSLINE* ol = blob.outlines; ol != nullptr; ol = ol->next) {
// Iterate the polygon.
EDGEPT* loop_pt = ol->FindBestStartPt();
EDGEPT* pt = loop_pt;
if (pt == nullptr) continue;
do {
if (pt->IsHidden()) continue;
// Find a run of equal src_outline.
EDGEPT* last_pt = pt;
do {
last_pt = last_pt->next;
} while (last_pt != loop_pt && !last_pt->IsHidden() &&
last_pt->src_outline == pt->src_outline);
last_pt = last_pt->prev;
// Until the adaptive classifier can be weaned off polygon segments,
// we have to force extraction from the polygon for the bl_features.
ExtractFeaturesFromRun(pt, last_pt, bl_denorm, kStandardFeatureLength,
true, bl_features);
ExtractFeaturesFromRun(pt, last_pt, cn_denorm, kStandardFeatureLength,
false, cn_features);
pt = last_pt;
} while ((pt = pt->next) != loop_pt);
if (outline_cn_counts != nullptr)
outline_cn_counts->push_back(cn_features->size());
}
results->NumBL = bl_features->size();
results->NumCN = cn_features->size();
results->YBottom = blob.bounding_box().bottom();
results->YTop = blob.bounding_box().top();
results->Width = blob.bounding_box().width();
}