Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation
Abstract
1. Introduction
- Preliminary characterization of pupil dynamics at high altitude, providing pilot-level quantitative observations of autonomic response patterns within the analyzed sample.
- Systematic comparison of four segmentation methods, identifying the binary threshold as the most computationally efficient and temporally stable method within the controlled illumination and acquisition conditions evaluated in this study.
- Demonstration of temporally consistent metrics across the evaluated subjects, supporting their potential applicability as non-invasive quantitative indicators in controlled experimental settings.
Related Work
2. Methodology
- Participants. Three healthy young adult volunteers, permanent residents of Cusco (3400 m above sea level), participated in this pilot study. All participants reported prolonged residence at high altitude (more than five years), normal or corrected-to-normal vision, and no diagnosed neurological, ophthalmological, or systemic diseases that could affect autonomic function. Recordings were made at rest to minimize the influence of stress on pupil dynamics. This exploratory sample size was selected to assess the technical feasibility and stability of the segmentation framework, rather than to establish physiological conclusions at the population level.
- Video acquisition and preprocessing. Video sequences were recorded at 30 frames per second (fps) using a compact optical system specifically configured to maintain controlled geometric alignment and stable illumination. A Region of Interest (ROI) was manually selected in the first frame to isolate the pupil area and reduce background variability. All subsequent processing steps were restricted to this ROI. Before segmentation, video stabilization was performed using tracking tools (DaVinci Resolve) to minimize motion artefacts and prevent abrupt fluctuations in the extracted pupil area signal. The frames were converted to greyscale when required by the segmentation method. To reduce high-frequency noise while preserving edge information, a Gaussian smoothing filter with a kernel size [15].
- Segmentation methods. Four classic and independent segmentation techniques were implemented: (i) binary thresholding with a fixed threshold value T, (ii) automatic threshold selection using the Otsu method, (iii) K-Means clustering with in RGB space, and (iv) multichannel thresholding in RGB. For the RGB multichannel thresholding approach, a fixed threshold was applied independently to each color channel (R, G, and B), producing three binary masks and corresponding pupil area time series. No simultaneous logical condition across channels was imposed, allowing evaluation of which individual channel provided the most stable pupil delineation under the experimental illumination conditions. These methods were selected for their low computational complexity, reproducibility, and suitability for implementation in resource-constrained environments. Unlike deep learning-based approaches, these techniques do not require large annotated datasets, GPU acceleration, or high memory capacity, making them appropriate for embedded or portable systems. For the fixed binary threshold method, the value was determined empirically by preliminary inspection of grayscale histograms under controlled lighting conditions. This value corresponded to the range of intensities that most consistently separated the pupil pixels from those of the iris and background throughout the recorded sequences. Subsequently, the threshold was held constant across subjects to assess temporal stability under identical acquisition conditions. Each algorithm generated a binary mask within the ROI, and the pupil area was calculated as the total number of pixels classified as pupil in each frame, in accordance with standard practices in computational pupillometry [16].
- Temporal analysis. The resulting area signals were normalized to the interval [0, 1] to facilitate comparison between subjects and between methods. From these normalized time series, the characteristic temporal parameters of the pupillary response were estimated: contraction time , plateau time , and recovery time , following established models of pupillary dynamics [17]. Given the exploratory nature of this study and the limited sample size, the analysis focuses on temporal consistency and comparative stability between segmentation methods under controlled experimental conditions, rather than on statistical inference at the population level.
3. Overall System
3.1. Acquisition and Processing System
- Application of a circular mask to isolate the ocular region and reduce peripheral noise.
- Cropping to define a consistent ROI.
- Conversion to grayscale when required, followed by Gaussian smoothing using kernel size to reduce high-frequency noise.
- Segmentation using four classical and computationally efficient methods: fixed thresholding, Otsu’s method, K-Means clustering (), and multi-channel RGB thresholding.
3.2. Light Stimulation System
- An 850 nm infrared (IR) LED, electrically connected in parallel with the blue LED and used exclusively as an optical time marker of the stimulus onset.
- A 465 nm blue LED (20 mA), used as the active photic stimulus applied to the contralateral eye.
4. System Procedure
4.1. Preparation
- Subject preparation. The volunteer puts on the modified lenses, which hold the LEDs at orbital level. In addition, a fixed distance between the volunteer’s eye and the camera is ensured.
- Light stimulation. The blue LED is activated in the volunteer’s left eye, while the infrared LED illuminates the right eye to record the consensual response between both eyes.
- Image recording. The camera captures video sequences at 30 fps, stored in .avi format. Several methods were used for segmentation. During this stage, conversion to grayscale is also performed, a circular mask is applied to centre the ROI, and the pupil is segmented using different methods. Several methods were used for segmentation.The first is binary thresholding [18], where the binarized value of a pixel at coordinates in the image, , is defined by Equation (1). takes the value 1 if the pixel belongs to the pupil, 0 otherwise. It also applies a fixed threshold of in grayscale (an intensity range of 0 to 255 for 8-bit images). Pixels with lower intensity are classified as pupils.where is the intensity of the pixel in grayscale at position and T is the fixed threshold of the grayscale.The second is clustering using K-Means [19,20], whose objective is to minimize the K-Means total cost function J. Equation (2) defines J, which represents the sum of the quadratic distances between each pixel and the center of the cluster to which it has been assigned. This method automatically groups the pixels into two classes, , corresponding to the pupil and background/iris, respectively, adapting to the distribution of the intensity vector of pixel .where is the centre of k.The third is Otsu [20], which automatically selects the optimal threshold using Equation (3). maximizes the variance between pixel classes , and equivalently, minimizes the robust intraclass variance in the face of lighting variations. is defined in Equation (4).Finally, Multichannel Thresholding (RGB) [21], in which the binary mask is determined by fixed thresholds to the intensity values of the color channels of the image, with . is defined in Equation (5) and is set in the three color channels to analyze the chromatic contribution to pupil discrimination.where R is red, G is green and B is blue. Likewise, to describe the temporal dynamics of the photomotor reflex and establish a mathematical basis for the subsequent extraction of temporal parameters, the normalized pupillary response was modeled using a piecewise function. This model explicitly represents the three main phases of the photomotor reflex, , , and , based on pupil dynamics [22].where represents the normalized pupil area as a function of time, dimensionless and bounded in the interval . The parameter corresponds to the normalized baseline value of the pupil area before the onset of the light stimulus, while denotes the minimum value reached during maximum pupil contraction. The instant indicates the onset of the light stimulus, corresponds to the time at which the pupil reaches its minimum aperture, and represents the switch-off of the light stimulus, from which begins. The parameters and represent the slopes of the contraction and recovery times, respectively. From a physiological point of view, is associated with parasympathetic activation, while reflects sympathetic recovery. A temporal smoothing filter was applied to the pupil series to reduce noise and improve the estimation of , and [23,24]. Finally, this segmented model provides a simple but physiologically coherent mathematical framework for the automatic identification of key points in the pupillary response. Based on this formulation, we define the characteristic times of the photomotor reflex, which are subsequently used to quantify , , and [25,26].
- Parameter extraction. In this stage, the characteristic times of the pupillary response are quantified from the normalized area time series. Quantification is performed by automatically identifying the key points of the dynamic response, defined by Equations (7)–(9).The ROI for each video was defined manually with guidance from a reference grid to maintain spatial consistency across frames and minimize pupil shifts [27]. In terms of physiological interpretation, three stages are considered: (i) Pupillary contraction, which corresponds to the interval between the onset of the stimulus and the minimum pupillary diameter, and represents the activation of the iris sphincter muscle in response to a sudden increase in brightness (miosis) [6,7]. (ii) Steady state or plateau time, which is the period during which the pupil remains in a stable reduced state. This steady state also reflects a temporary balance between parasympathetic activity (which maintains miosis) and residual sympathetic modulation [6]. (iii) Pupillary dilation, which describes the progressive recovery of the pupil diameter after the stimulus is removed. This process is equivalent to mydriasis, which is the action of the sympathetic system that restores the basal size of the eye [7]. Since pupil dilation and mydriasis describe the same phenomenon, the clinical term is used here solely as a conceptual reference.
4.2. Algorithm Development
4.2.1. Pupil Analysis
| Algorithm 1 Pupillary analysis pipeline (preprocessing + segmentation + temporal feature extraction) |
|
4.2.2. Binary Threshold
| Algorithm 2 Binary Thresholding (ROI) |
|
4.2.3. Otsu’s Method
| Algorithm 3 Otsu Thresholding (ROI) |
|
4.2.4. Segmentation Using K-Means
| Algorithm 4 K-Means Clustering on ROI (K = 2) |
|
4.2.5. RGB Thresholding
| Algorithm 5 Channel-Based Thresholding (R, G, B) |
|
4.2.6. Integration and Temporal Extraction
4.3. Implementation
5. Results
5.1. Binary Thresholding
5.2. Clustering Using K-Means
5.3. Otsu Method
5.4. Multichannel Thresholding (RGB)
5.5. Comparison of Segmentation Methods
5.6. Temporal Analysis of the Pupillary Reflex
5.7. Temporal Parameters
6. Discussion
Studies on Altitude Adaptation
7. Conclusions
8. Future Work
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Giap, B.D.; Srinivasan, K.; Mahmoud, O.; Mian, S.I.; Tannen, B.L.; Nallasamy, N. Adaptive tensor-based feature extraction for pupil segmentation in cataract surgery. IEEE J. Biomed. Health Inform. 2023, 28, 1599–1610. [Google Scholar] [CrossRef]
- Kothari, R.S.; Chaudhary, A.K.; Bailey, R.J.; Pelz, J.B.; Diaz, G.J. Ellseg: An ellipse segmentation framework for robust gaze tracking. IEEE Trans. Vis. Comput. Graph. 2021, 27, 2757–2767. [Google Scholar] [CrossRef]
- McDougal, D.H.; Gamlin, P.D. The influence of intrinsically-photosensitive retinal ganglion cells on the spectral sensitivity and response dynamics of the human pupillary light reflex. Vis. Res. 2010, 50, 72–87. [Google Scholar] [CrossRef] [PubMed]
- Pérez-León, J.A.; Brown, R.L. Las células con melanopsina: Nuevos fotorreceptores en la retina de los vertebrados. Rev. Educ. Bioquím. 2009, 28, 9–18. [Google Scholar]
- Park, J.C.; Moss, H.E.; McAnany, J.J. The pupillary light reflex in idiopathic intracranial hypertension. Investig. Ophthalmol. Vis. Sci. 2016, 57, 23–29. [Google Scholar]
- Kelbsch, C.; Strasser, T.; Chen, Y.; Feigl, B.; Gamlin, P.D.; Kardon, R.; Peters, T.; Roecklein, K.A.; Steinhauer, S.R.; Szabadi, E.; et al. Standards in pupillography. Front. Neurol. 2019, 10, 129. [Google Scholar] [CrossRef]
- Pinheiro, H.M.; da Costa, R.M. Pupillary light reflex as a diagnostic aid from computational viewpoint: A systematic literature review. J. Biomed. Inform. 2021, 117, 103757. [Google Scholar] [CrossRef]
- Quispe-Astorga, A.; Coaquira-Castillo, R.J.; Utrilla Mego, L.W.; Herrera-Levano, J.C.; Concha-Ramos, Y.; Sacoto-Cabrera, E.J.; Moreno-Cardenas, E. Data-Driven Fault Detection and Diagnosis in Cooling Units Using Sensor-Based Machine Learning Classification. Sensors 2025, 25, 3647. [Google Scholar] [CrossRef]
- Escalante-Mamani, J.C.; Sacoto-Cabrera, E.J.; Coaquira-Castillo, R.J.; Mego, L.W.U.; Herrera-Levano, J.C.; Concha-Ramos, Y.; Moreno-Cardenas, E. Design and Validation of an IoT-Integrated Fuzzy Logic Controller for High-Altitude NFT Hydroponic Systems: A Case Study in Cusco, Peru. Electronics 2025, 14, 3740. [Google Scholar] [CrossRef]
- Quispe-Vilca, J.L.; Moreno-Cardenas, E.; Sacoto-Cabrera, E.J.; Moreno-Cardenas, Y. Integrating IoT and image processing for crop monitoring: A LoRa-based solution for citrus pest detection. Electronics 2024, 13, 4863. [Google Scholar] [CrossRef]
- Calizaya-Neira, C.R.; Coaquira-Castillo, R.J.; Utrilla Mego, L.W.; Herrera-Levano, J.C.; Palomino Lopez, A.; Moreno-Cardenas, E.; Sacoto-Cabrera, E.J. Prototype Design for Irradiance Estimation Using Closed-Form Models and an Optimized MPPT IC Algorithm. Electronics 2025, 14, 1652. [Google Scholar] [CrossRef]
- Whang, A.J.W.; Chen, Y.Y.; Tseng, W.C.; Tsai, C.H.; Chao, Y.P.; Yen, C.H.; Liu, C.H.; Zhang, X. Pupil size prediction techniques based on convolution neural network. Sensors 2021, 21, 4965. [Google Scholar] [CrossRef]
- Lee, S.; Song, T.; Lee, J.K.; Lee, J. Effective encoder-decoder network for pupil light reflex segmentation in facial photographs of ptosis patients. Sci. Rep. 2024, 14, 26220. [Google Scholar] [CrossRef]
- Jaworski, D.; Suwała, K.; Kaluzny, B.J.; Kaluzny, J.J. Comparison of an AI-based mobile pupillometry system and NPi-200 for pupillary light reflex and correlation with glaucoma-related markers. Front. Neurol. 2025, 15, 1426205. [Google Scholar]
- Gonzalez, R.C. Digital Image Processing; Pearson Education: Chennai, India, 2009. [Google Scholar]
- Fuhl, W.; Tonsen, M.; Bulling, A.; Kasneci, E. Pupil detection for head-mounted eye tracking in the wild: An evaluation of the state of the art. Mach. Vis. Appl. 2016, 27, 1275–1288. [Google Scholar] [CrossRef]
- Zele, A.J.; Gamlin, P.D. The Pupil: Behavior, Anatomy, Physiology and Clinical Biomarkers; Frontiers Media S.A.: Lausanne, Switzerland, 2020. [Google Scholar]
- Xu, Y.; Quan, R.; Xu, W.; Huang, Y.; Chen, X.; Liu, F. Advances in medical image segmentation: A comprehensive review of traditional, deep learning and hybrid approaches. Bioengineering 2024, 11, 1034. [Google Scholar] [CrossRef]
- Ding, C.; He, X. K-means clustering via principal component analysis. In Proceedings of the Twenty-First International Conference on Machine Learning; Association for Computing Machinery: New York, NY, USA, 2004; p. 29. [Google Scholar]
- Liu, D.; Yu, J. Otsu Method and K-means. In Proceedings of the 2009 Ninth International Conference on Hybrid Intelligent Systems; IEEE Computer Society: Washington, DC, USA, 2009; Volume 1, pp. 344–349. [Google Scholar]
- Sharma, G.; Trussell, H.J. RGB-based image segmentation for real-time applications. IEEE Trans. Image Process. 2003, 12, 375–385. [Google Scholar] [CrossRef]
- Longtin, A.; Milton, J. A model of pupillary light reflex response. J. Biol. Phys. 1989, 17, 199–207. [Google Scholar]
- McDougal, D.H.; Gamlin, P.D. Autonomic control of the eye. Compr. Physiol. 2015, 5, 439–473. [Google Scholar] [CrossRef] [PubMed]
- Amiot, V.; Tomasoni, M.; Minier, A.; Gisselbaek, S.; Kawasaki, A.; Kostic, C. PupilMetrics: A support system for preprocessing of pupillometric data and extraction of outcome measures. Sci. Rep. 2024, 14, 28775. [Google Scholar] [CrossRef] [PubMed]
- Hall, C.A.; Chilcott, R.P. Eyeing up the Future of the Pupillary Light Reflex in Neurodiagnostics. Diagnostics 2018, 8, 19. [Google Scholar] [CrossRef]
- Pinheiro, J.; da Costa, J.P. Pupillary Light Reflex as a Diagnostic Aid: A Computational Perspective. Sensors 2021, 21, 6054. [Google Scholar] [CrossRef]
- Kim, K.L.; Kim, D.K.; Lee, J.H.; Kim, Y.C. SmartPLR: A digital solution for AI-powered smartphone pupillometry. BMC Ophthalmol. 2025, 25, 637. [Google Scholar] [CrossRef]
- Meyers, B.A.; Vlachos, P.P. Video-based pupillometry using Fourier Mellin image correlation. Sci. Rep. 2025, 15, 26153. [Google Scholar] [CrossRef]
- Amodio, A.; Ermidoro, M.; Maggi, D.; Formentin, S.; Savaresi, S.M. Automatic detection of driver impairment based on pupillary light reflex. IEEE Trans. Intell. Transp. Syst. 2018, 20, 3038–3048. [Google Scholar] [CrossRef]
- Vera-Olmos, F.J.; Pardo, E.; Melero, H.; Malpica, N. DeepEye: Deep convolutional network for pupil detection in real environments. Integr. Comput.-Aided Eng. 2019, 26, 85–95. [Google Scholar] [CrossRef]
- Taylor, W.R.; Chen, J.W.; Meltzer, H.; Gennarelli, T.A.; Kelbch, C.; Knowlton, S.; Richardson, J.; Lutch, M.J.; Farin, A.; Hults, K.N.; et al. Quantitative pupillometry, a new technology: Normative data and preliminary observations in patients with acute head injury. J. Neurosurg. 2003, 98, 205–213. [Google Scholar] [CrossRef] [PubMed]
- Sharma, V.; Varshney, R.; Sethy, N.K. Human adaptation to high altitude: A review of convergence between genomic and proteomic signatures. Hum. Genom. 2022, 16, 21. [Google Scholar] [CrossRef]











