https://github.com/codewithcc/mpkit_cc
mpkit-cc - A Python wrapper for MediaPipe that simplifies real-time hand, face, and pose detection. Just pip install mpkit-cc to add computer vision superpowers to your projects with minimal code. Perfect for gesture control, AR apps, and motion tracking. ๐ฅ
https://github.com/codewithcc/mpkit_cc
computer-vision mediapipe opencv-python python3
Last synced: 4 months ago
JSON representation
mpkit-cc - A Python wrapper for MediaPipe that simplifies real-time hand, face, and pose detection. Just pip install mpkit-cc to add computer vision superpowers to your projects with minimal code. Perfect for gesture control, AR apps, and motion tracking. ๐ฅ
- Host: GitHub
- URL: https://github.com/codewithcc/mpkit_cc
- Owner: codewithcc
- License: mit
- Created: 2022-05-25T14:47:38.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T19:05:16.000Z (about 1 year ago)
- Last Synced: 2025-07-02T03:05:15.439Z (12 months ago)
- Topics: computer-vision, mediapipe, opencv-python, python3
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MPKIT-CC: Enhanced MediaPipe Toolkit ๐
[](https://pypi.org/project/mpkit-cc/)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/)
[](https://mediapipe.dev/)
**MPKIT-CC** is a powerful Python wrapper that simplifies MediaPipe's computer vision capabilities with real-time FPS monitoring, customizable visualizations, and intuitive APIs for hand tracking, face detection, facial landmarks, and pose estimation.

## โจ Key Features
- **Real-time FPS Monitoring** - Built-in frame rate display with customizable styling
- **Multi-Feature Detection**:
- โ Hand tracking with 21 landmarks per hand
- ๐ Face detection with bounding boxes
- ๐๏ธ 468-point facial mesh detection
- ๐ง Full-body pose estimation (33 landmarks)
- **Custom Visual Styles**:
- ๐จ Predefined color constants (RED, GREEN, BLUE, etc.)
- ๐๏ธ Choice between default MediaPipe styles or custom drawings
- ๐ Toggleable landmark connections
- **Flexible Configuration**:
- ๐ท Camera settings adjustment (resolution, FPS)
- โ๏ธ Detection confidence thresholds
- ๐ผ๏ธ Multiple image format support (BGR, RGB, grayscale)
## ๐ฆ Installation
```bash
pip install mpkit-cc
```
## ๐งช Example Test Code
Here's a complete demonstration showcasing all features of MPKIT-CC with real-time FPS monitoring:
```python
from mpkit_cc import Mptools
from time import time
from cv2 import imshow, waitKey, destroyAllWindows
# Initialize with custom settings
obj = Mptools(
image_mode=False, # Video stream mode
cam_index=0, # Default camera
win_width=640, # Frame width
win_height=360, # Frame height
cam_fps=30, # Target FPS
hand_no=2, # Detect up to 2 hands
face_no=1, # Detect up to 1 face
tol1=0.5, # Detection confidence
tol2=0.5 # Tracking confidence
)
# Start camera
cam = obj.init()
start_time = time()
while cam.isOpened():
success, image = cam.read()
if not success:
print("Ignoring empty frame...")
continue
# Uncomment the detectors you want to use:
# Hand detection with connections (MediaPipe default style)
hand_data = obj.find_Hands(
image=image,
mode="BGR",
hand_connection=True,
show_detect=True,
detection_style=1
)
# Face detection with bounding box
face_data = obj.find_face(
image=image,
mode="BGR",
show_detect=True,
boundary=True
)
# Face mesh with 3D connections
face_meshs = obj.find_face_mesh(
image=image,
mode="BGR",
face_connection=True,
face_connection_3d=True,
show_detect=True
)
# Pose estimation with custom styling
poses = obj.find_pose(
image=image,
mode="BGR",
body_connection=True,
show_detect=True,
detection_style=0
)
# Print results if detections found
if hand_data and hand_data != ([], [], []):
print(f"Hands detected: {hand_data[1]} (Confidence: {hand_data[2]}%)")
if face_data and face_data != ([], [], []):
print(f"Face detected (Confidence: {face_data[2]}%)")
if face_meshs:
print(f"Face mesh points: {len(face_meshs)} landmarks")
if poses:
print(f"Body pose points: {len(poses)} landmarks")
# Calculate and display FPS
end_time = time()
fps = int(1 / (end_time - start_time))
start_time = end_time
image = obj.show_FPS(
image=image,
mode="BGR",
fps_rate=fps,
fore_bg=Mptools.YELLOW,
back_bg=Mptools.RED
)
# Display output
imshow("MPKIT-CC Real-time Detection", image)
# Exit on 'q' key press
if waitKey(1) == ord("q"):
break
# Cleanup
cam.release()
destroyAllWindows()
```