def contour_coords(contour, source='scikit'):
    """Extract x, y tuple of contour positions from contour data.

    Scikit has reversed x, y coordinates
    OpenCV has an unusual numpy array shape (npts, 1, 2)

    Parameters
    ----------
    contour: contour data
    source: 'scikit' or 'opencv'

    Output
    ------
    x, y (tuple of numpy arrays) that can be used directly on an imshow() graph
    """
    if source == 'scikit':
        return contour[:, 1], contour[:, 0]
    elif source == 'opencv':
        contour = contour.squeeze()   # eliminate middle dimension in array
        return contour[:, 0], contour[:, 1]
    else:
        raise ValueError(f'{source} not a valid source for contour data.')