I benchmarked this with the command time python3 main.py 800 1 1 300 1000. It seems to be about an 11x speedup.
Later, when doing the subtractLine part, I found that doing the subtractLine doesn't update the array. So, I changed it to update the numpy array instead.
Really cool project and video!
This PR speeds up getting the pixels which a thread crosses. The PIL docs say that looping over pixels is likely to be slow, so I tried replacing the loop over pixels in the line with a numpy indexing operation. I adapted an example from the scikit-image documentation to do that.
I benchmarked this with the command
time python3 main.py 800 1 1 300 1000
. It seems to be about an 11x speedup.Later, when doing the subtractLine part, I found that doing the subtractLine doesn't update the array. So, I changed it to update the numpy array instead.