Next Article in Journal
From Patient Emotion Recognition to Provider Understanding: A Multimodal Data Mining Framework for Emotion-Aware Clinical Counseling Systems
Previous Article in Journal
A Resource-Efficient Approach to Fine-Tuning a BERT-Base Model for Sentiment Analysis
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Analysis of the Consensual Pupillary Reflex Using Blue LED Step Light and Automated Image Segmentation

by
Edyson R. Torres-Centeno
1,
Erwin J. Sacoto-Cabrera
2,
Roger Jesus Coaquira-Castillo
3,
L. Walter Utrilla Mego
1,
Miguel A. Castillo-Guevara
4,*,
Yesenia Concha-Ramos
5 and
Edison Moreno-Cardenas
1,6
1
TESLA Laboratory, Universidad Nacional de San Antonio Abad del Cusco (UNSAAC), Cusco 08003, Peru
2
GIHP4C, Universidad Politécnica Salesiana, Cuenca 010102, Ecuador
3
LIECAR Laboratory, Universidad Nacional de San Antonio Abad del Cusco (UNSAAC), Cusco 08003, Peru
4
Professional Academic School of Industrial Engineering, Universidad Continental, Cusco 08000, Peru
5
Professional Academic School of Systems and Computer Engineering, Universidad Continental, Cusco 08000, Peru
6
Technology and Engineering Group, EM Research & Tech, Cusco 08003, Peru
*
Author to whom correspondence should be addressed.
Computers 2026, 15(3), 160; https://doi.org/10.3390/computers15030160
Submission received: 22 January 2026 / Revised: 16 February 2026 / Accepted: 26 February 2026 / Published: 3 March 2026

Abstract

This study evaluates the dynamics of the human pupillary reflex in response to a stepped blue light stimulus (465 nm) in young adults residing at high altitude (3400 m above sea level). High-resolution video sequences of three participants were analyzed using four classical image segmentation techniques: K-Means, Otsu, fixed binary threshold, and multi-channel RGB threshold. Rather than proposing new algorithms, this work evaluates the technical feasibility and stability of computationally lightweight segmentation approaches under controlled lighting conditions and with low-cost hardware constraints. Among the methods evaluated, fixed binary thresholding showed stable temporal behavior and minimal computational complexity within the experimental setup. The results show a consistent contraction–plateau–recovery pattern across all participants, with representative contraction, stabilization, and recovery times of 1.89 s, 0.41 s, and 2.33 s, respectively. Although limited by the small sample size, these findings support the feasibility of implementing simplified segmentation strategies for pupillometry in resource-limited settings.

Graphical Abstract

1. Introduction

Pupillometry is a non-invasive tool that is increasingly used to assess autonomic nervous system (ANS) function by quantifying pupillary dynamics [1,2]. The integration of computer vision techniques and computational models has enabled the accurate characterization of the pupillary response to light stimuli, solidifying its use as a biomarker in clinical and research applications, ranging from the assessment of neurological disorders to human-computer interaction. The pupillary light reflex (PLR) responds to changes in light intensity and depends on the joint activity of rods, cones, and ipRGCs [3,4]. Stimulation with blue light at a wavelength of approximately 450–490 nm causes a rapid contraction, followed by a sustained phase (PIPR), allowing for an indirect assessment of autonomic function [5]. Recent studies have defined standards for the acquisition and analysis of clinical pupillography, including luminance parameters, stimulus duration, and quantitative metrics [6,7].
On the other hand, neural networks, machine learning, and Internet of Things (IoT) systems enable the processing of sensor data and visual signals for the real-time detection and prediction of complex phenomena [8]. The integration of computer vision and computational techniques has been successfully applied in high-altitude environments with limited resources, including automated hydroponic systems [9] and image processing for crop monitoring [10]. Furthermore, stimulus modelling and the quantification of responses to external signals, such as the estimation of irradiance using optimized algorithms, demonstrate that it is possible to develop reproducible, efficient, and robust methods [11]. These strategies support the application of reliable, simple computational methods to quantify pupil dynamics in chronic hypoxia, maintaining physiological consistency and operational simplicity. Despite the growing use of pupillometry as a biomarker of autonomic function, there is little evidence on the characterization of pupillary dynamics in populations chronically exposed to high-altitude hypoxia. Furthermore, in resource-limited settings, advanced AI-based segmentation methods may not be feasible due to hardware limitations, dataset requirements, and computational costs. Therefore, it remains relevant to determine whether classical segmentation methods, which are less computationally intensive, can yield stable, physiologically consistent measurements of pupil dynamics under controlled lighting conditions.
The main objective of this study is to characterize the dynamics of the pupillary reflex to a stepped light stimulus generated by a 465 nm blue LED in young individuals residing at high altitudes, such as the city of Cusco, located at 3400 m.s.l. Likewise, the effectiveness of four image segmentation methods, such as K-Means, Otsu, binary threshold, and multichannel RGB threshold, was evaluated to quantify the temporal parameters of contraction, plateau, and recovery, which reflect ANS activity in conditions of chronic hypoxia.
The main contributions of this article are as follows:
  • 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.
In summary, this study provides preliminary quantitative information on pupil dynamics in individuals chronically exposed to high altitudes. It proposes an accessible, reproducible image-processing framework applicable in clinical and research contexts with limited technological resources. It demonstrates that computationally lightweight segmentation techniques can provide temporally consistent measurements under controlled lighting conditions in a pilot cohort at high altitude.

