HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING

4 次查看(过去 30 天)
how to move the array
1 4 6
8 2 3
7 9 5
all elements are move diagonally one pixel for m*n matix
  3 个评论

请先登录,再进行评论。

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-9-13
I = [
1 4 6
8 2 3
7 9 5]; % initial array
idx = reshape(1:numel(I),size(I));
for jj = -size(I,1) + 2 : size(I,2) - 2
a = diag(idx,jj);
I(a) = I(circshift(a,1));
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by