Skip to content

Commit 3b898a5

Browse files
authored
Create lsp.py
1 parent 477dace commit 3b898a5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

moumoubaimifan/lsp/lsp.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import cv2
2+
import os
3+
4+
image_base_path = "D:\\video\\images\\";
5+
6+
def get_images(video_path):
7+
frame_times = 0;
8+
fileName = video_path.split("\\")[-1:][0].split('.')[0]
9+
image_out_path = image_base_path + fileName
10+
if not os.path.exists(image_out_path):
11+
os.makedirs(image_out_path)
12+
13+
cap = cv2.VideoCapture(video_path)
14+
while cap.isOpened():
15+
frame_times = frame_times + 1
16+
success, frame = cap.read()
17+
18+
if not success:
19+
break;
20+
21+
cv2.imencode('.jpg', frame)[1].tofile(image_out_path + "\\" + str(frame_times) + ".jpg")
22+
23+
if __name__ == '__main__':
24+
get_images('D:\\video\\只予你的晴天【三杞】.mp4')

0 commit comments

Comments
 (0)