CVAT-UI: Couple of fixes (#1892)

* Polygon interpolation fix

* Fix interpolation issue

* Updated changelog
main
Boris Sekachev 6 years ago committed by GitHub
parent cb114b5286
commit e92014ead0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `outside` annotations should not be in exported images (<https://github.com/opencv/cvat/issues/1620>) - `outside` annotations should not be in exported images (<https://github.com/opencv/cvat/issues/1620>)
- `CVAT for video format` import error with interpolation (<https://github.com/opencv/cvat/issues/1893>) - `CVAT for video format` import error with interpolation (<https://github.com/opencv/cvat/issues/1893>)
- `Image compression` definition mismatch (<https://github.com/opencv/cvat/issues/1900>) - `Image compression` definition mismatch (<https://github.com/opencv/cvat/issues/1900>)
- Points are dublicated during polygon interpolation sometimes (<https://github.com/opencv/cvat/pull/1892>)
- When redraw a shape with activated autobordering, previous points are visible (<https://github.com/opencv/cvat/pull/1892>)
### Security ### Security
- -

@ -1,6 +1,6 @@
{ {
"name": "cvat-canvas", "name": "cvat-canvas",
"version": "2.0.0", "version": "2.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "cvat-canvas", "name": "cvat-canvas",
"version": "2.0.0", "version": "2.0.1",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library", "description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts", "main": "src/canvas.ts",
"scripts": { "scripts": {

@ -13,14 +13,14 @@ interface TransformedShape {
} }
export interface AutoborderHandler { export interface AutoborderHandler {
autoborder(enabled: boolean, currentShape?: SVG.Shape, ignoreCurrent?: boolean): void; autoborder(enabled: boolean, currentShape?: SVG.Shape, currentID?: number): void;
transform(geometry: Geometry): void; transform(geometry: Geometry): void;
updateObjects(): void; updateObjects(): void;
} }
export class AutoborderHandlerImpl implements AutoborderHandler { export class AutoborderHandlerImpl implements AutoborderHandler {
private currentShape: SVG.Shape | null; private currentShape: SVG.Shape | null;
private ignoreCurrent: boolean; private currentID?: number;
private frameContent: SVGSVGElement; private frameContent: SVGSVGElement;
private enabled: boolean; private enabled: boolean;
private scale: number; private scale: number;
@ -34,7 +34,7 @@ export class AutoborderHandlerImpl implements AutoborderHandler {
public constructor(frameContent: SVGSVGElement) { public constructor(frameContent: SVGSVGElement) {
this.frameContent = frameContent; this.frameContent = frameContent;
this.ignoreCurrent = false; this.currentID = undefined;
this.currentShape = null; this.currentShape = null;
this.enabled = false; this.enabled = false;
this.scale = 1; this.scale = 1;
@ -231,7 +231,8 @@ export class AutoborderHandlerImpl implements AutoborderHandler {
this.removeMarkers(); this.removeMarkers();
const currentClientID = this.currentShape.node.dataset.originClientId; const currentClientID = this.currentShape.node.dataset.originClientId;
const shapes = Array.from(this.frameContent.getElementsByClassName('cvat_canvas_shape')); const shapes = Array.from(this.frameContent.getElementsByClassName('cvat_canvas_shape'))
.filter((shape: HTMLElement): boolean => +shape.getAttribute('clientID') !== this.currentID);
const transformedShapes = shapes.map((shape: HTMLElement): TransformedShape | null => { const transformedShapes = shapes.map((shape: HTMLElement): TransformedShape | null => {
const color = shape.getAttribute('fill'); const color = shape.getAttribute('fill');
const clientID = shape.getAttribute('clientID'); const clientID = shape.getAttribute('clientID');
@ -277,12 +278,12 @@ export class AutoborderHandlerImpl implements AutoborderHandler {
public autoborder( public autoborder(
enabled: boolean, enabled: boolean,
currentShape?: SVG.Shape, currentShape?: SVG.Shape,
ignoreCurrent: boolean = false, currentID?: number,
): void { ): void {
if (enabled && !this.enabled && currentShape) { if (enabled && !this.enabled && currentShape) {
this.enabled = true; this.enabled = true;
this.currentShape = currentShape; this.currentShape = currentShape;
this.ignoreCurrent = ignoreCurrent; this.currentID = currentID;
this.updateObjects(); this.updateObjects();
} else { } else {
this.release(); this.release();

@ -433,7 +433,7 @@ export class DrawHandlerImpl implements DrawHandler {
this.drawPolyshape(); this.drawPolyshape();
if (this.autobordersEnabled) { if (this.autobordersEnabled) {
this.autoborderHandler.autoborder(true, this.drawInstance, false); this.autoborderHandler.autoborder(true, this.drawInstance, this.drawData.redraw);
} }
} }
@ -446,7 +446,7 @@ export class DrawHandlerImpl implements DrawHandler {
this.drawPolyshape(); this.drawPolyshape();
if (this.autobordersEnabled) { if (this.autobordersEnabled) {
this.autoborderHandler.autoborder(true, this.drawInstance, false); this.autoborderHandler.autoborder(true, this.drawInstance, this.drawData.redraw);
} }
} }
@ -478,7 +478,7 @@ export class DrawHandlerImpl implements DrawHandler {
if (this.canceled) return; if (this.canceled) return;
if ((xbr - xtl) * (ybr - ytl) >= consts.AREA_THRESHOLD) { if ((xbr - xtl) * (ybr - ytl) >= consts.AREA_THRESHOLD) {
const d = { x: (xbr - xtl) * 0.1, y: (ybr - ytl)*0.1} const d = { x: (xbr - xtl) * 0.1, y: (ybr - ytl) * 0.1 };
this.onDrawDone({ this.onDrawDone({
shapeType, shapeType,
points: cuboidFrom4Points([xtl, ybr, xbr, ybr, xbr, ytl, xbr + d.x, ytl - d.y]), points: cuboidFrom4Points([xtl, ybr, xbr, ybr, xbr, ytl, xbr + d.x, ytl - d.y]),
@ -767,7 +767,11 @@ export class DrawHandlerImpl implements DrawHandler {
this.autobordersEnabled = configuration.autoborders; this.autobordersEnabled = configuration.autoborders;
if (this.drawInstance) { if (this.drawInstance) {
if (this.autobordersEnabled) { if (this.autobordersEnabled) {
this.autoborderHandler.autoborder(true, this.drawInstance, false); this.autoborderHandler.autoborder(
true,
this.drawInstance,
this.drawData.redraw,
);
} else { } else {
this.autoborderHandler.autoborder(false); this.autoborderHandler.autoborder(false);
} }

@ -130,7 +130,7 @@ export class EditHandlerImpl implements EditHandler {
this.setupEditEvents(); this.setupEditEvents();
if (this.autobordersEnabled) { if (this.autobordersEnabled) {
this.autoborderHandler.autoborder(true, this.editLine, true); this.autoborderHandler.autoborder(true, this.editLine, this.editData.state.clientID);
} }
} }
@ -376,7 +376,11 @@ export class EditHandlerImpl implements EditHandler {
this.autobordersEnabled = configuration.autoborders; this.autobordersEnabled = configuration.autoborders;
if (this.editLine) { if (this.editLine) {
if (this.autobordersEnabled) { if (this.autobordersEnabled) {
this.autoborderHandler.autoborder(true, this.editLine, true); this.autoborderHandler.autoborder(
true,
this.editLine,
this.editData.state.clientID,
);
} else { } else {
this.autoborderHandler.autoborder(false); this.autoborderHandler.autoborder(false);
} }

@ -1,6 +1,6 @@
{ {
"name": "cvat-core", "name": "cvat-core",
"version": "3.1.0", "version": "3.1.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration", "description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js", "main": "babel.config.js",
"scripts": { "scripts": {

@ -1629,7 +1629,7 @@
} }
function matchRightLeft(leftCurve, rightCurve, leftRightMatching) { function matchRightLeft(leftCurve, rightCurve, leftRightMatching) {
const matchedRightPoints = Object.values(leftRightMatching); const matchedRightPoints = Object.values(leftRightMatching).flat();
const unmatchedRightPoints = rightCurve.map((_, index) => index) const unmatchedRightPoints = rightCurve.map((_, index) => index)
.filter((index) => !matchedRightPoints.includes(index)); .filter((index) => !matchedRightPoints.includes(index));
const updatedMatching = { ...leftRightMatching }; const updatedMatching = { ...leftRightMatching };

@ -5,6 +5,7 @@
from copy import copy, deepcopy from copy import copy, deepcopy
import numpy as np import numpy as np
from itertools import chain
from scipy.optimize import linear_sum_assignment from scipy.optimize import linear_sum_assignment
from shapely import geometry from shapely import geometry
@ -523,7 +524,7 @@ class TrackManager(ObjectManager):
return matching return matching
def match_right_left(left_curve, right_curve, left_right_matching): def match_right_left(left_curve, right_curve, left_right_matching):
matched_right_points = left_right_matching.values() matched_right_points = list(chain.from_iterable(left_right_matching.values()))
unmatched_right_points = filter(lambda x: x not in matched_right_points, range(len(right_curve))) unmatched_right_points = filter(lambda x: x not in matched_right_points, range(len(right_curve)))
updated_matching = deepcopy(left_right_matching) updated_matching = deepcopy(left_right_matching)

Loading…
Cancel
Save