Image Remap applies a generic geometrical transformation to an image. Typical uses include:
The algorithm can work on dense or sparse warp maps. A dense warp map stores the remapped position of all pixels in the output image, whereas a sparse map stores a subset of that. It's more efficient to process the latter than the former, but quality might decrease depending on how much distortion is applied by the mapping.
The example below shows the famous "Little Planet" (stereographic) projection applied to a equirectangular panorama image, where \(R\) is the planet radius.
Input | Mapping | Result |
---|---|---|
![]() Kyu Shiba Rikyu Garden: on the bridge by heiwa4126 is licensed under CC BY 2.0 | \begin{align*} \theta(x,y) &= \pi + \arctan\left(\frac{y}{x}\right) \\ \phi(x,y) &= \frac{\pi}{2} - 2\arctan\left(\frac{r}{2R}\right) \\ r &= \sqrt{x^2+y^2} \\ \end{align*} | ![]() This image is a derivative of Kyu Shiba Rikyu Garden: on the bridge by heiwa4126, used under CC BY 2.0 |
The algorithm uses a user-provided VPIWarpMap that maps every pixel in the output image to the corresponding pixel in the input image. It supports dense and sparse mappings.
The mapping operation is composed of two steps:
Image Remap supports the following pixel interpolators:
When the corresponding source pixel falls outside image boundary, Image Remap will use the boundary condition to decide what pixel value to pick.
The following boundary conditions are available:
Warp grids can be of 3 types:
When defining a sparse map, the output image can be split into at most 16 regions (4 horizontally and 4 vertically), with different control point interval (density) in each row or column of regions. The interval spacing must be expressed in power-of-two number of pixels in between control points. There are some other restrictions in the grid layout. Please consult VPIWarpGrid for more information.
To define a dense map, simply set up the warp grid to have just one region, and both horizontal and vertical spacing to 1.
For more details, consult the API reference.
Constraints for specific backends supersede the ones specified for all backends.
For further information on how performance was benchmarked, see Performance Measurement.
size | type | interval | interp. | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | nv12 | 1 | nearest | n/a | n/a | 2.880 ms |
1920x1080 | nv12 | 1 | linear | n/a | n/a | 2.882 ms |
1920x1080 | nv12 | 1 | catmull | n/a | n/a | 2.882 ms |
1920x1080 | nv12 | 2 | nearest | n/a | n/a | 0.913 ms |
1920x1080 | nv12 | 2 | linear | n/a | n/a | 0.912 ms |
1920x1080 | nv12 | 2 | catmull | n/a | n/a | 0.914 ms |
1920x1080 | nv12 | 4 | nearest | n/a | n/a | 0.669 ms |
1920x1080 | nv12 | 4 | linear | n/a | n/a | 0.668 ms |
1920x1080 | nv12 | 4 | catmull | n/a | n/a | 0.669 ms |