This is an example of a sketch that accepts poses either from PoseNet, or from a JSON file that was created by P5 PoseNet Recorder.
You can try it out online here.
To create PoseNet files for it, run P5 PoseNet Recorder to create some JSON pose files. You can use the online version of P5 PoseNet Recorder for this.
Move the files into the assets directory in this folder, and optionally rename
them. Modify the array that is used as an argument to loadPoseFiles() on lines
6–8 to specify the paths of the pose files.
Once this is done, you can run the sketch as normal. The menu can be used to switch between the webcam, and the recorded poses.
To use in your own sketch:
-
Copy pose JSON files into your own project.
-
Add a call to
loadPoseFiles()to yourpreload()function. If your sketch does not have apreload()function, copy the one fromsketch.jsin this project instead. -
Modify the arguments to
loadPoseFiles(), as specified above. -
Find the line is
sketch.jsthat begins with:/** Copy the code from here to the end of the file
Copy the
index.htmlfile, from this line to the end of the file, into your sketch.