Reshape image cell array

9 ビュー (過去 30 日間)
Joshitha R
Joshitha R 2020 年 4 月 16 日
コメント済み: Joshitha R 2020 年 4 月 23 日
I have a 1x 225 cell array called 'p'
Each cell has a 434x625x3 rgb image .
I would like to reshape this 'p' to now be of size 434x625x3x15x15
I tried the following
p = load('images.mat').images; %size(p) = 1x 225
pp = reshape(p , [15 15]); %size(pp) = 15x15
pnew = cell(434,625,3,15,15);
for i = 1:15
for j = 1:15
pnew{:,:,:,i,j} = pp{i,j};
end
end
But it does not work .
I know that reshaping as 434x625x3x15x15 will redristube the pixels to completely different locations, that is exactly how I need them.

採用された回答

Jyotsna Talluri
Jyotsna Talluri 2020 年 4 月 20 日
Convert the cell array into Matrix and then reshape the matrix to required dimensions.
p = [c{:}];
pp = reshape(p, [384 512 3 15 15]);
Hope this helps!
  1 件のコメント
Joshitha R
Joshitha R 2020 年 4 月 23 日
Yes this works ! thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by