L*a*b*色空間にて1成分を取り出し,黒い箇所を除いた合計と平均を取得したい
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
touka kakihara
il 23 Ago 2021
Commentato: touka kakihara
il 25 Ago 2021
以下のような画像があるとき,L*a*b*色空間に変換したのち,各L*,a*b*1成分づつ取り出し,各成分の合計値と合計値を黒い箇所を除く面積で割った平均を所得したいと考えております.
ご教授のほど、よろしくお願いいたします.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/718979/image.jpeg)
0 Commenti
Risposta accettata
Shunichi Kusano
il 24 Ago 2021
黒い部分の値はおそらくL=0,a=0,b=0になっていると思いますので(確認してみてください)、Labの各成分がその値に一致しているところを抜き出してきて、論理積を取れば黒い部分のマスクができます。
maskL = labImg(:,:,1) == 0;
maskA = labImg(:,:,2) == 0;
maskB = labImg(:,:,3) == 0;
mask = maskL & maskA & maskB;
マスクができれば、それ以外の画素の値を抽出できるので、その値から平均値を求めれば完了です。
[l,a,b] = imsplit(labImg); % チャンネルごとに分離
meanL = mean(l(~mask)); % 黒領域以外の画素値を抜き出してきて平均値を計算
meanA = mean(a(~mask));
meanB = mean(b(~mask));
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!