Related Work

The literature has addressed the automatic analysis of the pupillary reflex using various techniques, including computer vision and artificial intelligence (AI).
Giap et al. [1] applied adaptive tensor extraction to surgical videos for pupil segmentation, while Kothari et al. [2] proposed an elliptical segmentation framework that enables robust tracking of the iris and pupil, even under conditions of partial occlusion. These methods demonstrated significant improvements in accuracy, but their implementation often requires specialized equipment and controlled conditions.
On the other hand, in recent years, AI-based approaches for pupil segmentation and prediction have been developed. Whang et al. [12] proposed a model based on a convolutional neural network (CNN) to predict pupil size from video sequences, achieving accurate real-time estimation and demonstrating the feasibility of applying AI techniques in pupillometry with moderate computational resources. Lee et al. [13] developed an encoder–decoder network to segment the pupillary reflex in facial images of patients with ptosis, achieving satisfactory segmentation metrics, including a Dice coefficient of 0.767 and an IoU of 0.653. Jaworski et al. [14] evaluated an AI-based mobile pupillometry system by comparing it with a standard clinical pupillometer (NPi-200) to measure pupil reflex parameters and their correlation with glaucoma-associated markers.
Although these studies demonstrate the effectiveness of AI for pupil segmentation and analysis, its application in high-altitude populations or resource-limited settings may be restricted. This is due to the need for large datasets that require intensive processing and specific devices. In contrast, the present study focuses on low-cost, highly reproducible classical segmentation methods such as K-Means, Otsu, Binary Thresholding, and RGB Thresholding. These methods are used to evaluate pupil dynamics in subjects residing in Cusco, a city at 3400 m above sea level, an environment that has been little explored in the literature. This approach enables the extraction of consistent and comparable temporal parameters, demonstrating that computationally lightweight techniques can effectively characterize ANS function under resource-limited conditions, which represents a novel contribution compared to previous studies.
Finally, based on the overall picture, this paper deliberately adopts classical segmentation techniques, not as a competitive alternative to state-of-the-art deep learning, but as a complementary option suited to scenarios where training data, connectivity, and computational power are scarce. This study provides a reference framework to assist professionals working in high-altitude environments by systematically comparing four such methods using a standard dataset acquired under controlled conditions. It also helps to select transparent and straightforward segmentation strategies for future low-cost pupillometry systems.
The rest of the article is organized as follows. Section 2 describes the study methodology. Section 3 details the overall system, including data acquisition and light stimulation. Section 4 presents the complete procedure, algorithms, and their implementation. Section 5 presents the main results. Section 6 analyses the results in comparison with the literature. Section 7 presents the conclusions. Finally, Section 8 presents future works.

2. Methodology

This study was designed as a pilot experimental evaluation of image segmentation techniques for the analysis of consensual pupillary photomotor reflex under controlled lighting conditions in a population residing at high altitude. This workflow follows established practices in digital image processing [15] and computational pupil analysis [16]. The extraction of temporal parameters is consistent with classical models of pupil dynamics [17] and with recommended standards for acquisition and analysis in clinical pupillography [7].
  • 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 k G = 5 × 5  [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 k = 2 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 T = 51 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 T c , plateau time T s , and recovery time T r , 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

The overall system is conceived as an integrated experimental and computational ecosystem designed to acquire, process, and quantitatively analyze the consensual pupillary reflex (PLR) under controlled stimulation conditions in resource-limited environments. The primary objective is not to propose new segmentation algorithms, but to validate the feasibility, reproducibility, and robustness of a low-cost, portable platform based on classical, computationally lightweight image processing techniques.
Figure 1 shows the functional flow diagram of the general system. The architecture is organized into four main stages: (i) data acquisition, (ii) image pre-processing and segmentation, (iii) temporal and statistical analysis, and (iv) visualization and reporting. This modular organization ensures traceability of each processing step and facilitates replication under similar hardware constraints.
Each stage is supported by specific structural elements. The first stage relies on a structured video repository that preserves raw recordings to guarantee reproducibility and retrospective verification. The second stage incorporates a knowledge base containing segmentation parameters and reusable processing rules. The third stage integrates quantitative evaluation criteria for extracting temporal parameters of the PLR. Finally, the fourth stage enables user configuration and automated generation of graphical and tabulated outputs. Table 1 summarizes the notations used in this article.

3.1. Acquisition and Processing System

The proposed acquisition and processing system consists of different functional modules, as shown in Figure 2. The acquisition and processing subsystem integrates hardware and software modules to ensure controlled recording conditions and reliable quantitative analysis. The hardware platform consists of a 1080p CMOS camera operating at 30 fps, mounted on modified optical lenses to stabilize geometry and maintain a fixed working distance. This configuration was selected to ensure low cost, portability, and ease of deployment. Infrared illumination at 850 nm is used to enhance pupil visibility during recording without inducing additional photic stimulation. This wavelength lies outside the visible spectrum and is commonly used in eye-tracking systems, allowing clear imaging while minimizing interference with the reflex pathway. Each recorded frame undergoes a structured processing pipeline:
  • 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 k G = 5 × 5 to reduce high-frequency noise.
  • Segmentation using four classical and computationally efficient methods: fixed thresholding, Otsu’s method, K-Means clustering ( k = 2 ), and multi-channel RGB thresholding.
The choice of classical segmentation techniques is intentional. Unlike deep learning-based approaches, these methods require no large annotated datasets, no GPU acceleration, and minimal computational resources. This aligns with the objective of validating a reproducible and accessible system for environments where advanced hardware may not be available.
Segmentation outputs are converted into time series representing the pupil area P ( t ) , computed as the number of pixels classified as pupil within the ROI. A compact physical prototype integrates the camera, infrared illumination, and blue LED stimulation in a mechanical structure designed to minimize head movement and ambient light interference.

3.2. Light Stimulation System

The proposed light stimulation system is represented by a stimulation circuit, as shown in Figure 3. This light stimulation subsystem delivers controlled photic input to evoke the consensual pupillary reflex and to provide a precise temporal reference of stimulus onset. The circuit operates with a regulated 5 V power supply. Two light sources are incorporated with clearly separated roles:
  • 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.
The first visible frame of its activation in the recorded video provides a precise time stamp for the start of the blue light stimulus, as the IR LED shares the same control signal as the blue LED. The camera captures a faint but clearly detectable IR emission within the field of view of the consensual eye. This IR signal is not intended to illuminate or stimulate the pupil; it is used solely as a timing reference for the temporal analysis of the pupillary response. The blue wavelength (465 nm) was selected due to its known effectiveness in activating melanopsin-containing intrinsically photosensitive retinal ganglion cells (ipRGCs), which contribute to sustained pupillary constriction.
Current-limiting resistors were selected to ensure electrical safety and stable optical output. The separation between the visible stimulus (blue LED applied to one eye) and the IR marker (observed in the camera view of the consensual eye) ensures that the timing of stimulus onset can be identified precisely in the video without introducing additional visible-light stimulation to the recorded eye.

4. System Procedure

The proposed system development procedure is divided into three parts: preparation, algorithm development, and implementation. Each of these is described in detail in Section 4.1, Section 4.2 and Section 4.3.

4.1. Preparation

This first part follows a sequential procedure: preparation of the subject, light stimulation, image recording with a camera, and finally extraction of T c , T s , and T r . The development of each of these is presented below.
  • 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 ( x , y ) in the image, B ( x , y ) , is defined by Equation (1). B ( x , y ) takes the value 1 if the pixel belongs to the pupil, 0 otherwise. It also applies a fixed threshold of T = 51 in grayscale (an intensity range of 0 to 255 for 8-bit images). Pixels with lower intensity are classified as pupils.
    B ( x , y ) = 1 , if I ( x , y ) < T , 0 , if I ( x , y ) T ,
    where I ( x , y ) is the intensity of the pixel in grayscale at position ( x , y ) 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, k = 2 , corresponding to the pupil and background/iris, respectively, adapting to the distribution of the intensity vector of pixel x i .
    J = min { μ k } k = 1 2 i = 1 N min k { 1 , 2 } x i μ k 2
    where μ k is the centre of k.
    The third is Otsu [20], which automatically selects the optimal threshold T O t s using Equation (3). T O t s maximizes the variance between pixel classes σ B 2 ( T ) , and equivalently, minimizes the robust intraclass variance σ W 2 ( T ) in the face of lighting variations. σ B 2 ( T ) is defined in Equation (4).
    T O t s u = arg max T σ B 2 ( T ) = arg min T σ W 2 ( T )
    σ B 2 = k = 1 m ω k ( μ k μ T ) 2
    Finally, Multichannel Thresholding (RGB) [21], in which the binary mask B c h ( x , y ) is determined by fixed thresholds to the intensity values of the color channels T c h of the image, with c h { R , G , B } . B c h ( x , y ) is defined in Equation (5) and T c h = 51 is set in the three color channels to analyze the chromatic contribution to pupil discrimination.
    B c h ( x , y ) = 1 , if I c h ( x , y ) < T c h , 0 , if I c h ( x , y ) T c h , c h { R , G , B }
    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, T c , T s , and T r , based on pupil dynamics [22].
    P n o ( t ) = P 0 k c ( t t 0 ) , t 0 t < t min , P min , t min t < t off , P min + k r ( t t off ) , t t off ,
    where P n o ( t ) represents the normalized pupil area as a function of time, dimensionless and bounded in the interval [ 0 , 1 ] . The parameter P 0 corresponds to the normalized baseline value of the pupil area before the onset of the light stimulus, while P min denotes the minimum value reached during maximum pupil contraction. The instant t 0 indicates the onset of the light stimulus, t min corresponds to the time at which the pupil reaches its minimum aperture, and t off represents the switch-off of the light stimulus, from which T r begins. The parameters k c and k r represent the slopes of the contraction and recovery times, respectively. From a physiological point of view, k c is associated with parasympathetic activation, while k r reflects sympathetic recovery. A temporal smoothing filter was applied to the pupil series to reduce noise and improve the estimation of T c , T s , and T r  [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 T c , T s , and T r  [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).
    T c = t min t 0
    T s = t f s t min
    T r = t f r t off
    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

This subsection describes the development of pupil segmentation and analysis algorithms to identify the region corresponding to the pupil in each frame of the acquired videos. Segmentation methods were designed and implemented, including binary thresholding, Otsu, K-Means, and RGB channel thresholding, as well as a pipeline process that organizes their application frame by frame. Temporal smoothing filters are applied to the pupil series before feature extraction to reduce high-frequency noise and improve the estimation of characteristic times [23,24]. In addition, this pipeline process allows time series to be extracted from the pupil area for subsequent dynamic analysis.

4.2.1. Pupil Analysis

Pupil analysis is performed by designing a process in three main stages: pre-processing, segmentation, and extraction of temporal features. Algorithm 1 describes the flow of this process. This flow presents the sequence of operations from reading each video to obtaining the normalized pupil area time series. This scheme also allows the temporal evolution of the pupil to be analyzed using different segmentation methods applied frame by frame.
Algorithm 1 Pupillary analysis pipeline (preprocessing + segmentation + temporal feature extraction)
  1:
INPUT: video_list, ROI_coords per video, threshold parameters
  2:
OUTPUT: results_per_video (time, area_per_method)
  3:
Initialize libraries (cv2, numpy, skimage, sklearn, matplotlib)
  4:
for each video in video_list do
  5:
    Open video using cv2.VideoCapture
  6:
    Read fps, total_frames
  7:
    Define ROI = ( x , y , radius) manually with reference grid guidance to maintain spatial consistency across frames [27]
  8:
    for frame from start_frame to end_frame do
  9:
        frame_roi ← extract circular region at ( x , y , radius)
10:
        grayBGR2GRAY(frame_roi)
11:
        Apply each segmentation method (see Alg. B–E)
12:
        area_binary(frame) ← count dark pixels (fixed threshold)
13:
        area_otsu(frame) ← count pixels in Otsu mask
14:
        area_kmeans(frame) ← count dark cluster labels
15:
        area_rgb(frame) ← count pixels per R, G, B channel
16:
        Store time stamps and areas
17:
    end for
18:
    Normalize temporal series (0–1) using Equation (10) for comparability across participants [28]
19:
    Piecewise fitting to estimate T c , T s , T r
20:
    Store results_per_video
21:
end for
22:
return results_per_video

4.2.2. Binary Threshold

The binary threshold is the first method implemented, described in Algorithm 2. This method converts the frame to greyscale and applies a circular mask centered on the ROI. Pixels whose I ( x , y ) is less than a fixed threshold of T = 51 are classified as belonging to the pupil, while the others are discarded. Similarly, the pupil area is determined as the sum of the pixels classified within the mask. This fixed threshold is justified for consistency with prior studies and allows reproducible segmentation despite minor illumination variations [28].
Algorithm 2 Binary Thresholding (ROI)
1:
Function apply_binary(frame, center, radius, T)
2:
graycv2.cvtColor(frame)
3:
mask ← create circular mask centered at center with radius radius
4:
maskedbitwise_and(gray, mask)
5:
binary ← (masked < T)               ▹ “dark” pixels
6:
area ← ∑binary
7:
return area

4.2.3. Otsu’s Method

Otsu’s method is the second method implemented, described in Algorithm 3. The procedure of this method determines T O t s u that maximizes σ B 2 , separating the dark pixels (pupil) from the rest. Similarly, a Gaussian kernel size of 5 × 5 is applied for Gaussian smoothing before the calculation to improve threshold stability. This method eliminates the need to set a fixed threshold, which increases its robustness against lighting variations.
Algorithm 3 Otsu Thresholding (ROI)
1:
Function apply_otsu(frame, center, radius)
2:
gray ← cv2.cvtColor(frame)
3:
blur ← cv2.GaussianBlur(gray, 5 × 5 , 0)
4:
mask ← create circular mask centered at center with radius radius
5:
valid_pixels ← blur[mask == 255]
6:
thresh ← threshold_otsu(valid_pixels)
7:
binary ← (blur > thresh)
8:
area ← ∑ (binary == 0)           ▹ assuming pupil = dark
9:
return area

4.2.4. Segmentation Using K-Means

The K-Means segmentation method is the third method applied, as shown in Algorithm 4. This method uses a K-Means clustering algorithm with K = 2 applied to the pixels of the ROI in the RGB color space. Each pixel is assigned to the k whose μ k is closest according to the Euclidean distance, and k with the lowest average intensity. In addition, the ROI is determined by counting the pixels that belong to k. Finally, this method adapts to color and lighting variations that occur during operation.
Algorithm 4 K-Means Clustering on ROI (K = 2)
1:
Function apply_kmeans(frame, center, radius, K = 2)
2:
mask ← create circular mask centered on the eye ROI
3:
pixels ← frame[mask==255].reshape(−1,3)
4:
kmeans = KMeans(n_clusters = K).fit(pixels)
5:
labels ← kmeans.labels_
6:
area_dark ← ∑ (labels==0)
7:
area_bright ← ∑ (labels==1)
8:
return area_dark, area_bright

4.2.5. RGB Thresholding

The multi-channel RGB thresholding method is the fourth method applied, as shown in Algorithm 5. In this method, R, G, and B are processed independently, applying specific thresholds T R , T G , and T B , respectively. A pixel is classified as a pupil if its intensity is below the threshold defined in all three channels simultaneously. The areas per channel are also stored independently to evaluate which channel provides the most stable pupil delineation under the experimental illumination conditions.
Algorithm 5 Channel-Based Thresholding (R, G, B)
1:
Function apply_rgb_threshold(frame, center, radius, T C h R , T C h G , T C h B )
2:
mask ← create circular mask centered at center with radius radius
3:
channelscv2.split(frame)
4:
for each channel c { R , G , B }  do
5:
    masked_cchannels[c] & mask
6:
    binary_c ← (masked_c < T C h c ) ▹ pixels with intensity below the channel threshold
7:
    area_c ← ∑ binary_c
8:
end for
9:
return area_R, area_G, area_B

4.2.6. Integration and Temporal Extraction

After applying the segmentation methods, the main pipeline (Algorithm 1) integrates the ROI time series obtained by each method. Then, all series are normalized using the following:
x ˜ = x min ( x ) max ( x ) min ( x )
Normalization allows comparison of pupillary response shape across participants and methods and compensates for intensity and illumination variability [28]. This normalization enables the comparison of the pupillary response shape between methods and participants. Finally, a sectional adjustment is made to estimate T c , T s , and T r of the pupillary response. The values obtained allow the quantification of pupillary dynamics in response to the applied stimulus.

4.3. Implementation

The proposed system was implemented in Google Colab using Python 3. The OpenCV (cv2) libraries were used for image processing, while NumPy was used for array manipulation and numerical operations. Matplotlib (version 3.8.2) was used to visualize the results, scikit-learn to apply the K-Means algorithm, and scikit-image to estimate T O t s u . ROI was defined manually for each video using a reference grid to maintain spatial consistency and reduce motion artifacts [27]. During the segmentation, specific parameters were configured for each of the methods described above and summarized in Table 2.
All time series were normalized to [0, 1] to compare pupillary dynamics across participants and conditions [28]. Finally, the main metric was P ( t ) . This metric allowed us to quantify the temporal variation in pupil diameter in response to the applied light stimulus.

5. Results

This section presents the results obtained from applying the four pupil segmentation methods: binary thresholding, k-means clustering, Otsu’s threshold, and multichannel RGB thresholding. The choice of parameters and methods is justified based on preliminary tests and literature recommendations. Table 2 summarizes the values of parameters used.

5.1. Binary Thresholding

Figure 4 shows the temporal evolution of the normalized pupil area using binary thresholding P u b as a function of T n o for the three subjects evaluated. The curves represent the fraction of pixels classified as pupil within the ROI, scaled to the interval [ 0 , 1 ] . All time series are smoothed using a moving average filter (window = 3 frames) to reduce high-frequency noise. At the beginning of the recording ( T n o 0 ), the subjects present high P u b values, indicating a relatively dilated pupil under reference lighting conditions. Subsequently, for values of T n o between 0.1 and 0.2, P u b decreases abruptly, reaching minimum values close to 0.1–0.2. Likewise, for values of T n o between 0.3 and 0.6, P u b remains close to its minimum value, indicating a relatively stable plateau. During this interval, subject 1 exhibits greater short-term variability, likely due to micro-movements or acquisition artifacts, although the general trend remains consistent with that observed in the other subjects. Finally, starting at T n o = 0.7 , P u b shows a progressive increase, more pronounced in subjects 2 and 3, reaching values close to 0.7–0.8 towards the end of the recording.

5.2. Clustering Using K-Means

Figure 5 shows the temporal evolution of the normalized pupil area obtained using K-means P k m , with K = 2 as a function of T n o . In this approach, the pixels in the ROI are grouped according to their intensity, assigning the darkest cluster to the pupil region. P k m shows greater temporal variability. In particular, subjects 2 and 3 show abrupt peaks and discontinuities around T n o 0.45 and 0.60 . These irregularities highlight the sensitivity of K-means to small intensity variations in the ROI.

5.3. Otsu Method

Figure 6 shows the temporal evolution of the normalized pupil area obtained using the Otsu method P o , independently for each frame. P o for the three subjects shows marked temporal irregularity, with abrupt fluctuations and isolated peaks, especially for subjects 2 and 3 between T n o 0.5 and 0.7 . Additional filtering may be required to maintain temporal consistency.

5.4. Multichannel Thresholding (RGB)

Figure 7 shows the temporal evolution of the normalized pupil area obtained using independent thresholds in the B, G, and R channels, P u b m ( B ) , P u b m ( G ) , P u b m ( R ) , respectively, for the three subjects evaluated. This analysis allows us to evaluate the impact of the spectral channel on the temporal stability of the segmentation. Analysis of spectral channels shows the R channel provides the smoothest temporal behavior. In Figure 7a, P u b m ( B ) shows high variability and abrupt changes between frames. In Figure 7b, P u b m ( G ) shows improved continuity. In Figure 7c, P u b m ( R ) shows the most stable behavior among the three channels evaluated. Overall, the R channel provides the best compromise between temporal continuity and noise reduction.

5.5. Comparison of Segmentation Methods

Figure 8, Figure 9 and Figure 10 present a direct comparison between P u b , P o , P k m and P u b m ( R ) . All signals are smoothed prior to comparison to reduce artifacts. P u b and P u b m ( R ) consistently show the most stable behavior.

5.6. Temporal Analysis of the Pupillary Reflex

Figure 11 shows the behavior of the number of pupil pixels P within the ROI during the application of the blue light stimulus. Start and end of stimulus were visually corroborated with the processed signal. Representative values from Subject 2 are presented as an illustrative example of the parameter extraction process. Subject 2 was selected empirically because the results from Subjects 1 and 3 were practically similar, except for Subject 1, which exhibited slight differences likely due to external factors such as noise or lighting conditions. This selection ensures clarity in the presentation of results while maintaining consistency with the overall findings. P shows a differentiated variation in three consecutive time intervals: contraction ( T c ), steady-state ( T s ), and recovery ( T r ).

5.7. Temporal Parameters

Table 3 presents the average values of T c , T s , and T r obtained from the analysis of the normalized pupil signal of Subject 2. The superscript * indicates that T r did not reach baseline within the acquisition interval. Representative values from Subject 2 are presented as an illustrative example of the parameter extraction process.
Overall, fixed-threshold methods and the R channel show superior temporal stability and reproducibility.

6. Discussion

The results obtained in this study are consistent with the existing literature on pupil segmentation and photomotor reflex analysis, particularly those that prioritize temporal stability and experimental reproducibility. Table 4 summarizes representative approaches, from classical methods to deep learning-based solutions, allowing the scope of the proposed approach to be contextualized.
In [29], the authors combined the Hough transform with support vector machines (SVMs), achieving errors of less than 10 % in controlled scenarios. Although this approach offers robust performance, it requires precise calibration of the optical system and explicit modelling of the pupil contour, which increases computational complexity and limits its portability. On the other hand, methods based on deep neural networks, such as the one proposed in [30], achieve high levels of accuracy through advanced convolutional architectures. However, their dependence on large volumes of annotated data and their limited real-time performance restrict their application in embedded systems or those with low computational potential.
In the clinical setting, the work of [31] established normative parameters for the photomotor reflex using commercial infrared pupillometers, providing a robust quantitative reference based on a large cohort. However, this type of solution relies on specialized and costly equipment, limiting its accessibility outside the hospital setting. More recently, reference [13] demonstrated the feasibility of encoder–decoder architectures for pupil segmentation in complex clinical conditions, albeit with a significant increase in algorithmic complexity. In contrast to deep learning methods, the present work employs classical image processing methods, including binary thresholding, k-means clustering, Otsu’s method, and RGB analysis, all implemented in a low-computational-cost environment. Although segmentation metrics such as IoU or Dice are not reported, the temporal stability and reproducibility of the pupil area signal are prioritized, as required for dynamic reflex analysis. From a practical perspective, the approach’s computational simplicity facilitates its implementation on open-access platforms and its adaptation to adverse experimental conditions, such as lighting variations or hardware limitations. In this context, the results reinforce the idea that properly configured methods constitute a viable alternative for applications where temporal stability and real-time execution are priorities.

Studies on Altitude Adaptation

This study was conducted in the city of Cusco, a high-altitude region at approximately 3400 m above sea level, where chronic hypoxia can induce systemic physiological adaptations. Previous studies, such as [32], have documented genomic adaptations in Andean, Tibetan, and Himalayan populations, suggesting possible ANS modulation. Although these studies focus on molecular mechanisms, their results provide a framework for interpreting physiological responses in chronic hypoxic environments. Within the analyzed time intervals, no atypical pupillary responses attributable to high altitude were observed. Although no genetic comparisons or sea-level assessments were performed, the results indicate that the experimental protocol used allows the capture of consistent pupillary dynamics at high altitude. Future studies with larger cohorts and comparative low-altitude groups are recommended to investigate potential altitude-related differences.
In summary, this study constitutes a significant contribution to the field of pupillometry in high-altitude contexts. This study demonstrates that simple classical image processing techniques can provide physiologically relevant, temporally stable measures even in extreme environments. Furthermore, these results support the use of accessible, low-computational-cost methodologies for diagnostic and research applications in regions with limited technological resources. Experimental validation and agreement with previous studies reinforce the robustness of the proposed approach.

7. Conclusions

This study analyzes the dynamics of the human pupillary reflex to a blue, step-like light stimulus, using digital image processing techniques applied to video sequences acquired in the city of Cusco at an altitude of 3400 m above sea level. The results show that it is possible to consistently characterize the pupillary response using computationally simple methods, preserving the temporal and physiological coherence of the reflex.
The comparative evaluation of segmentation methods shows that binary thresholding and multichannel thresholding in the red channel achieve the greatest temporal stability and reproducibility across subjects, outperforming approaches such as Otsu and k-means in scenarios with lighting and noise variations. Temporal analysis allows us to consistently extract characteristic parameters of the pupillary reflex, demonstrating reproducible behavior among the subjects evaluated. These results confirm that threshold-based methods provide robust temporal profiles suitable for dynamic reflex analysis. From an applied perspective, this study demonstrates that it is possible to implement computer vision-based pupil analysis systems without resorting to specialized equipment or complex AI models. This feature is particularly relevant in contexts with limited technological resources. In conclusion, classical image-processing techniques enable consistent characterization of pupil reflex dynamics under blue illumination in a high-altitude population. The results confirm the validity of the proposed approach as a simple, reproducible, and low-computational-cost solution suitable for pupillometry applications in experimental and clinical contexts with limited resources, while future automation of ROI selection is expected to further enhance reproducibility.
Finally, this study should be interpreted as a pilot methodological validation conducted at high altitude. Therefore, the results should be considered preliminary and are not intended to be generalized to the population as a whole.

8. Future Work

Based on the results of this study, several lines of future research are proposed to enhance the robustness, applicability, and generalizability of the system. Expanding the cohort size and including control groups at sea level will allow the investigation of potential altitude-related differences in the pupillary reflex. Temporal filtering and smoothing techniques for the extracted pupil time series will be implemented, particularly for adaptive methods such as Otsu and K-means, to reduce short-term fluctuations and improve temporal stability. Comparative studies will be conducted between the proposed low-cost, image-processing-based approach and deep learning-based segmentation methods under identical experimental conditions, assessing trade-offs between computational cost, temporal stability, and segmentation accuracy. The system will be evaluated under varied illumination conditions, including blue and infrared light, to determine the influence of spectral channels on pupillary dynamics. Automated ROI selection and tracking techniques will be explored to minimize manual intervention, increase reproducibility, and reduce operator bias, ensuring that results remain robust across multiple subjects and experimental sessions.

Author Contributions

Conceptualization and methodology, E.R.T.-C., E.M.-C. and M.A.C.-G.; software, E.R.T.-C.; validation and formal analysis, E.R.T.-C. and M.A.C.-G.; investigation, E.R.T.-C. and R.J.C.-C.; resources, L.W.U.M. and M.A.C.-G.; data curation, E.R.T.-C., E.M.-C. and E.J.S.-C.; writing—original draft preparation, E.R.T.-C., Y.C.-R., E.M.-C. and E.J.S.-C.; writing—review and editing, all authors; visualization, L.W.U.M., Y.C.-R. and E.M.-C.; supervision, R.J.C.-C., E.M.-C. and E.J.S.-C.; project administration, L.W.U.M., R.J.C.-C. and E.M.-C.; funding acquisition, L.W.U.M., M.A.C.-G., R.J.C.-C. and E.J.S.-C. All authors have read and agreed to the published version of the manuscript.

Funding

This work was funded by the Universidad Nacional San Antonio Abad del Cusco (UNSAAC) through the projects of the Professional School of Electronic Engineering and partially by the Universidad Politécnica Salesiana under the Fog Computing Simulation project.

Data Availability Statement

Data are contained within the article.

Acknowledgments

We thank the Institutional Laboratory of Renewable Energy, Optical Communications Engineering and Environmental Technology (TESLA), and the Laboratory for Research, Entrepreneurship and Innovation in Automatic Control Systems, Automation and Robotics (LIECAR), both from the Universidad Nacional de San Antonio Abad del Cusco, and Cloud Computing Smart Cities & High Performance Computing Research Group (GIHP4C) from the Universidad Politécnica Salesiana. Additionally, the authors acknowledge the Technology and Engineering Group of EM Research & Tech for providing technical support and feedback during the development of this work.

Conflicts of Interest

The authors declare no potential conflicts of interest. Author Edison Moreno-Cardenas was employed by the company EM Research & Tech.

References

  1. 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]
  2. 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]
  3. 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]
  4. 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]
  5. 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]
  6. 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]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. Gonzalez, R.C. Digital Image Processing; Pearson Education: Chennai, India, 2009. [Google Scholar]
  16. 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]
  17. Zele, A.J.; Gamlin, P.D. The Pupil: Behavior, Anatomy, Physiology and Clinical Biomarkers; Frontiers Media S.A.: Lausanne, Switzerland, 2020. [Google Scholar]
  18. 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]
  19. 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]
  20. 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]
  21. Sharma, G.; Trussell, H.J. RGB-based image segmentation for real-time applications. IEEE Trans. Image Process. 2003, 12, 375–385. [Google Scholar] [CrossRef]
  22. Longtin, A.; Milton, J. A model of pupillary light reflex response. J. Biol. Phys. 1989, 17, 199–207. [Google Scholar]
  23. McDougal, D.H.; Gamlin, P.D. Autonomic control of the eye. Compr. Physiol. 2015, 5, 439–473. [Google Scholar] [CrossRef] [PubMed]
  24. 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]
  25. Hall, C.A.; Chilcott, R.P. Eyeing up the Future of the Pupillary Light Reflex in Neurodiagnostics. Diagnostics 2018, 8, 19. [Google Scholar] [CrossRef]
  26. Pinheiro, J.; da Costa, J.P. Pupillary Light Reflex as a Diagnostic Aid: A Computational Perspective. Sensors 2021, 21, 6054. [Google Scholar] [CrossRef]
  27. 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]
  28. Meyers, B.A.; Vlachos, P.P. Video-based pupillometry using Fourier Mellin image correlation. Sci. Rep. 2025, 15, 26153. [Google Scholar] [CrossRef]
  29. 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]
  30. 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]
  31. 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]
  32. 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]
