Reputation: 9333
I'm using the GaussianBlur function in OpenCV to perform Gaussian blurring. While the bordertype parameter can be filled with BORDER_CONSTANT
, it doesn't allow to set the value of the constant. From the explanation of borderInterpolate, it seems that the value of the constant is set to -1. Is it possible to set it to 0?
Thanks!
Upvotes: 2
Views: 3323
Reputation: 11941
The reason borderInterpolate returns -1 for BORDER_CONSTANT is so this code in filter.cpp works:
int srcY = borderInterpolate(dstY + dy + i + roi.y - ay,
wholeSize.height, columnBorderType);
if( srcY < 0 ) // can happen only with constant border type
brows[i] = alignPtr(&constBorderRow[0], VEC_ALIGN);
That is, it causes your border to be set to zero, which is what you want. The border is not being set to -1.
Upvotes: 1
Reputation: 731
I think that the -1 is the return value for the function borderInterpolate() when you use BORDER_CONSTANT. Check out the top section of this page:
http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=gaussianblur#image-filtering
"all the non-existing pixels are zeros (“constant border” extrapolation method)", so it does already use zeros for the GaussianBlur function.
Upvotes: 3