Implementing Depth Refocusing and Aperture Adjustment
This project implements key light field camera capabilities using multiple images taken from different viewpoints. Based on Ng et al.'s work, we demonstrate how simple operations like shifting and averaging can achieve complex photographic effects such as post-capture refocusing and aperture adjustment.
The depth refocusing implementation leverages the principle that distant objects show minimal position changes across different viewpoints, while nearby objects exhibit significant shifts. By applying appropriate shifts before averaging, we can focus on objects at different depths.
The aperture adjustment simulates different lens apertures by controlling how many viewpoints contribute to the final image. Larger apertures use more viewpoints, creating stronger depth-of-field effects.
Implementing Poisson Blending and Mixed Gradients
Gradient-domain processing enables seamless blending of objects between images by preserving gradient information while allowing intensity adjustments. This technique creates natural-looking composites by solving a series of optimization problems that maintain local image structure while eliminating visible seams.
I implement a gradient reconstruction system that recovers an image from its x and y gradients plus a single intensity value. The system solves a least squares problem by constructing sparse matrices that represent gradient constraints. For each pixel, I minimize (v(x+1,y)-v(x,y) - (s(x+1,y)-s(x,y)))² for x-gradients and (v(x,y+1)-v(x,y) - (s(x,y+1)-s(x,y)))² for y-gradients, plus an anchor constraint v(1,1)=s(1,1) to fix the absolute intensities.
I implement Poisson blending by solving for pixel values that preserve gradients from the source image while matching the boundary conditions of the target image. The system uses sparse matrices to efficiently solve the optimization problem. For each pixel i in the source region and its neighbors j, I minimize (v_i - v_j - (s_i - s_j))² when j is also in the source region, and (v_i - t_j - (s_i - s_j))² when j is in the target region.
I improved the basic Poisson blending by implementing mixed gradients, where instead of always using source gradients, I select the gradient with larger magnitude between source and target. This preserves strong edges from both images, leading to better preservation of high-frequency details. For each pixel pair (i,j), I compare |s_i - s_j| with |t_i - t_j| and use the larger gradient in the optimization.