Topic: kinovea with pose estimation software

Since my sons began playing tennis, I am considering numerically / visually understanding the tennis for kids.
Kinovea is good for that.

In order to make "tracking" easier, I wrote a script to convert the output of OpenPose, open source pose estimation software, to Kinovea format.

This is a sample movie without hand tracking. (Click "View Raw")
https://github.com/sitony/kinovea/blob/ … ressed.mp4

I uploaded the script and the usage on same github site.
github.com/sitony/kinovea


I hope you will find it useful.

Re: kinovea with pose estimation software

Wow, this is awesome!

3 (edited by getpa 2018-Nov-05 14:42:52)

Re: kinovea with pose estimation software

Dear siton,
amazing!
Thank you for sharing!

Correct me if I am wrong, but one possible scenario (someone using already?) would be

- sample .avi video
- run through OpenPose with your .kva output script
- open .avi & .kva in Kinovea
- use the linear / angular kinematics tools for analyses (am I taking shortcuts here?)
- export / use results for ...

have to consider accuracy, though... but it looks really awesome

Re: kinovea with pose estimation software

Thank you for your replies.

Dear getpa,

You are correct.


I added another sample files in github.com/sitony/kinovea/sample

tennis.mp4: target video
tennis_openpose.png: screen image of running OpenPose
tennis_json.zip: output files from OpenPose
tennis.kva: output file from my script
tennis_saved.kva: I adjusted the location of the labels by hand.

If you want to open "tennis.kva" in your Kinovea,
Please first open "tennis.mp4" alone, save it in .avi format and use it with tennis.kva.
(Because of file size, AVI file could not be uploaded.)

... I don't know why, but it is fun to see people with many labels:)


I think, angular kinematics tool needs angle marker.
Kinovea cannot convert from track marker to another type of marker such as angle marker.

I want to be able to convert it to another type marker, in script. Just a plan...

Re: kinovea with pose estimation software

I tracked down the issue with the mp4 file.
The problem is when the KVA is imported in Kinovea. It's a bug in Kinovea I don't think you can work around it in the script. The mp4 file has timestamps that don't start at zero and when the track data is imported it wasn't adjusted to take that into account.

I want to be able to convert it to another type marker, in script. Just a plan...

Yes that would be great. As you may have noticed the tracking for angles and other drawings is handled differently. It's using the Trackability block at the end of the KVA and each point in each drawing has its own timeline there. The "id" field on TrackableDrawing references a drawing declared earlier in a Keyframe block.

It would be super cool to convert the OpenPose json into a tracked human figure. We can create a suitable custom tool to match the number of points output from OpenPose.

It's using 25 keypoints right?
Are all the keypoint locations always filled even when part of the body is occluded? If yes that would simplify things a lot.

Re: kinovea with pose estimation software

I made a custom tool that matches the OpenPose's BODY_25 human model as per this documentation page. You can download it here: openpose_body25.xml.

It needs to be copied to Kinovea installation directory > DrawingTools > Custom.

Optional: in order to see it in the toolbar, you can add it by name to the player.xml file in DrawingTools > Toolbars. I also uploaded a premodified player.xml here.

I tracked the tennis video manually for a few frames with this tool to create a reference file. I uploaded the resulting KVA here.

Note: This kva is for the .mp4 video. Also, I just realized that if you try to open this kva without having copied the custom tool it will crash, so make sure you have the openpose_body25.xml copied under DrawingTools > Custom.

So this kva has the expected format for a full body pose tracked over time, that would ideally be generated by the conversion script from the OpenPose output. Basically there needs to be a keyframe with a GenericPosture drawing with a GUID (can be random), and then a Trackable drawing referencing this GUID. The trackable drawing contains timelines for each point.

Let me know of any issue if you start playing with this.

Re: kinovea with pose estimation software

Can I just copy and paste the premodified player.xml file as is, Joan?

Re: kinovea with pose estimation software

Yes, you can paste it under DrawingTools > Toolbars. The only difference is that there is an extra entry for the new custom tool. After closing and reopening Kinovea there should now be 3 custom tools with a human figure icon, the bottom one is the new one. The file for the custom tool itself has to be copied to DrawingTools > Custom.