How shreyaschakravarthy19/iris-pupil-ratio-using-daugman-segmentation works
Project Type & Purpose
• This is a real-time computer vision application focused on detecting faces and eyes using OpenCV’s Haar cascades. It then applies the Daugman segmentation algorithm to segment the iris and pupil, computing the ratio between them.
• The README clearly outlines that the core functionalities include eye detection, segmentation (with Daugman’s algorithm), ratio calculation, and live visualization.
Analyzing the File Structure
• Top-Level Files:
• README.md: Project overview and instructions.
• main.py: The primary executable script which likely ties together all components.
• requirements.txt: Lists all dependencies (e.g., OpenCV).
• Directories:
• Scripts: Contains core Python scripts (e.g., DaugmanSegementation.py, sample.py, setup.py) that possibly manage real-time processing and setup.
• data: Houses the Haar cascade XML files for face and eye detection. Also includes sample datasets.
• irisSeg: Contains modules (command_line.py, utils.py, and __init__.py) that likely encapsulate the segmentation logic and utility functions.
Main Components
a. Input & Data Acquisition:
• Webcam Feed/Video Input (real-time user input).
• Data Files: Haar cascade classifier XMLs in the data folder.
b. Face & Eye Detection:
• The module that utilizes OpenCV’s Haar cascades (XMLs from the data directory). This component detects the region of interest (eyes/faces) before segmentation.
c. Iris & Pupil Segmentation:
• DaugmanSegementation script (in Scripts) and associated logic in the irisSeg module.
• Highlights: Application of Daugman’s operator to detect circular boundaries and perform segmentation.
d. Iris-to-Pupil Ratio Calculator:
• Module or script extracting segmented iris and pupil boundaries to perform the ratio computation.
e. Real-time Visualization:
• Module integrated within main.py (or part of the Scripts) to overlay segmentation results and ratio values on the live video feed.
f. Supporting Components:
• Utility functions from irisSeg/utils.py.
• Command-line interface support from irisSeg/command_line.py (enabling runtime configurations).
Relationships & Interactions
• main.py is the central orchestrator which initializes:
• The camera input.
• The detection modules (loading Haar cascades from the data folder).
• The segmentation module (invoking Daugman’s algorithm from Scripts/irisSeg).
• The ratio calculation and visualization pipelines.
• The data components (Haar-cascade XMLs) are utilized by both the detection component and may be loaded during initialization by a setup script.
• Directional data flow:
1. Webcam Feed → Face & Eye Detection → (Coordinates/ROIs) → Iris & Pupil Segmentation.
2. Segmentation Output → Ratio Calculator → Visualization.
• Additional interactions:
• The irisSeg module possibly contains helper utilities used across these steps for proper abstraction of segmentation logic.