MATLAB Answers

I have three different images and I want to take a small cross-section from all the three and then plot it on the same graph in order to make a comparison. Can anyone help me?

1 view (last 30 days)
Aqiba Hafeez
Aqiba Hafeez on 11 May 2020
Commented: Aqiba Hafeez on 11 May 2020
The three images are of 600*600. I want to cut a small portion from the figure like 330-353 along x-axis for each.

  0 Comments

Sign in to comment.

Answers (1)

Mehmed Saad
Mehmed Saad on 11 May 2020
Edited: Mehmed Saad on 11 May 2020
im1 = imresize(imread('cameraman.tif'),[600 600]);
figure,imshow(im1),axis on
im1_seg = im1(:,330:353);
figure,imshow(im1_seg)
For comparing three different images you can use subplots ( drawing them on three different axes)
or if there size is same then you can draw them on 1 axes with seperation
For example
im1 = imresize(imread('cameraman.tif'),[600 600]);
im2 = imresize(imread('moon.tif'),[600 600]);
im3 = imresize(imread('canoe.tif'),[600 600]);
%%
im1 = im1(:,330:353);
im2 = im2(:,330:353);
im3 = im3(:,330:353);
%%
sepr = 255*ones(600,4);
figure,imshow([im1 sepr im2 sepr im3])
Edit:
For colored images
im4 = imresize(imread('car_2.jpg'),[600 600]);
figure,imshow(im4),axis on
im1_seg = im4(:,330:353,:);
figure,imshow(im1_seg)

Products


Release

R2018a

Translated by