MATLAB Answers

Auto Image Reading and Resizing

4 views (last 30 days)
Chandra Bhushan
Chandra Bhushan on 29 May 2020
Commented: Mohammad Sami on 29 May 2020
Suppose There is a Directory Names "Database"
It contains 1000 plus image file
I want to read all the images of the folder Database
and Resize it to a new size of M x N
and sequentially keep showing rezied images in imshow
Suggest a minimal line for this task

  1 Comment

Mehmed Saad
Mehmed Saad on 29 May 2020
what have you done so far. Show us your code

Sign in to comment.

Answers (1)

Mohammad Sami
Mohammad Sami on 29 May 2020
If you have deep learning toolbox, this can be easily acheieved with the augmented Image Data Store.
a = imageDatastore(foldername,'IncludeSubfolders',true);
size = [m n 3]
a = augmentedImageDatastore(size,a);

  2 Comments

Mohammad Sami
Mohammad Sami on 29 May 2020
If you do not have deep learning toolbox you can use the transform function on image datastore to achieve the same results.
a = imageDatastore(foldername,'IncludeSubfolders',true);
m = 224;
n = 224;
targetSize = [m,n];
imdsReSz = transform(a,@(x) imresize(x,targetSize));

Sign in to comment.