How to draw trajectory line from detected object
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Leona Chan
el 8 de Oct. de 2017
Comentada: Leona Chan
el 10 de Oct. de 2017
How can I draw the trajectory line on detected object from video? The object will move from fig1.jpg position to fig2.jpg position. How can I get the red point position and draw the trajectory line? Would you please help, thanks.
0 comentarios
Respuesta aceptada
Image Analyst
el 8 de Oct. de 2017
I would think that plot should be able to do it:
hold on;
plot([x1,x2], [y1,y2], 'r-', 'LineWidth', 2);
You just need to use the x and y that you used to draw the red spots, which you should already have since I see them in your images.
3 comentarios
Image Analyst
el 8 de Oct. de 2017
Not exactly where the red spot should go, but I think you can erode the binary image until the "shaft" is gone and all that's there is the "head" of the golf club. Then get the centroid.
binaryImage = imerode(binaryImage, true(3)); % Get rid of shaft.
binaryImage = bwareafilt(binaryImage, 1); % Take only the largest remaining blob.
props = regionprops(binaryImage, 'Centroid'); % Find centroid of blob.
x = props.Centroid(1);
y = props.Centroid(2);
Más respuestas (0)
Ver también
Categorías
Más información sobre Tracking and Motion Estimation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!