Extension of image edge by Python opencv

original image

expands the image outwards according to the pixel value of the image boundary, expanding 50 pixels in each direction.
a = cv2. CopyMakeBorder (img, 50,50,50,50, cv2. BORDER_REPLICATE)

near the boundary of the 50 pixels fold out (axisymmetric) :
a = cv2. CopyMakeBorder (img, 50,50,50,50, cv2 BORDER_REFLECT)

constant fill:

a = cv2.copymakeborder (img,50,50,50, cv2.border_constant,value=[0,255,0])

Read More: