Skip to content

Commit

Permalink
start addressing Bryon's comments
Browse files Browse the repository at this point in the history
- show stereo matching only in multicam mode
- show 3d track viewer toggle only in stereo config mode
- trigger annotator resize on 3d track viewer toggling
- add track viewer settings to right sidebar only in stereo config mode
  • Loading branch information
bourdaisj committed Apr 17, 2024
1 parent 92592d0 commit 11cc2a7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 14 deletions.
1 change: 1 addition & 0 deletions client/dive-common/apispec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ interface DatasetMeta extends DatasetMetaMutable {
originalFps?: Readonly<number>;
subType: Readonly<SubType>; // In future this could have stuff like IR/EO
multiCamMedia: Readonly<MultiCamMedia | null>;
stereoConfigurationFile?: Readonly<string>;
}

interface Api {
Expand Down
10 changes: 8 additions & 2 deletions client/dive-common/components/TrackSettingsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
computed,
} from '@vue/composition-api';
import { clientSettings } from 'dive-common/store/settings';
import { useCameraStore } from '../../src/provides';
export default defineComponent({
name: 'TrackSettingsPanel',
Expand All @@ -30,17 +32,21 @@ export default defineComponent({
interpolate: 'Whether new tracks should have interpolation enabled by default',
continuous: 'Immediately stay in detection creation mode after creating a new track. Hit Esc to exit.',
prompt: 'Prompt user before deleting a track?',
stereoMatching: 'When manually adding detections, control whether to create a mirror feature in other cameras.',
});
const modes = ref(['Track', 'Detection']);
// Add unknown as the default type to the typeList
const typeList = computed(() => ['unknown'].concat(props.allTypes));
const cameraStore = useCameraStore();
const multiCam = ref(cameraStore.camMap.value.size > 1);
return {
clientSettings,
itemHeight,
help,
modes,
typeList,
multiCam,
};
},
});
Expand Down Expand Up @@ -208,7 +214,7 @@ export default defineComponent({
</v-col>
</v-row>

<v-row>
<v-row v-if="multiCam">
<v-col class="py-1">
<v-switch
v-model="
Expand All @@ -235,7 +241,7 @@ export default defineComponent({
mdi-help
</v-icon>
</template>
<span>Help</span>
<span>{{ help.stereoMatching }}</span>
</v-tooltip>
</v-col>
</v-row>
Expand Down
54 changes: 43 additions & 11 deletions client/dive-common/components/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import context from 'dive-common/store/context';
import { MarkChangesPendingFilter, TrackWithContext } from 'vue-media-annotator/BaseFilterControls';
import { EditAnnotationTypes, VisibleAnnotationTypes } from 'vue-media-annotator/layers';
import TrackViewer from 'vue-media-annotator/components/track_3d_viewer/TrackViewer.vue';
import TrackViewerSettings from 'vue-media-annotator/components/track_3d_viewer/TrackViewerSettings.vue';
import TrackViewerSettingsStore from 'vue-media-annotator/components/track_3d_viewer/TrackViewerSettingsStore';
import TrackViewerSettings from 'vue-media-annotator/components/track_3d_viewer/TrackViewerSettings.vue';
import GroupSidebarVue from './GroupSidebar.vue';
import MultiCamToolsVue from './MultiCamTools.vue';
import PrimaryAttributeTrackFilter from './PrimaryAttributeTrackFilter.vue';
Expand Down Expand Up @@ -106,7 +106,8 @@ export default defineComponent({
const { prompt } = usePrompt();
const loadError = ref('');

const tracks3d = ref(false);
const showTrack3dViewer = ref(false);
const isStereoConfigMode = ref(false);

const baseMulticamDatasetId = ref(null as string | null);
const datasetId = toRef(props, 'id');
Expand Down Expand Up @@ -567,6 +568,9 @@ export default defineComponent({
// Close and reset sideBar
context.resetActive();
const meta = await loadMetadata(datasetId.value);

isStereoConfigMode.value = meta.stereoConfigurationFile != null;

const defaultCameraMeta = meta.multiCamMedia?.cameras[meta.multiCamMedia.defaultDisplay];
baseMulticamDatasetId.value = datasetId.value;
if (defaultCameraMeta !== undefined && meta.multiCamMedia) {
Expand All @@ -583,6 +587,8 @@ export default defineComponent({
/* Otherwise, complete loading of the dataset */
trackStyleManager.populateTypeStyles(meta.customTypeStyling);
groupStyleManager.populateTypeStyles(meta.customGroupStyling);


if (meta.customTypeStyling) {
trackFilters.importTypes(Object.keys(meta.customTypeStyling), false);
}
Expand Down Expand Up @@ -733,6 +739,18 @@ export default defineComponent({
component: GroupSidebarVue,
});
}

if (meta.stereoConfigurationFile) {
context.register({
component: TrackViewerSettings,
description: 'Track Viewer Settings',
});
} else {
context.unregister({
component: TrackViewerSettings,
description: 'Track Viewer Settings',
});
}
} catch (err) {
progress.loaded = false;
console.error(err);
Expand Down Expand Up @@ -867,6 +885,12 @@ export default defineComponent({
});
}

// trigger resize of the annotator on track 3d viewer toggling
watch(showTrack3dViewer, async () => {
await nextTick();
onResize();
});

provideAnnotator(
{
annotatorPreferences: toRef(clientSettings, 'annotatorPreferences'),
Expand Down Expand Up @@ -964,7 +988,8 @@ export default defineComponent({
onTrackAdded,
onGeometryAdded,
datasetId,
tracks3d,
showTrack3dViewer,
isStereoConfigMode,
};
},
});
Expand Down Expand Up @@ -1080,12 +1105,19 @@ export default defineComponent({
</template>
</v-select>

<v-btn
color="secondary"
@click="tracks3d = !tracks3d"
>
Toggle 3d
</v-btn>
<template v-if="isStereoConfigMode">
<v-divider
vertical
class="mx-2"
/>

<v-switch
v-model="showTrack3dViewer"
label="Track 3D Viewer"
color="primary"
hide-details
/>
</template>

<v-divider
vertical
Expand Down Expand Up @@ -1192,7 +1224,7 @@ export default defineComponent({
:style="{ 'max-height': `calc(100% - ${controlsHeight}px)` }"
>
<div
v-if="tracks3d"
v-if="showTrack3dViewer"
:style="{ height: '50%', width: '100%', 'flex-basis': '100%' }"
>
<track-viewer :controls-height="controlsHeight" />
Expand All @@ -1202,7 +1234,7 @@ export default defineComponent({
v-for="camera in multiCamList"
:key="camera"
class="d-flex flex-column grow"
:style="tracks3d ? { height: '50%' } : { height: '100%' }"
:style="showTrack3dViewer ? { height: '50%' } : { height: '100%' }"
@mousedown.left="changeCamera(camera, $event)"
@mouseup.right="changeCamera(camera, $event)"
>
Expand Down
2 changes: 1 addition & 1 deletion client/platform/desktop/frontend/components/Recent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { join } from 'path';
import moment from 'moment';
import {
computed, defineComponent, ref, Ref, reactive,
computed, defineComponent, ref, Ref,
} from '@vue/composition-api';
import type { DatasetType, MultiCamImportArgs } from 'dive-common/apispec';
Expand Down

0 comments on commit 11cc2a7

Please sign in to comment.