开发者

Can anyone provide an approachable explanation of how an edge-preserving smooth works?

How does an edge preserving smooth work? This is an image filter which blurs t开发者_如何学Gohe image without messing up the edges.

My searches on Google have turned up only academic papers discussing mathematics that are way beyond my comprehension.

Can you provide some pseudocode or a link to a simple explanation?


First of all, there's a lot of math in doing that, so if you don't understand the mathematical equations you found, I'll try to explain it in simple terms:

Smoothing in general is done by doing some kind weighted average of the adjacent pixels.

Because this is basically math, and pictures are basically 3D matrices, you can achieve smoothing efficiently with basic matrix mathematical manipulations.

Now to get edge detection you just need to find the difference between adjacent pixels (or if it's a wide edge, you can set a maximal width), which again is just the gradient of the matrix. (Multi-dimensial Derivative).

So, even if you do it naively, you could use the gradient as a weight factor for the weighting the average of pixel color.

I assume that most of the mathematical equations you'll find use the gradient at some level, but just make it more efficient (single mathematical formula in oppose to many loops)


If you take a really simple 2D smoothing filter (like a box or Gaussian kernel) this will smooth in all directions about equally (more true for Gaussian than box.) The basic idea is somehow making a filter that smooths parallel to the edge (or along it), but not perpendicular to it (or across it), as much as possible.

However, you don't know a priori which direction the edge is for any given point in the image, so you have to figure this out. What most edge-preserving smoothings wind up doing is computing which direction the edge is locally, and then applying the appropriate smoothing direction. Some do these two steps more explicitly, and some just wind up rolling all of that math into one.


The median filter might help you, since it tends to keep edges in images both sharp and in place while removing outlying noise. It works by replacing every pixel with the median pixel in its neighborhood, i.e. the pixel that would be the middle one if you would sort the neighborhood pixels by value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