• This repository has been archived on 14/Jul/2020
  • Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    HTML
  • License
    BSD 3-Clause "New...
  • Created over 11 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A bounding box annotation widget written in CoffeeScript.

Bounding box annotator

A bounding box annotation tool written in CoffeeScript/JavaScript. There is an online demo at https://kyamagu.github.io/bbox-annotator/demo.html

Contents

bbox_annotator.coffee  Main code.
demo.html              Example to host on a private server.
mturk.html             Example to use in Amazon MTurk.
README.md              This documentation.

Be sure to unescape × with × when directly editing an MTurk template on the Amazon requester UI.

Compile

Compile the coffee script to get a javascript.

coffee -c bbox_annotator.coffee

Or, go to http://coffeescript.org/ and compile the coffeescript.

Usage

Load the compiled javascript codes inside HTML.

<script src="bbox_annotator.js" type="text/javascript"></script>

Embed a block element for annotation tool and a form element in HTML.

<div id="bbox_annotator"></div>
<input id="annotation_data" name="annotation_data" type="hidden" />

Then, attach a piece of script to launch the annotation tool. The annotator takes a callback function on change of the annotation data. Use JSON format to display the value.

<script type="text/javascript">
$(document).ready(function() {
  var editor = new BBoxAnnotator({
    url: "/url/to/image.jpg",
    onchange: function(annotation) {
      $("#annotation_data").val(JSON.stringify(annotation));
    }
  });
});
</script>

The returned annotation is an array of objects. Here is an example.

[
  {
    "top": 0,
    "left": 0,
    "width": 100,
    "height": 100,
    "label", "object"
  }
]

Check the attached demo.html and mturk.html for how to use.

Options

The BBoxAnnotator object takes options to change its behavior.

  • id: CSS selector for the annotator element. Default is "#bbox_annotator".
  • input_method: One of the "text", "select", and "fixed". This will change how to input associated annotation text.
  • labels: A string, or an array of strings. Set of labels used for suggestion in "text" or "select" input. When fixed, only the first element is chosen.
  • width: Width of the image. The default is the original width of the image.
  • height: Height of the image. The default is the original height of the image.
  • show_label: Flag to display a label in the box. Default is true for "text" and "select" input, and false for "fixed" input.
  • border_width: Size of border around the image. Default is 2. Leaving it 0 can make it hard to start annotation around the image border.
  • multiple: Defines if multiple boxes could be selected. Default is true.
  • guide: Enable vertical and horizontal guide lines. Specify true, or object that specifies color like {'color': '#fff'}.

License

The code may be redistributed under BSD license.

More Repositories

1

mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
MATLAB
660
star
2

js-segment-annotator

Javascript image annotation tool based on image segmentation.
JavaScript
524
star
3

faiss-wheels

Unofficial faiss wheel builder
Python
286
star
4

skia-python

Python binding to Skia Graphics Library
Jupyter Notebook
240
star
5

mexplus

C++ Matlab MEX development kit.
C++
99
star
6

paperdoll

Paper doll parser implementation from ICCV 2013
Jupyter Notebook
83
star
7

matlab-json

Use official API: https://mathworks.com/help/matlab/json-format.html
Java
52
star
8

psd2svg

PSD to SVG converter.
Python
52
star
9

matlab-lmdb

Matlab LMDB wrapper
C
38
star
10

js-graph-annotator

Javascript widget to draw a graph annotation on an image.
JavaScript
37
star
11

matlab-sqlite3-driver

Matlab driver for SQLite3 database
C
35
star
12

sge-gpuprolog

Scripts to manage NVIDIA GPU devices in SGE 6.2u5
Shell
25
star
13

photoshop-connection

Python package to remotely execute ExtendScript in Adobe Photoshop.
Python
22
star
14

pf-segmentation

Image segmentation algorithm of [P Felzenszwalb 2004] for Matlab
C++
16
star
15

matlab-leveldb

Matlab LevelDB wrapper
C++
11
star
16

matlab-tcpip

TCP/IP server and client for Matlab
MATLAB
11
star
17

matlab-fscache

File-system based cache for Matlab.
MATLAB
4
star
18

matlab-bson

Matlab BSON encoder based on libbson.
C
4
star
19

lda-matlab

Latent Dirichlet Allocation for Matlab
C++
4
star
20

matlab-bdb

Persistent key-value storage for matlab.
C++
3
star
21

matlab-batch

Distributed Matlab job execution library.
MATLAB
3
star
22

matlab-serialization

Matlab object serialization functions
C++
2
star
23

matlab-ejdb

EJDB Matlab binding
C++
1
star