MATLAB Answers

How to display two images into one figure without blocking each other?

3 views (last 30 days)
Veronika
Veronika on 23 Apr 2017
Commented: Veronika on 24 Apr 2017
Dear all,
I have two images in jpg format. I would like to these two images display in one figure lay on each other and without blocking each other. Is it possible?
I attach these two images. Thank you for your answers.

  0 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 23 Apr 2017
Yes, just stitch them together
wideImage = [image1, image2]; % Have the same number of rows.
or else use imfuse() or imshowpair(). Or put them into separate axes.

  5 Comments

Show 2 older comments
Veronika
Veronika on 24 Apr 2017
Now, I don´t deal this problem, but I have this figure:
but I would like to have this image:
This is my code:
fontSize = 15;
% baseFileName = '110.jpg';
baseFileName = 'thorax-mdl.jpg';
folder = pwd
fullFileName = fullfile(folder, baseFileName);
% Načtení obrazu.
grayImage = imread(fullFileName);
grayImage_pater = imread (fullFileName);
% Dimenze obrazu.
% numberOfColorBands by měl být = 1.
% ***
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
% Máme barevný obraz, musíme ho převést na černobílý = vybereme zelený kanál
grayImage = grayImage(:, :, 2); % zelený kanál
end
eq_grayImage = histeq(grayImage);%ekvalizace pomocí histogramu obrazu
[rows, columns, numberOfColorChannels] = size(grayImage_pater);
if numberOfColorChannels > 1
% Máme barevný obraz, musíme ho převést na černobílý = vybereme zelený kanál
grayImage_pater = grayImage_pater(:, :, 2); % zelený kanál
grayImage_pater(425:end, :) = 0;
end
eq_grayImage_pater = histeq(grayImage_pater);
thresholdValue = 170;
binaryImage = grayImage < thresholdValue;
% Odstranění okolí.
binaryImage = imclearborder(binaryImage);
% Vyplnění otvorů.
binaryImage = imfill(binaryImage, 'holes');
se = strel('line',5,100);
%binaryImage= imdilate(binaryImage,se);
% Práh pro vytvoření binárního obrazu páteře.
bodyMask = grayImage > 128;
% Get rid of white surround.
bodyMask = imclearborder(bodyMask);
% Extract the largest blob only.
bodyMask = bwareafilt(bodyMask, 1);
binaryImage_pater = bodyMask & (grayImage > 220);
% Fill holes.
binaryImage_pater= imfill(binaryImage_pater, 'holes');
binaryImage_pater = bwareaopen(binaryImage_pater,197);
%Find areas.
labeledImage = bwlabel(binaryImage_pater);
se = strel('line',5,100);
%binaryImage_pater= imdilate(binaryImage_pater,se);
%Práh pro vytvoření binárního obrazu okolí
thresholdValue = 180;
binaryImage_okoli = eq_grayImage > thresholdValue;
% Odstranění okolí.
binaryImage_okoli = imclearborder(binaryImage_okoli);
% Vyplnění otvorů.
binaryImage_okoli = imfill(binaryImage_okoli, 'holes');
% Vymazání menších otvorů.
binaryImage_okoli = bwareaopen(binaryImage_okoli, 750);
se = strel('line',5,100);
Npts1 = 20; % počet bodů interpolovaných hranic
Ncomps = 20; % počet fourierových komponentů
shape.thorax=Model(binaryImage_okoli,Ncomps,100);
figure()
tmp=shape.thorax{1};
se = strel('square',5);
erodedBW = imerode(binaryImage_okoli,se);
% erodedBW_plice = imerode(handles.binaryImage,se);
shape.thorax=Model(erodedBW,Ncomps ,30);
tmp = shape.thorax{1};
plot(tmp(:,2), tmp(:,1), 'o-b')
Can you advice me, how transform this curve?
Image Analyst
Image Analyst on 24 Apr 2017
Try
ax = gca; % Get handle to current/last used axes control.
ax.YDir = 'reverse'; % Flip it top to bottom.

Sign in to comment.


Translated by