{"id":23914468,"url":"https://github.com/ra101/pose2input-mk9","last_synced_at":"2025-08-31T12:40:13.101Z","repository":{"id":43646225,"uuid":"387519451","full_name":"ra101/Pose2Input-MK9","owner":"ra101","description":"Play Mortal Kombat with the camera as your input device and your body/pose as a controller.","archived":false,"fork":false,"pushed_at":"2023-06-18T07:31:39.000Z","size":2550,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"core","last_synced_at":"2025-04-11T15:59:24.004Z","etag":null,"topics":["game","gamming","mediapipe","mk","mk9","mortal-kombat","mortal-kombat-9","opencv","opencv-python","pyautogui","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ra101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":["https://www.buymeacoffee.com/ra101"]}},"created_at":"2021-07-19T15:56:33.000Z","updated_at":"2024-06-22T05:37:56.000Z","dependencies_parsed_at":"2025-04-11T16:01:58.282Z","dependency_job_id":null,"html_url":"https://github.com/ra101/Pose2Input-MK9","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ra101/Pose2Input-MK9","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ra101%2FPose2Input-MK9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ra101%2FPose2Input-MK9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ra101%2FPose2Input-MK9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ra101%2FPose2Input-MK9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ra101","download_url":"https://codeload.github.com/ra101/Pose2Input-MK9/tar.gz/refs/heads/core","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ra101%2FPose2Input-MK9/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272982765,"owners_count":25025984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","gamming","mediapipe","mk","mk9","mortal-kombat","mortal-kombat-9","opencv","opencv-python","pyautogui","python","python3"],"created_at":"2025-01-05T10:13:59.739Z","updated_at":"2025-08-31T12:40:13.076Z","avatar_url":"https://github.com/ra101.png","language":"Python","funding_links":["https://www.buymeacoffee.com/ra101"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/logo.min.png\" height=\"250px\"\u003e\n\u003c/p\u003e\n\n\n\u003cimg src=\"https://img.shields.io/badge/Made%20with-Python-feab00?style=for-the-badge\u0026logo=python\" alt=\"Made with Python\"\u003e \u003ca href=\"https://github.com/ra101/Pose2Input-MK9/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/ra101/Pose2Input-MK9?style=for-the-badge\" alt=\"Stars\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/ra101/Pose2Input-MK9/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/ra101/Pose2Input-MK9?style=for-the-badge\" alt=\"Forks\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/ra101/Pose2Input-MK9/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/ra101/Pose2Input-MK9?style=for-the-badge\" alt=\"Open Issues\"\u003e\u003c/a\u003e \u003cimg src=\"https://img.shields.io/badge/Open%20Source-%E2%98%95-red?style=for-the-badge\u0026logo=open-source-initiative\" alt=\"Open Source Love\"\u003e \u003cimg src=\"https://img.shields.io/badge/Built%20With-%E2%99%A1-critical?style=for-the-badge\u0026logo=github\" alt=\"Built with Love\"\u003e\n\n\u003c/div\u003e\n\nPlay **Mortal Kombat** with the camera as your input device and your body/pose as a controller.\n\n\n\n**Video Tutorial:** [LRBY]() | [YouTube]()\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n## 📈Workflow\n\nIt converts given image of pose into keystroke (accorging to the given config). This is done broadly in 4 simple steps:\n\n- **OpenCV** capture image if any motion is detected (via frame differencing)\n- **MediaPipe** returns `(x, y)` coordinates of the each body part (if found)\n- We use *Mathematics* to determine what pose is and which key that pose is associated with\n- **PyAutoGUI** to input the keystroke\n\n\u003cbr\u003e\n\n### 📷 Image Processing\n\n\u003cimg src=\"./assets/pose_landmark.min.jpg\" width=80%\u003e\n\n\u003cBR\u003e\n\n### :punch:MoveList\n\n| Move            | Pose Image | Mathematics |\n| :-------------: | :--: | :------ |\n| **UP**      | \u003cimg src=\"./assets/moves/up.png\"\u003e | • *ankles should be above knees* |\n| **DOWN**    | \u003cimg src=\"./assets/moves/down.png\"\u003e  | • *dist(hip-\u003enose) : dist(hip-\u003eknee) \u003e **7 : 10*** |\n| **LEFT**    | \u003cimg src=\"./assets/moves/left.png\"\u003e  | • *(perpendicular of r_ankle-\u003el_ankle) should be right of **right_hip***\u003cbr /\u003e• *slope(**right_hip**-\u003eankle) for both ankles should be b/w -65° and -115°* |\n| **RIGHT**   | \u003cimg src=\"./assets/moves/right.png\"\u003e  | • *same as above but with **left_hip*** |\n| **FRONT_PUNCH** | \u003cimg src=\"./assets/moves/front_punch.png\"\u003e | • *slope(left_shoulder-\u003eleft_wirst) should be b/w -10.5° and 10.5°*\u003cbr /\u003e• *angle(left_shoulder\u003c-left_elbow-\u003eleft_wirst) should be b/w 169.5° and 190.5°*\u003cbr /\u003e **TLDR: arm should parallel to ground** |\n| **BACK_PUNCH** | \u003cimg src=\"./assets/moves/back_punch.png\"\u003e | • *same as above but with **right arm*** |\n| **FRONT_KICK** | \u003cimg src=\"./assets/moves/front_kick.png\"\u003e  | • *slope(left_ankle-\u003eleft_hip) should be b/w 45° and 135°* |\n| **BACK_KICK** |    \u003cimg src=\"./assets/moves/back_kick.png\"\u003e   | • *same as above but with **right leg*** |\n| **THROW**   |   \u003cimg src=\"./assets/moves/throw.png\"\u003e    | • *wrist should be above elbow of same arm, they both should be above nose* |\n| **TAG**     |    \u003cimg src=\"./assets/moves/tag.png\"\u003e  | • *dist(wrists) : dist(elbows) \u003c 3 : 10*\u003cbr /\u003e• *angle(left_elbow\u003c-wirsts-\u003eright_elbow) should be b/w 169.5° and 190.5°*\u003cbr /\u003e**TLDR: forearms should parallel to ground** |\n| **BLOCK**   |   \u003cimg src=\"./assets/moves/block.png\"\u003e   | • *wrist should be above nose, they both should be above elbow of same arm* |\n\n\u003cbr\u003e\n\n## ⚙Development\n\n### :floppy_disk:Setup\n\nLets start the standard procedure for python project setup.\n\n- Clone the repository\n\n```bash\n$ git clone https://github.com/ra101/Pose2Input-MK9.git\n```\n\n- Create the virtualenv and activate it\n\n```bash\n$ cd Pose2Input-MK9\n$ virtualenv venv\n$ source ./venv/bin/activate # unix\n$ .\\venv\\Scripts\\activate.bat  # windows\n```\n\n- Install requirements\n\n```bash\n$ pip install -r requirements.txt\n```\n\n- copy content of .env.template into .env *(one can use [dump-env](https://github.com/sobolevn/dump-env) as well)*\n\n```bash\n$ cat .env.template \u003e .env\n```\n\n\n\n**Env Help Guide:**\n\n| Env Variables             | Defination                                          | Default Value |\n| ------------------------------ | ----------------------------------- | ------------- |\n| **Pose2Input Variables**:      |                                                     |               |\n| CAMERA_PORT                    | Camera Port for OpenCV              | 0             |\n| DELAY_TIME                     | A Delay before Starting the Program | 0             |\n| LOG_FPS                        | FPS Setting for logs | 20            |\n| MOTION_THRESHOLD_FACTOR | More the value is, More the Motion is Captured | 64            |\n|  |  |  |\n| **PyAutoGUI Constants:** |  |  |\n| PYAUTO_PAUSE | Time (sec) to pause after each PyAuto Function Call | 0.1 |\n|  |  |  |\n| **Input Config:** |  |  |\n| UP | KeyStroke for UP (used by PyAuto) | up |\n| DOWN | KeyStroke for Down (used by PyAuto) | down |\n| `\u003cmove\u003e` | KeyStroke for `\u003cmove\u003e` (used by PyAuto) | `\u003ckey\u003e` |\n\n\u003cbr\u003e\n\n### 💻Run\n\nOne can simply run the application by this\n\n```bash\n$ python run.py\n```\n\nbut for calibration, optional arguments are provided\n\n| Argument                     | Alias             | Purpose                                                      | Deafult |\n| ---------------------------- | ----------------- | ------------------------------------------------------------ | ------- |\n| --help                       | --h               | Shows the available options                                  | -       |\n| --debug_level   \u003c0, 1, 2, 3\u003e | --d  \u003c0, 1, 2, 3\u003e | Set Different Levels of Information for Logs or Live feed (explained below this table) | `0`     |\n| --log_flag                   | --l               | Stores the `video_log` in \"logs\" folder (.avi)               | `False` |\n| --live_flag                  | -L                | Displays the Captured Video                                  | `False` |\n\n**Debug**:\n\n- Levels:\n  - **0**: Raw Video Footage\n  - **1**: `0` + FPS and Output Moves\n  - **2**:  `1` + Virtual Exoskeleton of Body Parts Found\n  - **3**:  `2` + Black Screen if no motion found\n- If `debug_level` \u003e 0 and no flag is selected, then `log_flag` is automatically set to `True`\n\n\n\n**Example of all flags being used**:\n\n```bash\n$ python run.py --debug_level 3 --live_flag --log_flag\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## 📃Breakdown of `requirements.txt`\n\n| Dependency       | Usage                                                        |\n| ---------------- | ------------------------------------------------------------ |\n| Python-DotENV    | Reads the key-value pair from `.env` file and adds them to environment variable. |\n| OpenCV-Python    | Image Processing library which uses NumPy containers|\n| MediaPipe        | Offers cross-platform, customizable ML solutions for live and streaming media. |\n| PyAutoGUI        | It can control the mouse and keyboard to automate interactions with other applications. |\n\n\n\u003cbr\u003e\u003cbr\u003e\n\n## 🎁Donations\n\n[![Sponsor](https://img.shields.io/badge/Buy_Me_A_Coffee-Sponsor-ff9933?style=for-the-badge\u0026logo=buy-me-a-coffee\u0026logoColor=orange)](https://www.buymeacoffee.com/ra101)\n\n\u003cbr\u003e\n\n## 🌟Credit/Acknowledgment\n\n[![Contributors](https://img.shields.io/github/contributors/ra101/Pose2Input-MK9?style=for-the-badge)](https://github.com/ra101/Pose2Input-MK9/graphs/contributors)\n\n\u003cbr\u003e\n\n## 📜License\n\n[![License](https://img.shields.io/github/license/ra101/Pose2Input-MK9?style=for-the-badge)](https://github.com/ra101/Pose2Input-MK9/blob/core/LICENSE)\n\n\u003cbr\u003e\n\n## 🤙Contact Me\n\n[![Protonmail](https://img.shields.io/badge/Protonmail-Email-ab44fe?style=for-the-badge\u0026logo=protonmail)](mailto://agarwal.parth.101@protonmail.com) [![Telegram](https://img.shields.io/badge/Telegram-Chat-informational?style=for-the-badge\u0026logo=telegram)](https://telegram.me/ra_101)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fra101%2Fpose2input-mk9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fra101%2Fpose2input-mk9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fra101%2Fpose2input-mk9/lists"}