2D majority filer in MATLAB?
8 ビュー (過去 30 日間)
古いコメントを表示
Hello,
Is there a 2D majority filter in MATLAB?
With ordfilt2 minimum, maximum, median etc. filters can be implemented, but not majority. Is there another command with that functionality?
Here 'majority filter' means replacing each element of a matrix by the most frequently occurring element in a set of neighbors of that element.
Regards, Elena
回答 (3 件)
Sailesh Sidhwani
2019 年 5 月 22 日
編集済み: Sailesh Sidhwani
2019 年 5 月 22 日
There is no direct function for mode filtering, you can use the colfilt instead:
out = colfilt(img, [5 5], 'sliding', @mode) ;
0 件のコメント
Sailesh Sidhwani
2020 年 11 月 25 日
A new 'modefilt' function for 2D and 3D data was added to Image Processing Toolbox in R2020a:
Both 'colfilt' and 'nlfilter' are generic sliding window functions and can be used to perform mode filtering but the expectation is that 'modefilt' to be faster than both of these functions and also work on 3D grayscale data.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!