def resizing(img):
height, width, channels = img.shape
if max(height, width) > 100:
ratio = float(height) / width
new_width = 100 / ratio
img_resized = cv2.resize(img, (int(new_width), 100))
ip_convert = cv2.imencode('.png', img_resized)
else:
ip_convert = cv2.imencode('.png', img)
return ip_convert
评论列表
文章目录