Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation of polyshapes in CVAT #1571

Merged
merged 42 commits into from Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
11cdf72
cvat-core interpolation
bsekachev May 7, 2020
ea53236
Merge branch 'develop' into bs/interpolation
bsekachev May 7, 2020
0b01d5e
Unlocked polyshapes
bsekachev May 7, 2020
ad4efce
Updated versions
bsekachev May 8, 2020
681c6ec
Second implementation
bsekachev May 12, 2020
5cf8d65
Splitted line
bsekachev May 12, 2020
87ad105
Merged develop
bsekachev May 13, 2020
6918d87
Inverse, set start point, fixed editing a bit, point menu refactoring
bsekachev May 14, 2020
612affc
Removed extra code, fixed bug: Cannot open shape context menu when po…
bsekachev May 14, 2020
51849c4
Do not close shape context menu on change shap[e
bsekachev May 14, 2020
02ea007
Merge branch 'develop' into bs/interpolation
bsekachev May 14, 2020
c006771
Improved editing
bsekachev May 14, 2020
6fa96ee
Updated mouseevents to edit/delete, added ability to redraw (shift + N)
bsekachev May 14, 2020
0f5acee
Ignore tags when redraw
bsekachev May 14, 2020
ad4041e
Merged develop
bsekachev May 15, 2020
7f08d3a
Ingoring tags on canvas, added method isAbleToChangeFrame, hide shape…
bsekachev May 15, 2020
18ad263
Canceled advanced editing for polygons
bsekachev May 15, 2020
4e5c66a
Merge branch 'develop' into bs/interpolation
bsekachev May 19, 2020
b38d138
A couple of fixes in interpolation, editing, reducing number of points
bsekachev May 20, 2020
a4d2eb3
Moved change orientation functionality
bsekachev May 20, 2020
fb5a18c
Fixed interpolation algorithm
bsekachev Jun 3, 2020
c96c99c
Zero division issue
bsekachev Jun 4, 2020
67acfaa
Zero division issue
bsekachev Jun 4, 2020
45e3f23
Segment minimization
bsekachev Jun 4, 2020
3b1fb55
Merged develop
bsekachev Jun 4, 2020
a5a3c2b
Server implementation
bsekachev Jun 5, 2020
34bdbeb
Keyframe set to False
bsekachev Jun 5, 2020
54b2da6
Merged develop
bsekachev Jun 5, 2020
49cf9b6
Simplified code, fixed server side code
bsekachev Jun 8, 2020
bb6c34b
Merge branch 'develop' into bs/interpolation
bsekachev Jun 9, 2020
5720272
Merged develop
bsekachev Jun 15, 2020
960d244
Updated changelog.md
bsekachev Jun 15, 2020
591977f
Merge branch 'develop' into bs/interpolation
bsekachev Jun 15, 2020
19c040c
Added pdf describing interpolation
bsekachev Jun 16, 2020
7b1f747
Resolved some issues
bsekachev Jun 17, 2020
1843415
Merged develop
bsekachev Jun 17, 2020
c005560
Merge branch 'develop' into bs/interpolation
bsekachev Jun 17, 2020
8c1ed2e
Merge branch 'develop' into bs/interpolation
bsekachev Jun 19, 2020
456a3f9
Updated UI version
bsekachev Jun 19, 2020
f86410b
Updated canvas version
bsekachev Jun 19, 2020
aad9c09
Merged develop
bsekachev Jun 22, 2020
5e7b404
Fixed host
bsekachev Jun 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -15,10 +15,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Built-in search for labels when create an object or change a label (<https://github.com/opencv/cvat/pull/1683>)
- Better validation of labels and attributes in raw viewer (<https://github.com/opencv/cvat/pull/1727>)
- ClamAV antivirus integration (<https://github.com/opencv/cvat/pull/1712>)
- Polygon and polylines interpolation (<https://github.com/opencv/cvat/pull/1571>)
- Ability to redraw shape from scratch (Shift + N) for an activated shape (<https://github.com/opencv/cvat/pull/1571>)
- Highlights for the first point of a polygon/polyline and direction (<https://github.com/opencv/cvat/pull/1571>)
- Ability to change orientation for poylgons/polylines in context menu (<https://github.com/opencv/cvat/pull/1571>)
- Ability to set the first point for polygons in points context menu (<https://github.com/opencv/cvat/pull/1571>)

### Changed
- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)
- Update https install manual. Makes it easier and more robust. Includes automatic renewing of lets encrypt certificates.
- Using only single click to start editing or remove a point (<https://github.com/opencv/cvat/pull/1571>)

### Deprecated
-
Expand Down
7 changes: 5 additions & 2 deletions cvat-canvas/README.md
Expand Up @@ -117,6 +117,7 @@ Canvas itself handles:
mode(): Mode;
cancel(): void;
configure(configuration: Configuration): void;
isAbleToChangeFrame(): boolean;
}
```

Expand Down Expand Up @@ -188,8 +189,7 @@ Standard JS events are used.

| | IDLE | GROUP | SPLIT | DRAW | MERGE | EDIT | DRAG | RESIZE | ZOOM_CANVAS | DRAG_CANVAS |
|--------------|------|-------|-------|------|-------|------|------|--------|-------------|-------------|
| html() | + | + | + | + | + | + | + | + | + | + |
| setup() | + | + | + | + | + | +/- | +/- | +/- | + | + |
| setup() | + | + | + | +/- | + | +/- | +/- | +/- | + | + |
| activate() | + | - | - | - | - | - | - | - | - | - |
| rotate() | + | + | + | + | + | + | + | + | + | + |
| focus() | + | + | + | + | + | + | + | + | + | + |
Expand All @@ -208,3 +208,6 @@ Standard JS events are used.
| setZLayer() | + | + | + | + | + | + | + | + | + | + |

You can call setup() during editing, dragging, and resizing only to update objects, not to change a frame.
You can change frame during draw only when you do not redraw an existing object

Other methods do not change state and can be used everytime.
19 changes: 19 additions & 0 deletions cvat-canvas/src/scss/canvas.scss
Expand Up @@ -151,6 +151,25 @@ polyline.cvat_canvas_shape_splitting {
cursor: move;
}

.cvat_canvas_first_poly_point {
fill: lightgray;
}

.cvat_canvas_poly_direction {
fill: lightgray;
stroke: black;

&:hover {
fill: black;
stroke: lightgray;
}

&:active {
fill: lightgray;
stroke: black;
}
}

#cvat_canvas_wrapper {
width: calc(100% - 10px);
height: calc(100% - 10px);
Expand Down
5 changes: 5 additions & 0 deletions cvat-canvas/src/typescript/canvas.ts
Expand Up @@ -58,6 +58,7 @@ interface Canvas {
mode(): Mode;
cancel(): void;
configure(configuration: Configuration): void;
isAbleToChangeFrame(): boolean;
}

class CanvasImpl implements Canvas {
Expand Down Expand Up @@ -153,6 +154,10 @@ class CanvasImpl implements Canvas {
public configure(configuration: Configuration): void {
this.model.configure(configuration);
}

public isAbleToChangeFrame(): boolean {
return this.model.isAbleToChangeFrame();
}
}

export {
Expand Down
38 changes: 34 additions & 4 deletions cvat-canvas/src/typescript/canvasModel.ts
Expand Up @@ -66,6 +66,7 @@ export interface DrawData {
numberOfPoints?: number;
initialState?: any;
crosshair?: boolean;
redraw?: number;
}

export interface EditData {
Expand Down Expand Up @@ -169,6 +170,7 @@ export interface CanvasModel {
dragCanvas(enable: boolean): void;
zoomCanvas(enable: boolean): void;

isAbleToChangeFrame(): boolean;
configure(configuration: Configuration): void;
cancel(): void;
}
Expand Down Expand Up @@ -382,10 +384,17 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
}

if (this.data.mode !== Mode.IDLE && clientID !== null) {
// Exception or just return?
throw Error(`Canvas is busy. Action: ${this.data.mode}`);
}

if (typeof (clientID) === 'number') {
const [state] = this.data.objects
.filter((_state: any): boolean => _state.clientID === clientID);
if (!['rectangle', 'polygon', 'polyline', 'points', 'cuboid'].includes(state.shapeType)) {
return;
}
}

this.data.activeElement = {
clientID,
attributeID,
Expand Down Expand Up @@ -465,10 +474,24 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
}
}

this.data.drawData = { ...drawData };
if (this.data.drawData.initialState) {
this.data.drawData.shapeType = this.data.drawData.initialState.shapeType;
if (typeof (drawData.redraw) === 'number') {
const clientID = drawData.redraw;
const [state] = this.data.objects
.filter((_state: any): boolean => _state.clientID === clientID);

if (state) {
this.data.drawData = { ...drawData };
this.data.drawData.shapeType = state.shapeType;
} else {
return;
}
} else {
this.data.drawData = { ...drawData };
if (this.data.drawData.initialState) {
this.data.drawData.shapeType = this.data.drawData.initialState.shapeType;
}
}

this.notify(UpdateReasons.DRAW);
}

Expand Down Expand Up @@ -548,6 +571,13 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
this.notify(UpdateReasons.CONFIG_UPDATED);
}

public isAbleToChangeFrame(): boolean {
const isUnable = [Mode.DRAG, Mode.EDIT, Mode.RESIZE].includes(this.data.mode)
|| (this.data.mode === Mode.DRAW && typeof (this.data.drawData.redraw) === 'number');

return !isUnable;
}

public cancel(): void {
this.notify(UpdateReasons.CANCEL);
}
Expand Down