-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrite2csv.py
More file actions
49 lines (27 loc) · 843 Bytes
/
write2csv.py
File metadata and controls
49 lines (27 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# coding: utf-8
# In[29]:
import cv2
import csv
import os
#setting path to the frames converted from the video
path = ".\\output_frames"
def write2csv():
# get all the video file names
video_file_names = []
for x in os.listdir(path):
video_file_names.append(x)
data = (zip(video_file_names))
#iterate the list above and write to csv
# The csv would be saved in "video csv data" folder
with open(".\\video_csv_data\\{}_pixel.csv".format(x), 'a', newline = '') as f:
writer = csv.DictWriter(f, fieldnames = ['Filename'])
writer.writeheader()
writer = csv.writer(f, delimiter=',')
for x in data:
writer.writerow(x)
f.close()
if __name__=="__main__":
write2csv()
# In[ ]:
# In[ ]: