MATLAB: How to segment (divide) an image into 4 equal halves

Image Processing Toolbox

Am working on medical imaging. i have to segment an image into 4 equal parts like 4 quadrants and each segmented image should get displayed separately. can anyone help me with the code?

Best Answer

I1=I(1:size(I,1)/2,1:size(I,2)/2,:);
I2=I(size(I,1)/2+1:size(I,1),1:size(I,2)/2,:);
I3=I(1:size(I,1)/2,size(I,2)/2+1:size(I,2),:);
I4=I(size(I,1)/2+1:size(I,1),size(I,2)/2+1:size(I,2),:);
try this out, it will do