Disparity-Based View Warping
Warp an image using a disparity map for view synthesis.
To synthesize a novel view at position between two cameras, we shift pixels based on their disparity:
where:
- is the target pixel x-coordinate
- is the disparity at that pixel
- is the interpolation factor (0 = left view, 1 = right view)
- is where to sample from the source image
This "backward warping" approach samples the source image at computed coordinates, avoiding holes in the output.
Example
warp_by_disparity([[1, 2, 3, 4]], [[0, 1, 1, 0]], 1)
[[1, 1, 2, 4]]
- Inputs:
imageis a strip of intensities ;disparitygives each target pixel's horizontal shift, , so the two middle pixels belong to a nearer surface;tmeans we synthesise the full right-hand view. - Math: every output pixel asks where it came from, . Only the column moves; the row stays the same.
- Column 0: , value . Column 1: , value . Column 2: , value . Column 3: , value .
- A fractional goes to the nearest column, and anything left of column 0 or right of column is clamped to the edge.
- Output:
[[1, 1, 2, 4]], same size as the input. Notice that intensity vanishes and appears twice: backward warping never leaves a hole, but it can duplicate or drop source pixels where disparity changes.
Constraints
- image: 2D source image
- disparity: 2D disparity map (same dimensions)
- t: interpolation factor
- Use nearest-neighbor sampling with boundary clamping
- Return warped image