Skip to content

Commit

Permalink
enh(stereo): get rid of stereoscopic calibration dialog
Browse files Browse the repository at this point in the history
keep one single import dialog for stereo
  • Loading branch information
bourdaisj committed Apr 23, 2024
1 parent 51a3b81 commit b7c663a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 68 deletions.
8 changes: 3 additions & 5 deletions client/dive-common/apispec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export interface MultiCamImportFolderArgs {
sourcePath: string;
trackFile: string;
}>; // path/track file per camera
calibrationFile?: string; // NPZ calibation matrix file
stereoConfigurationFile?: string; // kwiver *.conf file
calibrationFile?: string; // NPZ calibation matrix file or kwivier *.conf file
type: 'image-sequence' | 'video';
}

Expand All @@ -93,8 +92,7 @@ export interface MultiCamImportKeywordArgs {
glob: string;
trackFile: string;
}>; // glob pattern for base folder
calibrationFile?: string; // NPZ calibation matrix file
stereoConfigurationFile?: string; // kwiver *.conf file
calibrationFile?: string; // NPZ calibation matrix file or kwiver *.conf file
type: 'image-sequence'; // Always image-sequence type for glob matching
}

Expand Down Expand Up @@ -139,7 +137,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>;
calibrationFile?: Readonly<string>;
}

