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

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

 채택된 답변

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

댓글 수: 1

ajith
ajith 2012년 9월 13일
편집: ajith 2012년 9월 13일
Thanks a lot sir but i need that code for M*N matrix

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Sparse Matrices에 대해 자세히 알아보기

질문:

2012년 9월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by