cv2.copymakeborder
cv2.copyMakeBorder(src, top, bottom, left, right, cv2.BORDER_CONSTANT)
Impossible Iguana
cv2.copyMakeBorder(src, top, bottom, left, right, cv2.BORDER_CONSTANT)
# Python program to explain cv2.copyMakeBorder() method
# importing cv2
import cv2
# path
path = r'C:\Users\Rajnish\Desktop\geeksforgeeks\geeks.png'
# Reading an image in default mode
image = cv2.imread(path)
# Window name in which image is displayed
window_name = 'Image'
# Using cv2.copyMakeBorder() method
image = cv2.copyMakeBorder(image, 10, 10, 10, 10, cv2.BORDER_CONSTANT, None, value = 0)
# Displaying the image
cv2.imshow(window_name, image)