def histogram(f):
    """
    h = histogram(f)

    Find the histogram of the image f.

    Finds the histogram of the image `f`.

    For binary image the vector size is 2. For gray-scale uint8 and
    uint16 images, the vector size is the maximum pixel value plus
    one. h[0] gives the number of pixels with value 0.

    Parameters
    ----------
    f : Input image (of any integer type).

    Returns
    -------
    h : Histogram in a uint16 or an int32 vector.
    """
    import numpy as np
    return np.histogram(f, np.arange(f.max() + 2))[0]
