Search code examples
matlablinesmoothing

How to smooth a line surface to meet one pixel width?


I have a small problem in smoothing a line surface.

The image is a result of edge detection after sobel processing.

It has an uneven surface, and the unit of bulges is one pixel.

Red circle parts are the bulges.

The result of edge detection after sobel processing.

http://www.mathworks.com/help/matlab/creating_plots/smooth-contour-data-with-convolution-filter.html

The link I have tried, but the line width was increased too more.

smooth with convolution twice

I have to get a straight line with one pixel width.

How to clear up these bulges?

Many Thanks.


7/21 update:

Canny method can generate a detected image with one pixel.

The result of Canny edge detection: enter image description here

The line was segmented 2 parts, the under part was shifted by one pixel.

I hope the line that can be considered a straight line rather than 2 lines when the line width is within 2~3 pixel.

With Dilate and Erosion, I tried to smooth the line that become a straight line

Canny > Dilate:

enter image description here

Canny > Dilate > Erosion:

enter image description here

The result of before and after are the same...

Could anyone give me an idea?

Many Thanks again.


Solution

  • Maybe an approach similar to Canny edge detection could be the solution you are searching for. The Canny edge detector uses non maximum suppression, meaning that the edges are formed only by pixels that have the maximum gradient between their neighbours, resulting in many occasions in one-pixel-width edges.