From: Roman Donchenko Date: Fri, 16 Aug 2013 10:43:18 +0000 (+0400) Subject: In calcOpticalFlowSF, fixed several uninitialized uses of matrices. X-Git-Tag: accepted/tizen/ivi/20140515.103456~1^2~566^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d768d2159525d93eb28889154ae4124ac8369f7;p=profile%2Fivi%2Fopencv.git In calcOpticalFlowSF, fixed several uninitialized uses of matrices. This should fix that pesky test failure that pops up from time to time. I don't actually know if the default values should be zeros, but the tests pass, so... --- diff --git a/modules/video/src/simpleflow.cpp b/modules/video/src/simpleflow.cpp index 1de8084..7a32245 100644 --- a/modules/video/src/simpleflow.cpp +++ b/modules/video/src/simpleflow.cpp @@ -287,7 +287,7 @@ static Mat upscaleOpticalFlow(int new_rows, static Mat calcIrregularityMat(const Mat& flow, int radius) { const int rows = flow.rows; const int cols = flow.cols; - Mat irregularity(rows, cols, CV_32F); + Mat irregularity = Mat::zeros(rows, cols, CV_32F); for (int r = 0; r < rows; ++r) { const int start_row = max(0, r - radius); const int end_row = min(rows - 1, r + radius); @@ -409,7 +409,7 @@ static void extrapolateFlow(Mat& flow, const Mat& speed_up) { const int rows = flow.rows; const int cols = flow.cols; - Mat done(rows, cols, CV_8U); + Mat done = Mat::zeros(rows, cols, CV_8U); for (int r = 0; r < rows; ++r) { for (int c = 0; c < cols; ++c) { if (!done.at(r, c) && speed_up.at(r, c) > 1) { @@ -504,8 +504,8 @@ CV_EXPORTS_W void calcOpticalFlowSF(Mat& from, Mat mask = Mat::ones(curr_from.size(), CV_8U); Mat mask_inv = Mat::ones(curr_from.size(), CV_8U); - Mat flow(curr_from.size(), CV_32FC2); - Mat flow_inv(curr_to.size(), CV_32FC2); + Mat flow = Mat::zeros(curr_from.size(), CV_32FC2); + Mat flow_inv = Mat::zeros(curr_to.size(), CV_32FC2); Mat confidence; Mat confidence_inv;