Skip to content

A minimal JavaScript library for drawing bounding boxes with labels.

License

Notifications You must be signed in to change notification settings

hang-qi/label.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

label.js

This is a minimal JavaScript library I created in one of my projects for drawing bounding boxes with labels onto videos and images in the browser.

Usage

Include the library:

<script src="label.js"></script>

Assuming the canvas element is overlaying an image,

<div class="container">
    <canvas class="canvas" id="main-canvas" width="500" height="500">
    </canvas>
    <div class="image"><image src="lena.jpg"></image></div>
</div>

The following JavaScript snippet will draw a bounding box with a text label at the designated location.

var can = labeljs('#main-canvas');
can.drawRect({
    'x' : 120,
    'y' : 80,
    'width' : 300,
    'height': 300,
    'label': 'Lena',
    'color': 'rgb(50,150,50)'}
);

About

A minimal JavaScript library for drawing bounding boxes with labels.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published