Spaces:
Sleeping
Sleeping
Create readme.md
Browse files
readme.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ASL Recognition App: Image Preprocessing and Feature Extraction
|
| 2 |
+
|
| 3 |
+
This document explains the image preprocessing and feature extraction techniques used in our ASL Recognition App.
|
| 4 |
+
|
| 5 |
+
## Image Preprocessing
|
| 6 |
+
|
| 7 |
+
1. **Image Loading**: We use OpenCV (cv2) to load and process images.
|
| 8 |
+
2. **Color Conversion**: Images are converted from BGR to RGB color space for compatibility with MediaPipe.
|
| 9 |
+
|
| 10 |
+
## Hand Landmark Detection
|
| 11 |
+
|
| 12 |
+
We use MediaPipe Hands for detecting hand landmarks in the images:
|
| 13 |
+
|
| 14 |
+
1. **MediaPipe Hands**: Initializes with `static_image_mode=True`, `max_num_hands=1`, and `min_detection_confidence=0.5`.
|
| 15 |
+
2. **Landmark Extraction**: 21 hand landmarks are extracted from each image.
|
| 16 |
+
|
| 17 |
+
## Feature Extraction
|
| 18 |
+
|
| 19 |
+
### Landmark Normalization
|
| 20 |
+
|
| 21 |
+
1. **Centering**: Landmarks are centered by subtracting the mean position.
|
| 22 |
+
2. **Scaling**: Centered landmarks are scaled to unit variance.
|
| 23 |
+
|
| 24 |
+
### Angle Calculation
|
| 25 |
+
|
| 26 |
+
We calculate angles between all pairs of landmarks:
|
| 27 |
+
|
| 28 |
+
1. **Vector Calculation**: For each pair of landmarks (i, j), we calculate the vector from i to j.
|
| 29 |
+
2. **Angle Computation**: We compute the arcosine of the x and y components of the normalized vector.
|
| 30 |
+
3. **Feature Vector**: The angles form a 420-dimensional feature vector (21 choose 2 = 210 pairs, 2 angles per pair).
|
| 31 |
+
|
| 32 |
+
## Model Input
|
| 33 |
+
|
| 34 |
+
The preprocessed features (angles) are used as input to our Random Forest model for ASL sign classification.
|
| 35 |
+
|
| 36 |
+
This preprocessing pipeline ensures that our model receives consistent and informative features, regardless of the hand's position or size in the original image.
|