Borrar filtros
Borrar filtros

Error with permute function : which order to use??

7 visualizaciones (últimos 30 días)
Aude Rapet
Aude Rapet el 8 de Nov. de 2016
Comentada: Aude Rapet el 8 de Nov. de 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!!

Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Nov. de 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])

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by