ORB crashes when no keypoints are available (Bug #3878)
Description
ORB crashes in debug mode with a vector subscript out of range exception when no keypoint could be detected. I believe this is because of template<typename _Tp> inline void copyVectorToUMat(const std::vector<_Tp>& v, OutputArray um)
{ if(v.empty())
um.release(); Mat(1, (int)(v.size()*sizeof(v[0])), CV_8U, (void*)&v[0]).copyTo(um);
} @
in Orb.cpp:
if v is empty, v0 fails - which is not tragic in release because of the multiplication with v.size().
To resolve this, we need to add an else.
However, I think the case of no keypoints being in the image should be handled a little higher up in the chain, too - maye in the function computeKeyPoints() directly after line 807:
std::vector<Vec3i> ukeypoints_buf;
nkeypoints = (int)allKeypoints.size();
//quit further processing
@if(nkeypoints == 0)
Associated revisions
Merge pull request #3878 from mshabunin:fix-python
History
Updated by Philipp Hasper over 10 years ago
- % Done changed from 0 to 100
- Status changed from New to Done