mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-20 21:40:49 +08:00
Fixed number of neighbors not being passed to the flannquery in computeNormalsPC3d
This commit is contained in:
@@ -93,6 +93,7 @@ void computeBboxStd(Mat pc, float xRange[2], float yRange[2], float zRange[2]);
|
||||
void* indexPCFlann(Mat pc);
|
||||
void destroyFlann(void* flannIndex);
|
||||
void queryPCFlann(void* flannIndex, Mat& pc, Mat& indices, Mat& distances);
|
||||
void queryPCFlann(void* flannIndex, Mat& pc, Mat& indices, Mat& distances, const int numNeighbors);
|
||||
|
||||
/**
|
||||
* Mostly for visualization purposes. Normalizes the point cloud in a Hartley-Zissermann
|
||||
|
@@ -207,10 +207,15 @@ void destroyFlann(void* flannIndex)
|
||||
|
||||
// For speed purposes this function assumes that PC, Indices and Distances are created with continuous structures
|
||||
void queryPCFlann(void* flannIndex, Mat& pc, Mat& indices, Mat& distances)
|
||||
{
|
||||
queryPCFlann(flannIndex, pc, indices, distances, 1);
|
||||
}
|
||||
|
||||
void queryPCFlann(void* flannIndex, Mat& pc, Mat& indices, Mat& distances, const int numNeighbors)
|
||||
{
|
||||
Mat obj_32f;
|
||||
pc.colRange(0, 3).copyTo(obj_32f);
|
||||
((FlannIndex*)flannIndex)->knnSearch(obj_32f, indices, distances, 1, cvflann::SearchParams(32) );
|
||||
((FlannIndex*)flannIndex)->knnSearch(obj_32f, indices, distances, numNeighbors, cvflann::SearchParams(32));
|
||||
}
|
||||
|
||||
// uses a volume instead of an octree
|
||||
@@ -688,7 +693,7 @@ CV_EXPORTS int computeNormalsPC3d(const Mat& PC, Mat& PCNormals, const int NumNe
|
||||
Mat Indices(2, sizesResult, CV_32S, indices, 0);
|
||||
Mat Distances(2, sizesResult, CV_32F, distances, 0);
|
||||
|
||||
queryPCFlann(flannIndex, PCInput, Indices, Distances);
|
||||
queryPCFlann(flannIndex, PCInput, Indices, Distances, NumNeighbors);
|
||||
destroyFlann(flannIndex);
|
||||
flannIndex = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user