MATLAB: How to divide an image in two blocks

image processing

How can I divide an image into two halves? Then, after dividing it make each half independent, say
A = top half and
B = the bottom half.
So that I can extract features from each half.

Best Answer

im=imread('yourimage')
n=fix(size(im,1)/2)
A=im(1:n,:,:);
B=im(n+1:end,:,:)
imshow(A)
figure
imshow(B)