You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
* Change the version and updated CHANGELOG.md * Installation issues for development environment (#1280) * Installation issues * Added ffmpeg * Bump acorn from 6.3.0 to 6.4.1 in /cvat-ui (#1270) * Bump acorn from 6.3.0 to 6.4.1 in /cvat-ui Bumps [acorn](https://github.com/acornjs/acorn) from 6.3.0 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/6.3.0...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> * Updated CHANGELOG.md Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru> * Bump acorn from 6.2.1 to 6.4.1 in /cvat-canvas (#1281) Bumps [acorn](https://github.com/acornjs/acorn) from 6.2.1 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/6.2.1...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Use source label map for voc export (#1276) * Use source label map for voc export * Add line to changelog * [Datumaro] Fix frame matching in video annotations import (#1274) * Add extra frame matching way for videos * Add line to changelog * [Datumaro] Allow empty COCO dataset export (#1272) * Allow empty dataset export in coco * Add line to changelog Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com> * [Datumaro] Fix occluded and z_order attributes export (#1271) * Fix occluded and z_order attributes export * Add line to changelog Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com> * Fix LabelMe format (#1260) * Fix labelme filenames * Change module path * Add tests for LabelMe * Update test * Fix test * Add line in changelog * Fix release date. Co-authored-by: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru> Co-authored-by: zhiltsov-max <zhiltsov.max35@gmail.com> |
6 years ago | |
|---|---|---|
| .. | ||
| images | 7 years ago | |
| src | 6 years ago | |
| .eslintrc.js | 7 years ago | |
| .gitignore | 7 years ago | |
| README.md | 6 years ago | |
| package-lock.json | 6 years ago | |
| package.json | 6 years ago | |
| postcss.config.js | 6 years ago | |
| tsconfig.json | 6 years ago | |
| webpack.config.js | 6 years ago | |
README.md
Module CVAT-CANVAS
Description
The CVAT module written in TypeScript language. It presents a canvas to viewing, drawing and editing of annotations.
Commands
- Building of the module from sources in the
distdirectory:
npm run build
npm run build -- --mode=development # without a minification
- Updating of a module version:
npm version patch # updated after minor fixes
npm version minor # updated after major changes which don't affect API compatibility with previous versions
npm version major # updated after major changes which affect API compatibility with previous versions
Using
Canvas itself handles:
- Shape context menu (PKM)
- Image moving (mousedrag)
- Image resizing (mousewheel)
- Image fit (dblclick)
- Remove point (PKM)
- Polyshape editing (Shift + LKM)
API Methods
enum RectDrawingMethod {
CLASSIC = 'By 2 points',
EXTREME_POINTS = 'By 4 points'
}
interface DrawData {
enabled: boolean;
shapeType?: string;
rectDrawingMethod?: RectDrawingMethod;
numberOfPoints?: number;
initialState?: any;
crosshair?: boolean;
}
interface GroupData {
enabled: boolean;
resetGroup?: boolean;
}
interface MergeData {
enabled: boolean;
}
interface SplitData {
enabled: boolean;
}
interface DrawnData {
shapeType: string;
points: number[];
objectType?: string;
occluded?: boolean;
attributes?: [index: number]: string;
label?: Label;
color?: string;
}
interface Canvas {
html(): HTMLDivElement;
setZLayer(zLayer: number | null): void;
setup(frameData: any, objectStates: any[]): void;
activate(clientID: number, attributeID?: number): void;
rotate(frameAngle: number): void;
focus(clientID: number, padding?: number): void;
fit(): void;
grid(stepX: number, stepY: number): void;
draw(drawData: DrawData): void;
group(groupData: GroupData): void;
split(splitData: SplitData): void;
merge(mergeData: MergeData): void;
select(objectState: any): void;
fitCanvas(): void;
dragCanvas(enable: boolean): void;
zoomCanvas(enable: boolean): void;
cancel(): void;
}
API CSS
- All drawn objects (shapes, tracks) have an id
cvat_canvas_shape_{objectState.clientID} - Drawn shapes and tracks have classes
cvat_canvas_shape,cvat_canvas_shape_activated,cvat_canvas_shape_grouping,cvat_canvas_shape_merging,cvat_canvas_shape_drawing,cvat_canvas_shape_occluded - Drawn texts have the class
cvat_canvas_text - Tags have the class
cvat_canvas_tag - Canvas image has ID
cvat_canvas_image - Grid on the canvas has ID
cvat_canvas_gridandcvat_canvas_grid_pattern - Crosshair during a draw has class
cvat_canvas_crosshair
Events
Standard JS events are used.
- canvas.setup
- canvas.activated => {state: ObjectState}
- canvas.clicked => {state: ObjectState}
- canvas.moved => {states: ObjectState[], x: number, y: number}
- canvas.find => {states: ObjectState[], x: number, y: number}
- canvas.drawn => {state: DrawnData}
- canvas.editstart
- canvas.edited => {state: ObjectState, points: number[]}
- canvas.splitted => {state: ObjectState}
- canvas.groupped => {states: ObjectState[]}
- canvas.merged => {states: ObjectState[]}
- canvas.canceled
- canvas.dragstart
- canvas.dragstop
- canvas.zoomstart
- canvas.zoomstop
WEB
// Create an instance of a canvas
const canvas = new window.canvas.Canvas();
console.log('Version', window.canvas.CanvasVersion);
// Put canvas to a html container
htmlContainer.appendChild(canvas.html());
canvas.fitCanvas();
// Next you can use its API methods. For example:
canvas.rotate(270);
canvas.draw({
enabled: true,
shapeType: 'rectangle',
crosshair: true,
rectDrawingMethod: window.Canvas.RectDrawingMethod.CLASSIC,
});
API Reaction
| IDLE | GROUPING | SPLITTING | DRAWING | MERGING | EDITING | DRAG | ZOOM | |
|---|---|---|---|---|---|---|---|---|
| html() | + | + | + | + | + | + | + | + |
| setup() | + | + | + | + | + | - | + | + |
| activate() | + | - | - | - | - | - | - | - |
| rotate() | + | + | + | + | + | + | + | + |
| focus() | + | + | + | + | + | + | + | + |
| fit() | + | + | + | + | + | + | + | + |
| grid() | + | + | + | + | + | + | + | + |
| draw() | + | - | - | - | - | - | - | - |
| split() | + | - | + | - | - | - | - | - |
| group() | + | + | - | - | - | - | - | - |
| merge() | + | - | - | - | + | - | - | - |
| fitCanvas() | + | + | + | + | + | + | + | + |
| dragCanvas() | + | - | - | - | - | - | + | - |
| zoomCanvas() | + | - | - | - | - | - | - | + |
| cancel() | - | + | + | + | + | + | + | + |
| setZLayer() | + | + | + | + | + | + | + | + |