semanticse​gによるセグメンテー​ション後の画像の保存

5 ビュー (過去 30 日間)
Naoki Miyamoto
Naoki Miyamoto 2018 年 10 月 19 日
回答済み: Naoki Miyamoto 2018 年 10 月 20 日
下記記述によってsemanticsegを実行した後の複数の画像をtempdirのディレクトリに保存したのですが、すべて画素値が0の画像が保存されていました。適切な画像を保存したいのですが、どのように修正すればよいでしょうか。ご助言お願い致します。
dataSetDir = fullfile(toolboxdir('vision'),'visiondata','triangleImages');
testImagesDir = fullfile(dataSetDir,'testImages');
testLabelsDir = fullfile(dataSetDir,'testLabels');
imds = imageDatastore(testImagesDir);
classNames = ["triangle","background"];
labelIDs = [255 0];
pxdsTruth = pixelLabelDatastore(testLabelsDir,classNames,labelIDs);
net = load('triangleSegmentationNetwork');
net = net.net;
tempdir=fullfile('C:\tempdir');
pxdsResults = semanticseg(imds,net,"WriteLocation",tempdir);

採用された回答

Kei Otsuka
Kei Otsuka 2018 年 10 月 19 日
記載して頂いた例の場合、セグメンテーションの結果得られるクラスの数は2ですので、
取り得る輝度値は0か1となります。表現可能な輝度レンジ[0 255]に対して低輝度に分布が偏っているため、
真っ黒な画像に見えているだけではないでしょうか。
  \n 
もし画像の輝度値がすべて0であれば、以下を実行した結果が0になるはずですが、
確認してみてください。
imds2 = imageDatastore(tempdir);
img = readimage(imds2, 1);
sum(img(:))

その他の回答 (1 件)

Naoki Miyamoto
Naoki Miyamoto 2018 年 10 月 20 日
おっしゃる通り、低輝度側に分布が偏っておりました。 ありがとうございました。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!