画像のサイズを変えたい I want to change the size of the image

8 次查看(过去 30 天)
元画像200×200×3のイメージサイズ imds(1 ×1 ImageDatastore)に The image size imds (1 × 1 ImageDatastore) of the original image 200 × 200 × 3
imageSize = [28 28 1];
   auimds = augmentedImageDatastore(imageSize,imds)
とすると28×28×3のイメージサイズになります。28×28×1にするためにはどうすればいいですか?
Then it becomes the image size of 28 × 28 × 3. How can I make it 28 × 28 × 1?

采纳的回答

Kei Otsuka
Kei Otsuka 2018-7-13
编辑:Kei Otsuka 2018-7-13
augmentedImageDatastoreで指定できる出力画像サイズは行・列のみ有効となります。
28x28x3から28x28x1への変更(ex, RGBからグレースケールへの変更等)が必要な場合は、
imageDatastoreのReadFcnとして関数指定することで行うことができます。
例えばですが、以下のような関数を作成し、
function Iout = myrgb2gray(filename)
I = imread(filename);
Iout = rgb2gray(I);
end
ReadFcnとして利用します。
imds.ReadFcn = @(filename)myrgb2gray(filename);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 イメージを使用した深層学習 的更多信息

Community Treasure Hunt

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

Start Hunting!