bus analyser: add a frame extraction cli command

pull/361/head
Mike Lang 1 year ago
parent 06cd5d48ee
commit e38d21fb61

@ -5,6 +5,7 @@ from io import BytesIO
import argh
from PIL import Image, ImageStat
import common
from common.segments import extract_frame, parse_segment_path
@ -186,6 +187,17 @@ def create_prototype(output, *images):
first.save(output)
@cli
def get_frame(*segments):
for path in segments:
segment = parse_segment_path(path)
filename = segment.start.strftime("%Y-%m-%dT-%H-%M-%S") + ".png"
with open(filename, "wb") as f:
for chunk in extract_frame([segment], segment.start):
common.writeall(f.write, chunk)
print(filename)
def extract_segment(prototypes, segment):
# We haven't observed worse than 0.15 or so in the wild,
# and an all-black screen is identified as "1" with a score of 0.07.

Loading…
Cancel
Save