From 92826a0436266c0af63991f47c7b3c930825a63e Mon Sep 17 00:00:00 2001 From: PhilLab Date: Fri, 22 Aug 2014 21:00:41 +0200 Subject: [PATCH] ORB crashed with no keypoints present --- modules/features2d/src/orb.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/features2d/src/orb.cpp b/modules/features2d/src/orb.cpp index 57bce1c..983b2dd 100644 --- a/modules/features2d/src/orb.cpp +++ b/modules/features2d/src/orb.cpp @@ -49,7 +49,8 @@ template inline void copyVectorToUMat(const std::vector<_Tp>& v, O { if(v.empty()) um.release(); - Mat(1, (int)(v.size()*sizeof(v[0])), CV_8U, (void*)&v[0]).copyTo(um); + else + Mat(1, (int)(v.size()*sizeof(v[0])), CV_8U, (void*)&v[0]).copyTo(um); } static bool @@ -805,6 +806,10 @@ static void computeKeyPoints(const Mat& imagePyramid, std::vector ukeypoints_buf; nkeypoints = (int)allKeypoints.size(); + if(nkeypoints == 0) + { + return; + } Mat responses; UMat ukeypoints, uresponses(1, nkeypoints, CV_32F); -- 2.7.4