This assignment was to combine several images with a varying depth of field, (ie, area of focus) into one image with an extended deth of field.
First, the input images from the provided data set.
Now, the result of extending the depth of field:
As you can see, the depth of field is extended, but we have produced significant artifacts. I hope that eventually I can find a way to eliminate them, but at the moment I'm with out recourse.
For my own dataset, I took a picture of some of my stuffed animals, arranged in my living room. The pathogens are up front, along with one of my candles. A monkey two mysterious lump-like things are on the coffee table, and "My Pet Monster" is way in the back on the couch. I had to reduce the size of these images signficantly from that recorded by my digital camera if I wanted the poor lab computers to finish processing sometime this century. Here are my input images:
What is the result of the operation?
The depth of field is improved, but poor Hapatitis looks like he has glasses! Some of the distortion is caused by camear movement (I really must invest in a good tripod). The rest by flaws in my algorithm. What can I do to improve the results? I have some idea, but unfortunately no more time to try them out right now. I could:
Finally, here is the matlab code that generated these images:
max_depth_of_field.m This takes the images as input, and returns as the result its best attempt at maximizing focus.
o_grad.m This is the functon that produces the mask for each image.