How do I subplot multiple tiles that I divided from a satellite image in one figure?

5 次查看(过去 30 天)
I have to divide my satellite image into 256 tiles of 500 by 500 pixels. I use mat2cell function to do that. After that I want to see the result by displaying in one figure.
Please help me figure out how to subplot it!
Here is my code :
tiles=zeros(500,500);
tiles = mat2cell(TOARef_B{5}, [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 261], [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 101]);
for m=1:16
for n=1:16
subplot(16,16,256); imshow(tiles{m,n});
end
end

采纳的回答

Sriram Tadavarty
Sriram Tadavarty 2020-8-4
Hi Oanh,
You can try the following, since you are there are 16 x 16 tiles.
tiles=zeros(500,500);
tiles = mat2cell(TOARef_B{5}, [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 261], [500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 101]);
k = 1; % to index the subplot
for m=1:16
for n=1:16
subplot(16,16,k); imshow(tiles{m,n});
k = k+1;
end
end
Note, this will create very small sub-tiles since the size is 256.
Hope this helps.
Regards,
Sriram

更多回答(1 个)

KSSV
KSSV 2020-8-4
count = 0 ;
for m=1:16
for n=1:16
count = count+1 ;
subplot(16,16,count); imshow(tiles{m,n});
end
end
Read about montage. This would be better.
  3 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by