3D reconstruction - PYTHON - Adv. CV

 In this article we will try to implement 3D reconstruction from multi-views of human pose on a calibrated system. We already detected the position of the 25 joints store in txt files, to do that we use a deepnet OpenPose which also give a reliability score.


Read the 2DTXT file and draw the keypoints on original video

Each line of the 2DTXT is a frame and lines look like this (r is the reliability score, x is coordinate on X, y is coordinate on Y) : xJ1 yJ1 rJ1 xJ2 yJ2 rJ2 xJ3 yJ3 rJ3....... xJ25 yJ25 rJ25 .
I did this code :

And obtain this result (which is what we want) :


Read the 3DTXT file and draw the keypoints on original video

For this one we have access to a given code by our teacher and the 3DTXT files gives only 15 joints this time :



Some explanation :
  • Create an instance of our object (dbMan) using the folder where data are, our subject and its action.
  • Origin shifting matrix : P01 P12 because we work in 3D this time.
  • Read dataset for all camera into two lists.
  • Load the 2D pose & the 3D pose using the txt files.
  • Open the original video
  • Some checks all things are good.
  • Inside the loop [for each frame] :
    • write in a file (for us it's a video) 
    • [for each point]
      • calculate the position of points using the shifting matrix
      • draw them on the video
  • Release everything      

And what we obtain is this :