Clear Filters
Clear Filters

How to show four sub sections of two images separately in a single window???

1 view (last 30 days)
Img=read('A.jpg');
a=imresize(img,[300 200]);
Img(a)

Accepted Answer

KSSV
KSSV on 13 Apr 2017
I=imread('peppers.png');
imshow(I)
%%split the image into four parts
[m,n,p] = size(I) ;
I1 = imcrop(I,[1,1,m/2,n/2]) ;
I2 = imcrop(I,[m/2,1,m,n/2]) ;
I3 = imcrop(I,[1,n/2,m/2,n]) ;
I4 = imcrop(I,[m/2,n/2,m,n]) ;
figure
subplot(221)
imshow(I1)
subplot(222)
imshow(I2)
subplot(223)
imshow(I3)
subplot(224)
imshow(I4)

More Answers (1)

Walter Roberson
Walter Roberson on 12 Apr 2017
Edited: Walter Roberson on 12 Apr 2017
Remove the line Img(a) as that is wrong. Then
subplot(2,2,1)
imshow(a(1:150,1:100,:));
subplot(2,2,2),
imshow(a(1:150,101:200,:));
subplot(2,2,3)
imshow(a(151:300,1:100,:));
subplot(2,2,4)
imshow(a(151:300,101:200,:));

Community Treasure Hunt

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

Start Hunting!