MATLAB: How can i divide this image into 4 piece of image

image processing

hello guys, how can I auto divide these images into 4 small image?I want to cut out the brain place.But I don't know how do it. Thank you for your answer.

Best Answer

I = imread('results.48-1.png.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I1) ;
[nx,ny] = size(I1) ;
strip = I(:,round(ny/2)) ;
A = strip' ;
ii = zeros(size(A));
jj = A > 0;
ii(strfind([0,jj(:)'],[0 1])) = 1;
idx = cumsum(ii).*jj;
for i = 1:max(idx)
figure
imshow(I(idx==i,:,:))
end
Related Question