Skip to content

Code for optical flow and disparity error calculation and visualization

Notifications You must be signed in to change notification settings

RitikMathur04/Optical-Flow-Disparity

Repository files navigation

Optical-Flow-Disparity-Error-Calculation-and-Visualization

This repository provides a comparison tool for optical flow algorithms by evaluating and visualizing flow error and disparity error based on ground truth values. The code has been implemented in MATLAB which integrates computation, visualization and programming in an easy-to-use way.

Quick Start

To quickly understand the fundamental concepts and implementation, run demo.m which accepts the ground truth and estimated flow and disparity map as inputs for optical flow error and disparity error calculation and display respectively.

Optical Flow Datasets

Refer this review paper on "Evaluation Datasets and Benchmarks for Optical Flow Algorithms: A Review" to select preferable datasets for key implementation of a specific task and training : http://ijcsmc.com/docs/papers/June2020/V9I6202004.pdf

Usage

Flow Demo

flow_read() → loads flow field F from PNG image
flow_visualization → displays the color-map and visualization of optical flow with u and v as inputs to the function (here u and v refers to the horizontal and vertical components of flow field respectively) and outputs uint8 image of cyclic encoding
flow_error → calculates flow error between flow field and ground truth
flow_error_image → displays flow error between flow field and ground truth
flow_write → saves flow field F to png format

Stereo Demo

disp_read() → loads disparity map D from PNG image
stereo_visualization → displays the color-map and visualization of stereo-disparity with disparity (the horizontal component of flow field) as input and outputs uint8 image of cyclic encoding
disp_error → calculates disparity error between input and ground truth
disp_error_image → displays disparity map between input and ground truth
disp_write → saves disparity map D to png format

Example

Read Flow F=flow_read('estimatedflow.png')
Horizontal Flow Component u=F(:,:,1)
Vertical Flow Component v=F(:,:,2)
Flow Visualization [rgbImage1, rgbImage2, rgbImage3] = flow_visualization( u, v, valid, meanU, meanV )
Read Ground Truth Flow G=flow_read('gt.png')
Calculate Flow Error d_err = disp_error (G,F,colorthreshold)
Display Flow Error image(rgbImage1/2/3)

Results

The estimated, ground and error map for disparity and optical flow with calculated error is shown in the images. Disparity Error Flow Error

Support

If you really like this repository and find it useful, please consider (★) starring it and acknowledging, so that it can reach a broader audience of like-minded people. It would be highly appreciated :) !

Author

Ritik Mathur
Email: rmathur@me.iitr.ac.in
UG Electrical Engineering
Indian Institute of Technology Roorkee, Uttarakhand, India

More Information

This project and review paper (http://ijcsmc.com/docs/papers/June2020/V9I6202004.pdf) have been implemented as a part of my internship "Optical Flow Algorithms" at National Tsing Hua University, Taiwan under the supervision of Prof Chung-Chuan Lo,Ph.D., Professor and Director at the Institute of Systems Neuroscience, NTHU, Taiwan (https://scholar.google.com/citations?user=zULxPHYAAAAJ&hl=en)
The main aim of the internship is to code, review and provide a benchmark test for promising optical flow algorithms.
The internship is accomplished in online mode due to COVID-19 travel restrictions and lockdown situation.

About

Code for optical flow and disparity error calculation and visualization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages