Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getRectSubPix and borderInterpolate in OpenCV

The documentation for OpenCVs getRectSubPix() function:

C++: void getRectSubPix(InputArray image, Size patchSize, 
Point2f center, OutputArray patch, int patchType=-1 )

contains the statement:

While the center of the rectangle must be inside the image, parts of the rectangle may be outside. In this case, the replication border mode (see borderInterpolate() ) is used to extrapolate the pixel values outside of the image.

But I can't see a way to set the borderInterpolate mode in getRectSubPix. Many other OpenCV functions (boxFilter, copyMakeBorder, ...) allow you to pass in the borderInterpolate enum, but not getRectSubPix.

Is this just a documentation error?

like image 512
Jay Borseth Avatar asked Nov 29 '25 14:11

Jay Borseth


1 Answers

The statement "replication border mode (see borderInterpolate() ) is used to extrapolate the pixel values", clearly states that it uses a predefined mode known as BORDER_REPLICATE to estimate the pixels outside the image boundary, You cannot use other Border methods like BORDER_REFLECT, BORDER_WRAP, BORDER_CONSTANT, etc.

like image 66
ZdaR Avatar answered Dec 01 '25 11:12

ZdaR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!