-
Notifications
You must be signed in to change notification settings - Fork 4
/
renderhtml.py
96 lines (75 loc) · 2.18 KB
/
renderhtml.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import sys
import os
print('<!DOCTYPE html><html>')
head="""
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
var index=0;
$(function(){
});
</script>
<style>
body{
background-color:lightgrey;
width: 960px;
margin: 0 auto;
}
h1 {color:blue;}
.circle {position: absolute; width: 5px; height: 5px; background: red;}
#annotation{
color: red;
}
#frame{
width: 800px;
}
</style>
</head>
<body>
"""
print(head)
#cml24
try:
dir_name = sys.argv[1]
except:
dir_name = "output/"
DIR = "/tmp3/jacky82226/baseline/"
DIR = os.path.join(DIR,dir_name)
demo = "http://cml24.csie.ntu.edu.tw:"+sys.argv[2]+"/"
file_length=len([name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))])
frame_dir = "frame"
poi_dir = "poi"
index = 0
for img_name in os.listdir(frame_dir):
img_name = img_name.replace(".jpg","").replace(".png","")
with open(os.path.join(poi_dir, img_name + ".txt"), 'r') as f:
for line in f:
token = line.strip().split("\t")
gps_pos = [0, 0]
[name, gps_pos[0], gps_pos[1], google_type, img_ref, gt] = token
str_gps_pos = [gps_pos[0], gps_pos[1]]
query_name = str(str_gps_pos[0]) + '_' + str(str_gps_pos[1])
print("<div>")
print(name)
# query
src=os.path.join(demo, 'search', query_name + ".jpg")
img = "<img height=\'250\' src=\'"+src+"\'/>"
print(img)
# result
src=os.path.join(demo, dir_name,"{}.jpg".format(index+1))
img = "<img width=\'960\' src=\'"+src+"\'/>"
print(img)
print("</div>")
index += 1
"""
for i in xrange(index):
print("<div>")
src=os.path.join(demo,"{}.jpg".format(i+1))
img = "<img width=\'960\' src=\'"+src+"\'/>"
print(img)
print("</div>")
print('</body></html>')
"""
#for i in range(0 ,len(files), 3):
# print '<a onclick="f1(\'' + "car" + str(i) + '\')"><img id=\'car' + str(i) + '\' src=\'' + server_url + parent_dir + files[i] + '\' width=\'130\' height=\'70\'></a>'