Skip to content

Commit

Permalink
CVAT 3D - Milestone-4 (#2891)
Browse files Browse the repository at this point in the history
* CVAT 3D Annotation - Added initial cuboid placement in all views

* Fixed MACOS issue for upload of zip files

* Fixed camera axis centre issue

* Fixed ESLint import issues

* Fixed context image fit issue and resizing possible on entire grey line between views

* Fixed the multiple interection point issue

* Fixed Naming convention as per SOW

* Trigger notification

* Reverted code to test cypress tests

* Fixed review comments

* Included tooltip and added actions for keys and UIOJKL buttons

* Merged dev code, updated changelog and minor fixes

* Fixed camera positioning issue in Top View

* Reverted kubernetes auto-corrected code

* Reverted kubernetes code

Co-authored-by: cdp <cdp123>
  • Loading branch information
manasars authored Mar 23, 2021
1 parent 4f7b1f9 commit 538bc93
Show file tree
Hide file tree
Showing 19 changed files with 720 additions and 147 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)
- [Backup/Restore guide](cvat/apps/documentation/backup_guide.md) (<https://github.com/openvinotoolkit/cvat/pull/2964>)
- Label deletion from tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/2881>)
- CVAT-3D: Implemented initial cuboid placement in 3D View and select cuboid in Top, Side and Front views
(<https://github.com/openvinotoolkit/cvat/pull/2891>)
- [Market-1501](https://www.aitribune.com/dataset/2018051063) format support (<https://github.com/openvinotoolkit/cvat/pull/2869>)
- Annotations filters UI using react-awesome-query-builder (https://github.com/openvinotoolkit/cvat/issues/1418)

Expand Down
5 changes: 5 additions & 0 deletions cvat-canvas3d/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cvat-canvas3d/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"three": "^0.125.0",
"camera-controls": "^1.25.3"
"@types/three": "^0.125.3",
"camera-controls": "^1.25.3",
"three": "^0.125.0"
}
}
27 changes: 24 additions & 3 deletions cvat-canvas3d/src/typescript/canvas3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

import pjson from '../../package.json';
import { Canvas3dController, Canvas3dControllerImpl } from './canvas3dController';
import { Canvas3dModel, Canvas3dModelImpl, Mode } from './canvas3dModel';
import { Canvas3dView, Canvas3dViewImpl, ViewsDOM } from './canvas3dView';
import {
Canvas3dModel, Canvas3dModelImpl, Mode, DrawData, ViewType, MouseInteraction,
} from './canvas3dModel';
import {
Canvas3dView, Canvas3dViewImpl, ViewsDOM, CAMERA_ACTION,
} from './canvas3dView';
import { Master } from './master';

const Canvas3dVersion = pjson.version;
Expand All @@ -17,6 +21,9 @@ interface Canvas3d {
mode(): Mode;
render(): void;
keyControls(keys: KeyboardEvent): void;
mouseControls(type: string, event: MouseEvent): void;
draw(drawData: DrawData): void;
cancel(): void;
}

class Canvas3dImpl implements Canvas3d {
Expand All @@ -38,10 +45,18 @@ class Canvas3dImpl implements Canvas3d {
this.view.keyControls(keys);
}

public mouseControls(type: MouseInteraction, event: MouseEvent): void {
this.view.mouseControls(type, event);
}

public render(): void {
this.view.render();
}

public draw(drawData: DrawData): void {
this.model.draw(drawData);
}

public setup(frameData: any): void {
this.model.setup(frameData);
}
Expand All @@ -53,6 +68,12 @@ class Canvas3dImpl implements Canvas3d {
public isAbleToChangeFrame(): boolean {
return this.model.isAbleToChangeFrame();
}

public cancel(): void {
this.model.cancel();
}
}

export { Canvas3dImpl as Canvas3d, Canvas3dVersion };
export {
Canvas3dImpl as Canvas3d, Canvas3dVersion, ViewType, MouseInteraction, CAMERA_ACTION,
};
7 changes: 6 additions & 1 deletion cvat-canvas3d/src/typescript/canvas3dController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
//
// SPDX-License-Identifier: MIT

import { Canvas3dModel, Mode } from './canvas3dModel';
import { Canvas3dModel, Mode, DrawData } from './canvas3dModel';

export interface Canvas3dController {
readonly drawData: DrawData;
mode: Mode;
}

Expand All @@ -22,4 +23,8 @@ export class Canvas3dControllerImpl implements Canvas3dController {
public get mode(): Mode {
return this.model.mode;
}

public get drawData(): DrawData {
return this.model.data.drawData;
}
}
29 changes: 29 additions & 0 deletions cvat-canvas3d/src/typescript/canvas3dModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ export enum FrameZoom {
MAX = 10,
}

export enum ViewType {
PERSPECTIVE = 'perspective',
TOP = 'top',
SIDE = 'side',
FRONT = 'front',
}

export enum MouseInteraction {
CLICK = 'click',
DOUBLE_CLICK = 'dblclick',
HOVER = 'hover',
}

export enum UpdateReasons {
IMAGE_CHANGED = 'image_changed',
OBJECTS_UPDATED = 'objects_updated',
Expand Down Expand Up @@ -61,6 +74,8 @@ export interface Canvas3dModel {
data: Canvas3dDataModel;
setup(frameData: any): void;
isAbleToChangeFrame(): boolean;
draw(drawData: DrawData): void;
cancel(): void;
}

export class Canvas3dModelImpl extends MasterImpl implements Canvas3dModel {
Expand Down Expand Up @@ -133,4 +148,18 @@ export class Canvas3dModelImpl extends MasterImpl implements Canvas3dModel {

return !isUnable;
}

public draw(drawData: DrawData): void {
if (drawData.enabled && this.data.drawData.enabled) {
throw new Error('Drawing has been already started');
}
this.data.drawData.enabled = drawData.enabled;
this.data.mode = Mode.DRAW;

this.notify(UpdateReasons.DRAW);
}

public cancel(): void {
this.notify(UpdateReasons.CANCEL);
}
}
Loading

0 comments on commit 538bc93

Please sign in to comment.