-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
40 additions
and
2,838 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
import cv2 | ||
import os | ||
|
||
def frameExtractor(PATH, VIDEO_PATH, selectedFrames): | ||
vid= cv2.VideoCapture(VIDEO_PATH) | ||
|
||
def frameExtractor(): | ||
if not os.path.exists(PATH): | ||
os.makedirs(PATH) | ||
|
||
for framePos in selectedFrames: | ||
for i, framePos in enumerate(selectedFrames): | ||
vid.set(cv2.CAP_PROP_POS_FRAMES, framePos-1) | ||
success, frame= vid.read() | ||
|
||
if not success: | ||
print('Video END or Video File corrupted.') | ||
break | ||
|
||
print("Selected Frame:", keyframe_count, ' @ ', vid.get(cv2.CAP_PROP_POS_MSEC)/1000, 'seconds') | ||
cv2.imwrite(os.path.join(PATH, 'Frame{}.jpg'.format(keyframe_count)), frame) | ||
keyframe_count+=1 | ||
print('Selected Frame: {} @ {} seconds'.format(i+1, vid.get(cv2.CAP_PROP_POS_MSEC)/1000)) | ||
|
||
cv2.imwrite(os.path.join(PATH, 'Frame{}.jpg'.format(i+1)), frame) | ||
|
||
vid.release() | ||
|
||
vid.release() | ||
if __name__ == '__main__': | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.