Superimpose a plot on a picture

7 visualizaciones (últimos 30 días)
Sara Macchiavello
Sara Macchiavello el 22 de Nov. de 2020
Editada: Sara Macchiavello el 22 de Nov. de 2020
Hello,
I have a problem superimposing a plot on an image.
When I do the plot only, I obtain the correct one. But when I apply it on an image I obtain it upside down.
I need the correct version also superimposing it on a picture.
Can someone help me please?
I explain it with images. The first is the correct one and the second the wrong one.
This is the simple code I used:
% Only Scan path plot
plot(xCoord(:,53:73),yCoord(:,53:73), '-o')
hold on
% Start -> green
p2 = plot(xCoord(53),yCoord(53), 'go')
hold on
% Finish -> red
p3 = plot(xCoord(73),yCoord(73), 'ro')
title('Scan-path movimenti oculari')
legend([p2 p3],{'Start','Finish'})
% Image + scan path plot
Imm = imread('image_056_0067.jpg');
figure
imshow(Imm)
hold on
% Scan path plot
plot(xCoord(:,53:73),yCoord(:,53:73), '-o')
hold on
% Start -> green
p2 = plot(xCoord(53),yCoord(53), 'go')
hold on
% Finish -> red
p3 = plot(xCoord(73),yCoord(73), 'ro')
title('Scan-path movimenti oculari')
legend([p2 p3],{'Start','Finish'})

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Nov. de 2020
That's because the origin of images and matrices is at the top (line 1 is the top of the matrix) while with traditional x,y the origin is at the bottom. Try using
axis ij
or
axis xy
You should be able to get what you want by calling the proper axis call.
  1 comentario
Sara Macchiavello
Sara Macchiavello el 22 de Nov. de 2020
Editada: Sara Macchiavello el 22 de Nov. de 2020
Thank you very much!
I tried but it rotate the entire image and the plot too. I put them in different position of the code but I obtain that or no change.
Where or how should I put this line?

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by