From 21ee113af30a2efba8faac4811d55822ff878b0e Mon Sep 17 00:00:00 2001 From: Ahmatnurov Dinar Date: Mon, 16 Feb 2015 16:28:33 +0300 Subject: [PATCH] fixig std::bad_alloc if points0 is empty checkVector(2) return -1, it causes the exception --- modules/videostab/src/global_motion.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/videostab/src/global_motion.cpp b/modules/videostab/src/global_motion.cpp index d840e895d2..f7938d5c4c 100644 --- a/modules/videostab/src/global_motion.cpp +++ b/modules/videostab/src/global_motion.cpp @@ -544,6 +544,9 @@ Mat MotionEstimatorL1::estimate(InputArray points0, InputArray points1, bool *ok CV_Assert(motionModel() <= MM_AFFINE && motionModel() != MM_RIGID); + if(npoints <= 0) + return Mat::eye(3, 3, CV_32F); + // prepare LP problem const Point2f *points0_ = points0.getMat().ptr();