Calculating the speed of moving object

7 ビュー (過去 30 日間)
Benjamin Dempsey
Benjamin Dempsey 2016 年 2 月 22 日
回答済み: Anish Mitra 2016 年 2 月 25 日
I would like to calculate the speed of moving object, i used the code below as a help to track object. How would i calculate the distance the centroid travels after each frame? Thanks

回答 (1 件)

Anish Mitra
Anish Mitra 2016 年 2 月 25 日
You can save the centroid results into a different variable at the end of every loop - 'centroids_old', and then compute the Euclidean distance between 'centroids_old' and 'centroids' for every row.
distCovered(k) = sqrt(sum((centroids(k,:)-centroids_old(k,:)).^2));
You will have to take care of boundary cases, where a track is lost (a row in centroids deleted) or a track is created (a row added in centroids).

カテゴリ

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