Skip to content

Commit

Permalink
faster decoding when subsampling input!
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidDoukhan committed Jun 10, 2023
1 parent 4526295 commit 5483d0d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inaFaceAnalyzer/opencv_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def video_iterator(src, time_unit='frame', start=None, stop=None, subsamp_coeff=
if stop is not None and cap.get(unit) > stop:
break

ret, frame = cap.read()
#ret, frame = cap.read()
ret = cap.grab()
if not ret:
break

Expand All @@ -67,7 +68,9 @@ def video_iterator(src, time_unit='frame', start=None, stop=None, subsamp_coeff=
if iframe % subsamp_coeff != 0:
continue


ret, frame = cap.retrieve()
if not ret:
break
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

if verbose:
Expand Down

0 comments on commit 5483d0d

Please sign in to comment.