[PYTHON] A game-like PGM that compares the PGM that registers poses from the background image with the registered pose image and camera image to measure the pose match rate according to the music.

We created a PGM that registers poses from the background image and a PGM that compares the registered pose image with the camera image to measure the pose match rate according to the music.


Referenced site How to write conditional branch by if statement in Python | note.nkmk.me opencv --No image is displayed when cv2.imshow in Python --Stack Overflow There are no global variables in Python, to be exact, in-module variables. is it? --When it ’s ready. Split comma-separated strings with Python, split, remove whitespace and list | note.nkmk.me Python array looping --Qiita Active engineers explain how to use Python's close method [for beginners] | TechAcademy Magazine Reading and writing (creating / adding) files with Python | note.nkmk.me Read / write (input / output) CSV file with Python | note.nkmk.me Get video from an OpenCV connected camera (Python)

Sound source acquisition site used I used the sound source from the following site Free BGM and music material for games [Wave, MP3]
githubURL:https://github.com/NanjoMiyako/PoseAndMusicGame

Sample data can be found in the sampleData folder of https://github.com/NanjoMiyako/PoseAndMusicGame

Since both the pose registration PGM and the pose match calculation PGM use the camera, At the time of execution, it is necessary to set the camera startup at the time of python execution of OS? To ON.


About PGM that registers poses from the background image PGM to register a pose from the background image is done by executing poseRegist1.py.

Enter the following command line arguments at runtime Argument 1: Pause image save folder Argument 2: Pose edge image save folder

To register the pose, first register the background image for acquiring the pose difference. The background image is created by pressing the'h'key when executing poseRegist1.py. Each pose is registered by performing Diff on the obtained background image. Diff is executed by pressing the'd'key when executing poseRegist1.py.

When registering a pose, the background should be as white as possible, and the clothes of the person to be registered as a pose should be dressed in a dark color so that there is a sufficient difference from the background image. Is recommended because you can get ...


About PGM that calculates the match rate between music and pose according to the registered pose

PGM that calculates the match rate between music and pose according to the registered pose is performed by executing PoseAndMusic.py.

Enter the following command line arguments at runtime Argument 1: Pause image save folder Argument 2: Pose edge image save folder Argument 3: Pause flow file path Argument 4: Music file path to play

The pause flow file is described in csv as follows.

Pose name 1 (excluding extension), elapsed time 1 (seconds) Pose name 2 (excluding extension), elapsed time 2 (seconds) ...

Recommended Posts

A game-like PGM that compares the PGM that registers poses from the background image with the registered pose image and camera image to measure the pose match rate according to the music.
PGM that takes the difference of the specified rectangular area from the camera and makes a sound when the rate of change exceeds a certain rate
Extract lines that match the conditions from a text file with python
Try to measure the position of the object on the desk (real coordinate system) from the camera image with Python + OpenCV