Saving a subplotted blocks in one image with 6 split parts
2 次查看(过去 30 天)
显示 更早的评论
imwrite(img, 'DEN.bmp');
bmp = imread('DEN.bmp');
[Matrix Map] = imread('DEN.bmp');
imshow(Matrix, Map);
[Row Col Layer] = size(bmp);
bmp = imread('DEN.bmp');
blocks = mat2cell(bmp, size(bmp,1)/2*ones(1,2), size(bmp,2)/3*ones(1,3), 3);
count = 1;
for i=1:size(blocks,1)
for j=1:size(blocks,2)
subplot(2,3,count)
imshow(blocks{i,j});
count = count + 1;
end
end
my question is if i use one image in a subplot to have 6 split parts in a block. how can i save them separately in an separate image format. i already forgot how to do this. i only have one image file called DEN.bmp .
0 个评论
采纳的回答
DGM
2022-1-6
I'm going to assume your image isn't an indexed image. If it is, you'll have to carry the map around too.
bmp = imread('peppers.png');
blocks = mat2cell(bmp, size(bmp,1)/2*ones(1,2), size(bmp,2)/3*ones(1,3), 3);
count = 1;
for i=1:size(blocks,1)
for j=1:size(blocks,2)
subplot(2,3,count)
imshow(blocks{i,j});
count = count + 1;
imwrite(blocks{i,j},sprintf('subblock_%d_%d.png',i,j))
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!