[opencv] 16/33: fix potential out-of-border access in gpu StereoBeliefPropagation
Mattia Rizzolo
mattia at debian.org
Tue Oct 4 17:51:04 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to annotated tag 2.4.12.2
in repository opencv.
commit 1d58e1a14a1c44a4c1b57c6a665acc7ea40d74ab
Author: Vladislav Vinogradov <vlad.vinogradov at itseez.com>
Date: Thu Aug 27 16:09:37 2015 +0300
fix potential out-of-border access in gpu StereoBeliefPropagation
---
modules/gpu/src/stereobp.cpp | 8 ++++----
modules/gpu/test/test_calib3d.cpp | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/gpu/src/stereobp.cpp b/modules/gpu/src/stereobp.cpp
index 1677f33..3b827a3 100644
--- a/modules/gpu/src/stereobp.cpp
+++ b/modules/gpu/src/stereobp.cpp
@@ -213,8 +213,8 @@ namespace
if (rthis.levels > 1)
{
- int less_rows = (rows + 1) / 2;
- int less_cols = (cols + 1) / 2;
+ int less_rows = rows / 2;
+ int less_cols = cols / 2;
u2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
d2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
@@ -283,8 +283,8 @@ namespace
for (int i = 1; i < rthis.levels; ++i)
{
- cols_all[i] = (cols_all[i-1] + 1) / 2;
- rows_all[i] = (rows_all[i-1] + 1) / 2;
+ cols_all[i] = cols_all[i-1] / 2;
+ rows_all[i] = rows_all[i-1] / 2;
datas[i].create(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type);
diff --git a/modules/gpu/test/test_calib3d.cpp b/modules/gpu/test/test_calib3d.cpp
index ea4039a..80882d4 100644
--- a/modules/gpu/test/test_calib3d.cpp
+++ b/modules/gpu/test/test_calib3d.cpp
@@ -114,7 +114,9 @@ GPU_TEST_P(StereoBeliefPropagation, Regression)
cv::Mat h_disp(disp);
h_disp.convertTo(h_disp, disp_gold.depth());
- EXPECT_MAT_NEAR(disp_gold, h_disp, 0.0);
+ cv::Rect roi(0, 0, disp_gold.cols - 20, disp_gold.rows - 20);
+
+ EXPECT_MAT_NEAR(disp_gold(roi), h_disp(roi), 0.0);
}
INSTANTIATE_TEST_CASE_P(GPU_Calib3D, StereoBeliefPropagation, ALL_DEVICES);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git
More information about the debian-science-commits
mailing list