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

3 次查看(过去 30 天)
HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING

采纳的回答

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 个评论
Image Analyst
Image Analyst 2012-9-12
Ah - I thought she was like a rescue dog, locating and pulling people from rubble after earthquakes.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by