import numpy as np


def divide_image(image_path, vertical_divides, horizontal_divides):
    # Load the image in grayscale
    # image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
    # if image is None:
    #     raise ValueError("Image not found or unable to load.")
    image = np.zeros((256, 256), dtype=np.uint8)

    # Get image dimensions
    height, width = image.shape

    # Calculate the step size for vertical and horizontal cuts
    vertical_step = width // (vertical_divides + 1)
    horizontal_step = height // (horizontal_divides + 1)

    # Initialize lists to store the cutting lines
    vertical_lines = []
    horizontal_lines = []

    # Calculate vertical cutting lines
    for i in range(1, vertical_divides + 1):
        x = i * vertical_step
        vertical_lines.append(((x, 0), (x, height)))

    # Calculate horizontal cutting lines
    for i in range(1, horizontal_divides + 1):
        y = i * horizontal_step
        horizontal_lines.append(((0, y), (width, y)))

    return vertical_lines, horizontal_lines


# Example usage
image_path = 'path_to_your_image.png'
vertical_divides = 3
horizontal_divides = 3

vertical_lines, horizontal_lines = divide_image(
    image_path, vertical_divides, horizontal_divides)

print("Vertical Lines:")
for line in vertical_lines:
    print(f"Start: {line[0]}, End: {line[1]}")

print("\nHorizontal Lines:")
for line in horizontal_lines:
    print(f"Start: {line[0]}, End: {line[1]}")
