diff --git a/2018-Python-Practice-master/main.py b/2018-Python-Practice-master/main.py index 9d8e7df..bc042e0 100644 --- a/2018-Python-Practice-master/main.py +++ b/2018-Python-Practice-master/main.py @@ -7,8 +7,8 @@ ''' 1. import `Video` and `save_video` from the correct module of package "styler" ''' -from ... import Video -from ... import save_video +from styler.video import Video +from styler.utils import save_video model_file = 'data/vg-30.pb' @@ -18,7 +18,7 @@ format='%(asctime)s %(levelname)s:%(message)s', level=logging.INFO, datefmt='%I:%M:%S') - +video_path = 'input/jaguar.mp4' def main(): @@ -41,7 +41,7 @@ def main(): ''' 2. set the `path` to your input ''' - with Video(...) as v: + with Video(path=video_path) as v: frames = v.read_frames(image_h=shape[1], image_w=shape[2]) logging.info("Processing image") @@ -53,7 +53,7 @@ def main(): ''' processed = [ session.run(out, feed_dict={image: [frame]}) - ... + for frame in frames ] ''' @@ -61,7 +61,7 @@ def main(): ''' save_video('result.mp4', fps=30, h=shape[1], w=shape[2], - frames=...) + frames=processed) logging.info("Processing took %f" % ( (datetime.now() - start_time).total_seconds())) diff --git a/2018-Python-Practice-master/result.mp4 b/2018-Python-Practice-master/result.mp4 new file mode 100644 index 0000000..218145b Binary files /dev/null and b/2018-Python-Practice-master/result.mp4 differ diff --git a/2018-Python-Practice-master/styler/__init__.py b/2018-Python-Practice-master/styler/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/2018-Python-Practice-master/styler/__pycache__/__init__.cpython-36.pyc b/2018-Python-Practice-master/styler/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..1658457 Binary files /dev/null and b/2018-Python-Practice-master/styler/__pycache__/__init__.cpython-36.pyc differ diff --git a/2018-Python-Practice-master/styler/__pycache__/utils.cpython-36.pyc b/2018-Python-Practice-master/styler/__pycache__/utils.cpython-36.pyc new file mode 100644 index 0000000..31b93ac Binary files /dev/null and b/2018-Python-Practice-master/styler/__pycache__/utils.cpython-36.pyc differ diff --git a/2018-Python-Practice-master/styler/__pycache__/video.cpython-36.pyc b/2018-Python-Practice-master/styler/__pycache__/video.cpython-36.pyc new file mode 100644 index 0000000..3b3f758 Binary files /dev/null and b/2018-Python-Practice-master/styler/__pycache__/video.cpython-36.pyc differ diff --git a/2018-Python-Practice-master/styler/video.py b/2018-Python-Practice-master/styler/video.py index deb57be..d66ca89 100644 --- a/2018-Python-Practice-master/styler/video.py +++ b/2018-Python-Practice-master/styler/video.py @@ -28,9 +28,15 @@ def read_frames(self, image_h, image_w): ''' frames = [] # 5-1 /5-2 Read video and collect them - - self.frames = ... # 5-3 let object have the result - return ... # return your results + while(True): + ret, frame = self.cap.read() + if ret: + frame = resize(frame, image_h, image_w) + frames.append(frame) + else: + break + self.frames = frames # 5-3 let object have the result + return self.frames # return your results def __exit__(self, exc_type, exc_val, exc_tb): self.cap.release()