https://github.com/singhpratyush/face-the-gate
https://github.com/singhpratyush/face-the-gate
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/singhpratyush/face-the-gate
- Owner: singhpratyush
- License: mit
- Created: 2016-03-30T20:29:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T05:41:06.000Z (over 8 years ago)
- Last Synced: 2025-01-26T16:35:02.272Z (9 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Face The Gate
Recognize faces using `OpenCV` and `Python`.
### Getting Things Ready
* Install `OpenCV` with `Python` bindings.
* Clone and get started -
```sh
$ git clone git@github.com:singhpratyush/face-the-gate.git
$ cd face-the-gate/
$ mkdir rsc/images
```
### Adding New Face Data
* While in `src`, use `add_data.py` to add new face data.
* Arguments -
* `-c` | `--camera-id` - Camera device ID. Defaults to 0.
* `-i` | `--subject-id` - ID of subject whise data is to be added.
* `-s` | `--start-pos` - Position of start index for the subject ID.
* `-e` | `--end-pos` - Position of end index for the subjet ID.
### Testing
* While in `src`, use `main.py` to test the data collected. You must have atleast 2 subjects registered to start this activity.
* Make sure to use `-r` or `--refresh-data` option to rebuild the classification data from the images.
* You may use the `-c` or `--camera-id` to specify the camera ID if default is not 0.
### Classifiers Used
Uses 3 different classifiers -
* Eigen Face Recognizer
* Fisher Face Recognizer
* LBPH Face Recognizer
### Rotation to Straighten Images
Sometimes, camera is little bent and the resulting image of face is little bent too.
But this small tilt has a large impact on the recognition numbers. To overcome this, following technique is used -
* Get the position of eyes in the frame.
* Calculate the angle by which they are away from being on the same horizontal line.
```python
delta_y = right_eye_y_center - left_eye_y_center
delta_x = right_eye_x_center - left_eye_x_center
rotation_degrees = math.degrees(math.atan(float(delta_y) / (delta_x)))
```
* Generate a 2D rotation matrix for the corresponding canvas and rotation angle.
* Perform affine transform using the rotation matrix.