Ask Your Question


asked 2014-11-12 12:39:12 -0500

akunze gravatar image

How does one know whether to use BORDER_REFLECT vs. BORDER_REFLECT_101 in OpenCV? Are there particular application scenarios that should encourage one or the other? Or is there a strong preference for always using one or the other?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-11-13 03:23:09 -0500

Guanta gravatar image

With BORDER_REFLECT also the outer-most border is reflected (copied), while with BORDER_REFLECT_101, the outer-most border is not part of the border. The difference is so subtle that it only matters if you apply it on small matrices (e.g. you want to build a larger kernel). If you typically use it to enlarge your image for filtering you won't see much difference. However, I probably would prefer BORDER_REFLECT_101 since it is a more natural extension and the border doesn't appear twice.

edit flag offensive delete link more

answered 2017-11-03 14:31:39 -0500

mhaghighat gravatar image
  • cv2.BORDER_REFLECT - Border will be mirror reflection of the border elements, like this : fedcba|abcdefgh|hgfedcb

  • cv2.BORDER_REFLECT_101 or cv2.BORDER_DEFAULT - Same as above, but with a slight change in which the outter-most pixels (a or h) are not repeated : gfedcb|abcdefgh|gfedcba

edit flag offensive delete link more

Question Tools


Asked: 2014-11-12 12:39:12 -0500

Seen: 4,745 times

Last updated: Nov 03 '17