import math


def get_num_windows(image_height, image_width, window_height, window_width, overlap=True, overlap_corners=True):
    """Return the number of height and width windows to generate

    Args:
        image_height: Height of the image in pixels.
        image_width: Width of the image in pixels.
        window_height: The height of each generated window.
        window_width: The width of each generated window.
        overlap: True iff generated windows should be overlapped.
        overlap_corners: True iff the corners/edges should be mirrored and contain
          as many overlaps as the centre of the image.

    Returns:
        A 3-element list containing the total number of windows, and the number of
        windows needed for the image height and width, respectively.
    """
    if not overlap:
        num_height_windows = math.ceil(image_height/window_height)
        num_width_windows = math.ceil(image_width/window_width)
    elif overlap_corners:
        num_height_windows = math.ceil(image_height/(window_height/2)) + 1
        num_width_windows = math.ceil(image_width/(window_width/2)) + 1
    else:
        num_height_windows = max(1, math.ceil(image_height/(window_height/2)) - 1)
        num_width_windows = max(1, math.ceil(image_width/(window_width/2)) - 1)

    return ((num_height_windows*num_width_windows), num_height_windows, num_width_windows)