How to remove the noise without destroying the main edge?

I am working on a project. I want to segment a logo from a car and the picture's size is 3648*2432. The logo is selected by the red rectangle.

I extracted this area and turn into gray level. The area's size is 249*173. Then, I use histogram equalize to enhance the edge. Finally, I use adaptive canny to find edge.

However, the result is not perfect. So, I used median filter to smooth the left picture. The result is as following.

I remove the small parts.

The result has been improved, but it is also not good. Besides, I have tried bilateral filter, mean filter and Gaussian filter, but the result is not good, too. I know that after passing histogram equalize, the noise can be enhance. But, in some case, low contrast, I need to adapt this step to enhance my picture. Is any one who can provide me any different comment? Thank you very much.

Use bilateral filter or anisotropic diffusion first.

The effect of anisotropic diffusion is as the following:

. The MATLAB code can be found here.

Here is its effect on your image:

Finally, non-local means is a also a good way to get rid of the noise. You might also want to take a look into that. I warn you though, it is slow.

• Have a try on this: github.com/RoyiAvital/… Much more advanced than the Classic Anisotropic Diffusion.
– Royi
Jan 18, 2015 at 17:35
• @tbirdal: anisotropic diffusion seems interesting, if you can you provide a set of original and processed image examples together with generating matlab code, that would be appreciated. Jan 18, 2015 at 19:20
• check again please. Jan 18, 2015 at 19:36
• Thank you for the examples and the code. I have provided my own much simple processing in the link: [IMG]i62.tinypic.com/2w3t6gz.jpg[/IMG]. Its effect on the Lena is alot better, but it is not an edge detector. Just a noise reductive image sharpener. Jan 18, 2015 at 20:08
• I will read the article about anisotropic diffusion. Besides, @Drazick , the code in github has error when the image is larger than about 328*228, but the result of small picture is good. Thank you very much for your enthusiastic reply.
– Kuo
Jan 19, 2015 at 2:36

I would not suggest an equalization as the first step. Go with noise reduction.

• So, you think that I need to reduce the noise first? Then implement histogram equalization?
– Kuo
Jan 18, 2015 at 16:44
• yes reduce the noice first. A blind histogram equalization may or may not improve your edges. So you better improve your edges adaptively. Jan 18, 2015 at 17:58
• When does edge sharpening reduce the noise? Jan 19, 2015 at 10:27
• Is there any method that I can use to enhance my edge? I have tried highboost filtering, but in low contrast condition, highboost filtering can't perform well.
– Kuo
Jan 19, 2015 at 12:32
• @tbirdal noise is reduced before edge is sharpened, in fact my algorithm is a space-variant nonlinear edge adaptive image sharpener. Its main purpose is to produce visually high quality sharp images while still preserving texture and yet not amplifiying noise. However, since it tries to protect textures from being washed out by the noise reduction, it may not produce desired result for all types of noises. Jan 19, 2015 at 18:44