Great contribution, Willi! 
Thank u so much as well. :)
jh

---------- Původní e-mail ----------
Od: William Oliver <ven...@billoblog.com>
Komu: users@lists.fedoraproject.org
Datum: 23. 7. 2019 15:30:05
Předmět: Re: How do I de-blur a picture?
"This really isn't a Fedora question but...

Blurring a pixel is simply replacing it with a weighted average of it
and the surrounding pixels. The mathematical process is called a
"convolution."

Classically, in order to deblur an image, you need to know the blurring 
function (the set of weights on the surrounding pixels, the shape of
the group of pixels used in the blur, and the size of the region used
in the blur). When done directly, this blurring function is called the
"point spread function" for obvious reasons. It turns out that there's
a neat thing about this in that the process of blurring is
computationally expensive when done directly, but if you do a fourier
transform of the image, it's just a multiplication of the image with
the blur function (called the "modulation transfer function" in
frequency space).

Reversing the convolution that resulted in the blurred image is called
"deconvolution."

The down side of doing things in frequency space is that many of the
coefficients are very small, or zero, usually, and 1) you can't divide
by zero, 2) small errors in very small numbers lead to very big errors
when you divide by them. So, if you don't have your point spread
function perfectly characterized, your error blows up. There are all
sorts of ways to try to get around this, both in image space and
frequency space, but the bottom line is that if you know your point
spread function well, you can deblur well, and if you don't, you can't. 

The well-known "unsharp mask" function is basically one iteration of a
multi-iteration deconvolution method in image space that assumes the
blur function is a gaussian/binomial. Thus, it doesn't look too bad if
you do it a little, but looks horrible if you do it a lot -- because
the real blurring function is likely not a gaussian. The more you do
it, the more the error becomes dominant.

You can try to do this without knowing the blurring function. This is
called "blind deconvolution." However, these methods usually force you
to make assumptions about things in the image, and then modify the
image to fit those things. The classic example here is astronomy
photography where you can assume that a distant star it just a dot, or
microscopy where they sell tiny little spheres that you then photograph 
and modify the image so that they look like little spheres. That way
you can estimate the point spread function and go from there.

Deblurring was a big deal in the 1980s when they put up the Hubble
telescope and found out they had polished the mirrors incorrectly. The
US government dumped millions of dollars in (successfully) trying to
correct for the Hubble blur. It then became very popular in
specialized microscopy, such as confocal microscopy, where you are
pushing the optics to their limits.

The other big advance was for smartphones. There are two common ways
to make sure you take good photos. The first is to have excellent
lenses with great optics, and try to do as little post processing as
possible. The second is to have a cheap lens that is well
characterized mathematically and designed to have few of those bad
coefficients, so you can easily post process it to get a good image.
Thus, you can either buy a really good camera with expensive lenses and 
take a good picture to start with, or you can put a cheap lousy lens in 
a smartphone and process the bejeezus out of it.

There are a number of freeware programs out there for deconvolution,
and a whole industry of proprietary stuff. Unfortunately, you usually
have to start by characterizing your point spread function, and that's
always a hassle. Some places have standardized point spread functions
for well-known lenses, but they can be hard to find.

One piece of software that has a number of deconvolution plugins
(primarily for microscopy) is ImageJ or Fiji (a not-quite-fork of
ImageJ). ImageJ is maintained by the National Institutes of Health in
the US, and is free. Fiji is maintained by an academic institution,
but I can't remember which.

So, do searches on "deconvolution," "blind deconvolution",
"deblurring," and "ImageJ deconvolution", "Fiji deconvolution." That
will get you started.

In particular, see:
https://imagej.net/Deconvolution

billo


On Tue, 2019-07-23 at 01:09 -0700, ToddAndMargo via users wrote:
> Hi All,
>
> Fedora 30, x64
>
> Anyone know of a way to remove the blur from this picture?
>
> https://ibb.co/cTPNHLf
>
>
> Many thanks,
> -T
> _______________________________________________
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines:
> https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.
org
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of
-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@lists.
fedoraproject.org
"
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to