This repository stores the MATLAB implementation of the method described in
Variational Simultaneous Stereo Matching and Defogging in Low Visibility
Yining (Ted) Ding, Andrew Wallace and Sen Wang
In BMVC, 2022
If you find our work useful in your research please consider citing our paper:
@inproceedings{ding2022variational,
title = {Variational Simultaneous Stereo Matching and Defogging in Low Visibility},
author = {Ding, Yining and Wallace, Andrew and Wang, Sen},
booktitle = {BMVC},
year = {2022}
}
The code was lastly tested in MATLAB R2022a on a laptop (running Ubuntu 22.04) equiped with a dedicated NVIDIA GPU that is supported by MATLAB. Please check MATLAB's GPU Computing Requirements.
├── classes
├── data/pad
├── util
└── demo.m
classesstores various MATLAB class definitions.data/padis to store the data needed (see Prepare data).utilstores various MATLAB functions.demo.mis a MATLAB script that you are able to run to test our method on a sample scene.
- Download the Pixel Accurate Depth Benchmark and unzip it.
- Unzip the following:
intermetric_rgb_left.zip,rgb_left_8bit.zipandrgb_right_8bit.zip. You can unzip others but only these three are needed by our code. - Copy directories
intermetric_rgb_left(dense ground truth depth data),rgb_left_8bit(left intensity images) andrgb_right_8bit(right intensity images), and paste them todata/pad. - Load each
.npzfile indata/pad/intermetric_rgb_leftand save it as a.matfile which can be loaded in MATLAB. The python code below should do the job. You can then manually delete all.npzfiles if you wish.
import os
import glob
import numpy as np
from scipy.io import savemat
npz_files = glob.glob("data/pad/intermetric_rgb_left/*.npz") # you may need to adjust this path
for npz_file in npz_files:
mat_file = os.path.splitext(npz_file)[0] + '.mat'
data = np.load(npz_file)
savemat(mat_file, data)
print(f'generated {mat_file} from {npz_file}')Simply run demo.m.
This will apply our method to a sample scene.
In your MATLAB workspace you will find variables including a dense disparity map, a defogged intensity image and various metrics.
You can try out other scenes, samples and visibilites.
Some of the code is replicated or adapted from the following repositories. We thank the authors for making their code open source.
fog_simulation-SFSU_synthetic by Christos Sakaridis
non-local-dehazing by Dana Berman
tofmark by David Ferstl
PixelAccurateDepthBenchmark by Tobias Gruber