| Description | Notation |
|---|---|
| Pupillary contraction time | |
| Plateau or steady-state time | |
| Pupillary recovery time | |
| Normalized time | |
| Number of pupil pixels in the ROI at time t | |
| Region of Interest (image area used for analysis) | |
| Normalized pupillary area in the range | |
| Pupillary area obtained by binary thresholding | |
| Pupillary area obtained using Otsu’s method | |
| Pupillary area obtained using K-means (dark cluster) | |
| Pupillary area obtained by multichannel thresholding in the red channel | |
| Pupillary area obtained by multichannel thresholding in the green channel | |
| Pupillary area obtained by multichannel thresholding in the blue channel | |
| Binarized value of a pixel at image coordinates | |
| Grayscale pixel intensity at position | |
| Pixel intensity in color channel at position | |
| Total K-means cost | J |
| Fixed grayscale threshold (0–255) | T |
| Fixed threshold of channel | |
| Centroid of cluster k in K-means | |
| Feature vector of pixel i | |
| Optimal threshold obtained using Otsu’s method | |
| Between-class pixel variance using Otsu’s method | |
| Robust within-class variance using Otsu’s method | |
| Gaussian kernel size used during smoothing |
| Method | Parameter | Value |
|---|---|---|
| Binary thresholding | T | 51 |
| Otsu | ||
| K-Means | K | 2 |
| RGB thresholding | 51 |
| Parameter | Duration (s) |
|---|---|
| 2.33 * |
| Ref. | Methodological Approach | Dataset | Performance Metrics | Experimental Validation |
|---|---|---|---|---|
| [29] | Hough transform, dynamic model, SVM | Healthy subjects and subjects under alcohol influence | Error rate < ; < in 75% of the evaluated cases | Full experimental |
| [30] | Deep convolutional neural network with ASPP blocks | Public dataset (non-clinical) | Accuracy = 0.921; Sensitivity = 0.896; Specificity = 0.999 | Partial validation |
| [31] | Portable infrared pupillometer (Neuroptics) | More than 300 healthy subjects and 26 acute traumatic brain injury patients | Constriction velocity: mm/s; Pupillary change: 34% | Full experimental |
| [13] | Encoder–decoder architecture for segmentation in ptosis assessment | Clinical images from patients | Dice coefficient = 0.767; IoU = 0.653 | Full experimental |
| This work | Binary thresholding, K-means clustering, Otsu’s method, and RGB-based analysis | Clinical video acquisition under blue LED stimulation | s; s; s | Full experimental |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Torres-Centeno, E.R.; Sacoto-Cabrera, E.J.; Coaquira-Castillo, R.J.; Utrilla Mego, L.W.; Castillo-Guevara, M.A.; Concha-Ramos, Y.; Moreno-Cardenas, E. Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation. Computers 2026, 15, 160. https://doi.org/10.3390/computers15030160
Torres-Centeno ER, Sacoto-Cabrera EJ, Coaquira-Castillo RJ, Utrilla Mego LW, Castillo-Guevara MA, Concha-Ramos Y, Moreno-Cardenas E. Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation. Computers. 2026; 15(3):160. https://doi.org/10.3390/computers15030160
Chicago/Turabian StyleTorres-Centeno, Edyson R., Erwin J. Sacoto-Cabrera, Roger Jesus Coaquira-Castillo, L. Walter Utrilla Mego, Miguel A. Castillo-Guevara, Yesenia Concha-Ramos, and Edison Moreno-Cardenas. 2026. "Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation" Computers 15, no. 3: 160. https://doi.org/10.3390/computers15030160
APA StyleTorres-Centeno, E. R., Sacoto-Cabrera, E. J., Coaquira-Castillo, R. J., Utrilla Mego, L. W., Castillo-Guevara, M. A., Concha-Ramos, Y., & Moreno-Cardenas, E. (2026). Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation. Computers, 15(3), 160. https://doi.org/10.3390/computers15030160

