Error with permute function : which order to use??

3 vues (au cours des 30 derniers jours)
Aude Rapet
Aude Rapet le 8 Nov 2016
Commenté : Aude Rapet le 8 Nov 2016
Hi,
I am using a code written by someone else, and I think he used an older version of Matlab than mine. Anyway, when I try to run the code, I have : "Error using ' Transpose on ND array is not defined. Use PERMUTE instead."
So then I tried to change those lines:
gconv = conv2(image_array',gaussian_kernel','same');
gconv = conv2(gconv',gaussian_kernel'),'same');
into (with permute) :
gconv = conv2(permute(image_array,[2 1]),permute(gaussian_kernel,[2 1]),'same');
gconv = conv2(permute(gconv,[2 1]),permute(gaussian_kernel,[2 1]),'same');
But I have this error message :
Error using permute
ORDER must have at least N elements for an N-D array.
Error in bpass (line 125)
gconv = conv2(permute(image_array,[2 1]),permute(gaussian_kernel,[2 1]),'same');
I read in the documentation that Given any matrix A, the statement " permute(A,[2 1]) " is the same as A.'.
But it is not working in my case...what should I change?
Thank you very much for your help!!

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Nov 2016
You are working with an RGB array and trying to treat it as if it is a grayscale array.
permute(image_array, [2 1 3])
  1 commentaire
Aude Rapet
Aude Rapet le 8 Nov 2016
Thank you very much Walter!!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by