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

3 views (last 30 days)
元画像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?
  2 Comments
madhan ravi
madhan ravi on 11 Oct 2018
Are you aware that you flagged your own question as SPAM?
Rena Berman
Rena Berman on 11 Oct 2018
(Answers Dev) Restored edit

Sign in to comment.

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!