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

1 回表示 (過去 30 日間)
ajith
ajith 2012 年 9 月 11 日
HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 9 月 11 日
Could you give a small example?
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by