MATLAB Answers


How to divide image into three equal parts?

Asked by Anyaya
on 20 Apr 2013

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


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.

on 21 Apr 2013


on 21 Apr 2013

Then they are not "layered" they are stacked. Have you tried imcrop()?


No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek
on 20 Apr 2013
Edited by Azzi Abdelmalek
on 20 Apr 2013
 Accepted answer

[n,m]=size(im)   % im is your image


on 21 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?

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!