From 6a374b450ad542e4bbf266f5f25105e0cc598acf Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 16 May 2023 20:31:06 +0300 Subject: [PATCH] Fixed area checking for skeleton in case with two points (#6156) ### Motivation and context ### How has this been tested? ### Checklist - [x] I submit my changes into the `develop` branch - [x] I have added a description of my changes into the [CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md) file - [ ] I have updated the documentation accordingly - [ ] I have added tests to cover my changes - [ ] I have linked related issues (see [GitHub docs]( https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)) - [x] I have increased versions of npm packages if it is necessary ([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning), [cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning), [cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning) and [cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning)) ### License - [x] I submit _my code changes_ under the same [MIT License]( https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. --- CHANGELOG.md | 4 +++- cvat-canvas/package.json | 2 +- cvat-canvas/src/typescript/drawHandler.ts | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 739b782a6c9f..b4540d5bf7c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,12 +33,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Image scaling when moving between images with different resolution () - Invalid completed job count reporting () - OpenVINO-based Nuclio functions can now be deployed to Kubernetes - (). + () +- Adjusted skeleton size checking after drawing () - HRNet CPU serverless function () - Sending empty list of events () + ### Security - TDB diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index f915be5ac810..20c28f199d41 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.16.5", + "version": "2.16.6", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": { diff --git a/cvat-canvas/src/typescript/drawHandler.ts b/cvat-canvas/src/typescript/drawHandler.ts index 60ca0c486913..e7be83b9a35a 100644 --- a/cvat-canvas/src/typescript/drawHandler.ts +++ b/cvat-canvas/src/typescript/drawHandler.ts @@ -72,6 +72,11 @@ function checkConstraint(shapeType: string, points: number[], box: Box | null = (points.length === 2 * 2 && (points[2] - points[0]) * (points[3] - points[1]) >= consts.AREA_THRESHOLD); } + if (shapeType === 'skeleton') { + const [xtl, ytl, xbr, ybr] = points; + return (xbr - xtl >= 1 || ybr - ytl >= 1); + } + return false; } @@ -762,7 +767,7 @@ export class DrawHandlerImpl implements DrawHandler { this.release(); if (this.canceled) return; - if (checkConstraint('rectangle', [xtl, ytl, xbr, ybr])) { + if (checkConstraint('skeleton', [xtl, ytl, xbr, ybr])) { this.onDrawDone({ clientID, shapeType,