def centroid_of_rect(roi):
    """ Finds the coordinates for the centroid of a rectangle.

        :param roi: rectangle region of interest as matrix
        :return: coordinates of centroid within region of interest
    """
    return int(roi.shape[0] / 2), int(roi.shape[1] / 2)