|
Tesseract
3.02
|
Public Member Functions | |
| KDTreeSearch (KDTREE *tree, FLOAT32 *query_point, int k_closest) | |
| ~KDTreeSearch () | |
| void | Search (int *result_count, FLOAT32 *distances, void **results) |
Definition at line 121 of file kdtree.cpp.
Definition at line 140 of file kdtree.cpp.
| KDTreeSearch::~KDTreeSearch | ( | ) |
Definition at line 148 of file kdtree.cpp.
{
delete results_;
delete[] sb_min_;
delete[] sb_max_;
}
| void KDTreeSearch::Search | ( | int * | result_count, |
| FLOAT32 * | distances, | ||
| void ** | results | ||
| ) |
Definition at line 156 of file kdtree.cpp.
{
if (tree_->Root.Left == NULL) {
*result_count = 0;
} else {
for (int i = 0; i < tree_->KeySize; i++) {
sb_min_[i] = tree_->KeyDesc[i].Min;
sb_max_[i] = tree_->KeyDesc[i].Max;
}
SearchRec(0, tree_->Root.Left);
int count = results_->elements_count();
*result_count = count;
for (int j = 0; j < count; j++) {
distances[j] = (FLOAT32) sqrt((FLOAT64)results_->elements()[j].key);
results[j] = results_->elements()[j].value;
}
}
}