Forums

"Repairing" an out-of- focus picture

Started by Nitram May 29, 2010
On May 29, 7:54&#2013266080;pm, dbd <d...@ieee.org> wrote:
> On May 29, 1:51&#2013266080;pm, spop...@speedymail.org (Steve Pope) wrote: > > > > ... > > > Yes. &#2013266080;In the simplest case I believe the blur of defocusing is > > like a 2-D sinc function. > > > Steve > > Sinc functions go negative in the first sidelobe. None of my blurred > pictures have negative values.
i don't think it's the sinc() function in the spatial domain, is it? i think it's a rect() function (which is always non-negative) in the 2D spatial domain which is convolved against the sharp image to get the blurry image. the 2D sinc() function is in the "frequency" domain (or the inverse-spatial domain), no? r b-j
On May 29, 6:14&#2013266080;pm, Jerry Avins <j...@ieee.org> wrote:
> On 5/29/2010 3:04 PM, robert bristow-johnson wrote: > > > > > On May 28, 11:52 pm, "Nitram"<morris.vian@n_o_s_p_a_m.gmail.com> > > wrote: > > >> Firstly, I was wondering if it is possible to compensate for a picture > >> taken by an out-of-focus digital camera by doing a 2D deconvolution on it > >> (MMSE filtering or something like that), in order to recover &#2013266080;the in-focus > >> picture > > > my understanding is that the in-focus image is run through a sorta low- > > pass filter in 2D which blurs it. &#2013266080;maybe the 2D deconvolution can be > > run through a compensating high-pass filter, if you knew the > > characteristics of the blurring filter closely. > > >> Secondly, can the optical transfer function between a properly focused > >> picture and an out of focus picture be parameterized in such a way that a > >> user could recover the image by gradually varying that parameter until the > >> image is in focus? &#2013266080;If this is indeed possible, what is that transfer > >> function? (any references to existing literature would be welcome). > > > i really don't know what the LPF characteristics of blurring would be > > if a well-shaped lens in the camera is just moved away from the > > correct focal length. &#2013266080;it seems like i should be able to figure that > > out (as a function of the deviation from the correct focal position) > > but i don't know where to begin to set up the problem. > > It depends in part on the shape of the aperture. A mirror lens makes > donut-shaped "circles" of confusion. With ordinary lenses, you can count > the number of blades in the diaphragm if they're few enough. All of that > is summed up as "bokeh" Seehttp://en.wikipedia.org/wiki/Bokehfor > etymology and more. > > > maybe someone else (like Clay or Glen or some other physiker) would > > know. &#2013266080;you guys, if it's a good lens, just bumped away from the > > correct position by a little, does it change the impulse response (in > > 2D) from an impulse (nice sharp image) to a rect() function? &#2013266080;the > > farther the lens is outa focus, the wider the rect() function? > > deconvolving a rect() function is a sorta bitch because of dividing by > > zero in the frequency domain. > > Not quite. Which is to say, that the point-turned-disc isn't necessarily > illuminated uniformly.
okay, i would like to know how it is, assuming a regular old lens (with spherical surfaces, so the focal length cannot be very tight) and the film surface spaced a little bit away from where it's s'posed to be. r b-j
On 5/29/2010 9:21 PM, robert bristow-johnson wrote:
> On May 29, 6:14 pm, Jerry Avins<j...@ieee.org> wrote: >> On 5/29/2010 3:04 PM, robert bristow-johnson wrote: >> >> >> >>> On May 28, 11:52 pm, "Nitram"<morris.vian@n_o_s_p_a_m.gmail.com> >>> wrote: >> >>>> Firstly, I was wondering if it is possible to compensate for a picture >>>> taken by an out-of-focus digital camera by doing a 2D deconvolution on it >>>> (MMSE filtering or something like that), in order to recover the in-focus >>>> picture >> >>> my understanding is that the in-focus image is run through a sorta low- >>> pass filter in 2D which blurs it. maybe the 2D deconvolution can be >>> run through a compensating high-pass filter, if you knew the >>> characteristics of the blurring filter closely. >> >>>> Secondly, can the optical transfer function between a properly focused >>>> picture and an out of focus picture be parameterized in such a way that a >>>> user could recover the image by gradually varying that parameter until the >>>> image is in focus? If this is indeed possible, what is that transfer >>>> function? (any references to existing literature would be welcome). >> >>> i really don't know what the LPF characteristics of blurring would be >>> if a well-shaped lens in the camera is just moved away from the >>> correct focal length. it seems like i should be able to figure that >>> out (as a function of the deviation from the correct focal position) >>> but i don't know where to begin to set up the problem. >> >> It depends in part on the shape of the aperture. A mirror lens makes >> donut-shaped "circles" of confusion. With ordinary lenses, you can count >> the number of blades in the diaphragm if they're few enough. All of that >> is summed up as "bokeh" Seehttp://en.wikipedia.org/wiki/Bokehfor >> etymology and more. >> >>> maybe someone else (like Clay or Glen or some other physiker) would >>> know. you guys, if it's a good lens, just bumped away from the >>> correct position by a little, does it change the impulse response (in >>> 2D) from an impulse (nice sharp image) to a rect() function? the >>> farther the lens is outa focus, the wider the rect() function? >>> deconvolving a rect() function is a sorta bitch because of dividing by >>> zero in the frequency domain. >> >> Not quite. Which is to say, that the point-turned-disc isn't necessarily >> illuminated uniformly. > > okay, i would like to know how it is, assuming a regular old lens > (with spherical surfaces, so the focal length cannot be very tight) > and the film surface spaced a little bit away from where it's s'posed > to be.
Don't disparage spheres. Properly combined -- part art, part science, like DSP -- they can generate diffraction-limited images at apertures larger than f/4 and fields as large as the focal length. Even a doublet can produce diffraction-limited images over fields useful for telescopes. Did you follow the bokeh link in the message you responded to here? Look at the aperture simulator link at the end to see pow important aperture shape is when deconvolving. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
On May 29, 5:06&#2013266080;pm, spop...@speedymail.org (Steve Pope) wrote:
> dbd &#2013266080;<d...@ieee.org> wrote: > >On May 29, 1:51&#2013266080;pm, spop...@speedymail.org (Steve Pope) wrote: > >> Yes. &#2013266080;In the simplest case I believe the blur of defocusing is > >> like a 2-D sinc function. > >Sinc functions go negative in the first sidelobe. None of my blurred > >pictures have negative values. > > Funny how negative audio sounds just the same as positive audio > too. > > S.
Audio is sensed with microphones with sensors smaller than a wavelength and capable of transducing positive and negative excursions from the average pressure. Photographic image sensors have individual sensors larger than optical wavelengths and produce outputs proportional to photon counts. The counts do not go negative. Run your audio through an AM demodulator and see if the output from the demodulator sounds like the input for your 'positive' and 'negative' audio sounds. Dale B. Dalrymple
On 29 Mai, 05:52, "Nitram" <morris.vian@n_o_s_p_a_m.gmail.com> wrote:
> Hi, > > My question might be simplistic as neither optics nor image processing is > my field. > > Firstly, I was wondering if it is possible to compensate for a picture > taken by an out-of-focus digital camera by doing a 2D deconvolution on it > (MMSE filtering or something like that), in order to recover &#2013266080;the in-focus > picture > > Secondly, can the optical transfer function between a properly focused > picture and an out of focus picture be parameterized in such a way that a > user could recover the image by gradually varying that parameter until the > image is in focus? &#2013266080;If this is indeed possible, what is that transfer > function? (any references to existing literature would be welcome).
The book "Digital Image Processing" (2009) by Gonzalez & Woods treat this problem. One of their approaches start out with a Wiener filter that represents the essentials of the deblurring process. They then continue to suggest an interactive approach based on the Wiener filter where the user interactively plays with certain parameters to produce a deblurred image. Rune
Thank you for all your answers: it looks like I have some reading to do and
try a few algorithms in Matlab to get a better feel for the problem.

