Skip to content

Commit

Permalink
Fixed issue 5256, improved 'occluded' visualization (#5259)
Browse files Browse the repository at this point in the history
* Fixed issue 5256, improved 'occluded' visualization

* Updated version & added test

* Updated changelog

* Fixed tests
  • Loading branch information
bsekachev authored Nov 9, 2022
1 parent 92ba1ab commit 080755a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
- Job assignee can not resolve an issue (<https://github.com/opencv/cvat/pull/5167>)
- Create manifest with cvat/server docker container command (<https://github.com/opencv/cvat/pull/5172>)
- Cannot assign a resource to a user who has an organization (<https://github.com/opencv/cvat/pull/5218>)
- Occluded not applied on canvas instantly for a skeleton elements (<https://github.com/opencv/cvat/pull/5259>)
- Oriented bounding boxes broken with COCO format ss(<https://github.com/opencv/cvat/pull/5219>)
- Fixed upload resumption in production environments
(<https://github.com/opencv/cvat/issues/4839>)
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "2.16.0",
"version": "2.16.1",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
13 changes: 13 additions & 0 deletions cvat-canvas/src/scss/canvas.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,23 @@ polyline.cvat_canvas_shape_splitting {
stroke-dasharray: 5;
}

.cvat_canvas_shape_occluded_point {
stroke-dasharray: 1 !important;
stroke: white;
}

circle.cvat_canvas_shape_occluded {
@extend .cvat_canvas_shape_occluded_point;
}

g.cvat_canvas_shape_occluded {
> rect {
stroke-dasharray: 5;
}

> circle {
@extend .cvat_canvas_shape_occluded_point;
}
}

.svg_select_points_rot {
Expand Down
9 changes: 7 additions & 2 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1916,10 +1916,11 @@ export class CanvasViewImpl implements CanvasView, Listener {
}

if (drawnState.occluded !== state.occluded) {
const instance = state.shapeType === 'points' ? this.svgShapes[clientID].remember('_selectHandler').nested : shape;
if (state.occluded) {
shape.addClass('cvat_canvas_shape_occluded');
instance.addClass('cvat_canvas_shape_occluded');
} else {
shape.removeClass('cvat_canvas_shape_occluded');
instance.removeClass('cvat_canvas_shape_occluded');
}
}

Expand Down Expand Up @@ -3388,6 +3389,10 @@ export class CanvasViewImpl implements CanvasView, Listener {
group.addClass('cvat_canvas_hidden');
}

if (state.occluded) {
group.addClass('cvat_canvas_shape_occluded');
}

shape.remove = (): SVG.PolyLine => {
this.selectize(false, shape);
shape.constructor.prototype.remove.call(shape);
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ export function updateAnnotationsAsync(statesToUpdate: any[]): ThunkAction {
const states = await Promise.all(promises);

const needToUpdateAll = states
.some((state: any) => [ShapeType.MASK, ShapeType.SKELETON].includes(state.shapeType));
.some((state: any) => state.shapeType === ShapeType.MASK || state.parentID !== null);
if (needToUpdateAll) {
dispatch(fetchAnnotationsAsync());
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ class ObjectsListContainer extends React.PureComponent<Props, State> {
}
};

const activatedState = (): ObjectState | null => {
const activatedState = (ignoreElements = false): ObjectState | null => {
if (activatedStateID !== null) {
const state = objectStates
.find((objectState: ObjectState): boolean => objectState.clientID === activatedStateID);

if (state && activatedElementID !== null) {
if (state && activatedElementID !== null && !ignoreElements) {
const element = state.elements
.find((_element: ObjectState): boolean => _element.clientID === activatedElementID);
return element || null;
Expand Down Expand Up @@ -399,7 +399,7 @@ class ObjectsListContainer extends React.PureComponent<Props, State> {
},
DELETE_OBJECT: (event: KeyboardEvent | undefined) => {
preventDefault(event);
const state = activatedState();
const state = activatedState(true);
if (state && !readonly) {
removeObject(state, event ? event.shiftKey : false);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/masks/masks_basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/// <reference types="cypress" />

context('Manipulations with masks', () => {
context('Manipulations with masks', { scrollBehavior: false }, () => {
const taskName = 'Basic actions with masks';
const serverFiles = ['images/image_1.jpg', 'images/image_2.jpg', 'images/image_3.jpg'];
const drawingActions = [{
Expand Down
10 changes: 8 additions & 2 deletions tests/cypress/integration/skeletons/skeletons_pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/// <reference types="cypress" />

context('Manipulations with skeletons', () => {
context('Manipulations with skeletons', { scrollBehavior: false }, () => {
const skeletonSize = 5;
const labelName = 'skeleton';
const taskName = 'skeletons main pipeline';
Expand Down Expand Up @@ -169,8 +169,14 @@ context('Manipulations with skeletons', () => {
cy.get(selector).should('not.exist');
}

it('Creating and removing a skeleton shape', () => {
it('Creating, checking occluded for a single point, and removing a skeleton shape', () => {
createSkeletonObject('shape');

cy.get('#cvat-objects-sidebar-state-item-element-2').within(() => {
cy.get('span[aria-label="user"]').click();
});
cy.get('#cvat_canvas_shape_2').should('have.class', 'cvat_canvas_shape_occluded');

deleteSkeleton('#cvat_canvas_shape_1', 'shape', false);
cy.removeAnnotations();
});
Expand Down

0 comments on commit 080755a

Please sign in to comment.