필터 지우기
필터 지우기

Plot graph from tracked points in 2D pictures

조회 수: 8 (최근 30일)
Henning
Henning 2022년 12월 3일
댓글: Image Analyst 2022년 12월 3일
In some Video i tracked an moving object. I extract the width and height in pixels and set these values as limit for my plot diagram. Now i want to get the tracked points in the diagram.
What I'm currently doing:
% read, track, display points and results in each frame
while hasFrame(videoReader)
frame = readFrame(videoReader);
[points,validity] = tracker(frame);
out = insertMarker(frame,points(validity, :),'+');
writeVideo(v1, out);
videoPlayer(out);
end
close(v1);
release(videoPlayer);
% draw diagram with position of tracked markers as graph
plot(points(:,1),points(:,2));
xlim([0 imageWidth])
ylim([0 imageHeight])
imageWidth and imageHeight are getting extracted from the first frame. The plotting is actually showing something, but the graph is not corresponding to my real tracked points. The Image is a 2D image, like looking from top on a table. So i only need x and y coordinates in pixels of the points and plot them.
What am I doing wrong?

채택된 답변

Image Analyst
Image Analyst 2022년 12월 3일
이동: Image Analyst 2022년 12월 3일
Are you sure points is in the form (x,y) and not (row, column) because if it were the plot would be rotated 90 degrees.
Why not display the last frame and plot the points over it?
imshow(frame);
hold on
axis('on', 'image')
plot(points(:,1), points(:,2), 'r.-', 'LineWidth', 2, 'MarkerSize', 30);
  댓글 수: 2
Henning
Henning 2022년 12월 3일
이동: Image Analyst 2022년 12월 3일
oh yes, you are absolutely right.
Your solution works perfect and indeed loks great. Thanks for the quick answer. I am new to MATLAB so i had no idea :D
Image Analyst
Image Analyst 2022년 12월 3일
OK, then can you please click the "Accept this answer" link? Thanks in advance. 🙂

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by