def remap(im, coords):
    """
    Remap an RGB image using the given target coordinate array.
    
    If available, OpenCV is used (faster), otherwise SciPy.
    
    :type im: ndarray of shape (h,w,3)
    :param im: RGB image to be remapped
    :type coords: ndarray of shape (h,w,2)
    :param coords: target coordinates in x,y order for each pixel
    :return: remapped RGB image
    :rtype: ndarray of shape (h,w,3)
    """
    if cv2:
        return remapOpenCv(im, coords)
    else:
        return remapScipy(im, coords)