def squeeze(image, width_max, border):
"""
This function squeezes images in the width.
:param image: Numpy array of image
:param width_max: max image width
:param border: border left and right of squeezed image
:return: Squeezed Image
"""
image_wd = image.shape[1]
image_ht = image.shape[0]
basewidth = width_max - border
wpercent = basewidth / image_wd
dim = (int(wpercent*image_wd), image_ht)
img_squeeze = cv.resize(image, dim, interpolation=cv.INTER_NEAREST)
return img_squeeze
评论列表
文章目录