forked from kyamagu/bbox-annotator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
44 lines (41 loc) · 1.47 KB
/
demo.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
<html>
<head>
<title>Bounding box annotator demo</title>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
<script src="bbox_annotator.js"></script>
</head>
<body>
<h1>Bounding box annotator demo</h1>
<div id="bbox_annotator" style="display:inline-block"></div>
<div style="display:inline-block;vertical-align:top;">
<div>
<textarea id="annotation_data" name="annotation" rows="30" cols="50" style="font-family:monospace;" readonly></textarea>
</div>
<div>
<input id="reset_button" type="reset" />
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
// Initialize the bounding-box annotator.
var annotator = new BBoxAnnotator({
url: "/url/to/image.jpg",
input_method: 'fixed', // Can be one of ['text', 'select', 'fixed']
labels: "object",
onchange: function(entries) {
// Input the text area on change. Use "hidden" input tag unless debugging.
// <input id="annotation_data" name="annotation_data" type="hidden" />
// $("#annotation_data").val(JSON.stringify(entries))
$("#annotation_data").text(JSON.stringify(entries, null, " "));
}
});
// Initialize the reset button.
$("#reset_button").click(function(e) {
annotator.clear_all();
})
});
</script>
</body>
</html>