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 次查看(过去 30 天)
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.

回答(1 个)

Mehmed Saad
Mehmed Saad 2020-5-11
编辑:Mehmed Saad 2020-5-11
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)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by