How to divide image into three equal parts?

How to split an image in three equal parts. This image is one Image which contains 3 images layered beneth each other I've tried everything to split them but I'm having difficulties, please help. the size of this image is 1024x396 and its unit8

5 Comments

Why have you changed the question?
Anyaya
Anyaya on 20 Apr 2013
Edited: Anyaya on 20 Apr 2013
Thought it was a double post.
What do you mean? Are you dealing with a gray scale image or a 3D true color RGB image? Like each color plane of an RGB image is a layer? Or do you mean that you want to split the image up vertically or horizontally into the top third, middle third, or bottom third (like Azzi did for a gray scale image), or left third, middle third, and right third? Please clarify.
Anyaya
Anyaya on 21 Apr 2013
Edited: Anyaya on 21 Apr 2013
,
Then they are not "layered" they are stacked. Have you tried imcrop()?

Sign in to comment.

 Accepted Answer

[n,m]=size(im) % im is your image
id=fix(n/3)
im1=im(1:id,:);
im2=im(id+1:2*id,:);
im3=im(2*id+1:n,:);

3 Comments

Anyaya
Anyaya on 21 Apr 2013
Edited: Anyaya on 22 Apr 2013
,
Like he said, im is your image variable. In your code you might have read in an image with imread like this
im = imread(fullFileName);
What variable name are you using instead of im in your code?
Thank you Mr. Azzi your answer help me a lot

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!