The code is used to get the co-ordinates of eyes and detect the pupil region accurately.
It works with human face images. Dlib's facial landmark detector is used for extracting the coordinates from the eye region. The eye corner points are collected and it check for dark colored region between the detected eye corner points of each eye. It uses OpenCV's houghcircles for detecting circle in a gray scaled image. Thus the pupil is calculated as the midpoint of the circle.
- Getting started
- Installation
- Features
- Usage
- Results
- Want to Contribute?
- Need Help / Support?
- Collection of Other Components
- Changelog
- Credits
- License
- Keywords
Prerequisites for running the code are:
- Python = 3.5
- python-opencv = 4.2.0
We have tested our program in above version, however you can use it in other versions as well.
From terminal run this
pip install numpy
pip install imutils
pip install scikit-image
pip install argparse
pip install opencv-python
pip install opencv-contrib-python
pip install dlib
If above command doesn't work then follow below steps
sudo apt-get install -y --fix-missing \
build-essential \
cmake \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
python3-numpy \
software-properties-common \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/*
git clone -b 'v19.9' --single-branch https://github.com/davisking/dlib.git
cd dlib
Run below command if system supports AVX instructions
sudo python setup.py install --yes USE_AVX_INSTRUCTIONS
Or
sudo pyhton setup.py install
- Accurately detects the eye pupil on human face.
- HoughCircles is used to detect circles.
Inside the project directory run:
python pupil_detection.py -i path-to-directory-of-input-images -o path-to-output-directory
You can find sample images in image folder and result images in output folder.
- Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).
- Fork it.
- Create new branch to contribute your changes.
- Commit all your changes to your branch.
- Submit a pull request.
We also provide a free, basic support for all users who want to use this AI ML based pupil detection techniques for their projects. In case you want to customize this Pupil detection technique for your development needs, then feel free to contact our AI ML developers.
We have built many other components and free resources for software development in various programming languages. Kindly click here to view our Free Resources for Software Development.
Detailed changes for each release are documented in CHANGELOG.md.
Refered dlib face detection lib Dlib.
Pupil-detection, face-detection, eye-detection, opencv-image-processing, dlib, HoughCircles, artificial-intelligence, machine-learning, ai-ml