Superimpose a plot on a picture

8 ビュー (過去 30 日間)
Sara Macchiavello
Sara Macchiavello 2020 年 11 月 22 日
編集済み: Sara Macchiavello 2020 年 11 月 22 日
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'})

採用された回答

Image Analyst
Image Analyst 2020 年 11 月 22 日
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 件のコメント
Sara Macchiavello
Sara Macchiavello 2020 年 11 月 22 日
編集済み: Sara Macchiavello 2020 年 11 月 22 日
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?

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by