Jump to content

Talk:Gaussian blur: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
cleanup.
Line 4: Line 4:
"Sequenced Convolution" perhaps? <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/82.46.170.107|82.46.170.107]] ([[User talk:82.46.170.107|talk]]) 21:09, 25 April 2008 (UTC)</small><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
"Sequenced Convolution" perhaps? <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/82.46.170.107|82.46.170.107]] ([[User talk:82.46.170.107|talk]]) 21:09, 25 April 2008 (UTC)</small><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
: That's what [[separable convolution]] is. I've never heard of "sequenced convolution". [[User:BenFrantzDale|—Ben FrantzDale]] ([[User talk:BenFrantzDale|talk]]) 01:36, 26 April 2008 (UTC)
: That's what [[separable convolution]] is. I've never heard of "sequenced convolution". [[User:BenFrantzDale|—Ben FrantzDale]] ([[User talk:BenFrantzDale|talk]]) 01:36, 26 April 2008 (UTC)
:I've heard both "sequenced" and "separable" before, but you're right "separable convolution" seems to be the most widely used term. Surely it's not [[linearly separable]] though...


== What does "Gaussian" mean? ==
== What does "Gaussian" mean? ==

Revision as of 12:39, 12 May 2008

Linearly Separable

The Gaussian filter can be applied with a 2d mask, or two 1d masks in sequence. Is "Linearly Separable" really the proper term for this? "Sequenced Convolution" perhaps? —Preceding unsigned comment added by 82.46.170.107 (talk) 21:09, 25 April 2008 (UTC)[reply]

That's what separable convolution is. I've never heard of "sequenced convolution". —Ben FrantzDale (talk) 01:36, 26 April 2008 (UTC)[reply]
I've heard both "sequenced" and "separable" before, but you're right "separable convolution" seems to be the most widely used term. Surely it's not linearly separable though...

What does "Gaussian" mean?

I spent some time looking through the article to find what the term "Gaussian" means, and didn't find any answers. After some further googling I found that it is named after a man named Gauss(http://www.webmonkey.com/webmonkey/glossary/gaussian.html). I am surprised the introduction doesn't mention this, and assumes the reader knows (or doesn't care) what Gaussian actually means -- I looked up this article to discover that, and the entire Wiki article didn't help.

Additionally, does Gaussian always necessarily mean it relates in some way to Karl Friedrich Gauss? Perhaps that clarification is beyond the scope of this article, but surely the fact that Gaussion in this case refers to Karl Friedrich Gauss is not? —Preceding unsigned comment added by Abeall (talkcontribs) 18:55, 3 January 2008 (UTC)[reply]

"Gaussian" almost always refers to CF Gauss. I cleaned up the intro accordingly. —Ben FrantzDale (talk) 01:36, 26 April 2008 (UTC)[reply]

Radius

The page claims most programs use a radius of 6σ+1. Won't this depend entirely on the bit depth? That is, to get "perfect" results you need a radius such that the value of the convolution kernel at that radius would round to zero in that bit depth? Actually, you might need to go further... I think the worst case is bluring a black circle with a white background. To find the result corresponding to the center of the circle you want to make sure your filter is large enough to get the correct value at the center of the circle in the current bit depth. I could work out the math, but either way, the optimum radius of the kernel will certainly be a function of bit depth. —Ben FrantzDale 15:14, 2 May 2006 (UTC)[reply]

The truncation boundary 6σ+1 is rather arbitrary; see the article on scale-space implementation for a complementary description. Tpl 17:41, 9 July 2006 (UTC)[reply]

Out-of-focus lens

Image:Josefina with Bokeh.jpg - Try doing this in the GIMP.

Shouldn't it rather say something like "viewing through a translucent screen". According to my understanding the blur you get with an out of focus lens has a distribution that's close to even inside a projection of the iris and zero outside it. That doesn't look a lot like the bell curve. See bokeh. —Home Row Keysplurge 14:50, 10 May 2006 (UTC)[reply]

I think it depends on the lens. Mirror lenses, for example, are close to zero at the center, then go up and back down to zero as you go out, causing halos. Whether or not there's a lens with a Gaussian distribution, I have no idea. (unsigned by 212.9.28.123)
Well, mirror lenses naturally produce a shadow in the centre of the blur, but that's not the point. The point is, lens blur is not Gaussian, and a Gaussian blur doesn't look anything like a lens blur. (I don't even think it's physically possible to build a lens that creates a Gaussian blur.) —Home Row Keysplurge 10:27, 18 May 2006 (UTC)[reply]
I'm going to be bold and just change it. —Home Row Keysplurge 10:39, 18 May 2006 (UTC)[reply]
Regarding the example image saying "Try doing this with the GIMP.", from what I can tell this can't be done easily with just the GIMP right now, but it can be done with the GIMP and the help another program such as ImageJ to do a large arbitrary convolution. I took an image in GIMP, set the gamma very high, saved that, opened it in ImageJ, convolved it with a 41-pixel–diameter circular kernel (which took a while since it's a O(x·y·r2) operation), saved that result, opened it in the GIMP, reversed the gamma transformation (which was required to get just the bright spots to bloom into circles), then finally I overlayed the unblured version and masked the portion I wanted out of focus. I tweaked the results (adding noise, and a tiny bit of gaussian blur), but what I describe got me 90% of the way from the original to the final version shown here:
original
final
The python script I used to make the convolution kernel goes like this:
#!/usr/bin/python
import math

