Speed calculation of a gesture

2 ビュー (過去 30 日間)
Shweta Saboo
Shweta Saboo 2021 年 1 月 1 日
コメント済み: Image Analyst 2021 年 1 月 1 日
I have a gesture and want to calculate its speed. I have got its x and y axis points. How can speed profile of a gesture can be claculated using trajectory points??

回答 (1 件)

Image Analyst
Image Analyst 2021 年 1 月 1 日
  1. Use sqrt to find the distance in pixels it traveled from one frame to the next.
  2. Multiply by your spatial calibration factor to convert from pixels to centimeters.
  3. Divide the distance in cm by the frame time.
Something like
distanceInPixels = sqrt(x1 - x2) ^ 2 + (y1 - y2) ^ 2);
distanceInCm = distanceInPixels * cmPerPixel;
speed = distanceInCm / frameTimeInSeconds;
To get the spatial calibration factor, see attached demo.
  2 件のコメント
Shweta Saboo
Shweta Saboo 2021 年 1 月 1 日
Thanks for the answer. But How to calculate frame time in seconds?
Image Analyst
Image Analyst 2021 年 1 月 1 日
When you open the videoReader, it is the NumberOfFrame property. See the help for videoReader. It might be 1/30 of a second.
frameTimeInSeconds = 1/30; % For standard US (or 1/29.94).

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

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by