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

3 visualizaciones (últimos 30 días)
HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING
  2 comentarios
ajith
ajith el 12 de Sept. de 2012
Editada: ajith el 13 de Sept. de 2012
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

Iniciar sesión para comentar.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 12 de Sept. de 2012
Editada: Andrei Bobrov el 12 de Sept. de 2012
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 comentario
ajith
ajith el 12 de Sept. de 2012
Editada: ajith el 13 de Sept. de 2012
Thanks a lot sir but i changed the question right now all the elements should change in the diagonal direction for m*n matrix

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 11 de Sept. de 2012
How about using circshift()?

Sean de Wolski
Sean de Wolski el 11 de Sept. de 2012
or diag()?
  3 comentarios
Sean de Wolski
Sean de Wolski el 12 de Sept. de 2012
Editada: Sean de Wolski el 12 de Sept. de 2012
So she's not a deer during hunting season :)
Image Analyst
Image Analyst el 12 de Sept. de 2012
Ah - I thought she was like a rescue dog, locating and pulling people from rubble after earthquakes.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by