Superimpose a plot on a picture

조회 수: 2 (최근 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