interface Api {
Expand Down
12 changes: 0 additions & 12 deletions client/dive-common/components/ImportButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,6 @@ export default defineComponent({
</v-list-item-content>
</v-list-item>

<v-list-item
v-if="openType === 'image-sequence'"
style="align-items':'center"
@click="$emit('multi-cam', { stereo: true, openType, calibration: true })"
>
<v-list-item-icon>
<v-icon>mdi-binoculars</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Stereoscopic Calibration</v-list-item-title>
</v-list-item-content>
</v-list-item>

<v-list-item
style="align-items':'center"
Expand Down
37 changes: 2 additions & 35 deletions client/dive-common/components/ImportMultiCamDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default defineComponent({
const pendingImportPayloads: Ref<Record<string, MediaImportResponse | null>> = ref({});
const globList: Ref<Record<string, { glob: string; trackFile: string}>> = ref({});
const calibrationFile = ref('');
const stereoConfigurationFile = ref('');
const defaultDisplay = ref('left');
const importAnnotationFilesCheck = ref(false);
const { error: importError, request: importRequest } = useRequest();
Expand Down Expand Up @@ -199,8 +198,6 @@ export default defineComponent({
const path = ret.filePaths[0];
if (folder === 'calibration') {
calibrationFile.value = path;
} else if (folder === 'stereoConfiguration') {
stereoConfigurationFile.value = path;
} else if (importType.value === 'multi') {
if (ret.root) {
folderList.value[folder].sourcePath = ret.root;
Expand Down Expand Up @@ -253,10 +250,6 @@ export default defineComponent({
calibrationFile: calibrationFile.value,
type: props.dataType,
};
if (props.calibration) {
delete args.calibrationFile;
args.stereoConfigurationFile = stereoConfigurationFile.value;
}
emit('begin-multicam-import', args);
} else if (importType.value === 'keyword') {
Expand Down Expand Up @@ -284,7 +277,7 @@ export default defineComponent({
defaultDisplay,
displayKeys,
importAnnotationFilesCheck,
stereoConfigurationFile,
// stereoConfigurationFile,
//Methods
open,
prepForImport,
Expand Down Expand Up @@ -479,32 +472,6 @@ export default defineComponent({
</v-icon>
</v-btn>
</v-row>

<v-row
v-else-if="stereo && calibration"
no-gutters
class="align-center"
>
<v-text-field
label="Stereoscopic Configuration File:"
placeholder="Choose File"
disabled
outlined
dense
hide-details
:value="stereoConfigurationFile"
class="mr-3"
/>
<v-btn
color="primary"
@click="open('stereoConfiguration', 'stereoConfiguration')"
>
Open Stereoscopic Configuration
<v-icon class="ml-2">
mdi-matrix
</v-icon>
</v-btn>
</v-row>
</div>
</div>

Expand All @@ -531,7 +498,7 @@ export default defineComponent({
</v-btn>
<v-btn
color="primary"
:disabled="!nextSteps || (stereo && (!calibrationFile && !stereoConfigurationFile))"
:disabled="!nextSteps || (stereo && (!calibrationFile))"
@click="prepForImport"
>
Begin Import
Expand Down
4 changes: 2 additions & 2 deletions client/dive-common/components/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export default defineComponent({
context.resetActive();
const meta = await loadMetadata(datasetId.value);

isStereoConfigMode.value = meta.stereoConfigurationFile != null;
isStereoConfigMode.value = meta.calibrationFile != null;

const defaultCameraMeta = meta.multiCamMedia?.cameras[meta.multiCamMedia.defaultDisplay];
baseMulticamDatasetId.value = datasetId.value;
Expand Down Expand Up @@ -741,7 +741,7 @@ export default defineComponent({
});
}

if (meta.stereoConfigurationFile) {
if (meta.calibrationFile) {
context.register({
component: TrackViewerSettings,
description: 'Track Viewer Settings',
Expand Down
9 changes: 1 addition & 8 deletions client/platform/desktop/backend/native/multiCamImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ async function beginMultiCamImport(args: MultiCamImportArgs): Promise<DesktopMed
calibration: args.calibrationFile,
defaultDisplay: args.defaultDisplay,
},
stereoConfigurationFile: args.stereoConfigurationFile,
subType: null,
};

Expand Down Expand Up @@ -177,9 +176,6 @@ async function beginMultiCamImport(args: MultiCamImportArgs): Promise<DesktopMed
cameras[cameraName].imageListPath = jsonMeta.originalBasePath;
cameras[cameraName].originalBasePath = '';
}
if (args.stereoConfigurationFile) {
cameras[cameraName].stereoConfigurationFile = args.stereoConfigurationFile;
}
});
} else if (isKeywordArgs(args)) {
jsonMeta.originalBasePath = args.sourcePath;
Expand All @@ -194,9 +190,6 @@ async function beginMultiCamImport(args: MultiCamImportArgs): Promise<DesktopMed
cameras[cameraName].imageListPath = jsonMeta.originalBasePath;
cameras[cameraName].originalBasePath = '';
}
if (args.stereoConfigurationFile) {
cameras[cameraName].stereoConfigurationFile = args.stereoConfigurationFile;
}
});
}
} else {
Expand All @@ -205,7 +198,7 @@ async function beginMultiCamImport(args: MultiCamImportArgs): Promise<DesktopMed

if (jsonMeta.multiCam?.cameras && jsonMeta.multiCam.cameras.left
&& jsonMeta.multiCam.cameras.right && (
jsonMeta.multiCam.calibration || jsonMeta.stereoConfigurationFile
jsonMeta.multiCam.calibration
)) {
jsonMeta.subType = 'stereo';
} else if (jsonMeta.multiCam) {
Expand Down
4 changes: 2 additions & 2 deletions client/platform/desktop/backend/native/viame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ async function runPipeline(
throw new Error('Attempting to run a multicam pipeline on non multicam data');
}

if (meta.stereoConfigurationFile) {
command.push(`-c "${meta.stereoConfigurationFile}"`);
if (meta.calibrationFile) {
command.push(`-c "${meta.calibrationFile}"`);

if (meta.multiCam) {
// eslint-disable-next-line no-restricted-syntax
Expand Down
4 changes: 2 additions & 2 deletions client/platform/desktop/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface Camera {
transcodedImageFiles: string[];
transcodedVideoFile: string;
imageListPath?: string;
stereoConfigurationFile?: string;
calibrationFile?: string;
}

export interface MultiCamDesktop {
Expand Down Expand Up @@ -122,7 +122,7 @@ export interface JsonMeta extends DatasetMetaMutable {
// Stereo or multi-camera datasets with uniform type (all images, all video)
subType: SubType;

stereoConfigurationFile?: string; // kwiver *.conf file
calibrationFile?: string; // kwiver *.conf file or *.npz
}

export type DesktopMetadata = DatasetMeta & JsonMeta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineComponent({
}
// Set default attributes for a stereo calibration configuration
if (argCopy.value.jsonMeta.stereoConfigurationFile) {
if (argCopy.value.jsonMeta.multiCam.calibration) {
argCopy.value.jsonMeta.attributes = {};
// Create x, y, z attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/UI-Attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Attributes are part of the dataset configuration that can be imported and export
## Reserved Attribute Names

Using certain import mode, attributes definitions might be created automatically. This is documented in this section.
- When importing using 'Stereoscopic Calibration' mode, the `stereo3d_x`, `stereo3d_y` and `stereo3d_z` detection attributes definitions will be created automatically.
- When importing using 'Stereoscopic' mode, the `stereo3d_x`, `stereo3d_y` and `stereo3d_z` detection attributes definitions will be created automatically.
They holds the 3d location of a detected fish and are used in the Track 3D Viewer.

## Applying Attributes Demo
Expand Down

0 comments on commit b7c663a

Please sign in to comment.