- Obtain an image-stack, by shooting N pictures, varying only the focus of the camera
- For each pixel (x, y), detirmine which of the N
images has the pixel in sharpest focus
*Measure 1:*Variance of image intensity over a neighborhood of*k*surrounding pixels*Measure 2:*Tenengrad Method - Sum of the intensity gradient over a neighborhood of*k*surrounding pixels (see Sobel kernels)

- Combine the sharpest pixels over all (x, y) to create an image with infinite depth of field

- Matlab code (zip)

- Input images were resized to 0.5x of their original dimensions (number of pixels changes by 0.25x), due to memory constraints
- Camera mount had a bit of flex, leading to potentional movement during manual re-focusing. This camera jitter could account for the apparent ghosting in the output images

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29

- Images on the left are the infinite DOF composites
- Images on the right are visualizations of which image in the stack is most in focus in a region. Light regions indicate "close", while dark regions indcate "far"
- Click for a full sized image

**Tenengrad Focus Measures**

Tenegrad Focus
Measure, Neighborhood *k* = 5

Tenegrad Focus Measure,
Neighborhood *k* = 10

Tenegrad
Focus Measure,Neighborhood *k* = 15

Tenegrad Focus Measure,
Neighborhood *k* = 20

Tenegrad Focus Measure,
Neighborhood *k* = 25

Tenegrad
Focus Measure,Neighborhood *k* = 30

Tenegrad Focus
Measure, Neighborhood *k* = 40

Tenegrad Focus Measure, Neighborhood
*k* = 50

**Variance Focus Measures**

Variance Focus Measure,**
**Neighborhood
*k* = 2

Variance Focus Measure,**
**Neighborhood
*k* = 4

Variance Focus Measure,**
**Neighborhood
*k* = 6

Variance Focus Measure,**
**Neighborhood
*k* = 8

Variance Focus Measure,**
**Neighborhood
*k* = 10

Variance Focus Measure,**
**Neighborhood
*k* = 13

Variance Focus Measure,**
**Neighborhood
*k* = 16

Variance Focus Measure,**
**Neighborhood
*k* = 19

Variance Focus Measure,**
**Neighborhood
*k* = 25

Variance Focus Measure,**
**Neighborhood
*k* = 30