Incidentally, I found "Introduction to Fourier Optics", but I'm still
hunting for "Deconvolution of Images and Spectra". With some luck the local
University's library will have it.

Cheers and thanks.

On May 28, 11:52&#2013266080;pm, "Nitram" <morris.vian@n_o_s_p_a_m.gmail.com>
wrote:
> Hi, > > My question might be simplistic as neither optics nor image processing is > my field. > > Firstly, I was wondering if it is possible to compensate for a picture > taken by an out-of-focus digital camera by doing a 2D deconvolution on it > (MMSE filtering or something like that), in order to recover &#2013266080;the in-focus > picture > > Secondly, can the optical transfer function between a properly focused > picture and an out of focus picture be parameterized in such a way that a > user could recover the image by gradually varying that parameter until the > image is in focus? &#2013266080;If this is indeed possible, what is that transfer > function? (any references to existing literature would be welcome). > > Thank you for your help.
I am sorry I was late for this discussion. The answer to this is yes, and the answer to the second is yes. With a technique designated SeDDaRA, the blurred image is compared to a reference image after application of an FFT and the transfer function is derived. The function is converted into a point spread function via an Inverse FFT. Any deconvolution technique can then be used to deblur the image. The process is fast compared to iterative tecniques, and at least as effective. Examples can be found on our website at http://www.quarktet.com/Gallery1.html as well more info about SeDDaRA. Our software program Tria (free-to-try) enables easy application of the method. Best Regards, Jim C
On 5/31/2010 4:42 PM, JimAtQuarktet wrote:
> On May 28, 11:52 pm, "Nitram"<morris.vian@n_o_s_p_a_m.gmail.com> > wrote: >> Hi, >> >> My question might be simplistic as neither optics nor image processing is >> my field. >> >> Firstly, I was wondering if it is possible to compensate for a picture >> taken by an out-of-focus digital camera by doing a 2D deconvolution on it >> (MMSE filtering or something like that), in order to recover the in-focus >> picture >> >> Secondly, can the optical transfer function between a properly focused >> picture and an out of focus picture be parameterized in such a way that a >> user could recover the image by gradually varying that parameter until the >> image is in focus? If this is indeed possible, what is that transfer >> function? (any references to existing literature would be welcome). >> >> Thank you for your help. > > I am sorry I was late for this discussion. The answer to this is yes, > and the answer to the second is yes. With a technique designated > SeDDaRA, the blurred image is compared to a reference image after > application of an FFT and the transfer function is derived. The > function is converted into a point spread function via an Inverse > FFT. Any deconvolution technique can then be used to deblur the > image. The process is fast compared to iterative tecniques, and at > least as effective. Examples can be found on our website at > http://www.quarktet.com/Gallery1.html as well more info about > SeDDaRA. Our software program Tria (free-to-try) enables easy > application of the method.
Where do you get the reference image? Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
On 5/31/2010 4:42 PM, JimAtQuarktet wrote:
> On May 28, 11:52 pm, "Nitram"<morris.vian@n_o_s_p_a_m.gmail.com> > wrote: >> Hi, >> >> My question might be simplistic as neither optics nor image processing is >> my field. >> >> Firstly, I was wondering if it is possible to compensate for a picture >> taken by an out-of-focus digital camera by doing a 2D deconvolution on it >> (MMSE filtering or something like that), in order to recover the in-focus >> picture >> >> Secondly, can the optical transfer function between a properly focused >> picture and an out of focus picture be parameterized in such a way that a >> user could recover the image by gradually varying that parameter until the >> image is in focus? If this is indeed possible, what is that transfer >> function? (any references to existing literature would be welcome). >> >> Thank you for your help. > > I am sorry I was late for this discussion. The answer to this is yes, > and the answer to the second is yes. With a technique designated > SeDDaRA, the blurred image is compared to a reference image after > application of an FFT and the transfer function is derived. The > function is converted into a point spread function via an Inverse > FFT. Any deconvolution technique can then be used to deblur the > image. The process is fast compared to iterative tecniques, and at > least as effective. Examples can be found on our website at > http://www.quarktet.com/Gallery1.html as well more info about > SeDDaRA. Our software program Tria (free-to-try) enables easy > application of the method.
Pictures on the web site are better far defined after processing, but colors are altered even in areas of solid color where I would expect no change. In other pictures, the contrast is increased beyond what sharper focus alone would achieve. What postprocessing has been applied? Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
>On May 28, 11:52=A0pm, "Nitram" <morris.vian@n_o_s_p_a_m.gmail.com> >wrote: >> Hi, >> >> My question might be simplistic as neither optics nor image processing
is
>> my field. >> >> Firstly, I was wondering if it is possible to compensate for a picture >> taken by an out-of-focus digital camera by doing a 2D deconvolution on
it
>> (MMSE filtering or something like that), in order to recover =A0the
in-fo=
>cus >> picture >> >> Secondly, can the optical transfer function between a properly focused >> picture and an out of focus picture be parameterized in such a way that
a
>> user could recover the image by gradually varying that parameter until
th=
>e >> image is in focus? =A0If this is indeed possible, what is that transfer >> function? (any references to existing literature would be welcome). >> >> Thank you for your help. > >I am sorry I was late for this discussion. The answer to this is yes, >and the answer to the second is yes. With a technique designated >SeDDaRA, the blurred image is compared to a reference image after >application of an FFT and the transfer function is derived. The >function is converted into a point spread function via an Inverse >FFT. Any deconvolution technique can then be used to deblur the >image. The process is fast compared to iterative tecniques, and at >least as effective. Examples can be found on our website at >http://www.quarktet.com/Gallery1.html as well more info about >SeDDaRA. Our software program Tria (free-to-try) enables easy >application of the method. > >Best Regards, >Jim C
That web site describes SeDDaRA as a blind technique, yet you use a reference image. Can you explain that? Some of your "before" images look considerably better than the "after" ones. The group of people, for example, seems to lack contrast as much as focus in the original. The after shot is more punchy, but is a horrible mass of artifacts. The before certainly looks better for that one. Others, like the sailing ship, certainly improve. Steve