Commit a97c2c83 authored by Leonid Beynenson's avatar Leonid Beynenson

Made small change which fixes the situation, when ORB does not find any…

Made small change which fixes the situation, when ORB does not find any descriptors on an image. Earlier ORB::operator() crashed in this case, since rowRange method was called for an empty matrix.
parent c6571249
...@@ -932,7 +932,12 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke ...@@ -932,7 +932,12 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
// Compute the descriptors // Compute the descriptors
if (do_descriptors) if (do_descriptors)
{ {
Mat desc = descriptors.rowRange(offset, offset + nkeypoints); Mat desc;
if (!descriptors.empty())
{
desc = descriptors.rowRange(offset, offset + nkeypoints);
}
offset += nkeypoints; offset += nkeypoints;
// preprocess the resized image // preprocess the resized image
Mat& workingMat = imagePyramid[level]; Mat& workingMat = imagePyramid[level];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment