Download extract/2.py from Staty/Soundscape_to_panorama: direct link, hf CLI and curl.
- Browser
- Download file 335 Bytes
-
https://huggingface.co/Staty/Soundscape_to_panorama/resolve/main/extract/2.py
- Command line
-
hf download hf://Staty/Soundscape_to_panorama/extract/2.py
-
curl -L -o 2.py https://huggingface.co/Staty/Soundscape_to_panorama/resolve/main/extract/2.py
335 Bytes
| import cv2 | |
| vc = cv2.VideoCapture("../v_c_0_10.mp4") | |
| if vc.isOpened(): | |
| ret, frame = vc.read() | |
| else: | |
| ret = False | |
| # loop read video frame | |
| i=0 | |
| while ret: | |
| ret, frame = vc.read() | |
| if i<250: | |
| image_path="./image/"+str(i)+".jpg" | |
| cv2.imwrite(image_path, frame) | |
| i=i+1 | |
| cv2.waitKey(40) | |