def _scale(image, min=0.9, max=1.1):
'''
Scale the input image by a random factor picked from a uniform distribution
over [min, max].
Returns:
The scaled image, the associated warp matrix, and the scaling value.
'''
rows,cols,ch = image.shape
#Randomly select a scaling factor from the range passed.
scale = np.random.uniform(min, max)
M = cv2.getRotationMatrix2D((cols/2,rows/2), 0, scale)
return cv2.warpAffine(image, M, (cols, rows)), M, scale
评论列表
文章目录