简体   繁体   中英

Getting the total number of frames to write it into BVH file while recording with kinect

I'm trying to write skeleton data into BVH file, for that I need to get the total number of frames and write it before the joints data as the hierarchy of the bvh file is. The function SensorSkeletonFrameReady allows me to have the frame number but I'm using this function to extract the joints data of each frame and write it directly into bvh file.

Can anyone help me, please?

BVH files have the total number of frames represented in the file. It is impossible to know this number until you are done recording.

Using the SkeletonFrameReady event you could:

  1. save the data to a List (or some other array type structure)
  2. stop recording and count the number of frames (ie, List items)
  3. write your file, with the total frames

... or ...

  1. output the file in real-time (as you indicate in your question), keeping a running total of the frame count
  2. stop recording and close the file as best you can
  3. re-open the file, seek to your "frames" line and enter the appropriate value you've stored

... or ...

  1. output the skeleton tracking data in real-time
  2. keep seeking back to the point in your file where the frames are defined and keep updating it, then seek back to the end to write the next frame.

I'm not really taking that last one too seriously. But it all comes down to the fact that you don't know the number of frames until you are done! You have to complete your recording first, before you output that line in the file.

Unless you recording really long sessions, storing your data in a List and then writing the data file once you've stopped is the most straight forward means. In my opinion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM