-
Notifications
You must be signed in to change notification settings - Fork 26
/
tool.html
executable file
·273 lines (230 loc) · 9.1 KB
/
tool.html
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!--
LabelMe is a WEB-based image annotation tool and a Matlab toolbox that allows researchers to label images and share the annotations with the rest of the community.
Copyright (C) 2007 MIT, Computer Science and Artificial
Intelligence Laboratory. Bryan Russell, Antonio Torralba, William T. Freeman
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>.
-->
<!--#if expr="!${InternetExplorer}" -->
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11-strict.dtd">
<!--#endif -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<title>LabelMe: The open annotation tool</title>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE,NO-STORE,MUST-REVALIDATE" />
<META HTTP-EQUIV="imagetoolbar" CONTENT="no" />
<LINK REL="SHORTCUT ICON" HREF="Icons/favicon16.ico" />
<script type="text/javascript">
// <![CDATA[
<!--#include virtual="./annotationTools/js/browser.js" -->
// Check browser:
GetBrowserInfo();
if(!(IsNetscape() || (IsMicrosoft() && (bversion>=4.5)) || IsSafari() || IsChrome())) {
window.location="tool.html?badbrowser";
}
<!--#if expr="${InternetExplorer}" -->
<!--#include virtual="./annotationTools/js/graphics_ie.js" -->
<!--#else -->
<!--#include virtual="./annotationTools/js/graphics_moz.js" -->
<!--#endif -->
<!--#include virtual="./annotationTools/js/my_scripts.js" -->
<!--#include virtual="./annotationTools/js/bubble-popups.js" -->
<!--#include virtual="./annotationTools/js/image.js" -->
<!--#include virtual="./annotationTools/js/file_info.js" -->
<!--#include virtual="./annotationTools/js/annotation.js" -->
<!--#include virtual="./annotationTools/js/canvas.js" -->
<!--#include virtual="./annotationTools/js/select_canvas.js" -->
<!--#include virtual="./annotationTools/js/draw_canvas.js" -->
<!--#include virtual="./annotationTools/js/query_canvas.js" -->
<!--#include virtual="./annotationTools/js/handler.js" -->
<!--#include virtual="./annotationTools/js/request.js" -->
<!--#endif -->
var main_handler;
var main_canvas;
var main_select_canvas;
var main_draw_canvas;
var main_image;
var xhtmlNS = 'http://www.w3.org/1999/xhtml';
function CreateTicket() {
var dirname = main_image.GetFileInfo().GetDirName();
var imname = main_image.GetFileInfo().GetImName();
var ticket_url = 'annotationTools/perl/generate_ticket.cgi?folder=' + dirname +
'&image=' + imname + '&username=' + username;
// Submit ticket:
if (window.XMLHttpRequest) {
req_submit = new XMLHttpRequest();
req_submit.open("GET", ticket_url, true);
req_submit.send('');
}
else if (window.ActiveXObject) {
req_submit = new ActiveXObject("Microsoft.XMLHTTP");
if (req_submit) {
req_submit.open("GET", ticket_url, true);
req_submit.send('');
}
}
}
function GoToVrmlDownloadPage() {
var dirname = main_image.GetFileInfo().GetDirName();
var imname = main_image.GetFileInfo().GetImName();
var url3D = 'view3D.html?folder=' + dirname + '&image=' + imname;
window.open(url3D);
}
function Check3DPageExists() {
if(req_submit.readyState==4) {
if(req_submit.status != 200) {
CreateTicket();
}
GoToVrmlDownloadPage();
}
}
function Make3D() {
WriteLogMsg('*make3d_pressed ' + main_image.GetFileInfo().GetImagePath());
var dirname = main_image.GetFileInfo().GetDirName();
var imname = main_image.GetFileInfo().GetImName();
var url3D = '3D/' + dirname + '/' +
imname.substr(0,imname.length-4) + '.wrl';
if(main_canvas.GetAnnotations().length==0) {
alert("In order for the 3D model to be generated, you must provide at least 5 labeled objects. Please start labeling and try pressing Make 3D again.");
// alert("The 3D model has not been created yet. Note that the model starts to be produced when there are at least 5 labeled objects. Please continue labeling and try again");
return;
}
var numUserAnno = 0;
for(ii = 0; ii < (main_canvas.GetAnnotations().length-num_orig_anno); ii++) {
if(main_canvas.GetAnnotations()[num_orig_anno+ii].GetDeleted()==0) numUserAnno++;
}
if(numUserAnno) {
CreateTicket();
GoToVrmlDownloadPage();
}
else {
// Check if VRML file exists:
if (window.XMLHttpRequest) {
req_submit = new XMLHttpRequest();
req_submit.onreadystatechange = Check3DPageExists;
req_submit.open("GET", url3D, true);
req_submit.send('');
}
else if (window.ActiveXObject) {
req_submit = new ActiveXObject("Microsoft.XMLHTTP");
if (req_submit) {
req_submit.onreadystatechange = Check3DPageExists;
req_submit.open("GET", url3D, true);
req_submit.send('');
}
}
}
}
function CheckXMLExists() {
if(req_submit.readyState==4) {
if(req_submit.status != 200) {
alert("The XML annotation file does not exist yet. Please label an object and try again");
}
else {
window.open(main_image.GetFileInfo().GetAnnotationPath());
}
}
}
function GetXMLFile() {
var xml_url = main_image.GetFileInfo().GetAnnotationPath();
// Check if VRML file exists:
if (window.XMLHttpRequest) {
req_submit = new XMLHttpRequest();
req_submit.onreadystatechange = CheckXMLExists;
req_submit.open("GET", xml_url, true);
req_submit.send('');
}
else if (window.ActiveXObject) {
req_submit = new ActiveXObject("Microsoft.XMLHTTP");
if (req_submit) {
req_submit.onreadystatechange = CheckXMLExists;
req_submit.open("GET", xml_url, true);
req_submit.send('');
}
}
}
function MainInit() {
main_handler = new handler();
main_canvas = new canvas();
main_select_canvas = new SelectCanvas();
main_draw_canvas = new DrawCanvas();
main_query_canvas = new QueryCanvas();
main_image = new image('im');
function main_image_onload_helper() {
main_image.SetImageDimensions();
LoadAnnotations(main_image.GetFileInfo().GetFullName());
var m = main_image.GetFileInfo().GetMode();
if(view_ObjList) LoadAnnotationList();
//if((m!='im') && (m!='mt')) LoadAnnotationList();
// Added for IE compatability. Without it, there is extra space
// at the top and the points are offset from where you clicked.
// Also, myCanvas_bg does not show up if this is not here.
//if(IsMicrosoft()) main_image.Zoom('fitted');
};
main_image.GetNewImage(main_image_onload_helper);
var dirname = main_image.GetFileInfo().GetDirName();
var imname = main_image.GetFileInfo().GetImName();
// document.getElementById('3d_link').href =
// 'view3D.html?folder=' + dirname + '&image=' + imname;
// document.getElementById('3d_link').href =
// 'http://labelme.csail.mit.edu/3D/' + dirname + '/' +
// imname.substr(0,imname.length-4) + '.wrl';
// document.getElementById('xml_url').href =
// main_image.GetFileInfo().GetAnnotationPath();
if(document.getElementById('img_url')) {
document.getElementById('img_url').href =
main_image.GetFileInfo().GetImagePath();
}
// document.getElementById('vrml_embed').src =
// 'http://labelme.csail.mit.edu/3D/' + dirname + '/' +
// imname.substr(0,imname.length-4) + '.wrl';
/*
document.getElementById('vrml_expand').href =
'http://labelme.csail.mit.edu/3D/' + dirname + '/' +
imname.substr(0,imname.length-4) + '.wrl';
document.getElementById('vrml_dload').href =
'http://labelme.csail.mit.edu/3D/' + dirname + '/' +
imname.substr(0,imname.length-4) + '.wrl';
document.getElementById('texture_dload').href =
'http://labelme.csail.mit.edu/3D/' + dirname + '/' + imname;
*/
if(document.getElementById('username_main_div')) write_username();
WriteLogMsg('*done_loading_' + main_image.GetFileInfo().GetImagePath());
}
// ]]>
</script>
<!-- added body overflow:hidden 7.5.06 to get rid of extra scrollbars -->
<!-- in IE. may need to turn this off for debugging //-->
<!--#if expr="${InternetExplorer}" -->
<style>v\:* { behavior: url(#default#VML); }</style>
<!--#endif -->
<style>
@import url("annotationTools/css/styles.css");
</style>
</head>
<!--#if expr="$QUERY_STRING_UNESCAPED!=badbrowser" -->
<!--#include virtual="./annotationTools/html/tool_main_01.html" -->
<!--#if expr="${InternetExplorer}" -->
<!--#include virtual="./annotationTools/html/tool_main_02_ie.html" -->
<!--#else -->
<!--#include virtual="./annotationTools/html/tool_main_02_moz.html" -->
<!--#endif -->
<!--#include virtual="./annotationTools/html/tool_main_03.html" -->
<!--#else -->
<!--#include virtual="./annotationTools/html/badbrowser.html" -->
<!--#endif -->
</html>