<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Pablo,<br>
<br>
I will answer your questions in two separate emails.<br>
This one is about increasing depth of focus.<br>
<br>
Pablo d'Angelo wrote:<br>
<blockquote type="cite" cite="mid20040503063922.GA2719@svalbart">
<blockquote type="cite">
<pre wrap="">2. I do macro photography (insects at 1-10X on the film),
so I am interested in montaging for extended depth of focus.
</pre>
</blockquote>
<pre wrap=""><!---->
Sounds interesting, but I haven't completely understood your application.
So you're registring the images, and place the masks based on a focus
estimate for each pixel? How do you estimate the focus?
</pre>
</blockquote>
Yes, register first, then construct masks that expose the layer having<br>
the best focus at each pixel. I do not attempt to estimate focus,<br>
only compare it. That is, I do not ask "how out of focus is this<br>
image?", but only "which image has the best focus (at this pixel<br>
position)?" I think the algorithm is not critical. Right now I use<br>
just variance in pixel values in small neighborhood. One pass<br>
over the images accumulates maximum variance and records the<br>
image at which it occurs. This works well in areas where some<br>
image has good focus. In background areas where no image has<br>
good focus, this simple approach falls down because it systematically<br>
selects the image with highest noise. To attack that problem,<br>
without doing too much damage in well-focused areas, it helps<br>
to run a smoothing filter on the depth image. It also helps to<br>
feather the masks based on averaged depth. No doubt more<br>
sophisticated algorithms can do a better job, but I have the<br>
impression that final image quality is determined much more by<br>
source image quality & coverage than by algorithm. I would<br>
rather be faced with selecting a sharp image (from among many)<br>
than fixing up a blurred one (the best of a few).<br>
<br>
--Rik<br>
<blockquote type="cite" cite="mid20040503063922.GA2719@svalbart">
<pre wrap="">
I know that some depth from defocus algorithms try to estimate the space
variant PSF, that leads to the blurring, and try to reconstruct depth from
it. Some algorithms can create superresolution images with less blur during
this step as well.
</pre>
<pre wrap="">
</pre>
</blockquote>
</body>
</html>