Skip to content

Middlebury Datasets

Nils Moehrle edited this page Nov 3, 2017 · 7 revisions

Wiki HomeMiddlebury Datasets

Middlebury Datasets

Ground Truth Camera Parameters

When working with the Middlebury Datasets, it is important to note that they come with ground truth camera parameters. It is not advisable to run MVE's Structure-from-Motion (SfM) on the dataset if you want to use your results for evaluation on the Middlebury benchmark.

Instead, you should create a scene with the provided ground truth camera parameters. The following script does that. It needs to be executed in the directory with the parameter file and the images.

#! /bin/bash

paramfile=templeR_par.txt
viewid=0;
ignorefirstline=1;
mkdir scene;
mkdir scene/views;
while read -a line; do
    if [[ $ignorefirstline == 1 ]]; then
        ignorefirstline=0;
        continue;
    fi

    image=${line[0]};
    flenx=${line[1]};
    ppx=${line[3]};
    fleny=${line[5]};
    ppy=${line[6]};

    view=view_`printf "%04d" $viewid`.mve;
    metafile=scene/views/$view/meta.ini;

    width=$(identify -format "%w" "$image")> /dev/null;
    height=$(identify -format "%h" "$image")> /dev/null;
    flen=`echo $flenx / $width | bc -l`;
    ppxn=`echo $ppx / $width | bc -l`;
    ppyn=`echo $ppy / $height | bc -l`;
    pa=`echo $fleny / $flenx | bc -l`; # is this correct?

    echo "Processing $image...";
    mkdir scene/views/$view;
    cp $image scene/views/$view/original.png;

    echo "[view]" > $metafile;
    echo "id = $viewid" >> $metafile;
    echo "name = $image" >> $metafile;
    echo "" >> $metafile
    echo "[camera]" >> $metafile;
    echo "focal_length = $flen" >> $metafile;
    echo "pixel_aspect = $pa" >> $metafile;
    echo "principal_point = $ppxn $ppyn" >> $metafile;
    echo "rotation = ${line[@]:10:9}" >> $metafile;
    echo "translation = ${line[@]:19:3}" >> $metafile;

    viewid=$(($viewid+1));
done <$paramfile

Feature Points

The resulting scene does not contain feature points, since SfM was not run. If your algorithm requires SfM features, or you want to use dmrecon for reconstruction, features have to be computed for the scene using the existing camera parameters.

Run the featurerecon application in mve/apps/featurerecon to generate features for a scene with existing camera parameters. Note that this is NOT a smart or efficient application. It will run feature detection, exhaustive matching, track generation and triangulation with simple outlier rejection without a lot of options to customize the process.