How do I vertically segment a image in three parts?

1 visualización (últimos 30 días)
Sumita Das
Sumita Das el 20 de Sept. de 2016
Editada: Abdullah Al el 30 de Oct. de 2020
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 comentario
Adam
Adam el 20 de Sept. de 2016
Just use standard array indexing as you would to divide up any array into subarrays.

Iniciar sesión para comentar.

Respuesta aceptada

Gopichandh Danala
Gopichandh Danala el 22 de Sept. de 2016
Editada: Gopichandh Danala el 22 de Sept. de 2016
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

Más respuestas (1)

zelalem tsegaye
zelalem tsegaye el 7 de Ag. de 2019
it worked perfectly for me thank you!!!

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by