| 509 | |
| 510 | |
| 511 | double computeChamfer(PointViewPtr srcView, PointViewPtr candView) |
| 512 | { |
| 513 | using namespace Dimension; |
| 514 | |
| 515 | KD3Index &srcIndex = srcView->build3dIndex(); |
| 516 | KD3Index &candIndex = candView->build3dIndex(); |
| 517 | |
| 518 | double sum1(0.0); |
| 519 | for (PointRef p : *srcView) |
| 520 | { |
| 521 | PointIdList indices(1); |
| 522 | std::vector<double> sqr_dists(1); |
| 523 | candIndex.knnSearch(p, 1, &indices, &sqr_dists); |
| 524 | sum1 += sqr_dists[0]; |
| 525 | } |
| 526 | |
| 527 | double sum2(0.0); |
| 528 | for (PointRef q : *candView) |
| 529 | { |
| 530 | PointIdList indices(1); |
| 531 | std::vector<double> sqr_dists(1); |
| 532 | srcIndex.knnSearch(q, 1, &indices, &sqr_dists); |
| 533 | sum2 += sqr_dists[0]; |
| 534 | } |
| 535 | |
| 536 | return sum1 + sum2; |
| 537 | } |
| 538 | |
| 539 | |
| 540 | std::vector<std::string> remoteGlob(const std::string& path) |