Grid Sampling¶
To process equirectangular images quickly, equilib relies on grid sampling
techniques. The goal of the project is to minimize external dependencies and
take advantage of cuda and batch processing with torch for fast processing.
The library implements a variety of methods in numpy and torch:
- For
torch, the built-intorch.nn.functional.grid_sampleis fast and reliable. A pure-torchimplementation is also provided and is highly customizable (though not necessarily as fast as the native function). - For
numpy, the implementations are faster thanscipyand more robust thancv2.remap, and are just as customizable as thetorchversion.
It is also possible to pass scipy.ndimage.map_coordinates or cv2.remap as
the sampling function via the override_func argument of grid_sample.
Notes¶
- By default, the
numpybackend uses the pure-numpyimplementation. Override it withscipyorcv2viaoverride_func. - By default, the
torchbackend uses the officialgrid_sample. - Benchmarking scripts live under
benchmarks/. For example,benchmarks/equi2pers/numpy_run_baselines.pybenchmarks thenumpyequi2perspath againstscipyandcv2.