How do I vertically segment a image in three parts?

4 ビュー (過去 30 日間)
Sumita Das
Sumita Das 2016 年 9 月 20 日
編集済み: Abdullah Al 2020 年 10 月 30 日
One of the module of my project requires me to divide a page into three parts, and then discard the middle one. Then I have to work with the 1st and the 3rd part? How do I segment my image into three parts?
  1 件のコメント
Adam
Adam 2016 年 9 月 20 日
Just use standard array indexing as you would to divide up any array into subarrays.

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

採用された回答

Gopichandh Danala
Gopichandh Danala 2016 年 9 月 22 日
編集済み: Gopichandh Danala 2016 年 9 月 22 日
You didn't provide the actual image but gave a mapped image I used it instead.
Here is the code:
% paper split
img = imread('paper.jpg');
%imshow(img, []);
[nrows ncols dim] = size(img);
% Get the slices colums wise split equally
img1 = img(:,1:ncols/3,:);
img2 = img(:,(ncols/3)+1:2*ncols/3,:);
img3 = img(:,(2*ncols/3)+1:ncols,:);
figure,
subplot(1,3,1), imshow(img1,[]); title('first part');
subplot(1,3,2), imshow(img2,[]); title('second part');
subplot(1,3,3), imshow(img3,[]); title('third part');
Let me know if this is your requirment
  1 件のコメント
Abdullah Al
Abdullah Al 2020 年 10 月 30 日
編集済み: Abdullah Al 2020 年 10 月 30 日
Thank you veruy much

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

その他の回答 (1 件)

zelalem tsegaye
zelalem tsegaye 2019 年 8 月 7 日
it worked perfectly for me thank you!!!

Community Treasure Hunt

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

Start Hunting!

Translated by