Adaptive Median Filtering using MATLAB

May 27th, 2007

MATLAB is a great tool. I recently wrote a code to perform an adaptive median filtering on a somewhat noisy image. The code works great in removing noise on an image…. It is a simple code that I wrote in a few minutes using MATLAB… for simplification the code does not render regions near the edges… the spatial mask which is a three by three window could not process the edges since it is out of bound…. I could have use padding and pad the edges so that the spatial mask can process the edges…. but you get the idea…and the code…Adaptive Filter

Adaptive median filtering is not the only way to remove noise on an image. It depends on the what kind of noise exists in the image. For example, if the image has a salt noise only, then using contraharmonic mean filter with Q=-1.5 probably will do the job, or if you have a pepper noise only, then using contraharmonic mean filter with Q=1.5 probably will do the job.

Also, extracting noise from an image, not necessarily we have to use time domain or spatial domain. We can also use the frequency domain such as by using band reject filter or notch filter to reject noises at certain region of the fourier spectrum.

Filed under: MATLAB

34 Comments Add your own

  • 1. zahra  |  April 20th, 2009 at 10:39 pm

    thank you for the post

    do you have any idea about wavelet denoising

  • 2. ridwan.chen  |  April 20th, 2009 at 11:43 pm

    Hi Zahra. In a wavelet denoising for a 2D image, first you have to choose a wavelet of your choice. This can be a haar wavelet or any other symlets. You will also choose the scaling factor which will be your number of iterations. So for two iterations will give you two scale decomposition. Apply the chosen FWT to your image which consist of your digital filtering and downsampling. The denoising part comes here: you can use hard thresholding by setting zero to elements whose absolute values are lower that your pre-set threshold. Another method is soft thresholding whereby after performing hard thresholding, you then scale the non-zero coefficients toward zero. This can eliminates discontinuity in your resulting image later on. Last you will perform the wavelet reconstruction or synthesis part.

  • 3. omar  |  June 10th, 2009 at 10:33 am

    Hi
    thaks for the post but the code of adaptive median filtering doesn’t exist
    i’ll plesaed if you can send it
    merci

  • 4. Ridwan.Chin  |  September 7th, 2009 at 12:36 pm

    I will have it e-mail to you in a bit. Thanks…

  • 5. krishna  |  September 22nd, 2009 at 5:15 am

    hi……
    i am doing project on inage processing……..can you please send me the code of adaptive median filter to reome noise and extracting the original image without disturbing the fringes.
    if you send me the solution it would be very helpful and i will be thankfull to you…………

    with regards,
    kishore.

  • 6. ridwan.chen  |  September 27th, 2009 at 9:50 pm

    Hi Kishore. You should have received the adaptive median filter m file by now. Good luck.

  • 7. Muthukumar  |  September 29th, 2009 at 3:20 am

    I need adaptive medain filter for my project so I request you to sent the code.

  • 8. Shruti  |  September 30th, 2009 at 7:31 am

    cn u plz forward me the code for adaptive median filter in matlab.
    Actually we are dng a project(classification of abnormal organs in abdomen using texture analysis of ct images) and are stuck on this algo.
    Can u suggest sm other filter which will b more suitable in our case..

  • 9. Saranya  |  October 6th, 2009 at 7:51 am

    Hi
    Iam working on ECG signal processing and it wub be kind of you if you cud send me your code for me as a reference

    Thankyou,

    Regards,
    Saranya

  • 10. Saranya  |  October 6th, 2009 at 7:54 am

    Hi
    If your familiar with ECG signals do let me know so that my discussions with you can help me progress in my project

    Awaiting you reply

    Saranya

  • 11. ridwan.chen  |  October 6th, 2009 at 8:38 pm

    Those who requested the m file for adaptive median filter should have received it by now.

    Good Luck!

  • 12. ridwan.chen  |  October 6th, 2009 at 8:40 pm

    Hi Saranya. I am much familiar with neuro stimulation than ECG. But please I am open to the discussion. Thanks!

  • 13. naren  |  October 12th, 2009 at 8:07 am

    hi , i m working on median filter on ultrasound image.if u please send me the code for that,it will be of great help thanks…
    naren

  • 14. naren  |  October 14th, 2009 at 2:01 am

    hi. i m doing project on median filtering on medical images.i will be very much thankful to u if u please send the m file to me at the earliest..thanks——-naren

  • 15. sholihex  |  October 16th, 2009 at 5:42 am

    I need adaptive medain filter for my project so I request you to sent the code

  • 16. amoli  |  November 3rd, 2009 at 2:27 am

    hi……
    i am doing project on image processing.do you please send me the code of adaptive median filter to reome noise and extracting the original image without disturbing the fringes.
    if you send me the solution it would be very helpful and i will be thankfull to you…………

    with regards,
    amoli

  • 17. uma  |  November 10th, 2009 at 6:42 am

    hai, i am in need of matlab code for adaptive median filter. kindly send me the code as soon as possible

  • 18. Kumar Samay  |  November 11th, 2009 at 9:30 am

    Hello Ridwan,

    I am involved with one of image processing project. It will be great if you can you send me the MATLAB code of adaptive median filtering for image processing?

    Thanks in advance.

  • 19. Kumar samay  |  November 14th, 2009 at 2:27 am

    Hello Ridwan Chendarma,

    Can you forward me the source code to do the adaptive median filtering. I want to utilise that code to do my study project. Thanks in advance.

  • 20. Somya  |  November 15th, 2009 at 11:48 am

    Hello,

    I am doing a project in digital image processing on noise removal. Kindly send me the code for Adaptive median Filter. The one I made is creating problems at the edges. It would be great if I can get to know where I am going wrong by comparing it with yours.

    Regards
    Somya

  • 21. zahid  |  November 16th, 2009 at 7:31 am

    Hi,
    Can you send me the matlab code of this filter.

    Regards!

  • 22. Kim Yong Hee  |  November 16th, 2009 at 9:54 pm

    Hi, My name is Kim yong Hee..^^

    Could you send source about this adaptive median filtering.

    I am willing to be pleased your resopnse.

  • 23. Vandana  |  December 16th, 2009 at 6:00 am

    Hi , can u send the adaptive median filter m file to me please ? I need it too ..

  • 24. soumya  |  December 18th, 2009 at 10:27 am

    hi..
    Am doin a project in image processing.Il be glad if u could send the code for adaptive median filter usin matlab. It will be very helpful
    Thanku

  • 25. Shyam Lal Rao  |  December 24th, 2009 at 12:21 pm

    Iam working on image processing and it would be kind of you if you could send me your code for me as a reference.

  • 26. Shyam Lal Rao  |  December 24th, 2009 at 12:24 pm

    thanks a lot for providing a information abt adaptive median filter matlab code , which will be very useful for person who is perticularly field.

  • 27. chirag  |  January 7th, 2010 at 11:02 am

    Hi,
    I m working on a project of image processing using AMF and bacterial foraging optimization..
    i m very new to this topic .
    if you can send your codeof AMF,it will be very helpful for me.
    Thanks in advance..

  • 28. sultan  |  January 15th, 2010 at 6:53 am

    Hi;
    plz send me the code of adaptive median filtering

  • 29. ridwan.chen  |  January 16th, 2010 at 1:05 am

    The requests have been overwhelming and I probably should post the programming skeleton so you can try it yourself and it should work!

    The adaptive median filter works in two levels. Lets label them level 1 and level 2.

    level 1: A1 = n_med - n_min
    A2 = n_med - n_max
    If A1 > 0 AND A2 < 0, Goto level 2
    Else increase the window size
    IF window size <= S_max repeat level 1
    Else output n_med
    level 2: B1 = n_xy - n_min
    B2 = n_xy - n_max
    If B1 > 0 AND B2 < 0, output n_xy
    Else output z_med

    Where, n_min = minimum gray level value in S_xy
    n_max = maximum gray level value in S_xy
    n_med = median of gray levels in S_xy
    n_xy = gray level at coordinates (x,y)
    S_max = maximum allowed size of S_xy

    So now go try ….

  • 30. prashanth  |  January 31st, 2010 at 10:08 am

    sir can you please send me the code for adaptive median filtering as it is my project too

  • 31. kirank  |  March 16th, 2010 at 7:49 am

    hello..im carrying out a project in image processing,i need ur guidance in doin so..do reply…waiting for ur response at the earliest.

  • 32. rajni  |  March 18th, 2010 at 11:58 am

    plz send me code for adaotive median filter

  • 33. sudhee  |  April 9th, 2010 at 11:06 am

    hi.. can u please send me the code for image denoising using ADAPTIVE MEDIAN FILTER.. it will be of great help.

  • 34. jaehoonLee  |  May 26th, 2010 at 11:30 pm

    hi, i am in need of matlab code for adaptive median filter. kindly send me the code as soon as possible

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


 

May 2007
M T W T F S S
« Mar   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

Pages

Blogroll

Categories