def TrimBorder(frame, border = 0):
    """
    Trim video frame border introduced by frame capture

    Parameters
    ----------
    frame : numpy uint8 array
        video frame
    border : integer
        border width in pixels to strip [0]

    Returns
    -------
    frame : numpy unit8 array
        video frame without border
    """

    if border > 0:

        # Get image dimension
        nx, ny = frame.shape[1], frame.shape[0]

        # Set bounding box
        x0 = border
        y0 = border
        x1 = nx - border
        y1 = ny - border

        # Make sure bounds are inside image
        x0 = x0 if x0 > 0 else 0
        x1 = x1 if x1 < nx else nx-1
        y0 = y0 if y0 > 0 else 0
        y1 = y1 if y1 < ny else ny-1

        # Crop and return
        return frame[y0:y1, x0:x1]

    else:

        return frame