fixed segfault at ORB::compute() near image's border

This commit is contained in:
Rostislav Vasilikhin
2016-12-14 12:55:00 +03:00
committed by Alexander Alekhin
parent 53f72f18f5
commit 13b9dd3963
2 changed files with 36 additions and 1 deletions
+3 -1
View File
@@ -970,7 +970,9 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
//ROI handling
const int HARRIS_BLOCK_SIZE = 9;
int halfPatchSize = patchSize / 2;
int border = std::max(edgeThreshold, std::max(halfPatchSize, HARRIS_BLOCK_SIZE/2))+1;
// sqrt(2.0) is for handling patch rotation
int descPatchSize = cvCeil(halfPatchSize*sqrt(2.0));
int border = std::max(edgeThreshold, std::max(descPatchSize, HARRIS_BLOCK_SIZE/2))+1;
bool useOCL = ocl::useOpenCL() && OCL_FORCE_CHECK(_image.isUMat() || _descriptors.isUMat());