size = 41
mid = size/2
for x in range(0,size):
  for y in range(0, size):
    dist = math.sqrt(pow(x-mid,2)+pow(y-mid,2))
    if dist < mid-0.5:
      print 1,
    elif dist > mid+0.5:
      print 0,
    else:
      print dist-(mid-0.5),
  print ""
I was amazed how easy this was to do well. I added it as GIMP Bug #345845. —Ben FrantzDale 23:06, 24 June 2006 (UTC)[reply]
As pointed out to me on that bug, there is a GIMP plugin to do this[1]. —Ben FrantzDale 01:16, 26 June 2006 (UTC)[reply]

The formulae

or

Why has the square root disappeared from the second formula, and why has a appeared?

We're told that so why wasn't that substitution the only difference?

I ask not because I think it's wrong, but because I'm trying to understand the formula before I use it in a program I'm writing.


Edited to add: for example see http://www.maths.abdn.ac.uk/~igc/tch/mx4002/notes/node99.html - this page shows this formula:

It looks to me as if the square root should be in the second formula above, and that it should extend over the sigma squared (and perhaps the first formula should extend it too and square the sigma for consistency?).

Can anyone clear this up for me?

It should be clarified that G(r) is a Gaussian distribution in 1 dimension. G(u,v) is simply the result of G(u,v) = G(u) * G(v) which is the correct way to use the Gaussian distribution in 2 dimensions. If you use G(r) with then the result of the integral in both dimensions is no longer 1. The formula on the reference link you found can be proved to be incorrect by counter-example: we use i=j=0 (which is the center of the matrix) G(0,0) = 0.398942 according to the given formula. But the value in the center of the matrix is 159/1003 = 0.158524 ... surprisingly this is very close to 1 / (2 * Pi). So in my opinion the forumlas in the article G(r) is correct in 1 dimension and G(u,v) is correct in 2 dimensions. So the statement should be removed.
Okay, how about this as a proposed replacement? I've replaced r with d in the one-dimensional example and taken out the bit about the radius.


...The equation of Gaussian distribution in one dimension is
or, in two dimensions,
where σ is the standard deviation of the Gaussian distribution...


What do you think? David 11:30, 22 June 2006 (UTC)[reply]
Surely it is approximately equal, and not equal therefore? 129.78.220.7 05:28, 18 July 2007 (UTC)[reply]

Note removed from article

(Note 12 July 2006 - xShin)
The matrix dimension would be better calculated in this manner Kernel Size = .
(End of Note 12 July 2006 - xShin)
I removed that note from the article, since it seemed to belong here. Luna Santin 07:01, 12 July 2006 (UTC)[reply]