本篇文章小编给大家分享一下Python imutils填充图片周边为黑色实现代码,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
代码
import imutils import cv2 image = cv2.imread('') # translate the image x=25 pixels to the right and y=75 pixels up translated = imutils.translate(image, -75, 75) cv2.imshow('original image',image) cv2.imshow('translated',translated) cv2.waitKey(0)
效果