grayscale画像のSuperpixels計算について
Show older comments
3 Comments
Hiroyuki Hishida
on 3 May 2021
Matsuura様、
MATLABに実装されているsuper pixelの計算方法は、ご指摘の通り Radhakrishna Achantaの手法になるので、L*a*bに変換する必要があります。https://jp.mathworks.com/help/images/ref/superpixels.html
実装についての調べ方ですが、関数の中身は自作関数か組み込み関数の違いなく、以下で確認することが可能です。
edit function_name
お問い合わせのグレースケール画像のときの処理ですが、R2021aにおいては、163行目からの"function Aout = postProcessInputImage(A,isInputLab)"で処理が行われますが、該当する部分を取り出しますと以下になります。言葉で説明すれば、グレースケールの画像(配列)を3次元方向に拡張(複製)したうえで、rgb2labでL*a*bに変換し、得られた3次元配列の先頭部分だけ取り出します。
grayscaleInput = false;
if ismatrix(A) && ~isa(A,'int16')
grayscaleInput = true;
A = repmat(A,[1 1 3]);
end
if isInputLab
:
elseif isa(A,'int16')
:
else
Aout = rgb2lab(A);
end
if grayscaleInput
Aout = Aout(:,:,1);
end
いかがでしょうか?
なお、"edit"コマンドで中がみれる場合とそうでない場合がございます。
菱田
eri matsuyama
on 3 May 2021
Hiroyuki Hishida
on 3 May 2021
Matsuyama様、 良かったです。
Answers (0)
Categories
Find more on イメージのセグメンテーション 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!