import cv2
import numpy as np
BLACK = [0,0,0]
img = cv2.imread('/home/ogai/Pictures/pistol.jpg')
constant = cv2.copyMakeBorder(img,120,120,0,0,cv2.BORDER_CONSTANT,value=BLACK)
while (1):
cv2.imshow('pistol',constant)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
opencv-python图片边框填充(padding)
最新推荐文章于 2024-09-04 20:26:55 发布