Created
October 26, 2021 15:14
-
-
Save Yuktha-Majella/b8dc4d8611ae3ff13adc070a655c294c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Making Borders | |
import cv2 | |
import numpy as np | |
BLUE = [255,0,0] | |
img = cv2.imread('C:\\Users\\Admin\\Downloads\\operations on images\\olympic_logo.png') | |
replicate = cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_REPLICATE) | |
reflect = cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_REFLECT) | |
reflect101 = cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_REFLECT_101) | |
wrap = cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_WRAP) | |
constant= cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_CONSTANT,value=BLUE) | |
vis1 = np.concatenate((reflect, constant, reflect101), axis=1) | |
vis2 = np.concatenate((replicate, wrap), axis=1) | |
cv2.imshow("Original Image", img) | |
cv2.imshow("REFLECT vs CONSTANT vs REFLECT_101 ", vis1) | |
cv2.imshow("REPLICATE vs WRAP", vis2) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment