opencv python版-lesson 08

jingxiang

import cv2
import numpy as np
import matplotlib.pyplot as mp

BLUE=[255,0,0]

img1=cv2.imread('test0.jpg')

replicate =cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REPLICATE)
reflect =cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REFLECT)
reflect101 =cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REFLECT_101)
wrap =cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_WRAP)
constant =cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_CONSTANT,value=BLUE)

mp.subplot(231),mp.imshow(img1,'gray'),mp.title('original')
mp.subplot(232),mp.imshow(img1,'gray'),mp.title('original2')
mp.subplot(233),mp.imshow(img1,'gray'),mp.title('original3')
mp.subplot(234),mp.imshow(img1,'gray'),mp.title('original4')
mp.subplot(235),mp.imshow(img1,'gray'),mp.title('original5')
mp.subplot(236),mp.imshow(img1,'gray'),mp.title('original6')

mp.show()

你可能感兴趣的:(opencv python版-lesson 08)