pythontensorflowdeep-learningclassificationopenpose

How do I use OpenPose data to segment a long clip?


I love the OpenPose library -- and I've been playing with the demo for a while. I like the option of it spitting out JSON file data of the poses.

I wanted to ask -- are there any examples I've missed or solutions where someone takes that pose keypoints data and uses it to segment a long clip?

For example: If I wanted to cut a clip of one person punching the other -- and use that to train a network to segment a different longer clip to TRIM only the punch if any in the other clip.

Any help would be appreciated. Using Python/Tensorflow


Solution

  • OpenPose analyzes each frame of the video. You just need to step into it to run your analysis and decide if you save that part or not.

    You can import the video as a CV VideoCapture, extract each frame into cv Mat, convert using CV2OPMAT, exctract keypoints and run your "punch detection" on a frame. You can reference OpenPose examples for image analysis. If the frame qualifies save the frame before conversions (CV MAT) back to video using CV Video Writer like in this example: https://www.life2coding.com/convert-image-frames-video-file-using-opencv-python/

    Extra consideration, you may need to convert pixels into BGR format using CV CVTCOLOR.

    Let me know if it works :)