def affine_zoom_matrix(zoom_range=(<NUM_LIT>, <NUM_LIT>)):
if isinstance(zoom_range, (float, int)):<EOL><INDENT>scale = zoom_range<EOL><DEDENT>elif isinstance(zoom_range, tuple):<EOL><INDENT>scale = np.random.uniform(zoom_range[<NUM_LIT:0>], zoom_range[<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>zoom_matrix = np.array([[scale, <NUM_LIT:0>, <NUM_LIT:0>],[<NUM_LIT:0>, scale, <NUM_LIT:0>],[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>]])<EOL>return zoom_matrix<EOL>
Create an affine transform matrix for zooming/scaling an image's height and width.
    OpenCV format, x is width.

    Parameters
    -----------
    x : numpy.array
        An image with dimension of [row, col, channel] (default).
    zoom_range : float or tuple of 2 floats
        The zooming/scaling ratio, greater than 1 means larger.
            - float, a fixed ratio.
            - tuple of 2 floats, randomly sample a value as the ratio between these 2 values.

    Returns
    -------
    numpy.array
        An affine transform matrix.