How can I resize all images within a cell array?

6 ビュー (過去 30 日間)
M J
M J 2020 年 10 月 27 日
コメント済み: Sudhakar Shinde 2020 年 10 月 27 日
Hi everyone,
So I wrote a function that returns a 50x2 table. The first column is a 50x1 cell array (paths to png files) and the second column is a 50x1 categorical array.
I have no problem reading all images of the cell array using the following:
image_content = cellfun(@imread, myTable.result1, 'uniform', 0)
Each image has a different dimension.
I simply want to resize all images of the first column (myTable.result1) to a standard 224x224x3 (with a for loop or simply a function handle?) but it doesn't seem to work. Is there an easy way to do this?
Thank you!
Best regards.

採用された回答

Sudhakar Shinde
Sudhakar Shinde 2020 年 10 月 27 日
編集済み: Sudhakar Shinde 2020 年 10 月 27 日
This could work if your images are size of [MxNx3]:
for i=1:length(image_content)
ResImage{i}=imresize(image_content{i},[224 224]);
end
  2 件のコメント
M J
M J 2020 年 10 月 27 日
Thank you very much !!
Sudhakar Shinde
Sudhakar Shinde 2020 年 10 月 27 日
Welcome

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by