Skip to main content

Nearest neighbor interpolation for disparity images with missing parts.

Project description

Python 3.7 Python 3.8 Python 3.9 License: MIT Linux CI

Fast nearest-neighbor interpolation of disparity maps using Cython

Some stereo matching methods such as Semi-Global Matching (SGM) might provide sparse disparity maps, meaning that some pixels will not have valid disparity values. In those cases, an interpolation of the predicted disparity map might be needed for evaluation against semi-dense ground-truth, as in the KITTI Stereo 2015 benchmark.

Usage example:

import disparity_interpolation


def interpolate_disparity(disparity_map: np.array) -> np.array:
    """Intepolate disparity image to inpaint holes.
       The expected run time for a stereo image with 2056 × 2464 pixels is ~50 ms.
    """
    # Set the invalid disparity values defined as "0" to -1.
    disparity_map[disparity_map == 0] = -1
    disparity_map_interp = disparity_interpolation.disparity_interpolator(disparity_map)

    return disparity_map_interp

Project details


Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page