I have segmented the file (I) into 4 parts (A, B, C, D) as shown in the matlab code below. How to rejoin theses file. Could u please help as I am working on medical images.

1 view (last 30 days)
I=imread('cameraman.tif'); subplot 334 imshow(I); [r c p]= size(I); %r-rows,c-columns,p-planes A=I(1:r/2,1:c/2,:); B=I(1:r/2,c/2+1:c,:); C=I(r/2+1:r,1:c/2,:); D=I(r/2+1:r,c/2+1:c,:); subplot 332 imshow(A); title('Image part 1'); imwrite(A, 'FirstPart.tif'); subplot 333 imshow(B); title('Image part 2'); imwrite(A, 'SecondPart.tif') subplot 335 imshow(C); title('Image part 3'); imwrite(A, 'ThirdPart.tif') subplot 336 imshow(D); title('Image part 4'); imwrite(A, 'ForthPart.tif')

Answers (1)

Image Analyst
Image Analyst on 10 Dec 2016
Did you know you're writing out A every single time? You're not writing out B, C, and D. Once you fix that, you can just stitch them together after using imread()
A = imread('FirstPart.tif');
B = imread('SecondPart.tif');
C = imread('ThirdPart.tif');
D = imread('ForthPart.tif');
fullImage = [A,B;C,D];
Also read this link to learn how to properly format your code.

Community Treasure Hunt

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

Start Hunting!