getImages.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:crawl-dataset 作者: e-lab 项目源码 文件源码
def resizeImg(imgPath,img_size):
    img = imread(imgPath)
    h, w, _ = img.shape
    scale = 1
    if w >= h:
        new_w = img_size
        if w  >= new_w:
            scale = float(new_w) / w
        new_h = int(h * scale)
    else:
        new_h = img_size
        if h >= new_h:
            scale = float(new_h) / h
        new_w = int(w * scale)
    new_img = imresize(img, (new_h, new_w), interp='bilinear')
    imsave(imgPath,new_img)

#Download img
#Later we can do multi thread apply workers to do faster work
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号