From a8c24ada60c128c336a1920e9465931016652559 Mon Sep 17 00:00:00 2001 From: Alexandr Graschenkov Date: Mon, 30 Jul 2018 11:47:18 +0300 Subject: [PATCH] - fix selecting pixels outside the memory --- src/FullSystem/PixelSelector2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FullSystem/PixelSelector2.cpp b/src/FullSystem/PixelSelector2.cpp index 5e2242ea3..280d9cc88 100644 --- a/src/FullSystem/PixelSelector2.cpp +++ b/src/FullSystem/PixelSelector2.cpp @@ -368,8 +368,12 @@ Eigen::Vector3i PixelSelector::select(const FrameHessian* const fh, if(xf<4 || xf>=w-5 || yf<4 || yf>h-4) continue; + int thIdx = (xf>>5) + (yf>>5) * thsStep; + int maxThIdx = (w >> 5) * (h >> 5); + if (thIdx >= maxThIdx) continue; - float pixelTH0 = thsSmoothed[(xf>>5) + (yf>>5) * thsStep]; + + float pixelTH0 = thsSmoothed[thIdx]; float pixelTH1 = pixelTH0*dw1; float pixelTH2 = pixelTH1*dw2;