In this project we used lightfield data from Stanford Light Field Archive to refocus images based on depth and mimic different aperture sizes by varying the sample size of images.
Using a data set of a 17x17 grid of images, I could refocus an image by averaging all the photos after shifting them toward the center. I identified the center at (8,8) and used the provided (u,v) coordinates as the center. Then for all the images in the grid I would find the offset of their (u,v) coordinates from the center and shift them by the offset * α. α is a constant that varies the point of focus on the chessboard depending on its value. In my implementation I took the absolute values of the coordinates, so my values of α are probably opposite of expected behavior (in my case, the bigger the α the depth of focus is further away).
|
|
|
|
|
In an image, a smaller aperture (the width of the opening of the lens) creates a larger area of focus. To mimic this effect, I only sample images within a certain radius around the center of the 17x17 grid. Then I would do the same procedure as the previous part (using α = .05) on that sample to create the effect.
|
|
|
|