Open ahundt opened 8 years ago
I am also receiving this error when trying to match. The method executes correctly when training the detector.
@RayceRossum off topic but I'm now using https://github.com/tum-mvp/ObjRecRANSAC, plus some fixes at: https://github.com/ahundt/ObjRecRANSAC.
Thank you @ahundt, I noticed this has also been implemented in the PCL library which I have been working with so I'll give that a try!
Could you provide some details on that or a sample code to reproduce the error?
I think all my tests are in this folder: https://github.com/ahundt/grl/tree/master/test
It has been so long that I don't recall exactly what I did, but the main files should be fairly easy to use, sorry!
I had this bug aswell. It happens when data in the mat is nullptr. Solution is to do a check before calling the match function, but this should really be done within the match function
@feliwir Could you please open a pull request with data and sample code to reproduce it and the fix itself? I'm sure many would appreciate it.
@bmagyar @tolgabirdal Problem is line 286 and following in ppf_helpers.cpp:
float xr = xrange[1] - xrange[0];
float yr = yrange[1] - yrange[0];
float zr = zrange[1] - zrange[0];
int numPoints = 0;
map.resize((numSamplesDim+1)*(numSamplesDim+1)*(numSamplesDim+1));
// OpenMP might seem like a good idea, but it didn't speed this up for me
//#pragma omp parallel for
for (int i=0; i<pc.rows; i++)
{
const float* point = pc.ptr<float>(i);
// quantize a point
const int xCell =(int) ((float)numSamplesDim*(point[0]-xrange[0])/xr);
const int yCell =(int) ((float)numSamplesDim*(point[1]-yrange[0])/yr);
const int zCell =(int) ((float)numSamplesDim*(point[2]-zrange[0])/zr);
const int index = xCell*numSamplesDim*numSamplesDim+yCell*numSamplesDim+zCell;
/*#pragma omp critical
{*/
map[index].push_back(i);
When xr,yr or zr are 0 there occurs a division by 0. This happens for me with zr, so the zCell is completly messed up and the index is wrong aswell after that. I recommend a check for zero division, but i am not sure to which value xCell,yCell and zCell should be set in that special case
I am also having this issue, has anyone found a good solution for this? Just realized this was from 2017.
It looks like this issue was fixed in OpenCV 3.4.2 in this commit: https://github.com/opencv/opencv_contrib/commit/71191e36d6b278e1d20007b6b217d799388e84ae#diff-30596ba439a137919cd3407e960b71ea
I am going to test now and see if the issue is fixed.
I've run into a case where ppf_helpers.cpp samplePCByQuantization fails because
On line 278 the value contained in
point
aka*point
contains the value NaN. It almost looks like a pointer is being multiplied by i, which seems quite strange, unless cv::MatStep is convertible into something else.Here is the stack trace:
Here is the state of the relevant variables:
Clearly
*point
isn't right and neither isindex
.