Figure 1. General system of the integrated ecosystem for pupil analysis.
Figure 1. General system of the integrated ecosystem for pupil analysis.
Computers 15 00160 g001
Figure 2. Data acquisition and processing system.
Figure 2. Data acquisition and processing system.
Computers 15 00160 g002
Figure 3. Light stimulation circuit.
Figure 3. Light stimulation circuit.
Computers 15 00160 g003
Figure 4. Behavior of P u b for Subjects 1, 2 and 3, with T = 51 . The moving average smoothing was applied to reduce temporal noise.
Figure 4. Behavior of P u b for Subjects 1, 2 and 3, with T = 51 . The moving average smoothing was applied to reduce temporal noise.
Computers 15 00160 g004
Figure 5. Behavior of P k m for Subjects 1, 2 and 3, with K = 2 . Notice higher temporal fluctuations compared to threshold-based methods.
Figure 5. Behavior of P k m for Subjects 1, 2 and 3, with K = 2 . Notice higher temporal fluctuations compared to threshold-based methods.
Computers 15 00160 g005
Figure 6. Behavior of P o for Subjects 1, 2 and 3. Adaptive thresholds lead to abrupt fluctuations, limiting continuous tracking.
Figure 6. Behavior of P o for Subjects 1, 2 and 3. Adaptive thresholds lead to abrupt fluctuations, limiting continuous tracking.
Computers 15 00160 g006
Figure 7. Multichannel thresholding applied to the (a) blue, (b) green, and (c) red channels for the three evaluated subjects. The R channel facilitates reliable extraction of T c , T s , and T r .
Figure 7. Multichannel thresholding applied to the (a) blue, (b) green, and (c) red channels for the three evaluated subjects. The R channel facilitates reliable extraction of T c , T s , and T r .
Computers 15 00160 g007
Figure 8. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 1. Threshold-based methods provide smooth and reproducible temporal profiles.
Figure 8. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 1. Threshold-based methods provide smooth and reproducible temporal profiles.
Computers 15 00160 g008
Figure 9. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 2. Local variations in P u b m ( R ) remain minimal.
Figure 9. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 2. Local variations in P u b m ( R ) remain minimal.
Computers 15 00160 g009
Figure 10. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 3. Smooth curves from threshold-based methods enable reliable identification of pupillary dynamics.
Figure 10. Comparison of P u b , P o , P k m and P u b m ( R ) for Subject 3. Smooth curves from threshold-based methods enable reliable identification of pupillary dynamics.
Computers 15 00160 g010
Figure 11. Temporal analysis of the pupillary light reflex of Subject 2. The green region corresponds to T c , the light blue region to T s , and the pink region to T r . Segmentation based on binary thresholding ensures temporal stability for parameter extraction.
Figure 11. Temporal analysis of the pupillary light reflex of Subject 2. The green region corresponds to T c , the light blue region to T s , and the pink region to T r . Segmentation based on binary thresholding ensures temporal stability for parameter extraction.
Computers 15 00160 g011
Table 1. General notation used in this article.
Table 1. General notation used in this article.
DescriptionNotation
Pupillary contraction time T c
Plateau or steady-state time T s
Pupillary recovery time T r
Normalized time T n o
Number of pupil pixels in the ROI at time t P ( t )
Region of Interest (image area used for analysis) ROI
Normalized pupillary area in the range [ 0 , 1 ] P n o
Pupillary area obtained by binary thresholding P u b
Pupillary area obtained using Otsu’s method P o
Pupillary area obtained using K-means (dark cluster) P k m
Pupillary area obtained by multichannel thresholding in the red channel P u b m ( R )
Pupillary area obtained by multichannel thresholding in the green channel P u b m ( G )
Pupillary area obtained by multichannel thresholding in the blue channel P u b m ( B )
Binarized value of a pixel at image coordinates ( x , y ) B ( x , y )
Grayscale pixel intensity at position ( x , y ) I ( x , y )
Pixel intensity in color channel c h { R , G , B } at position ( x , y ) I c h ( x , y )
Total K-means costJ
Fixed grayscale threshold (0–255)T
Fixed threshold of channel c h T c h
Centroid of cluster k in K-means μ k
Feature vector of pixel i x i
Optimal threshold obtained using Otsu’s method T Otsu
Between-class pixel variance using Otsu’s method σ B 2
Robust within-class variance using Otsu’s method σ W 2 ( T )
Gaussian kernel size used during smoothing k G
Table 2. Configuration of specific parameters.
Table 2. Configuration of specific parameters.
MethodParameterValue
Binary thresholdingT51
Otsu k G 5 × 5
K-MeansK2
RGB thresholding T c h 51
Table 3. Quantitative parameters derived from pupillary analysis.
Table 3. Quantitative parameters derived from pupillary analysis.
ParameterDuration (s)
T c 1.89
T s 0.41
T r 2.33 *
* The recorded value corresponds to the maximum interval observed during the experimental acquisition.
Table 4. Comparative analysis of works in pupil segmentation and pupillary light reflex assessment.
Table 4. Comparative analysis of works in pupil segmentation and pupillary light reflex assessment.
Ref.Methodological ApproachDatasetPerformance MetricsExperimental Validation
[29]Hough transform, dynamic model, SVMHealthy subjects and subjects under alcohol influenceError rate < 10 % ; < 5 % in 75% of the evaluated casesFull experimental
[30]Deep convolutional neural network with ASPP blocksPublic dataset (non-clinical)Accuracy = 0.921; Sensitivity = 0.896; Specificity = 0.999Partial validation
[31]Portable infrared pupillometer (Neuroptics)More than 300 healthy subjects and 26 acute traumatic brain injury patientsConstriction velocity: 1.48 ± 0.33 mm/s; Pupillary change: 34%Full experimental
[13]Encoder–decoder architecture for segmentation in ptosis assessmentClinical images from patientsDice coefficient = 0.767; IoU = 0.653Full experimental
This workBinary thresholding, K-means clustering,
Otsu’s method, and
RGB-based analysis
Clinical video acquisition under blue LED stimulation T c = 1.89 s; T s = 0.41 s; T r = 2.33 sFull 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.

Share and Cite

MDPI and ACS Style

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

AMA Style

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 Style

Torres-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 Style

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. (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

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop