CommonestFilter[data,r]
範囲 r の近傍のすべての値を最頻値で置換することで data にフィルタをかける.
CommonestFilter[data,{r1,r2,…}]
データの
次元のフィルタリングに riを使う.
CommonestFilter
CommonestFilter[data,r]
範囲 r の近傍のすべての値を最頻値で置換することで data にフィルタをかける.
CommonestFilter[data,{r1,r2,…}]
データの
次元のフィルタリングに riを使う.
詳細
- CommonestFilterは,大多数フィルタとも呼ばれるもので,局所的最頻値を返すことでデータにフィルタをかけるために使われる. どの程度の効果があるかは r の値に依存する.
- 範囲 r の各近傍に適用される関数はCommonestである.
- 最頻画素が複数存在し,中心画素がその一つである場合は,中心画素が使われる.それ以外の場合は 画素がランダムな最頻画素で置換される.
- data は次のいずれでもよい.
-
list 任意階数の数値配列 tseries TimeSeriesやTemporalData等の時間データ image 任意のImageオブジェクトまたはImage3Dオブジェクト audio Audioオブジェクト video Videoオブジェクト - 多チャンネルの画像については,CommonestFilterは各画素を近傍の最頻画素ベクトルで置換する.
- CommonestFilter[data,{r1,r2,…}]は,各サンプルを中心とした
ブロック中の最頻値を計算する. - CommonestFilterは,リストおよび画像について指標座標系を仮定する.
- CommonestFilterは,データの境界ではより小さい近傍を使う.
例題
すべて開く すべて閉じる例 (3)
CommonestFilter[{0, 1, -1, 1, 2, 1, 3, 3, 3, 1}, 1]TimeSeriesにフィルタをかける:
ts = TemporalData[TimeSeries, {{{-1, -2, -4, -4, -6, -7, -8, -11, -13, -11, -12, -11, -11, -12, -13,
-13, -12, -11, -9, -8, -8, -7, -6, -7, -10, -11, -10, -9, -10, -9, -7, -7, -7, -8, -7, -7, -7,
-8, -7, -8, -8, -7, -7, -7, -6, -6, -6, -7, -7, ... 2, -73, -73, -73, -74,
-73, -73, -74, -75, -76, -75, -75, -74, -73, -72, -73, -75, -74, -74, -74}}, {{0, 782, 1}}, 1,
{"Continuous", 1}, {"Discrete", 1}, 1,
{ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 11.1];filtered = CommonestFilter[ts, 50]ListLinePlot[{ts, filtered}, PlotLegends -> {"original data", "filtered"}]CommonestFilter[[image], 3]スコープ (12)
データ (8)
CommonestFilter[ {a, b, b, c, c, c, d, d, e}, 2]CommonestFilter[(| | | | |
| - | - | - | - |
| 1 | 1 | 2 | 0 |
| 2 | 3 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 0 | 1 | 2 | 3 |), 1]//MatrixFormdata = {Quantity[2, "Meters"], Quantity[0, "Meters"], Quantity[0, "Meters"], Quantity[3, "Meters"], Quantity[0, "Meters"], Quantity[1, "Meters"], Quantity[3, "Meters"], Quantity[1, "Meters"], Quantity[1, "Meters"], Quantity[3, "Meters"], Quantity[3, "Meters"], Quantity[1, "Meters"]};filtered = CommonestFilter[data, 1]EventSeriesにフィルタをかける:
es = TemporalData[EventSeries, {{{8, 3, 1, 4, 10, 9, 4, 8, 5, 3, 5, 6, 1, 8, 3, 3, 2, 5, 0, 6, 4, 4, 3,
10, 0, 1, 1, 10, 3, 5, 2, 1, 8, 8, 2, 10, 9, 5, 4, 9, 8, 5, 1, 2, 8, 10, 0, 5, 8, 10, 0, 4, 4,
5, 8, 0, 8, 2, 3, 5, 9, 6, 5, 6, 10, 1, 8, 4 ... , 4, 0, 0, 7, 4, 6, 6, 6, 7,
7, 1, 9, 2, 3, 9, 10, 6, 2, 9, 7, 10, 5, 9, 7, 7, 9, 6, 7, 8, 6, 7, 8, 0, 2, 5, 5, 8, 7, 0, 9,
2, 2, 4, 5}}, {{0, 149, 1}}, 1, {"Discrete", 1}, {"Discrete", 1}, 1,
{ResamplingMethod -> None}}, False, 10.1];filtered = CommonestFilter[es, 10]ListPlot[{es, filtered}, PlotLegends -> {"original data", "filtered"}, Filling -> Axis]Audio信号にフィルタをかける:
a = Import["ExampleData/rule30.wav"];b = CommonestFilter[a, 35]AudioPlot[{a, b}]CommonestFilter[[image], 5]CommonestFilter[Video["ExampleData/fish.mp4"], 3]CommonestFilter[ExampleData[{"TestImage3D", "CTengine"}], 2]パラメータ (4)
CommonestFilter[[image], 3]Table[Labeled[CommonestFilter[[image], r], Text["*r* = " <> ToString@r]], {r, {1, 3, 6}}]CommonestFilter[[image], {10, 0}]CommonestFilter[[image], {0, 10}]CommonestFilter[[image], {15, 0, 0}]CommonestFilter[[image], {0, 5, 5}]アプリケーション (2)
特性と関係 (1)
最頻値フィルタはバイナリ画像に対してMedianFilterと同じ結果を与える:
i = [image];
CommonestFilter[i, 3] === MedianFilter[i, 3]考えられる問題 (1)
テクニカルノート
-
▪
- 画像処理
関連するガイド
-
▪
- 画像のフィルタリングと近傍処理 ▪
- 画像復元 ▪
- 動画計算機能の更新履歴
テキスト
Wolfram Research (2008), CommonestFilter, Wolfram言語関数, https://reference.wolfram.com/language/ref/CommonestFilter.html (2025年に更新).
CMS
Wolfram Language. 2008. "CommonestFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/CommonestFilter.html.
APA
Wolfram Language. (2008). CommonestFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CommonestFilter.html
BibTeX
@misc{reference.wolfram_2026_commonestfilter, author="Wolfram Research", title="{CommonestFilter}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/CommonestFilter.html}", note=[Accessed: 15-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_commonestfilter, organization={Wolfram Research}, title={CommonestFilter}, year={2025}, url={https://reference.wolfram.com/language/ref/CommonestFilter.html}, note=[Accessed: 15-September-2026]}