medfilt1 medifilt2 or movmedian

28 views (last 30 days)
Can any one explain the benefits of medfilt1 over movemedian (apart from the padding behavior)?
Which one is faster?
Is there any benefit of using medfilt2 for 1d median filtering? Will it perform better in a generated code? (Coder)
I've noticed that movemedian gives me the best peformance in my matlab code by my generated code is much slower.

Accepted Answer

Mike Hosea
Mike Hosea on 12 Apr 2022
Edited: Mike Hosea on 14 Apr 2022
Long ago there was only medfilt1 and no movmedian. Then there was both. Now medfilt1 calls movmedian. That fact severely limits the possibility of any significant benefits of medfilt1 over movmedian.
I don't know the answer to the question about medfilt2 in MATLAB execution. That's an image processing function, and those folks generally work pretty hard on the performance side. In particular, the Code Generation notes at the bottom of the doc page have some intriguing comments. Might be worth a try, or it might turn out that the parallelism/threading scheme only helps in 2D. Let's add the Image Processing Toolbox to the Products and see if we can get someone from that team to respond.

More Answers (0)

Categories

Find more on Code Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!