How can I randomly select 1000 small matrix like 11X11 from 7081X7811 matrix size?
古いコメントを表示
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?
採用された回答
その他の回答 (1 件)
David Hill
2022 年 3 月 15 日
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 件のコメント
Torsten
2022 年 3 月 15 日
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
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!