Superimpose a plot on a picture

8 Ansichten (letzte 30 Tage)
Sara Macchiavello
Sara Macchiavello am 22 Nov. 2020
Bearbeitet: Sara Macchiavello am 22 Nov. 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'})

Akzeptierte Antwort

Image Analyst
Image Analyst am 22 Nov. 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 Kommentar
Sara Macchiavello
Sara Macchiavello am 22 Nov. 2020
Bearbeitet: Sara Macchiavello am 22 Nov. 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?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by