Python imutils 填充图片周边为黑色的实现

yipeiwu_com5年前Python基础

代码

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)

效果

参考:https://github.com/jrosebr1/imutils

以上这篇Python imutils 填充图片周边为黑色的实现就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

使用Python读写及压缩和解压缩文件的示例

读写文件 首先看一个例子: f = open('thefile.txt','w') #以写方式打开, try: f.write('wokao') finally: f.c...

python+numpy+matplotalib实现梯度下降法

python+numpy+matplotalib实现梯度下降法

这个阶段一直在做和梯度一类算法相关的东西,索性在这儿做个汇总: 一、算法论述 梯度下降法(gradient  descent)别名最速下降法(曾经我以为这是两个不同的算法-.-...

Python基于回溯法子集树模板实现8皇后问题

Python基于回溯法子集树模板实现8皇后问题

本文实例讲述了Python基于回溯法子集树模板实现8皇后问题。分享给大家供大家参考,具体如下: 问题 8×8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、...

python: 判断tuple、list、dict是否为空的方法

Test tuple_test = () assert not tuple_test list_test = [] assert not list_test dict_test...

python3库numpy数组属性的查看方法

实例如下所示: import numpy as np a1 = np.array([1,2,3,4],dtype=np.complex128) print(a1) print("数据...