I am trying to do some simulation of out-of-focus images. I have a
perfect high defination PDF or Jpeg file of a book page with black-
white picture in it. Now image we print it out and use a camera to
capture a picture of it. The camera is out of focus. I would like to
simulation the photo I am going to get with some image processing
technologes.
I tried just blur the image with a gaussian filter. But the result
does not seem to be good.
Could anyone tell me how to do the simulation and what is the
mathematics behine out-of-focus?
Thanks you very much.
FF
You may want to google for "bokeh" and how to simulate it.
http://www.flarg.com/bokeh.html
w.
The dificulty with such a simulation is that the result depends on the
aberrations of the camera lens. Unless you know the aberration I
don't see how you can obtain accurate results.
> I tried just blur the image with a gaussian filter. But the result
> does not seem to be good.
It's better to use a rectangular filter.
Michael
Depends on exactly what you mean. If you want the same blur everywere in
the photo, the blur due to defocus isn't that complex.
However, in a real scene with various depths of objects in different
places in the scene, and it is very hard to do a realistic defocus,
since in a 2D image one does not have real depth information to work
with. There are some editors with "filters" that claim to do this, but
the results I have seen are not great.
In many of these, the results are almost the same as if you select an
object, reverse the selection, and do a gaussian blur on this reversed
selection. But this again gives you the same blur for everything "not
the subject".
--
Bob May
rmay at nethere.com
http: slash /nav.to slash bobmay
http: slash /bobmay dot astronomy.net
Thank you very much for all your response.
I found that my problem may be more difficulty. Since you guys are
experts on optics, I would post more. Here is one image taken by a
relative good focus:
http://farm3.static.flickr.com/2561/4125766595_cd165c1755.jpg
As you can see, the barcode has two bars on the very left. If I take
it with a out-of-focus camera, it looks like this:
http://farm3.static.flickr.com/2751/4125766469_2b38892356.jpg
The very left two bars merge into one and looks not symetric on the x
direction.
My question is how to simulate the second imgae (bad focus). what
terms should I consider? Only out of focus or other aberration terms
also? What is the mathematically fomula for other aberration terms?
Thank you very much.
ff
>
>
>Thank you very much for all your response.
>
>I found that my problem may be more difficulty. Since you guys are
>experts on optics, I would post more. Here is one image taken by a
>relative good focus:
>
>http://farm3.static.flickr.com/2561/4125766595_cd165c1755.jpg
>
>As you can see, the barcode has two bars on the very left. If I take
>it with a out-of-focus camera, it looks like this:
>
>http://farm3.static.flickr.com/2751/4125766469_2b38892356.jpg
>
>The very left two bars merge into one and looks not symetric on the x
>direction.
>
>My question is how to simulate the second imgae (bad focus). what
>terms should I consider? Only out of focus or other aberration terms
>also? What is the mathematically fomula for other aberration terms?
>
>Thank you very much.
>
>ff
"ringing"
by the sinc function wherever there is a step
in illuminance.
w.
Note how sinc is related to the Cornu spiral and bessel functions
http://www.valdostamuseum.org/hamsmith/FrsCrnu.gif
which depicts the actual light distribution after a spatial density
step. This is due to diffraction
http://en.wikipedia.org/wiki/Diffraction
Note the term "Airy disc" which depicts the actual limit
of resolution of any optical instrument.
which is also color dependent
http://tinyurl.com/yhdfjbx
The actual light distribution after a 0 to 100% intensity step
is depicted here (further down the page)
http://tinyurl.com/y8o4sqh
Note that there are regions of more brightness than the original
source. Same applies to "black" but there is of course no
blacker than black and the sinc function appears "rectified"
at the bottom.
Stepping from e.g. 70% brightness to e.g. 30% brightness
will see the full swing of course.
w.
usually one goes the other way round,
restoring sharpness from washed images,
but your search term anyway then would be
"defocus blur" or "defocusing blur"
w.
usually one goes the other way round,
restoring sharpness from washed images,
but your search term anyway then would be
"defocus blur" or "defocusing blur"
google: >simulate "defocus blur"<
has some hits too.
http://tinyurl.com/ydpg3c6
around page 300, use the search function.
Me is leaving this topic now, me wants sharp images.
:-)
w.
One last word: focus blur effects ain't symmetrical
because astigmatism comes into play.
w.
hehe, the Linux folks
http://sudakyo.hp.infoseek.co.jp/gimp/fblur/focusblur_e.html
w.
Wow, 5 fups to yourself. Reminds me of Stan Freberg: "The only man in
radio who has to sponsor his own show."
;)
Phil Hobbs
--
Dr Philip C D Hobbs
Principal
ElectroOptical Innovations
55 Orchard Rd
Briarcliff Manor NY 10510
845-480-2058
hobbs at electrooptical dot net
http://electrooptical.net
Your opinion.
(One starts with diffraction to help the OP.)
Waiting for your correct posts now.
w.
Try reading my previous ones.
But defocus assumes first order optics- in a simple model all defocus is
the same. Many geometrical aberrations have a pretty simple form. You
need to know the size but the shape is pretty easily modeled. But for
defocus you can even calculate the size of the defocus spot.
Consider the simple case of spherical aberration. I've put a few
pictures on the web at www.temp.richardfisher.com (I'll keep them
there for about a month.) The first diagram shows the transverse
aberration of almost pure S1 (spherial aberration) at best focus. The
second plot shows spot diagrams at 100 micron focal separations for
the same lens. As you can see there is considerable difference inside
and outside focus. This becomes even more noticable as one adds other
aberrations into the mix.
Richard you are right, but surely in a practical photographic
objective the aberrations may be considered sufficiently small, and
diffraction negligible, for the point spread function to be just a top
hat (or a ring, for a reflecting objective). The main difficulty then
becomes one of allocating different PSF diameters to diffferent parts
of the image according to the range of the corresponding object.
While we are on the topic, does anyone know whether the freeware
AbePSF program, written in C ages ago by Nelson Wallace, is available
anywhere on the net? I downloaded it at the time, and still have a
copy but I can't find anyone hosting it now. It is a wonderful
teaching tool, where you define a pupil shape and apodisation, plug in
your Seidel or Zernike terms and get out plots of the point spread
function. Magic!
Brian
Ancient and Modern Optics
Brian,
I fairly recently was evaluating lenses for CCD cameras for a machine
vision application. You would be amazed at how poor some of the
"standard" lenses are, even those claimed to be superior. These are
often the lenses of choice for users with limited optical knowledge.
Cheap photographic lenses are also questionable. (I wish Nikon still
supported a full range of OEM lenses.)
However, I agree that for good semi professional cameras one would
expect the aberrations to be fairly small, although it doesn't take
much spherical aberration to result in assymetry inside and outside
focus. A more difficult problem (as you pointed out) is variation of
aberration across the field.
And most of the posts are either irrelevant or incorrect.
----------------------------------------------------------------
But interesting nonetheless. :-)