フィルターのクリア

split an image into six equal parts

3 ビュー (過去 30 日間)
uma
uma 2020 年 4 月 5 日
回答済み: Image Analyst 2020 年 4 月 5 日
how we can split an image into six equal parts using a loop and then performing enhancement on each part
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日
How do you want to divide the image? Do you want 3 blocks horizontally and 2 blocks vertically or some other arrangement?
uma
uma 2020 年 4 月 5 日
Any arrangement but all should be equally divided.

サインインしてコメントする。

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日
This code shows one example. However, this will only work if the number of pixels in the image can be evenly divided into blocks
I = imread('pears.png');
blocks = mat2cell(I, size(I,1)/2*ones(1,2), size(I,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
  4 件のコメント
uma
uma 2020 年 4 月 5 日
Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日
It seems that the number of pixels in row and column of your images cannot be evenly divided. Is it acceptable if a few pixels are ignored? At maximum, only 1-2 lines of pixels will be deleted.

サインインしてコメントする。


Image Analyst
Image Analyst 2020 年 4 月 5 日

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by