Error with permute function : which order to use??

14 views (last 30 days)
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!!

Accepted Answer

Walter Roberson
Walter Roberson on 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])

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!