how to plot speed graph from centroid of the detected object in image processing ?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Biswas Lohani V K
el 14 de Mayo de 2016
Comentada: Image Analyst
el 15 de Mayo de 2016
Dear All,
i would like to plot the speed of the detected object moving only in the x direction in real time.(Not y direction) so i have tried with the following code but didn't get the appropriate solution. please find the attached code and graph i have sending with this file. the graph is not correct because i didnt understant how to implement the following formula
speed= distance/ time,
how can i modified the attached code to display the detected object and speed of moving object from centroid only in the x-direction as in the attached figure in real time.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164249/image.jpeg)
hope for your appropriate solution.
Thank you.
0 comentarios
Respuesta aceptada
Image Analyst
el 14 de Mayo de 2016
Add a third axes control. Then get the object alone by cropping it from the entire image using the object's bounding box and the imcrop() function. Then display the cropped image in the third axes.
4 comentarios
Image Analyst
el 15 de Mayo de 2016
Let's assume 1 object. For each frame you should calculate the centroid location. So now you have x and y vectors. You can also keep distance, speed, and acceleration arrays in your loop over frames.
thisDistance = sqrt((x(frame)-x(frame-1)^2+(y(frame)-y(frame-1))^2);
distance(frame) = distance(frame-1) + thisDistance;
frameTime = toc;
speed(frame) = thisDistance / frameTime; % Frame time is like 1/10 or /130 of a second or whatever. use tic and toc to get exact time.
accel(frame) = (speed(frame) - speed(frame-1)) / frameTime;
and so on.
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!