Skip to content

Commit 8d6ad95

Browse files
authored
Merge branch 'develop' into bs/fixed_implicit_change
2 parents 743a0ad + 95d3108 commit 8d6ad95

File tree

10 files changed

+42
-35
lines changed

10 files changed

+42
-35
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Setup Node
4343
uses: actions/setup-node@v4
4444
with:
45-
node-version: '18.x'
45+
node-version: '22.x'
4646

4747
- name: Install npm packages
4848
working-directory: ./site

.github/workflows/eslint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: actions/setup-node@v4
99
with:
10-
node-version: '16.x'
10+
node-version: '22.x'
1111

1212
- name: Install dependencies
1313
run: |

.github/workflows/full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ jobs:
256256

257257
- uses: actions/setup-node@v4
258258
with:
259-
node-version: '16.x'
259+
node-version: '22.x'
260260

261261
- name: Download CVAT server image
262262
uses: actions/download-artifact@v4

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ jobs:
280280

281281
- uses: actions/setup-node@v4
282282
with:
283-
node-version: '18.x'
283+
node-version: '22.x'
284284

285285
- name: Download CVAT server image
286286
uses: actions/download-artifact@v4

.github/workflows/remark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: actions/setup-node@v4
99
with:
10-
node-version: '16.x'
10+
node-version: '22.x'
1111

1212
- name: Run checks
1313
run: |

.github/workflows/schedule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180

181181
- uses: actions/setup-node@v4
182182
with:
183-
node-version: '16.x'
183+
node-version: '22.x'
184184

185185
- name: Download CVAT server image
186186
uses: actions/download-artifact@v4

.github/workflows/stylelint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: actions/setup-node@v4
99
with:
10-
node-version: '16.x'
10+
node-version: '22.x'
1111

1212
- name: Install dependencies
1313
run: |

.github/workflows/update-yarn-lock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: actions/setup-node@v4
2020
with:
21-
node-version: '16.x'
21+
node-version: '22.x'
2222

2323
- name: Update yarn.lock file
2424
run: yarn
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Changed
2+
3+
- Updated limitation for minimal object size from 9px area to 1px in dimensions
4+
(<https://github.com/cvat-ai/cvat/pull/9055>)

cvat-core/src/object-utils.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,45 +67,48 @@ export function findAngleDiff(rightAngle: number, leftAngle: number): number {
6767
}
6868

6969
export function checkShapeArea(shapeType: ShapeType, points: number[]): boolean {
70-
const MIN_SHAPE_LENGTH = 3;
71-
const MIN_SHAPE_AREA = 9;
72-
const MIN_MASK_SHAPE_AREA = 1;
70+
const MIN_SHAPE_SIZE = 1;
7371

7472
if (shapeType === ShapeType.POINTS) {
7573
return true;
7674
}
7775

76+
let width = 0;
77+
let height = 0;
78+
7879
if (shapeType === ShapeType.MASK) {
7980
const [left, top, right, bottom] = points.slice(-4);
80-
const area = (right - left + 1) * (bottom - top + 1);
81-
return area >= MIN_MASK_SHAPE_AREA;
82-
}
83-
84-
if (shapeType === ShapeType.ELLIPSE) {
81+
[width, height] = [right - left + 1, bottom - top + 1];
82+
} else if (shapeType === ShapeType.RECTANGLE) {
83+
const [xtl, ytl, xbr, ybr] = points;
84+
[width, height] = [xbr - xtl, ybr - ytl];
85+
} else if (shapeType === ShapeType.ELLIPSE) {
8586
const [cx, cy, rightX, topY] = points;
86-
const [rx, ry] = [rightX - cx, cy - topY];
87-
return rx * ry * Math.PI > MIN_SHAPE_AREA;
88-
}
89-
90-
let xmin = Number.MAX_SAFE_INTEGER;
91-
let xmax = Number.MIN_SAFE_INTEGER;
92-
let ymin = Number.MAX_SAFE_INTEGER;
93-
let ymax = Number.MIN_SAFE_INTEGER;
87+
[width, height] = [(rightX - cx) * 2, (cy - topY) * 2];
88+
} else {
89+
// polygon, polyline, cuboid, skeleton
90+
let xmin = Number.MAX_SAFE_INTEGER;
91+
let xmax = Number.MIN_SAFE_INTEGER;
92+
let ymin = Number.MAX_SAFE_INTEGER;
93+
let ymax = Number.MIN_SAFE_INTEGER;
94+
95+
for (let i = 0; i < points.length - 1; i += 2) {
96+
xmin = Math.min(xmin, points[i]);
97+
xmax = Math.max(xmax, points[i]);
98+
ymin = Math.min(ymin, points[i + 1]);
99+
ymax = Math.max(ymax, points[i + 1]);
100+
}
94101

95-
for (let i = 0; i < points.length - 1; i += 2) {
96-
xmin = Math.min(xmin, points[i]);
97-
xmax = Math.max(xmax, points[i]);
98-
ymin = Math.min(ymin, points[i + 1]);
99-
ymax = Math.max(ymax, points[i + 1]);
100-
}
102+
if (shapeType === ShapeType.POLYLINE) {
103+
// horizontal / vertical lines have one of dimensions equal to zero
104+
const length = Math.max(xmax - xmin, ymax - ymin);
105+
return length >= MIN_SHAPE_SIZE;
106+
}
101107

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

107-
const area = (xmax - xmin) * (ymax - ymin);
108-
return area >= MIN_SHAPE_AREA;
111+
return width >= MIN_SHAPE_SIZE && height >= MIN_SHAPE_SIZE;
109112
}
110113

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

0 commit comments

Comments
 (0)