Error with permute function : which order to use??

조회 수: 3 (최근 30일)
Aude Rapet
Aude Rapet 2016년 11월 8일
댓글: Aude Rapet 2016년 11월 8일
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!!

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 8일
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])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by