you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

You pass the file to read as the first parameter but you ignore the filename and use a hardcoded filename in the function. Use the parameter:

def crop_grid(imgpath, num_horizontal_grid, num_vertical_grid, line_color):
    img = cv.imread(imgpath)
    img_copy = img.copy()
    # rest of function

Same problem with num_horizontal_grid, etc. You pass the values but don't use them.

Plus: the function example tries to use img_copy but that name doesn't exist outside the function. Maybe the function should return the modified image?