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

조회 수: 2 (최근 30일)
HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING
  댓글 수: 2
ajith
ajith 2012년 9월 12일
편집: ajith 2012년 9월 13일
for example
1 2 4
2 5 6
1 3 8
to move the diagonal in one pixel like
8 6 4
3 1 2
1 2 5
and give detail about m*n matrix

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 9월 12일
편집: Andrei Bobrov 2012년 9월 12일
I = [1 2 4
2 5 6
1 3 8 ];
ii = 1:size(I,1)+1:numel(I);
I(ii) = I(ii(mod(ii - 2,3)+1));
or
I(eye(size(I))>0) = circshift(diag(I),1);
  댓글 수: 1
ajith
ajith 2012년 9월 12일
편집: ajith 2012년 9월 13일
Thanks a lot sir but i changed the question right now all the elements should change in the diagonal direction for m*n matrix

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

추가 답변 (2개)

Image Analyst
Image Analyst 2012년 9월 11일
How about using circshift()?

Sean de Wolski
Sean de Wolski 2012년 9월 11일
or diag()?
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2012년 9월 12일
편집: Sean de Wolski 2012년 9월 12일
So she's not a deer during hunting season :)
Image Analyst
Image Analyst 2012년 9월 12일
Ah - I thought she was like a rescue dog, locating and pulling people from rubble after earthquakes.

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

Community Treasure Hunt

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

Start Hunting!

Translated by