Day07 solved
This commit is contained in:
parent
5012d9f4f6
commit
3ab95b74e5
BIN
Day 07/3DULK2N7DcpXFg8qGo9Z9qEQqvaEDpUCBB1v.mp4
Normal file
BIN
Day 07/3DULK2N7DcpXFg8qGo9Z9qEQqvaEDpUCBB1v.mp4
Normal file
Binary file not shown.
35
Day 07/decode.py
Normal file
35
Day 07/decode.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#$ ffmpeg -i 3DULK2N7DcpXFg8qGo9Z9qEQqvaEDpUCBB1v.mp4 -vf fps=10 frames/frame%04d.jpg -hide_banner
|
||||||
|
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
def brightness(pix):
|
||||||
|
return ((pix[0] + pix[1] + pix[2]) / 3) / 255
|
||||||
|
|
||||||
|
bytes = []
|
||||||
|
|
||||||
|
i = 1
|
||||||
|
while True:
|
||||||
|
path = "frames/frame%04d.jpg" % i
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
break
|
||||||
|
|
||||||
|
img = Image.open(path);
|
||||||
|
pix = img.load()
|
||||||
|
|
||||||
|
pos = [(343,177), (418,180), (551,166), (626,185),
|
||||||
|
(717,169), (788,164), (878,162), (959,165)]
|
||||||
|
|
||||||
|
byte = ""
|
||||||
|
for p in pos:
|
||||||
|
if brightness(pix[p]) > 0.6:
|
||||||
|
byte += "1"
|
||||||
|
else:
|
||||||
|
byte += "0"
|
||||||
|
|
||||||
|
bytes.append(byte)
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
print("".join(chr(int(x, 2)) for x in bytes))
|
Loading…
Reference in New Issue
Block a user