Created
January 27, 2018 22:06
-
-
Save volkanozcan2/800f5eb05ec6abfee2be0cd43479585e to your computer and use it in GitHub Desktop.
image from prime numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
import primesieve | |
from PIL import Image | |
# t is time in seconds | |
#fps is videos frame rate | |
t=30 | |
fps=30 | |
for i in range(fps*t): | |
t=time.time() | |
p=np.array(primesieve.primes(1920*1080*i,1920*1080*(i+1))) | |
z=np.zeros(1920*1080*3,dtype=np.uint8) | |
for x in p: | |
z[3*(x-1920*1080*i):3*(x-1920*1080*i)+3]=[0,255,0] | |
z=z.reshape(1080,1920,3) | |
Image.fromarray(z).save("img/pr{}.png".format(i)) | |
print("{}/{}".format(i,fps*t-1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment