ishihara_generator
ishihara_generator copied to clipboard
Fix image index out of range error
Sometimes it's go out of range, so with this it work correctly
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)