Overlay a plot on an image
이전 댓글 표시
Hi,
I have to overlay a plot on a image. Here is my code:
Imm = imread('imageLeft.png');
figure()
imshow(Imm)
hold on
plot(pos_sensor_Lx,pos_sensor_Ly,'-o')
where Imm is the image (634x484x3 uint 8) while pos_sensor_Lx and pos_sensor_Ly are two column vectors 3487x1 double with values all normalized between [0;1].
When I plot the vectors and the image separately, I get this results:


Overlaying them, I ideally had to see the scan path well distribuited on the white and red dots of the image. Anyway when I overlay them I can't see the scan path over the image because of the very small values of the vector elements. Here the result I get:

All the values are clustered as shown.
Is there a way to adjust the image dimensions or the value of the vector elements to get the result I want?
Thank you
댓글 수: 4
Rik
2021년 2월 8일
The scale of your points is fairly small. Do those units represent pixels? Normalized location? Something else?
Using daspect([1 1 1]) will also do something you might want.
KALYAN ACHARJYA
2021년 2월 8일
편집: KALYAN ACHARJYA
2021년 2월 8일
@Federica In the image, pixels are positioned based on Indices [0-r] and [0-c] in both in y and x direction. In the 2nd data, the values within 0-1, you may check for the normalize the 2nd data with repect to the 1st one?
Actually how do consider the maping of 2nd data with respect to image indices?
채택된 답변
추가 답변 (1개)
Ravi Kumar Pallantla
2022년 8월 10일
0 개 추천
There is a script in file exchange to plot data on an image file. Hope it will be helpful to you.
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!