-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborders.py
22 lines (18 loc) · 925 Bytes
/
borders.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
__author__ = 'brycerich'
import cv2
import numpy as np
from matplotlib import pyplot as plt
BLUE = [255,0,0]
img1 = cv2.imread('jurassic_world.jpg')
replicate = cv2.copyMakeBorder(img1,240,240,240,240,cv2.BORDER_REPLICATE)
reflect = cv2.copyMakeBorder(img1,240,240,240,240,cv2.BORDER_REFLECT)
reflect101 = cv2.copyMakeBorder(img1,240,240,240,240,cv2.BORDER_REFLECT_101)
wrap = cv2.copyMakeBorder(img1,240,240,240,240,cv2.BORDER_WRAP)
constant= cv2.copyMakeBorder(img1,240,240,240,240,cv2.BORDER_CONSTANT,value=BLUE)
plt.subplot(231),plt.imshow(img1,'gray'),plt.title('ORIGINAL')
plt.subplot(232),plt.imshow(replicate,'gray'),plt.title('REPLICATE')
plt.subplot(233),plt.imshow(reflect,'gray'),plt.title('REFLECT')
plt.subplot(234),plt.imshow(reflect101,'gray'),plt.title('REFLECT_101')
plt.subplot(235),plt.imshow(wrap,'gray'),plt.title('WRAP')
plt.subplot(236),plt.imshow(constant,'gray'),plt.title('CONSTANT')
plt.show()