balbasty / torch-interpol

High-order spline interpolation in PyTorch
MIT License
62 stars 4 forks source link

Boundary processing of depth maps #8

Closed LogWell closed 1 year ago

LogWell commented 1 year ago

For depth maps, the invalid pixels are usually set to 0. How to handle the boundary of such data during interpolation? image

ps: The primary in rendering is a triangle, so the barycentric interpolation of the triangle and bilinear interpolation may be involved here: mesh formed from image image

balbasty commented 1 year ago

Hi,

If you set extrapolate = True, the boundary condition specified using the bound keyword will be used to fill out-of-bound values. Would that help?

Edit: Maybe I misunderstood your question. Do you mean that you want some values (e.g. 0) to not be used in the interpolation? This code does not handle such cases. You could try to fill these missing values using e.g. the nearest valid value? This would be equivalent to using the boundary condition "nearest" for out-of-bound data.

Cheers Yael