how to draw lines using given points in a video?

23 ビュー (過去 30 日間)
vimal gayan
vimal gayan 2019 年 5 月 17 日
コメント済み: vimal gayan 2019 年 5 月 24 日
First,I give some points to starting posistion of the video,I need to draw lines through that points and get angles using x,y values,
Currently i able add points and get x,y values of those points while video playing.
videoFileReader = vision.VideoFileReader('ex.mp4');
videoPlayer = vision.VideoPlayer('Position',[1,10,1280,720]);
objectFrame = videoFileReader();
objectRegion = [264,122,93,93];
figure;
imshow(objectFrame);
[shoulder_X,shoulder_Y]= ginput(1);
[elbow_x,elbow_y]= ginput(1);
[wrist_x,wrist_y]= ginput(1);
pos = [shoulder_X,shoulder_Y;elbow_x,elbow_y;wrist_x,wrist_y];
color = {'red','green','magenta'};
start_x = shoulder_X;
start_y=shoulder_Y;
disp(shoulder_X +" - "+shoulder_Y);
% imshow(pointImage);
points = detectMinEigenFeatures(rgb2gray(objectFrame));
pointImage1 = insertMarker(objectFrame,pos,'+','Color',color,'size',10);
plot([shoulder_X,shoulder_Y], [elbow_x,elbow_y]);
plot([wrist_x,wrist_y], [elbow_x,elbow_y]);
figure;
imshow(pointImage1);
title('Detected interest points');
tracker = vision.PointTracker('MaxBidirectionalError',1);
initialize(tracker,pos,objectFrame);
while ~isDone(videoFileReader)
frame = videoFileReader();
[points,validity] = tracker(frame);
out = insertMarker(frame,points(validity, :),'+');
videoPlayer(out);
disp(points);
end
Capturesd.PNG
As shown in above image,
Black circle: current status of my code,and these points move when video playing,
Red Circle:I need to improve red circle to this level.and these lines should move when video playing.
I try to draw lines using plot function but its not work.
plot([shoulder_X,shoulder_Y], [elbow_x,elbow_y]);
plot([wrist_x,wrist_y], [elbow_x,elbow_y]);
  2 件のコメント
darova
darova 2019 年 5 月 17 日
try
plot([shoulder_X elbow_x wrist_x shoulder_X], ...
[shoulder_Y elbow_y wrist_y shoulder_Y])
vimal gayan
vimal gayan 2019 年 5 月 17 日
not working :(

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

採用された回答

Mark Sherstan
Mark Sherstan 2019 年 5 月 17 日
Use insertShape(). Cool project!
  10 件のコメント
vimal gayan
vimal gayan 2019 年 5 月 24 日
編集済み: vimal gayan 2019 年 5 月 24 日
got it,It works now as i want.Thanks for the continues help.
vimal gayan
vimal gayan 2019 年 5 月 24 日

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTracking and Motion Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by