MATLAB: How to do median filter without using medfilt2..

functionhomeworkmedian filter

hello, i need to do an image enhancement using median filter… but im not suppose to use medfilt2 or those function in matlab… how create my own function… im not sure on how to do it… can some1 help me in this..?? ~THANK YOU~

Best Answer

Use blockproc() or nlfilter() and inside the function call the sort() routine and take the middle value. If you can't even use those functions, then you'll have to do the whole thing yourself with a bunch of nested for loops.