For this project, we had to use lightfield data from the Stanford Light Field Archive to implement the concepts of depth refocusing and aperture adjustment.
In order to implement the concept of depth refocusing, I used image at 8,8 as the reference center image. After that, I computed the displacement for every sub-aperature image corresponding to the image from the reference center image at 8,8. I then shift the sub-aperture image by the calculated displacement multiplied by a constant C. Once I did this for every sub-aperature image, I averaged all the shifted images into one final output image. We repeat his process 5 more times where each time we vary the C constant within a range of (-1,4). As you can clearly see, a larger C value focuses the image farther from the front, while a smaller C value focuses away from you. Below are the still images and then finally a GIF to show the transition.
c = -1
c = 0
c = 1
c = 2
c = 3
c = 4
Gif of all c values from (-1,4)
In order to implement aperture adjustment, I averaged a subset of the shifted images with varius radia from the center 8,8. So for radius x, I will average all the images from [8-x],[8-x] to [8+x],[8+x]. Ex. if x = 1, I average images 7,7 7,8 7,9 8,7 8,8 8,9 9,7 9,8 9,9. The radius is varied with the following values: 1,2,4, and 8. You can see the still pictures below as well as the final GIF.
r = 1
r = 2
r = 4
r = 8
Gif of all r values