Skip to content

Commit

Permalink
Merge branch 'develop' into bs/fixed_implicit_change
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Feb 5, 2025
2 parents 743a0ad + 95d3108 commit 8d6ad95
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.x'

- name: Install npm packages
working-directory: ./site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Download CVAT server image
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.x'

- name: Download CVAT server image
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Run checks
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Download CVAT server image
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-yarn-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'

- name: Update yarn.lock file
run: yarn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Updated limitation for minimal object size from 9px area to 1px in dimensions
(<https://github.com/cvat-ai/cvat/pull/9055>)
57 changes: 30 additions & 27 deletions cvat-core/src/object-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,45 +67,48 @@ export function findAngleDiff(rightAngle: number, leftAngle: number): number {
}

export function checkShapeArea(shapeType: ShapeType, points: number[]): boolean {
const MIN_SHAPE_LENGTH = 3;
const MIN_SHAPE_AREA = 9;
const MIN_MASK_SHAPE_AREA = 1;
const MIN_SHAPE_SIZE = 1;

if (shapeType === ShapeType.POINTS) {
return true;
}

let width = 0;
let height = 0;

if (shapeType === ShapeType.MASK) {
const [left, top, right, bottom] = points.slice(-4);
const area = (right - left + 1) * (bottom - top + 1);
return area >= MIN_MASK_SHAPE_AREA;
}

if (shapeType === ShapeType.ELLIPSE) {
[width, height] = [right - left + 1, bottom - top + 1];
} else if (shapeType === ShapeType.RECTANGLE) {
const [xtl, ytl, xbr, ybr] = points;
[width, height] = [xbr - xtl, ybr - ytl];
} else if (shapeType === ShapeType.ELLIPSE) {
const [cx, cy, rightX, topY] = points;
const [rx, ry] = [rightX - cx, cy - topY];
return rx * ry * Math.PI > MIN_SHAPE_AREA;
}

let xmin = Number.MAX_SAFE_INTEGER;
let xmax = Number.MIN_SAFE_INTEGER;
let ymin = Number.MAX_SAFE_INTEGER;
let ymax = Number.MIN_SAFE_INTEGER;
[width, height] = [(rightX - cx) * 2, (cy - topY) * 2];
} else {
// polygon, polyline, cuboid, skeleton
let xmin = Number.MAX_SAFE_INTEGER;
let xmax = Number.MIN_SAFE_INTEGER;
let ymin = Number.MAX_SAFE_INTEGER;
let ymax = Number.MIN_SAFE_INTEGER;

for (let i = 0; i < points.length - 1; i += 2) {
xmin = Math.min(xmin, points[i]);
xmax = Math.max(xmax, points[i]);
ymin = Math.min(ymin, points[i + 1]);
ymax = Math.max(ymax, points[i + 1]);
}

for (let i = 0; i < points.length - 1; i += 2) {
xmin = Math.min(xmin, points[i]);
xmax = Math.max(xmax, points[i]);
ymin = Math.min(ymin, points[i + 1]);
ymax = Math.max(ymax, points[i + 1]);
}
if (shapeType === ShapeType.POLYLINE) {
// horizontal / vertical lines have one of dimensions equal to zero
const length = Math.max(xmax - xmin, ymax - ymin);
return length >= MIN_SHAPE_SIZE;
}

if (shapeType === ShapeType.POLYLINE) {
const length = Math.max(xmax - xmin, ymax - ymin);
return length >= MIN_SHAPE_LENGTH;
[width, height] = [xmax - xmin, ymax - ymin];
}

const area = (xmax - xmin) * (ymax - ymin);
return area >= MIN_SHAPE_AREA;
return width >= MIN_SHAPE_SIZE && height >= MIN_SHAPE_SIZE;
}

export function rotatePoint(x: number, y: number, angle: number, cx = 0, cy = 0): number[] {
Expand Down

0 comments on commit 8d6ad95

Please sign in to comment.