Skip to content

Middlebury Datasets

Simon Fuhrmann edited this page Oct 30, 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?

    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]} ${line[11]} ${line[12]} ${line[13]} ${line[14]} ${line[15]} ${line[16]} ${line[17]} ${line[18]}" >> $metafile;
    echo "translation = ${line[19]} ${line[20]} ${line[21]}" >> $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.