def crop_center(image, w, h):
    """
    Crop region with size w, h from center of image.

    Note that the crop is specified via w, h and not via shape (h,w).
    Furthermore if the image or the crop region have even dimensions,
    coordinates are rounded down.

    >>> import numpy as np
    >>> image = np.reshape(np.arange(16, dtype='uint8'), (4, 4))
    >>> crop_center(image, 3, 2)
    array([[ 4,  5,  6],
           [ 8,  9, 10]], dtype=uint8)

    :param numpy array image: Numpy array.
    :param int w: Width of crop
    :param int h: Height of crop
    :return: Cropped image
    :rtype: numpy array
    :raise: ValueError if image is smaller than crop region
    """
    iw, ih = image.shape[1], image.shape[0]
    dw, dh = iw - w, ih - h
    if dw < 0 or dh < 0:
        raise ValueError('Image too small for crop {}x{}'.format(iw, ih))
    return image[dh // 2:dh // 2 + h, dw // 2:dw // 2 + w]
