Permalink
Browse files

fix a couple of issues with unit tests

  • Loading branch information...
sdpython committed Jan 20, 2018
1 parent eaa071d commit efe0ee85eca32b8ee8e1d7db1bc85d1544f00bff
@@ -46,7 +46,7 @@
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from src.code_beatrix.art.video import video_enumerate_frames
from src.code_beatrix.art.video import video_enumerate_frames, video_load, video_clean
class TestVideoOpenProcess(ExtTestCase):
@@ -56,10 +56,12 @@ def test_extract_frames_check_open(self):
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
vid = os.path.join(os.path.dirname(__file__), 'data', 'videxa.mp4')
vid = video_load(os.path.join(
os.path.dirname(__file__), 'data', 'videxa.mp4'))
fra = list(video_enumerate_frames(vid, clean=True))
self.assertEqual(len(fra), 78)
self.assertEqual(fra[0].shape, (720, 404, 3))
video_clean(vid)
if __name__ == "__main__":
@@ -47,7 +47,7 @@
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from src.code_beatrix.art.videodl import video_map_images
from src.code_beatrix.art.video import video_save, video_extract_video, clean_video
from src.code_beatrix.art.video import video_save, video_extract_video, clean_video, video_load
class TestVideoDLPeople(ExtTestCase):
@@ -58,7 +58,7 @@ def test_modify_avideo(self):
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_videodl_people")
vid = os.path.join(temp, '..', 'data', 'mur.mp4')
vid = video_load(os.path.join(temp, '..', 'data', 'mur.mp4'))
vide = video_extract_video(vid, 0, 5 if __name__ == "__main__" else 1)
vid2 = video_map_images(
vide, fps=10, name="people", progress_bar=__name__ == "__main__", fLOG=fLOG)
@@ -419,7 +419,7 @@ def video_enumerate_frames(video_or_file, folder=None, fps=10, pattern='images_%
for frame in video.iter_frames(fps=fps, **kwargs):
yield frame
if clean:
clean_video(video)
clean_video(video.video)
else:
if 'dtype' in kwargs:
if kwargs['dtype'] != 'uint8':
@@ -433,7 +433,7 @@ def video_enumerate_frames(video_or_file, folder=None, fps=10, pattern='images_%
imsave(name, frame)
yield name
if clean:
clean_video(video)
clean_video(video.video)
def video_replace_audio(video_or_file, new_sound, loop=True):
@@ -221,7 +221,7 @@ def video_map_images_detect(video_or_file, fps=None, with_times=False, progress_
def fl_blur(gf, t, rects):
im = gf(t)
ti = min(int(t * fps), len(rects))
ti = min(int(t * fps), len(rects) - 1)
rects = all_rects[ti]
for rect in rects:
x1, y1, dx, dy = rect
@@ -230,7 +230,7 @@ def fl_blur(gf, t, rects):
def fl_rect(gf, t, rects):
im = gf(t)
ti = min(int(t * fps), len(rects))
ti = min(int(t * fps), len(rects) - 1)
rects = all_rects[ti]
for rect in rects:
x1, y1, dx, dy = rect

0 comments on commit efe0ee8

Please sign in to comment.