We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 477dace commit 3b898a5Copy full SHA for 3b898a5
moumoubaimifan/lsp/lsp.py
@@ -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