Open ghemann opened 10 years ago
I've run a few more tests. It appears to only be an issue when my data points are of length 3. Length 2 and 4 work fine.
Hi,
Can you send (or post on gist) a minimal program that reproduces the segfault?
Thanks, Marius
https://gist.github.com/ghemann/c5edf7ac5035d057cbfb
Only depends on flann. (using 1.8-4). Run with arguments 2, then 3, then 4 (dimensions). 2 and 4 seem to work fine, 3 segs after 8192 iterations.
Thanks Marius
Ok, I've actually found an issue with my code, but still doesn't explain the segfault. My code, for dimensions 2 and 4, are actually not pulling the correct data into the matrix (lines 33 and 54 should be using data2 and data4 respectively). When I make the fix, then 2 and 3 dimensions are limited to 8192 points and 4 is limited to 4096. It's interesting though that i get no segfaults when a different data size gets pushed into the matrix and added to the index. Still trying to debug that.
I am using FLANN-1.8.4 library for writing a C++ code. I am trying to use kd-tree implementation.
I am using this function
void addPoints(const Matrix
cv::Mat features;
flann::Matrix
But it gives me build error as: error: ‘class flann::Index < flann::L2 < float > >’ has no member named ‘addPoints’
addPoints function is there in flann.hpp file but i think it works only with particular type of distances. Please help.
I've got a pretty standard setup with adding a new data point each loop, but every time i run it, when i get to the 8192nd adding of a point, i get a segmentation fault. The line
abs(point[i]-leaf_point[i])
(line 666.h in kdtree_index.h) gives me the issue when accessing the 2nd index of leaf_point.I thought it may be the BLOCKSIZE of 8192 for allocation of new memory, but changing that number didn't seem to have an effect. I'm using the default (2) for build index when I call addPoints().
The code is pretty self explanatory.
flann::Matrix<double> newpoint(data, 1, 3);
kd_index_->addPoints(newpoint);
Calling this addPoints on the 8192nd time every time causes the issue.