Effacer les filtres
Effacer les filtres

How to resize a 4D Matrix

22 vues (au cours des 30 derniers jours)
Sriparna Sen
Sriparna Sen le 24 Sep 2019
Commenté : Sriparna Sen le 24 Sep 2019
I want to resize a 4D matrix with the following dimensions (238,87,60,69) to a 4D matrix with the following dimensions (238,58,40,46).
I tried using the function 'imresizen' as follows:
vtc = xff('DX.vtc');
vtc1 = vtc.VTCData; %vtc.VTCData has the following dimensions (238,87,60,69)
vtc2 = imresizen(vtc1,[238,58,40,46]);
However, I get the following error message:
Error using griddedInterpolant/subsref
Requested 56644x5046x2400x3174 (8111094.2GB) array exceeds maximum array size preference. Creation of arrays greater
than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference
panel for more information.
Error in imresizen (line 71)
Y=reshape(F(yvec),szy);
Is there a way to resize the 4D matrix using another method? Or am I using 'imresizen' incorrectly?
Thank you so much in advance!!!!

Réponse acceptée

Rik
Rik le 24 Sep 2019
Modifié(e) : Rik le 24 Sep 2019
You misunderstood the syntax of the FEX submission imresizen. The second input is a scaling factor, meaning your syntax should look like this:
img4D=rand(238,87,60,69);
wanted_size=[238,58,40,46];
out=imresizen(img4D,wanted_size./size(img4D));
clc,size(out)
  1 commentaire
Sriparna Sen
Sriparna Sen le 24 Sep 2019
Oh, thank you so much!!! Make perfect sense now! Cheers

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by