image and its intensity profile on one plot
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gefen Livne
el 31 de Mayo de 2021
Comentada: Gefen Livne
el 25 de Jul. de 2021
Hi
I created the intensity profile, but would like to plot it on the original image, at the place were I measured it, with the proper scale.
I need it to be in one figure and not in subplots like I used in the code.
the code and the image are attached below.
appreciate your help.
thanks, Gefen
I=imread('Composite (RGB).tif');
% imshow(I)
%improfile(I)
x = [0 size(I,2)];
y = [size(I,1)/2 size(I,1)/2];
c = improfile(I,x,y);
figure
subplot(2,1,1)
imshow(I)
hold on
plot(x,y,'r')
subplot(2,1,2)
plot(c(:,1,1),'r')
hold on
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')
0 comentarios
Respuesta aceptada
Hrishikesh Borate
el 23 de Jul. de 2021
Hi,
The following code demonstrates a few possible approaches to display the intensity profile and it’s image in one plot.
I=imread('peppers.png');
% imshow(I)
%improfile(I)
x = [0 size(I,2)];
y = [size(I,1)/2 size(I,1)/2];
c = improfile(I,x,y);
a = normalize(squeeze(c),'range');
figure;
subplot(1,3,1)
imagesc(flipud(I))
set(gca,'YDir','normal')
axis on;
hold on;
plot(x,y,'r')
plot(c(:,1,1),'r')
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')
title('Original')
hold off;
subplot(1,3,2)
imagesc(flipud(I))
set(gca,'YDir','normal')
axis on;
hold on;
plot(x,y,'r')
plot(c(:,1,1)+y(1),'r')
plot(c(:,1,2)+y(1),'g')
plot(c(:,1,3)+y(1),'b')
title('Shifted, Not Scaled')
ylim([0 max(c(:))+y(1)])
hold off;
subplot(1,3,3)
imagesc(flipud(I))
set(gca,'YDir','normal')
axis on;
hold on;
plot(x,y,'r')
plot((a(:,1)+1)*y(1),'r')
plot((a(:,2)+1)*y(1),'g')
plot((a(:,3)+1)*y(1),'b')
title('Shifted and Scaled')
hold off;
Más respuestas (0)
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!