Assignment
Write a Java application program whose main method is in the file named EDoF.java that computes an extended depth of field image.
Normal images have a limited depth of field. Extended depth of field is an approach in which a stack of images captured at different focal settings are combined to reconstruct an image that is (ideally) sharp everywhere. This method is related to the depth from focus technique covered in the module.
From a given stack compute the extended depth of field image using the Laplacian pyramid approach described in this paper (note the typos in equation 7): “Pyramid methods in image processing”, Adelson, E. H., Anderson, C. H., Bergen, J. R., Burt, P. J., Ogden, J. M., RCA Engineer, 29(6), pp. 33-41, 1984.
This involves the following steps:
1. Construct a Gaussian pyramid for each image in the stack – use this simple approach: at each level decimate the image by taking the average (boxcar filter) of a 2 × 2 window. The widths and heights of images in the Gaussian pyramid reduce by a half at each level.
2. Construct the Laplacian pyramid for each image in the stack (use bilinear interpolation for the upsampling).
3. Combine the Laplacian pyramids into a single Laplacian pyramid by taking the maximum magnitude responses.
4. Reconstruct the EDoF image from the merged Laplacian pyramid.
Each image will be a grayscale image in the PGM format, and the maximum number of images in the stack will be 40.
This basic version of EDoF.java must take one command line argument which is the name of the file containing the newline separated filenames of the input stack of PGM images (there is no naming convention for these filenames, but they will be ordered according to the focal settings).
EDoF.java outputs the following images with the following filenames:
• first.pgm – The first image in the stack.
• pyramidGaussian.pgm – The Gaussian pyramid constructed from the first image in the stack – display the pyramid as a single tiled image with the levels translated horizontally (see the Sample Outputs at the end for examples).
• mean.pgm – Constructed by averaging the bottom (coarsest) images in the Gaussian pyramid from all the images in the stack.
• pyramidLaplacian.pgm – The Laplacian pyramid constructed from the first image in the stack – display the pyramid as a single tiled image with the levels translated horizon- tally. Sinec the Laplacian is a signed value you should rescale the output intensities to the full range 0–255.
• pyramidLaplacianMax.pgm – The final Laplacian pyramid constructed by combining the stack of Laplacian pyramids.
• edof.pgm – The extended depth of field result.
See the last page for examples of applying EDoF.java
Extend the above extended depth of field scheme. There are many possibilities, and some
examples are given below. You can also get some inspiration from the paper: “A novel method for multi-focus image fusion”, Bilcu, R. C., Alenius, S., Vehvilainen, M., ICIP, pp. 1525-1528, 2009. Note that for full marks a non trivial extension needs to be provided.
• Alternative schemes for combining the stack of Laplacian pyramids.
• Add an additional step to attempt to improve the spatial consistency of the above com- bination step.
• Extend the scheme to process colour images (and not just process the RGB channels independently!).
• Alternative decimation schemes (e.g. more levels in the pyramids).
• Pre-processing the image stack to improve the quality.
Note (applying to the above tasks):
1. This assignment does not involve writing a GUI.
2. Apart from the image I/O code that I provide you should write all the code yourself. E.g. do not use Java’s built-in image processing classes or use third-party libraries.
3. Some test images are provided for you on Learning Central to help develop and test your program.
4. NOTE: I will perform extensive tests on your program, using more than just the test data I have provided.
You must supply a report on your submission which provides a short written description (1–2 pages of text; plus diagrams, screenshots etc.) conveying all the appropriate information to demonstrate its operation and explaining your extension of the basic algorithm. Include your student number in the report. (10% weight)
Learning Outcomes Assessed
• Be aware of the applications of computer vision.
• Understand the technical details of a range of techniques for image manipulation.
Criteria for assessment
Credit will be awarded according to the correct functioning of the following components of the code.
1. 10% – reading image stack and outputting first image
2. 20% – computing the Gaussian pyramids and displaying the tiled image 3. 10% – computing the mean of the bottoms of the Gaussian pyramids
4. 10% – computing Laplacian pyramids
5. 10% – combining the stack of Laplacian pyramids
6. 10% – reconstruction from the Laplacian pyramid
7. 20% – Extended EDoF scheme
8. 10% – Report.
Sample Outputs
Results from % java EDoF filenames
Figure 1: first.pgm and mean.pgm (shown zoomed)
Figure 2: pyramidGaussian.pgm
Figure 3: pyramidLaplacian.pgm
Figure 4: pyramidLaplacianMax.pgm
Figure 5: edof.p