This method returns the features associated with the input blob. */ The resulting features are returned in int_features, which must be of size MAX_NUM_INT_FEATURES. The number of features is returned in num_features (or 0 if there was a failure). On return feature_outline_index is filled with an index of the outline corresponding to each feature in int_features. TODO(rays) Fix the caller to out ou
| 2740 | // corresponding to each feature in int_features. |
| 2741 | // TODO(rays) Fix the caller to out outline_counts instead. |
| 2742 | void TessBaseAPI::GetFeaturesForBlob(TBLOB* blob, |
| 2743 | INT_FEATURE_STRUCT* int_features, |
| 2744 | int* num_features, |
| 2745 | int* feature_outline_index) { |
| 2746 | GenericVector<int> outline_counts; |
| 2747 | GenericVector<INT_FEATURE_STRUCT> bl_features; |
| 2748 | GenericVector<INT_FEATURE_STRUCT> cn_features; |
| 2749 | INT_FX_RESULT_STRUCT fx_info; |
| 2750 | tesseract_->ExtractFeatures(*blob, false, &bl_features, |
| 2751 | &cn_features, &fx_info, &outline_counts); |
| 2752 | if (cn_features.empty() || cn_features.size() > MAX_NUM_INT_FEATURES) { |
| 2753 | *num_features = 0; |
| 2754 | return; // Feature extraction failed. |
| 2755 | } |
| 2756 | *num_features = cn_features.size(); |
| 2757 | memcpy(int_features, &cn_features[0], *num_features * sizeof(cn_features[0])); |
| 2758 | // TODO(rays) Pass outline_counts back and simplify the calling code. |
| 2759 | if (feature_outline_index != NULL) { |
| 2760 | int f = 0; |
| 2761 | for (int i = 0; i < outline_counts.size(); ++i) { |
| 2762 | while (f < outline_counts[i]) |
| 2763 | feature_outline_index[f++] = i; |
| 2764 | } |
| 2765 | } |
| 2766 | } |
| 2767 | |
| 2768 | // This method returns the row to which a box of specified dimensions would |
| 2769 | // belong. If no good match is found, it returns NULL. |
no test coverage detected