|
|
@@ -1,47 +0,0 @@
|
|
1
|
|
-import pandas as pd
|
|
2
|
|
-import os
|
|
3
|
|
-import sys
|
|
4
|
|
-
|
|
5
|
|
-target_dir = str(sys.argv[1])
|
|
6
|
|
-
|
|
7
|
|
-full_list = os.listdir(target_dir)
|
|
8
|
|
-csv_list = [file for file in full_list if file.startswith('cam')]
|
|
9
|
|
-csv_list = sorted(csv_list)
|
|
10
|
|
-#csv_list = [cam1.csv,cam2.csv]
|
|
11
|
|
-#print(csv_list)
|
|
12
|
|
-
|
|
13
|
|
-d1 = pd.read_csv(os.path.join(target_dir,csv_list[0]))
|
|
14
|
|
-d2 = pd.read_csv(os.path.join(target_dir,csv_list[1]))
|
|
15
|
|
-
|
|
16
|
|
-d2['x'] = 1920 - d2['x']
|
|
17
|
|
-
|
|
18
|
|
-df_conc = pd.concat([d1,d2])
|
|
19
|
|
-
|
|
20
|
|
-df_conc.sort_values(by='frame')
|
|
21
|
|
-df_conc.drop_duplicates(['frame'])
|
|
22
|
|
-#print(df_conc)
|
|
23
|
|
-
|
|
24
|
|
-df_global = pd.DataFrame(index=range(0,int(df_conc['frame'].iloc[-1])+1), columns=['x','y','z','frame'])
|
|
25
|
|
-df_global['frame'] = list(range(1, int(df_conc['frame'].iloc[-1]+2)))
|
|
26
|
|
-df_global = df_global.astype({'frame':'int'})
|
|
27
|
|
-#print(df_global)
|
|
28
|
|
-
|
|
29
|
|
-df_global = pd.concat([df_global,df_conc])
|
|
30
|
|
-
|
|
31
|
|
-df_global=df_global.sort_values(by = ['frame'])
|
|
32
|
|
-df_global = df_global.drop_duplicates(['frame'], keep='last')
|
|
33
|
|
-df_global = df_global.reset_index(drop=True)
|
|
34
|
|
-df_global = df_global.interpolate()
|
|
35
|
|
-df_global = df_global.interpolate(method='values')
|
|
36
|
|
-#print(df_global)
|
|
37
|
|
-
|
|
38
|
|
-
|
|
39
|
|
-df_global['x'] = 10 * ((df_global['x'] - df_global['x'].min()) / (df_global['x'].max() - df_global['x'].min())) - 5
|
|
40
|
|
-df_global['y'] = 10 * ((df_global['y'] - df_global['y'].min()) / (df_global['y'].max() - df_global['y'].min())) - 5
|
|
41
|
|
-df_global['z'] = 2.7 * ((df_global['z'] - df_global['z'].min()) / (df_global['z'].max() - df_global['z'].min())) + 0.3
|
|
42
|
|
-#print(df_global)
|
|
43
|
|
-
|
|
44
|
|
-df_summary = df_global[df_global['frame']% 30 == 1]
|
|
45
|
|
-#print(df_summary)
|
|
46
|
|
-df_global.to_csv(os.path.join(target_dir,'coordinate.csv'))
|
|
47
|
|
-df_summary.to_csv(os.path.join(target_dir,'coordinate_summary.csv'))
|