How can I randomly select 1000 small matrix like 11X11 from 7081X7811 matrix size?
Afficher commentaires plus anciens
I have 7081X7811 size of matrix which have image pixel values, want to randomly select small matrix of size 11X11.
Right now, I am reading one small matrix like:
[A, R] = geotiffread('...tif'); %reading .tif image
%(200,1414) this center for below matrix
i0 = 200;
j0 = 1414; %center of small 11X11 matrix
[row, col] = size(A);
A_small = A((i0-5):(i0+5),(j0-5):(j0+5));
can you guys please help me in this?
Réponse acceptée
Plus de réponses (1)
David Hill
le 15 Mar 2022
r=randi(7070,1000,1);
c=randi(7800,1000,1);
for k=1:1000
newMatrix(:,:,k)=yourMatrix(r(k):r(k)+11,c(k):c(k)+11);
end
1 commentaire
Torsten
le 15 Mar 2022
I think
r=randi(7071,1000,1);
c=randi(7801,1000,1);
for k=1:1000
newMatrix(:,:,k)=yourMatrix(r(k):r(k)+10,c(k):c(k)+10);
end
instead of
r=randi(7070,1000,1);
c=randi(7800,1000,1);
for k=1:1000
newMatrix(:,:,k)=yourMatrix(r(k):r(k)+11,c(k):c(k)+11);
end
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!