一个好用的基于opencv的工具箱——imutils

pip主页:https://pypi.org/project/imutils/
github主页:https://github.com/jrosebr1/imutils

功能包括:

1.最简单的图像变换
bridge = cv2.imread("../demo_images/bridge.jpg")
cactus = cv2.imread("../demo_images/cactus.jpg")
logo = cv2.imread("../demo_images/pyimagesearch_logo.jpg")
workspace = cv2.imread("../demo_images/workspace.jpg")
# translate the image x-50 pixels to the left and y=100 pixels down
translated = imutils.translate(workspace, -50, 100)
cv2.imshow("Translated", translated)
cv2.waitKey(0)
# rotate the image and display it
rotated = imutils.rotate(bridge, angle=60)
cv2.imshow("Angle=%d" % (angle), rotated)
# wait for a keypress, then close all the windows
cv2.waitKey(0)
cv2.destroyAllWindows()
# resize the image and display it
resized = imutils.resize(workspace, width=321,height=123)
cv2.imshow("Width=%dpx" % (width), resized)
# wait for a keypress, then close all the windows
cv2.waitKey(0)
cv2.destroyAllWindows()

以及

def skeletonize(image, size, structuring=cv2.MORPH_RECT)		#灰度骨架提取
def opencv2matplotlib(image):									#opencv默认图片是GBR通道
def url_to_image(url, readFlag=cv2.IMREAD_COLOR):				#URL连接保存为图片
def auto_canny(image, sigma=0.33):								#边缘提取
def build_montages(image_list, image_shape, montage_shape):
2.base64编解码
def base64_encode_image(a):
def base64_decode_image(a):
def base64_encode_array(a):
def base64_decode_array(a, dtype):
3.展示目录下的所有文件
def list_files(basePath, validExts=(".jpg", ".jpeg", ".png", ".bmp", ".tif", ".tiff"), contains=None):
4.排序勾勒轮廓
def sort_contours(cnts, method="left-to-right"):
4.四点透视变换
def four_point_transform(image, pts):
其他

README.md和/demo/×均有示例和说明

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值