interactive calibration application fails assertion when compiled for debug
Environment: openCV 3.4.2, Windows 10, VS2017
I have recompiled the interactive calibration application in debug mode (After modifying parts of main.cpp and calibPipeline.cpp to work with Spinnaker library from FLIR). Everything is more-or-less working up to when the maximum number of frames are collected and the filterFrames function in calibController.cpp starts removing poor frames from the queue. (I haven't made any changes to this code)
At this point the debugger halts, reporting a debug assertion failure as shown below in mat.inl.hpp:
template<typename _Tp> inline
_Tp* Mat::ptr(int y)
{
CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
return (_Tp*)(data + step.p[0] * y);
}
after some debugging I've traced the offending line of code in calibController.cpp to:
std::copy(mCalibData->perViewErrors.ptr<double>((int)worstElemIndex + 1), mCalibData->perViewErrors.ptr<double>((int)numberOfFrames),newErrorsVec.ptr<double>((int)worstElemIndex));
I'm simultaneously trying to get up to speed with openCV, C++, and VS 2017 and have reached (or maybe exceeded) the limits of my knowledge so I'm not sure where to go next.
The code seems to make sense and when compiled for release, the code executes without crashing but I've always heard that it's a bad idea to assume that asserts are false alarms...
In debug mode when assertion is set use stack trace to get context at line https://github.com/opencv/opencv/blob... then you can display values of mCalibData, numberOfFrames,.... something must be wrong
looks like a valid bug to me.
what if
worstElemIndex
happens to be the last one ? the code does not check.https://github.com/opencv/opencv/issu...