MeanShiftFilter[data,r,d]
範囲 r の近傍で値が距離 d 以内の画素の平均値で各値を置換することで data にフィルタをかける.
MeanShiftFilter[data,{r1,r2,…},d]
データの
次元のフィルタリングに riを使う.
MeanShiftFilter
MeanShiftFilter[data,r,d]
範囲 r の近傍で値が距離 d 以内の画素の平均値で各値を置換することで data にフィルタをかける.
MeanShiftFilter[data,{r1,r2,…},d]
データの
次元のフィルタリングに riを使う.
詳細とオプション
- MeanShiftFilterは,データを局所的に平滑化してノイズを削減し,一方で画像中のエッジのような重大なジャンプは残すために使われる.平滑化量は r と d の値に依存する.
- 範囲 r の各近傍に適用される関数はMeanShiftである.
- data は次のいずれでもよい.
-
list 任意階数の数値配列 tseries TimeSeries,TemporalData等の時間データ image 任意のImageオブジェクトまたはImage3Dオブジェクト audio Audioオブジェクト video Videoオブジェクト - 多チャンネルの画像と音声信号については,距離がチャンネルベクトル間で計算される.
- MeanShiftFilter[data,{r1,r2,…},d]は,各画素を中心にした各サンプルの
ブロックの平均値を計算する. - MeanShiftFilterは,リストと画像について指標座標系を仮定する.
- データの境界では,MeanShiftFilterMeanFilterはより小さい近傍を使う.
- 使用可能なオプション
-
DistanceFunction EuclideanDistance 値間の距離をどのように計算するか MaxIterations 1 実行する反復の最大回数 - DistanceFunctionで使用可能な設定値の完全リストはMeanShiftの解説ページを参照のこと.
- 距離パラメータ d の可能な値の範囲は,距離関数,さらに色空間の次元に依存する.
予備知識
- MeanShiftFilterは,一般にノイズや粗いテクスチャ等による局所変化を除去するために画像を平滑化するフィルタである.MeanShiftFilterは,他の画像解析操作(分割等)を行う際の前処理として使われることが多い.
- 他の多くのノイズ除去フィルタ(MeanFilter等)とは異なり,MeanShiftFilterは画像中のエッジを保存する.他の同様の関数には,PeronaMalikFilter,BilateralFilter,NonlocalMeansFilter等がある.
例題
すべて開く すべて閉じる例 (3)
MeanShiftFilter[ {1, 0, 1, 4, 4, 5, 2, 1}, 2, 1]TimeSeriesにフィルタをかける:
ts = TemporalData[TimeSeries, {{{0., -0.054108337548928784, 0.1280211704499059, 0.28162021808461324,
-0.2057320325139802, -0.4871901025739722, -0.7154387408784426, -0.7399660905024047,
-0.6981022018441507, -0.7178077145466483, -0.8034462541874 ... 7894984276149, 1.8851123992920942, 1.8341759268762767, 2.0335844117979263}},
{{0., 10., 0.1}}, 1, {"Continuous", 1}, {"Continuous", 1}, 1,
{ValueDimensions -> 1, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.];filtered = MeanShiftFilter[ts, 5, 2]ListLinePlot[{ts, filtered}, PlotLegends -> {"original data", "filtered"}]MeanShiftFilter[[image], 10, .5]スコープ (12)
データ (7)
MeanShiftFilter[ {0, 1, 10, 11}, 1, 1]MeanShiftFilter[(| | | | |
| - | - | - | - |
| 0 | 3 | 2 | 2 |
| 3 | 9 | 9 | 6 |
| 5 | 8 | 7 | 0 |
| 3 | 1 | 1 | 2 |), 1, 2]//MatrixFormTimeSeriesにフィルタをかける:
ts = TemporalData[TimeSeries, {{{0., -0.27267267057145633, -0.6672983789995302, -0.5338541947930846,
-0.6117404489279314, -0.6755527076595494, -0.02125421294486496, -0.10792797291843935,
-0.6138271235477938, -0.3248568606554575, -0.08843449054 ... 2053424, -0.49980440691873723, -0.5388679788215971,
-0.4101602764645551}}, {{0, 1., 0.01}}, 1, {"Continuous", 1}, {"Continuous", 1}, 1,
{ValueDimensions -> 1, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.1];filtered = MeanShiftFilter[ts, 5, 1, MaxIterations -> 100]ListLinePlot[{ts, filtered}, PlotLegends -> {"original data", "filtered"}]Audio信号にフィルタをかける:
a = Import["ExampleData/rule30.wav"];b = MeanShiftFilter[a, 25, 0.5]AudioPlot[{a, b}]MeanShiftFilter[[image], 5, 0.1]MeanShiftFilter[Video["ExampleData/fish.mp4"], 3, .02]MeanShiftFilter[[image], 6, 0.1]パラメータ (5)
MeanShiftFilter[[image], 5, 1]MeanShiftFilter[[image], {5, 0}, 1]MeanShiftFilter[[image], {0, 5}, 1]MeanShiftFilter[[image], {5, 0, 0}, 1]MeanShiftFilter[[image], {0, 5, 5}, 1]平均シフトフィルタは値の違いが d 未満の画素だけを平均化する:
Labeled[MeanShiftFilter[[image], 5, #], #]& /@ {0.1, 0.3, 0.5}オプション (3)
DistanceFunction (2)
デフォルトで,EuclideanDistanceが使われる:
MeanShiftFilter[[image], 10, .5]MeanShiftFilter[[image], 10, .5, DistanceFunction -> ManhattanDistance]MaxIterations (1)
デフォルトで,入力に適用される平均シフトは1回しか反復されない:
MeanShiftFilter[[image], 3, .1]MaxIterationsを使って反復回数を指定する:
MeanShiftFilter[[image], 3, .1, MaxIterations -> 100]アプリケーション (2)
特性と関係 (1)
MeanShiftFilterは,データの動的範囲より大きい距離 d についてはMeanFilterに等しい:
r = 1;
data = RandomReal[{0, r}, 100];MeanShiftFilter[data, 1, r + $MachineEpsilon] == MeanFilter[data, 1]おもしろい例題 (1)
値が収束するまでMeanShiftFilterが値を反復的にシフトさせる様子を示す:
data = Join[RandomReal[NormalDistribution[0, .4], {500, 2}], RandomReal[NormalDistribution[1, .4], {500, 2}]];ListPlot[data]ms = NestList[MeanShiftFilter[#, 1000, {.6, .6}]&, data, 5];ListLinePlot[Transpose[ms]]関連するガイド
-
▪
- 画像復元 ▪
- 線形・非線形フィルタ ▪
- 画像の処理と解析 ▪
- 画像のフィルタリングと近傍処理 ▪
- 動画計算機能の更新履歴
テキスト
Wolfram Research (2010), MeanShiftFilter, Wolfram言語関数, https://reference.wolfram.com/language/ref/MeanShiftFilter.html (2025年に更新).
CMS
Wolfram Language. 2010. "MeanShiftFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/MeanShiftFilter.html.
APA
Wolfram Language. (2010). MeanShiftFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MeanShiftFilter.html
BibTeX
@misc{reference.wolfram_2026_meanshiftfilter, author="Wolfram Research", title="{MeanShiftFilter}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MeanShiftFilter.html}", note=[Accessed: 03-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_meanshiftfilter, organization={Wolfram Research}, title={MeanShiftFilter}, year={2025}, url={https://reference.wolfram.com/language/ref/MeanShiftFilter.html}, note=[Accessed: 03-November-2026]}