Skip to content

Commit f74a496

Browse files
CVAT 3D Milestone-5 (cvat-ai#3079)
3D bounding box manipulation: side view, top view, front view surrounding the object. Allow user to place 3D bounding boxes & tag labels on specific area using point cloud. Co-authored-by: cdp <cdp123> Co-authored-by: Jayraj <[email protected]>
1 parent 11d967d commit f74a496

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2868
-520
lines changed

.github/workflows/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ jobs:
168168
npx cypress run --headless --browser chrome --spec 'cypress/integration/${{ matrix.specs }}/**/*.js'
169169
mv ./.nyc_output/out.json ./.nyc_output/out_${{ matrix.specs }}.json
170170
else
171-
npx cypress run --headless --browser chrome --env coverage=false --spec 'cypress/integration/${{ matrix.specs }}/**/*.js'
171+
if [[ ${{ matrix.specs }} != 'canvas3d_functionality' ]]; then
172+
npx cypress run --headless --browser chrome --env coverage=false --spec 'cypress/integration/${{ matrix.specs }}/**/*.js'
173+
else
174+
npx cypress run --browser chrome --env coverage=false --spec 'cypress/integration/${{ matrix.specs }}/**/*.js'
175+
fi
172176
fi
173177
- name: Creating a log file from "cvat" container logs
174178
if: failure()

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Other ways to ask questions and get our support:
164164
vision AI platform that fully integrates CVAT with scalable data processing
165165
and parallelized training pipelines.
166166
- [DataIsKey](https://dataiskey.eu/annotation-tool/) uses CVAT as their prime data labeling tool
167-
to offer annotation services for projects of any size.
167+
to offer annotation services for projects of any size.
168168

169169
<!-- prettier-ignore-start -->
170170
<!-- Badges -->

cvat-canvas3d/README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,20 @@ npm run build -- --mode=development # without a minification
2626

2727
```ts
2828
interface Canvas3d {
29-
html(): HTMLDivElement;
30-
setup(frameData: any): void;
31-
mode(): Mode;
29+
html(): ViewsDOM;
30+
setup(frameData: any, objectStates: any[]): void;
3231
isAbleToChangeFrame(): boolean;
32+
mode(): Mode;
3333
render(): void;
34+
keyControls(keys: KeyboardEvent): void;
35+
draw(drawData: DrawData): void;
36+
cancel(): void;
37+
dragCanvas(enable: boolean): void;
38+
activate(clientID: number | null, attributeID?: number): void;
39+
configureShapes(shapeProperties: ShapeProperties): void;
40+
fitCanvas(): void;
41+
fit(): void;
42+
group(groupData: GroupData): void;
3443
}
3544
```
3645

@@ -44,5 +53,9 @@ console.log('Version ', window.canvas.CanvasVersion);
4453
console.log('Current mode is ', window.canvas.mode());
4554

4655
// Put canvas to a html container
47-
htmlContainer.appendChild(canvas.html());
56+
const views = canvas.html();
57+
htmlContainer.appendChild(views.perspective);
58+
htmlContainer.appendChild(views.top);
59+
htmlContainer.appendChild(views.side);
60+
htmlContainer.appendChild(views.front);
4861
```

cvat-canvas3d/src/typescript/canvas3d.ts

+45-13
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,42 @@
55
import pjson from '../../package.json';
66
import { Canvas3dController, Canvas3dControllerImpl } from './canvas3dController';
77
import {
8-
Canvas3dModel, Canvas3dModelImpl, Mode, DrawData, ViewType, MouseInteraction,
8+
Canvas3dModel,
9+
Canvas3dModelImpl,
10+
Mode,
11+
DrawData,
12+
ViewType,
13+
MouseInteraction,
14+
ShapeProperties,
15+
GroupData,
916
} from './canvas3dModel';
1017
import {
11-
Canvas3dView, Canvas3dViewImpl, ViewsDOM, CAMERA_ACTION,
18+
Canvas3dView, Canvas3dViewImpl, ViewsDOM, CameraAction,
1219
} from './canvas3dView';
1320
import { Master } from './master';
1421

1522
const Canvas3dVersion = pjson.version;
1623

1724
interface Canvas3d {
1825
html(): ViewsDOM;
19-
setup(frameData: any): void;
26+
setup(frameData: any, objectStates: any[]): void;
2027
isAbleToChangeFrame(): boolean;
2128
mode(): Mode;
2229
render(): void;
2330
keyControls(keys: KeyboardEvent): void;
24-
mouseControls(type: string, event: MouseEvent): void;
2531
draw(drawData: DrawData): void;
2632
cancel(): void;
33+
dragCanvas(enable: boolean): void;
34+
activate(clientID: number | null, attributeID?: number): void;
35+
configureShapes(shapeProperties: ShapeProperties): void;
36+
fitCanvas(): void;
37+
fit(): void;
38+
group(groupData: GroupData): void;
2739
}
2840

2941
class Canvas3dImpl implements Canvas3d {
30-
private model: Canvas3dModel & Master;
31-
private controller: Canvas3dController;
42+
private readonly model: Canvas3dModel & Master;
43+
private readonly controller: Canvas3dController;
3244
private view: Canvas3dView;
3345

3446
public constructor() {
@@ -45,10 +57,6 @@ class Canvas3dImpl implements Canvas3d {
4557
this.view.keyControls(keys);
4658
}
4759

48-
public mouseControls(type: MouseInteraction, event: MouseEvent): void {
49-
this.view.mouseControls(type, event);
50-
}
51-
5260
public render(): void {
5361
this.view.render();
5462
}
@@ -57,23 +65,47 @@ class Canvas3dImpl implements Canvas3d {
5765
this.model.draw(drawData);
5866
}
5967

60-
public setup(frameData: any): void {
61-
this.model.setup(frameData);
68+
public setup(frameData: any, objectStates: any[]): void {
69+
this.model.setup(frameData, objectStates);
6270
}
6371

6472
public mode(): Mode {
6573
return this.model.mode;
6674
}
6775

76+
public group(groupData: GroupData): void {
77+
this.model.group(groupData);
78+
}
79+
6880
public isAbleToChangeFrame(): boolean {
6981
return this.model.isAbleToChangeFrame();
7082
}
7183

7284
public cancel(): void {
7385
this.model.cancel();
7486
}
87+
88+
public dragCanvas(enable: boolean): void {
89+
this.model.dragCanvas(enable);
90+
}
91+
92+
public configureShapes(shapeProperties: ShapeProperties): void {
93+
this.model.configureShapes(shapeProperties);
94+
}
95+
96+
public activate(clientID: number | null, attributeID: number | null = null): void {
97+
this.model.activate(String(clientID), attributeID);
98+
}
99+
100+
public fit(): void {
101+
this.model.fit();
102+
}
103+
104+
public fitCanvas(): void {
105+
this.model.fit();
106+
}
75107
}
76108

77109
export {
78-
Canvas3dImpl as Canvas3d, Canvas3dVersion, ViewType, MouseInteraction, CAMERA_ACTION,
110+
Canvas3dImpl as Canvas3d, Canvas3dVersion, ViewType, MouseInteraction, CameraAction, ViewsDOM,
79111
};

cvat-canvas3d/src/typescript/canvas3dController.ts

+28-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
//
33
// SPDX-License-Identifier: MIT
44

5-
import { Canvas3dModel, Mode, DrawData } from './canvas3dModel';
5+
import {
6+
Canvas3dModel, Mode, DrawData, ActiveElement, FocusData, GroupData,
7+
} from './canvas3dModel';
68

79
export interface Canvas3dController {
810
readonly drawData: DrawData;
11+
readonly activeElement: ActiveElement;
12+
readonly selected: any;
13+
readonly focused: FocusData;
14+
readonly groupData: GroupData;
915
mode: Mode;
16+
group(groupData: GroupData): void;
1017
}
1118

1219
export class Canvas3dControllerImpl implements Canvas3dController {
@@ -27,4 +34,24 @@ export class Canvas3dControllerImpl implements Canvas3dController {
2734
public get drawData(): DrawData {
2835
return this.model.data.drawData;
2936
}
37+
38+
public get activeElement(): ActiveElement {
39+
return this.model.data.activeElement;
40+
}
41+
42+
public get selected(): any {
43+
return this.model.data.selected;
44+
}
45+
46+
public get focused(): any {
47+
return this.model.data.focusData;
48+
}
49+
50+
public get groupData(): GroupData {
51+
return this.model.groupData;
52+
}
53+
54+
public group(groupData: GroupData): void {
55+
this.model.group(groupData);
56+
}
3057
}

0 commit comments

Comments
 (0)