def METHOD_NAME(im, invert, flip, crop, gaussian_sigma, eqhis):
    '''
    Typical preprocessing steps needed before performing keypoint matching
    im (DataArray): Input image
    invert (bool): Invert the brightness levels of the image
    flip (tuple(bool, bool)): Determine if the image should be flipped on the X and Y axis
    crop (tuple(t,b,l,r): Crop values in pixels
    gaussian_sigma (int): Blur intensity
    eqhis (bool): If True, an histogram equalisation is performed (and data type)
      is set to uint8
    return (DataArray of same shape): Processed image
    '''
    try:
        metadata = im.metadata
    except AttributeError:
        metadata = {}
    flip_x, flip_y = flip
    # flip on X axis
    if flip_x:
        im = im[:, ::-1]
    # flip on Y axis
    if flip_y:
        im = im[::-1, :]
    crop_top, crop_bottom, crop_left, crop_right = crop
    # remove the bar
    im = im[crop_top:im.shape[0] - crop_bottom, crop_left:im.shape[1] - crop_right]
    # Invert the image brightness
    if invert:
        # mn = im.min()
        mx = im.max()
        im = mx - im
    # equalize histogram
    if eqhis:
        if im.dtype != numpy.uint8:
            # OpenCV histogram equalisation only works on uint8 data
            rgb_im = img.DataArray2RGB(im)
            im = rgb_im[:, :, 0]
        im = cv2.equalizeHist(im)
    # blur the image using a gaussian filter
    if gaussian_sigma:
        im = ndimage.gaussian_filter(im, sigma=gaussian_sigma)
    # return a new DataArray with the metadata of the original image
    return model.DataArray(im, metadata)