max and min value of matrix
Mostrar comentarios más antiguos
I have AB matrix that contains 3000x2000 grids data.
AB =
(1,1) (1,2) (1,3) (1,4) ... (1,3000)
(2,1) (2,2) (2,3) (2,4) ... (2,3000)
(3,1) (3,2) (3,3) (3,4) ... (3,3000)
(4,1) (4,2) (4,3) (4,4) ... (4,3000)
(5,1) (5,2) (5,3) (5,4) ... (5,3000)
...
...
...
(2000,1)
I want to calculate (MAX-MIN) value for each 3x5 grids in matrix AB
For Example :
If target grid is (3,2), I use 15 grids data (1~5,1~3) for calculation of MAX and MIN.
And if MAX is (1,1) and MIN is (2,3), then (MAX-MIN) at (3,2) is ((1,1)-(2,3)).
In the same way, if target grid is (3,3), I use (1~5,2~4).
Can you help me to make automatic script to calculate this??
2 comentarios
Stephen23
el 6 de En. de 2017
@Ashvin Hamzah Driwantara: your question is not clear. Please edit your question and provide us with complete input and output examples so that we can write and test code.
Ashvin Hamzah Driwantara
el 6 de En. de 2017
Respuesta aceptada
Más respuestas (4)
Guillaume
el 6 de En. de 2017
I believe Ashvin is looking for nlfilter rather than blockproc. I.e., he wants sliding overlapping blocs instead of adjacent blocks. So:
nlfilter(X, [3 5], @(block) std(block(:)));
1 comentario
Ashvin Hamzah Driwantara
el 6 de En. de 2017
Editada: Ashvin Hamzah Driwantara
el 6 de En. de 2017
Ashvin Hamzah Driwantara
el 6 de En. de 2017
6 comentarios
Stephen23
el 6 de En. de 2017
@Ashvin Hamzah Driwantara: read my answer and comments again.
Ashvin Hamzah Driwantara
el 6 de En. de 2017
Editada: Ashvin Hamzah Driwantara
el 6 de En. de 2017
Stephen23
el 6 de En. de 2017
@Ashvin Hamzah Driwantara: do you wish for all pixels within one block to have the same value?
Ashvin Hamzah Driwantara
el 6 de En. de 2017
@Ashvin Hamzah Driwantara: your explanation is not clear. If each block does not generate one value, then you will need to explain in more detail, and provide input and output sample matrices so that we can test code. Until you provide a clear explanation of what you want there is nothing more that I can do for you.
Ashvin Hamzah Driwantara
el 6 de En. de 2017
Ashvin Hamzah Driwantara
el 7 de En. de 2017
Zeeshan Salam
el 24 de Mzo. de 2019
0 votos
i=3:3:smax what is meaning of this?
Categorías
Más información sobre Neighborhood and Block Processing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
