ishihara_generator icon indicating copy to clipboard operation
ishihara_generator copied to clipboard

Fix image index out of range error

Open dupeljan opened this issue 6 years ago • 1 comments

Sometimes it's go out of range, so with this it work correctly

dupeljan avatar Dec 11 '18 10:12 dupeljan

It'd add another dependency, but I adapted this code to use Numpy to check if the motive overlaps with the image. In my code, I called the motive draw_over_image, but I think it's more straightforward and easier to understand.

draw_over_image_np = np.asarray(Image.open(DRAW_OVER_IMAGE_PATH))
def point_inside_draw_over_image(x, y):
    return np.any(draw_over_image_np[int(y)][int(x)] != 0)

tomaz-suller avatar Sep 04 '21 11:09 tomaz-suller