Eye-closed pupil center real-time extraction and trajectory tracking image processing algorithm
By using the least squares ellipse fitting method of geometric distance in the image processing algorithm, the problem of difficulty in monitoring the pupil parameters under closed eyelids is solved, high-precision real-time extraction and trajectory tracking of the pupil center are achieved, and the accuracy and applicability of monitoring are improved.
Patent Information
- Application Number
- CN202510045412.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-01-13
AI Technical Summary
The prior art is difficult to accurately monitor pupil parameters in the case of closed eyelids, low-light environments, or eye damage, especially in cases where conventional methods require eyes open, rely on visible light and are sensitive to light conditions.
Using an algorithm based on image processing, the center of the pupil under the closed eyelid is extracted in real time and its motion trajectory is tracked through the least squares ellipse fitting method of geometric distance. The algorithm includes steps such as image preprocessing, adaptive threshold segmentation, morphological operations, connectivity domain analysis, edge extraction and ellipse fitting.
High-precision real-time extraction and trajectory tracking of the pupil center under closed eyelid conditions, reducing dependence on visible light environments, and improving monitoring accuracy under low light or unsuitable lighting conditions.
Smart Images

Figure CN119810087A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pupil monitoring, and in particular to an algorithm for real-time extraction and trajectory tracking of pupil centers in eye movement videos under closed eyelid conditions based on image processing. Background Art
[0002] The monitoring of pupil changes is of vital importance in clinical care and neuroscience research. The information it conveys can not only assist clinicians in predicting and diagnosing the potential deterioration of patients' diseases, but also provide key reference indicators for various neurological function assessments. Especially in fields such as neurology, intensive care, and anesthesia that are highly dependent on rapid and accurate physiological signal assessment, monitoring pupil size and its dynamic response to light stimulation has become a key part of the comprehensive evaluation of patients' vital signs. When patients are in a more special physiological state, such as closed eyelids, limited consciousness, or in a state of deep sedation and anesthesia, conventional visual pupil measurement methods become very difficult. Due to the frequent changes in the visible light environment and the high requirements on the patient's physiological state and environmental adaptability, traditional visible light-based pupil measurement methods often find it difficult to provide accurate and stable pupil parameters in the case of closed eyelids, low light environments, or eye injuries. On the other hand, in clinical practice, when eye drops, sedatives, anesthetics or other intervention methods are sometimes used, changes in pupil diameter can directly or indirectly reflect the degree of damage to the nervous system and the effects of drugs. Therefore, it is necessary to accurately monitor the patient's closed eyes pupil state in a non-invasive or low-burden state.
[0003] However, the current traditional pupil measurement methods are intermittent, qualitative, manual, and limited to cases with open eyes, such as direct observation with a flashlight, manual comparison of pupil scales, and eyelid opening measurement with the help of professional instruments, all of which have certain limitations. These traditional methods often require the patient's eyelids to be open, and have high requirements on the medical staff's proficiency in operation and on-site lighting conditions. At the same time, when faced with patients who are unable or inappropriate to open their eyes (such as patients with severe injuries that prevent their eyelids from opening voluntarily, or patients under deep sedation or anesthesia), traditional methods cannot be performed normally, making pupil measurement under such special physiological or pathological conditions a clinical problem. In addition, solutions that rely on visible light measurement have insufficient accuracy and consistency in strong light, weak light, and variable lighting scenes, which is not conducive to continuous and quantitative tracking of the severity and progression of the disease.
[0004] In the face of the above challenges, some researchers have proposed a method for detecting and measuring pupils under closed eyelids using near-infrared light sources and infrared cameras. For example, according to the paper "Measuring pupil size and light response through closed eyelids" published by Yousef Farraj et al. in Volume 12, Issue 10 of Biomedical Optics Express in 2021, a technical solution has been reported to irradiate the eyelids with near-infrared light, capture the transcutaneous reflection signal through a camera, and then estimate the pupil diameter using an image algorithm. This type of method reduces the impact of changes in the visible light environment to a certain extent, making it possible to evaluate the size and dynamic characteristics of the pupil under closed eyelids. Through this infrared imaging method, pupil information can be obtained under relatively more stable and low-contrast image conditions, and the stress response of patients caused by strong light stimulation can be reduced. However, this type of method still faces some problems in implementation: First, during the process of human eye image acquisition, the collected human eye image does not always contain a complete pupil. The human eye pupil will have certain or even large differences in shape, size, opening and closing state, etc. In noisy images, the pupil is not necessarily a complete circular pattern. Since IR is scattered through the eyelids, the pupil image has no obvious boundaries. Therefore, the low-intensity interference area in the binary image may surround the pupil and reduce the accuracy of pupil positioning. This method assumes that the pupil is circular, which will cause errors in fitting the pupil diameter. Secondly, this method only calculates the pupil diameter through static images and cannot extract the pupil trajectory and achieve real-time tracking. Therefore, it is inconvenient to study the complex shape and movement of the pupil under dynamic conditions and has low flexibility.
[0005] At the same time, some scholars have tried to use intelligent algorithms or machine learning methods to assist pupil detection and size quantification, and automatically segment and identify eye features in video data through deep learning models. For example, in the paper "Touchless short-wave infrared imaging for dynamic rapid pupillometry and gaze estimation in closed eyes" published by Omer Ben Barak-Dror, Barak Hadad et al. in 2024, it was reported that short-wave infrared (SWIR, ~0.9-1.7 microns) imaging was combined with image processing algorithms. The analysis based on neural networks can successfully use closed-eye SWIR data to reconstruct the estimation of open-eye images and evaluate pupil size, thus achieving rapid pupil measurement and eye tracking in closed-eye state. However, this method requires a large amount of open-eye annotated data to be established through experiments for model training, which has a large demand for computing resources, requires specific SWIR cameras and light sources, and is relatively complex. At the same time, this method relies on the assumption of binocular symmetry of healthy individuals, and the analysis needs to rely on the training of individual open-eye data of subjects. Some literature points out that more robust image enhancement and adaptive segmentation strategies are needed to stably locate pupil boundaries under conditions of noise interference, low local contrast, and frequent illumination changes. Summary of the invention
[0006] In view of the technical difficulties faced by the above existing technologies in the process of pupil detection and trajectory tracking under closed eyelid conditions, the present invention proposes an image processing algorithm for real-time extraction and trajectory tracking of closed eye pupil center. On the basis of traditional digital image processing, the algorithm adopts a least squares ellipse fitting algorithm based on geometric distance, utilizes the geometric characteristics of the ellipse, and determines the ellipse parameters by minimizing the geometric distance from a given point to the ellipse surface. Through fminsearch iteration, it can gradually approach the optimal solution, that is, the ellipse shape that best fits the image data, and finally realizes the real-time extraction and trajectory depiction of the pupil in the closed eyelid eye movement video.
[0007] The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention comprises the following steps:
[0008] S1: Raw video data acquisition and image preprocessing:
[0009] The present invention first initializes the reading and writing of the video, then initializes the coordinate array and creates a fixed graphic window to speed up the processing of the effective area of the video, and then reads the original eye image in the video sequence frame by frame, and first performs grayscale conversion on each frame of the image to eliminate the interference of color information on pupil recognition. Then, according to the lighting conditions in the actual scene, the mean of the image brightness is calculated. The brightness enhancement and contrast enhancement methods (such as histogram equalization) are used to adjust the global brightness of the grayscale image to highlight the contrast between the pupil area and the surrounding tissue. On this basis, Gaussian smoothing filtering is used to suppress high-frequency noise and local texture stray information, providing better quality image basic data for subsequent segmentation and fitting.
[0010] S2: Adaptive threshold segmentation and morphological operation processing:
[0011] For the preprocessed grayscale image, the present invention uses an adaptive threshold method for binary segmentation, dynamically adjusts the segmentation threshold according to the brightness characteristics of the local area, and effectively deals with low-contrast areas caused by non-uniform lighting conditions and closed eyelid occlusion. In the preliminary binary image obtained, there may be edge defects or internal holes in the pupil area. The broken edges are connected by morphological closing operations, the internal holes are repaired by filling operations, and the discrete noise points are eliminated by morphological opening operations to obtain a continuous, complete binary image of the pupil candidate area with clear boundaries.
[0012] S3: Connected domain analysis and pupil candidate region screening:
[0013] The present invention marks the connected domains in the binary image after morphological processing, and obtains the morphological features such as the area, eccentricity, roundness, extension and centroid of all independent regions. By setting reasonable threshold conditions (such as the minimum area lower limit, the eccentricity upper limit and the roundness lower limit, etc.), the connected domains are screened one by one, and the areas that do not meet the physiological characteristics of the pupil are eliminated. Finally, only the candidate areas that are consistent with the real pupil morphology, size and distribution characteristics are retained, providing a reliable basis for the accurate positioning of the pupil center.
[0014] S4: Pupil contour feature edge extraction:
[0015] After obtaining the pupil candidate area, the present invention uses the Canny operator to perform edge detection on the effective area, thereby extracting the precise pupil contour, and statistically calculates the coordinates of these boundary points to form a point set for subsequent ellipse fitting.
[0016] S5: Least squares ellipse fitting based on geometric distance:
[0017] The pupil contour point set is extracted from the regional boundary, and the least square method based on geometric distance is used to perform ellipse fitting according to the extracted boundary points. The specific steps include calculating the covariance matrix for eigenvalue decomposition, so as to preliminarily estimate the major axis and minor axis directions of the pupil. Subsequently, the minimization residual fitting method (such as using the weighted residual square sum minimization optimization algorithm) is used to iteratively solve the ellipse parameters (the present invention uses the fminsearch iterative algorithm), and the optimal solution, that is, the ellipse shape that best fits the image data, can be gradually approached through iteration, so as to achieve high-precision ellipse fitting of the pupil contour.
[0018] The ellipse fitting method based on the least squares method used in the present invention takes into account five parameters, such as the center position of the ellipse, the length of the semi-axis, and the attitude angle of the ellipse, to form a parameter vector. The specific implementation steps of the algorithm are as follows:
[0019] 1) Initialize the ellipse parameters:
[0020]
[0021] Calculate the center point:
[0022]
[0023] Calculate the covariance matrix:
[0024] Centralized boundary point coordinates:
[0025]
[0026] Calculate the covariance matrix C:
[0027]
[0028] Eigenvalue Decomposition:
[0029] Perform eigenvalue decomposition on the covariance matrix C to obtain the eigenvectors v1,v2 of the eigenvalues λ1,λ2:
[0030] Cv=λv
[0031] Calculate the major and minor axes:
[0032] Calculate the major semi-axis a0 and the minor semi-axis b0 by eigenvalues:
[0033]
[0034] Calculate the ellipse rotation angle φ:
[0035]
[0036] where v 11 and v 21are the x and y components of the eigenvector v1.
[0037] Make sure the major and minor axes are correct:
[0038] if a<b
[0039] a,b=b,a
[0040] φ=φ+π / 2
[0041] 2) Calculate weights:
[0042]
[0043] Where: n is the number of data points, (x i ,y i ) are the coordinates of each data point.
[0044] 3) Define the objective function:
[0045]
[0046] Where: P = [p1, p2, p3, p4, p5] is the ellipse parameter to be optimized
[0047] 4) Minimize the objective function:
[0048]
[0049] Iterate through fminsearch, when the error ε<10 -7 To terminate.
[0050] 5) Extract the fitting results:
[0051] center:
[0052] Semimajor axis:
[0053] Semi-minor axis:
[0054] Rotation Angle:
[0055] S6: Pupil center extraction and real-time trajectory drawing:
[0056] In step S5), the center coordinates, major and minor axis parameters and rotation angle obtained by fitting can not only clearly define the position of the pupil center, but also calculate the pupil area to quantify the change of pupil size. The position of the pupil center is obtained by fitting, and the center coordinates are stored in the coordinate array. The video is processed frame by frame through the cycle to obtain the pupil center coordinate array set, and the center coordinate motion trajectory is depicted in a fixed window with a smooth curve. The image display is updated during each cycle, so that the center motion trajectory of the pupil can be depicted in real time. The video is saved after all center point trajectories are depicted.
[0057] S7: Plotting the curve of pupil area changing with time before and after white light stimulation:
[0058] Based on the continuous multi-frame video processing, the present invention performs time series analysis on pupil area data. First, pupil area data of the initial several frames are selected to calculate the baseline, and the ellipse area data is smoothed using a larger window size to ensure the continuity and smoothness of the time series and reduce the influence of noise, thereby obtaining a more stable curve that can effectively reflect the dynamic response of the pupil over time.
[0059] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0060] From the perspective of digital image processing, the present invention adopts morphological operations and optimizes the traditional image processing algorithm through least squares fitting and iterative algorithm, and proposes a real-time pupil center extraction and trajectory tracking algorithm in the process of eyelid closure based on video image processing, which has the following advantages:
[0061] 1) The adaptive threshold segmentation method is used to significantly reduce the problem of uneven illumination caused by light source excitation, provide more accurate segmentation, and have strong adaptability.
[0062] 2) The present invention adopts a filtering algorithm and an edge extraction algorithm, both of which are convolution algorithms, which significantly reduce the number of parameters of the method. The present invention only requires several convolution operations to extract the pupil edge point set parameters, which is simple to calculate and highly efficient.
[0063] 3) The present invention adopts the least squares ellipse fitting algorithm based on geometric distance, which utilizes the geometric characteristics of the ellipse and determines the ellipse parameters by minimizing the geometric distance from a given point to the ellipse surface. This algorithm takes into account five parameters, including the center position of the ellipse, the length of the semi-axis, and the attitude angle of the ellipse. It is optimized through an iterative algorithm, has a high fitting accuracy, and improves the robustness of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1A detailed flow chart of an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention;
[0065] Figure 2 A schematic diagram of an original image of an embodiment of an image processing algorithm for real-time extraction and trajectory tracking of pupil center of closed eyes of the present invention;
[0066] Figure 3 A schematic diagram of an image after graying and contrast enhancement according to an embodiment of an image processing algorithm for real-time extraction and trajectory tracking of pupil center of closed eyes of the present invention;
[0067] Figure 4 A schematic diagram of an image after Gaussian smoothing filtering of an embodiment of an image processing algorithm for real-time extraction and trajectory tracking of closed-eye pupil center of the present invention;
[0068] Figure 5 A schematic diagram of a local adaptive threshold-binarization image of an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention;
[0069] Figure 6 A schematic diagram of an image after morphological processing of an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention;
[0070] Figure 7 This is a schematic diagram of an image after deleting small areas and some interference areas according to an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention;
[0071] Figure 8 This is a schematic diagram of an image after edge extraction using the Canny operator according to an embodiment of an image processing algorithm for real-time extraction and trajectory tracking of closed-eye pupil centers of the present invention.
[0072] Fig. 9 This is a schematic diagram of an image of an ellipse fitting result based on the least squares method of geometric distance according to an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention.
[0073] Fig.10 This is a schematic diagram of a pupil center motion trajectory tracking image of an embodiment of a closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention.
[0074] Fig.11 This is an image schematic diagram of pupil area changing over time according to an embodiment of the closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of the present invention. DETAILED DESCRIPTION
[0075] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further elaborated in detail below in conjunction with the accompanying drawings and specific embodiments.
[0076] The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm of this embodiment is as follows: Figure 1 As shown in the figure, a detailed flow chart of the algorithm is given, which includes the following steps:
[0077] 1) Input video acquisition and preprocessing:
[0078] First, the video reading module is used to read the eye video to be processed frame by frame. The input video contains white light stimulation under the closed eyelids to verify the pupil's responsiveness, which may cause the original video frame to have problems such as uneven brightness, noise interference, and low contrast. In order to improve the distinguishability of the pupil area and the surrounding eye structures, the video frame needs to be preprocessed. In this example, one frame is selected as a demonstration. The original image diagram is shown in the figure below. Figure 2 shown.
[0079] The frame image is grayed out to remove the interference of color information and make the image features simpler. Then the average brightness of the frame image is calculated. Since the subsequent morphological processing will have different parameter settings according to the average brightness, the grayscale image is globally enhanced by brightness enhancement and histogram equalization according to the overall brightness level and contrast characteristics of the image, so that the dark details are improved and the contrast-enhanced image is obtained, such as Figure 3 shown.
[0080] There may still be high-frequency noise and local uneven illumination in the enhanced image. To further improve the accuracy of subsequent segmentation, the enhanced grayscale image is subjected to Gaussian smoothing filtering, which can effectively suppress random noise and retain the overall structural features of the pupil boundary. Figure 4 As shown in Figure 2, it can be seen that the overall illumination of the preprocessed image is uniform and the noise is significantly reduced.
[0081] 2) Adaptive threshold segmentation and morphological processing:
[0082] After obtaining a relatively clear preprocessed grayscale image, the image is binarized by the local adaptive threshold method to obtain a local adaptive threshold-binarized image, such as Figure 5 As shown in the figure. This threshold segmentation method can automatically adapt to the brightness changes of the periocular skin and pupil area in each local area, so that the pupil and the background can still be effectively distinguished under uneven lighting and partial eyelid closure conditions. In this example, after white light excitation, the average brightness of the image is large, and the adaptive threshold is set to 0.5 at this time, while the adaptive threshold is set to 0.53 when there is no white light excitation.
[0083] In the binary image obtained, the pupil area may have broken edges and small internal holes. The morphological closing operation is used to connect the pupil edges and repair the broken curves; the area filling operation is used to fill the holes inside the pupil so that the pupil presents a complete solid area; then the morphological opening operation is used to remove the small noise points attached to the outside of the pupil edge and retain the clean pupil body. After the above processing, the image after morphological operation is obtained, as shown in Figure 1. Figure 6 As shown in the figure, it can be clearly seen that the pupil area in the binary image after the above morphological processing presents a relatively smooth and coherent regional morphology. In this example, circular structure elements are used for both opening and closing operations. For frame images with higher average brightness, a circular structure element with a radius of 5 is first used for closing operation, and then a circular structure element with a radius of 40 is used for opening operation; for frame images with lower average brightness, a circular structure element with a radius of 5 is first used for closing operation, and then a circular structure element with a radius of 25 is used for opening operation.
[0084] 3) Connected domain labeling and pupil candidate region screening:
[0085] Connected domain analysis is performed on the processed binary image to mark all connected regions in the image. At this point, in addition to the pupil, there may still be several pseudo target regions formed by uneven lighting, noise, eyelid edges, eyelash shadows, etc.
[0086] In order to eliminate these interferences, the regionprops function is used to extract various features of each connected domain, including area, eccentricity, roundness (calculated by the relationship between area and perimeter), fill ratio of the circumscribed rectangle, and region centroid. By setting appropriate thresholds, such as minimum area, upper limit of eccentricity, lower limit of roundness and other parameters, areas that do not match the physiological characteristics of the pupil can be effectively filtered. The parameters set in this example are as follows: eccentricity is less than 0.9, area ratio is greater than 0.5, minimum area of the connected domain is greater than 8500 pixels, and roundness is greater than 0.85. By screening the connected domain under the above conditions, invalid non-pupil areas and small noise can be effectively removed. When there is no valid area or the pupil area is not obvious, skip the processing of the frame and proceed to the next frame.
[0087] After removing the connected domains that obviously do not meet the requirements, the remaining area is the pupil candidate area. Figure 7 As shown in FIG. 1 , after the above-mentioned feature screening, the connected domain retained is closer to the human pupil in shape and size.
[0088] 4) Pupil contour feature edge extraction:
[0089] For the determined pupil candidate area, extract its boundary point set, use the edge function to perform Canny edge detection on the binary area, and the convolution kernel size of the Canny operator is 3×3, so as to extract the precise pupil contour and obtain the binary time-frequency graph after edge extraction, as shown in Figure 8 The coordinates of these boundary points are statistically analyzed to form point cloud data for subsequent ellipse fitting.
[0090] 5) Least squares ellipse fitting based on geometric distance:
[0091] This algorithm uses the geometric properties of the ellipse to determine the ellipse parameters by minimizing the geometric distance from a given point to the ellipse surface. This algorithm takes into account five parameters, including the center position of the ellipse, the length of the semi-axis, and the attitude angle of the ellipse, to form a parameter vector. The optimal solution is found through an iterative algorithm. The specific calculation steps are: first initialize the ellipse parameter vector, then calculate the center and covariance matrix of the pupil boundary point set, and obtain the initial ellipse parameter estimate through eigenvalue decomposition, including the major and minor axis directions and proportional relationships. Then, the minimization error fitting method is used. In this example, the fminsearch function is used to iteratively optimize the defined error function, and the ellipse parameters (including the center coordinates (x, y), the major semi-axis a, the minor semi-axis b, and the rotation angle) are optimized. ) to optimize the solution.
[0092] During the optimization process, a weighted residual minimization strategy is used to assign smaller weights to boundary points that are far from the center to reduce the impact of outliers on the fitting results. Finally, it is also necessary to ensure that the obtained major and minor axes are reasonable, that is, if the obtained eigenvalues (a, b) are both positive and reasonable, it means that the fitting is successful. The fitting results are extracted to obtain the precise parameters of the pupil ellipse, thereby obtaining the ellipse fitting result based on weight optimization, such as Fig. 9 As shown, the optimal values of the parameters are: the pupil center coordinates are (174.2391, 757.5408), the major semi-axis a = 79.9237, the minor semi-axis b = 66.2307, the rotation angle (radian) = 1.547, and the rotation angle (degree) = 88.6352; the red solid line ellipse in the figure is fitted to the pupil contour, and the center point is marked with a green star mark, which is the pupil center coordinate of the current frame. It can be seen from the figure that the results obtained after the least squares ellipse fitting based on geometric distance and the optimization of the iterative algorithm are consistent with the pupil effective area actually observed under the closed eyelid, indicating that the algorithm can accurately identify and locate the position of the pupil (including the center coordinates), thereby verifying the beneficial effects of the present invention.
[0093] 6) Pupil center extraction and real-time trajectory description:
[0094] The pupil center coordinates can be obtained from step 5), and the pupil center coordinates obtained from multiple consecutive frames are recorded to obtain the change characteristics of the pupil movement trajectory over time. Finally, the pupil movement trajectory is drawn in real time, and the pupil center coordinate trajectory is superimposed and displayed on the original video frame. The movement of the pupil under the condition of closed eyelids is intuitively displayed in an animated manner, realizing the visual analysis of the dynamic changes of the pupil, such as Fig.10 shown.
[0095] 7) Plotting the curve of pupil area changing with time before and after white light stimulation:
[0096] First, the pupil area (πab) calculated for each frame is analyzed in time series. The baseline value is calculated using the area data of the first few frames. The time point corresponding to each frame is calculated and a moving average filter is applied to smooth the data. Then, a curve chart of pupil area changing over time is drawn, such as Fig.11 As shown in the figure, the dynamic change trend of pupil area before and after white light stimulation is shown. By analyzing this trend, the effect of white light stimulation on pupil response is evaluated, providing quantitative and visual analysis results for the study of pupil behavior under light stimulation.
[0097] The above embodiments are preferred specific implementations of the present invention. Obviously, the above implementations of the present invention are only examples for more clearly illustrating the present invention, and are not intended to limit the implementations of the present invention. Any modifications, equivalent substitutions and improvements within the spirit and principles of the present invention shall be included in the protection scope of the claims of the present invention.
Claims
1. A closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm, characterized in that: The following steps are involved: S1: Raw video data acquisition and image preprocessing: First, the eye video sequence to be processed is obtained and a video writing object is created; then, images are extracted frame by frame from the input original video, and each frame is grayed and the average brightness of the image is calculated; then, the overall brightness is globally enhanced to achieve a preliminary improvement of the original low-contrast image; On the basis of global enhancement, adaptive smooth filtering is used to suppress high-frequency noise in the local area, so as to reduce the interference of background stray information while keeping the pupil edge clear, and obtain an optimized grayscale image sequence; after the above processing, a grayscale image sequence of the eye after preliminary preprocessing is obtained; S2: Adaptive threshold segmentation and morphological operation processing: For the preprocessed eye grayscale image sequence, an adaptive threshold segmentation algorithm is used to analyze the local brightness features; by selecting a sliding window and counting the local brightness features, a threshold level adapted to the current lighting conditions is determined using the local mean, standard deviation or Gaussian filtering result, so as to generate a binary image with appropriate contrast in a scene with uneven brightness; The noise and pseudo-target areas are suppressed and cleaned up by combining morphological closing, filling and opening operations, so as to obtain a binary image with a relatively complete pupil area contour. S3: Connected domain analysis and pupil candidate region screening: The connected domain analysis method is used to mark regions and screen targets in the binary images after morphological processing. For each connected domain, comprehensive features such as area, perimeter, eccentricity, roundness, area compactness, and occupancy ratio of the circumscribed rectangle are extracted and matched with the pre-established pupil physiological characteristic model. By setting thresholds such as eccentricity, roundness, and minimum area, interference areas that obviously deviate from the pupil morphological characteristics are filtered out. For areas that meet the preliminary screening conditions, the area and position change trends of the connected domain are further analyzed in combination with multi-frame time series information, and suspicious areas with severe continuous deformation or abnormal position jumps are eliminated, thereby screening out candidate areas with higher credibility and consistent with pupil characteristics, providing reliable data support for subsequent pupil boundary fitting and trajectory tracking. S4: Pupil contour feature edge extraction For the retained pupil candidate area, the Canny edge detection operator is used to extract the edge point set of the pupil contour. S5: Least squares ellipse fitting based on geometric minimum distance: First, contour points of sufficient density are extracted from the point set, and the covariance matrix of these points relative to the contour centroid is calculated. By performing eigenvalue decomposition on the covariance matrix, the major axis, minor axis direction and rotation angle of the ellipse are preliminarily estimated using the maximum and minimum eigenvalues and their corresponding eigenvectors. Subsequently, the initial estimation results are substituted into the weighted residual minimization fitting model, and the ellipse parameters are accurately calculated through iterative optimization to ensure that the error between the fitted ellipse and the actual pupil boundary point set is minimized. At the same time, the pupil center position is recorded in the time series to achieve real-time extraction and visualization output of the pupil trajectory. S6: Real-time extraction and trajectory drawing of pupil center: The final determined ellipse center coordinates are recorded as the pupil center position, and the calculation results of multiple frames are recorded in time series. The pupil center trajectory is superimposed on the original video frame in real time and output, so that the observer can intuitively view the pupil movement trajectory in real time, thereby realizing the dynamic trajectory tracking and visualization drawing of the pupil center in the video sequence; after all the trajectories are described, the trajectory video will be saved; S7: Plotting the curve of pupil area changing with time before and after white light stimulation: After obtaining the pupil area of each frame, several frames at the beginning of the video are selected as the baseline, and the baseline average is calculated to evaluate the initial pupil area state; The area data is smoothed and filtered using sliding window averaging, weighted smoothing or wavelet denoising to eliminate high-frequency noise interference, thereby drawing a curve of the pupil area size changing with time before and after white light stimulation.
2. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S1), the adaptive smoothing filter adopts one of median filtering and Gaussian filtering.
3. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S1), the average brightness may vary due to factors such as the image acquisition environment, and the average brightness under white light excitation is higher than that without white light.
4. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S1), the video sequence is based on near-infrared side illumination through the temple and imaging through closed eyelids. The video sequence includes a white light excitation process to test the pupillary light reflex (PLR). The PLR shows a typical time course, including multiple parameters (such as latency, contraction time, and recovery baseline).
5. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S2), the structural element processed by the morphological operation adopts a disk structural element with a radius of R; the operation sequence of the morphological operation is: closing operation, filling, and opening operation.
6. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S3), for each connected domain, the setting of thresholds such as eccentricity, circularity and minimum area will vary due to the size of the pupil. Since the closed pupil is affected by stray light and has a quasi-circular shape, an elliptical fitting is used with a higher circularity, usually set in the range of 0.7 to 0.
9.
7. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S4), the convolution kernel size of the Canny edge detection operator is usually 3×3.
8. The closed-eye pupil center real-time extraction and trajectory tracking image processing algorithm according to claim 1, characterized in that: In step S5), the specific implementation steps of the algorithm are as follows: 1) Initialize the ellipse parameters: Calculate the center point: Calculate the covariance matrix: Centralized boundary point coordinates: Calculate the covariance matrix C: Eigenvalue Decomposition: Perform eigenvalue decomposition on the covariance matrix C to obtain the eigenvectors v1, v2 of the eigenvalues λ1, λ2: Cv=λv Calculate the major and minor axes: Calculate the major semi-axis a0 and the minor semi-axis b0 by eigenvalues: Calculate the ellipse rotation angle φ: where v 11 and v 21 are the x and y components of the eigenvector v1. Make sure the major and minor axes are correct: if a<b a,b=b,a φ=φ+π / 2 2) Calculate weights: Where: n is the number of data points, (x i ,y i ) are the coordinates of each data point. 3) Define the objective function: Where: P = [p1, p2, p3, p4, p5] is the ellipse parameter to be optimized 4) Minimize the objective function: Iterate through fminsearch, when the error ε<10 -7 To terminate. 5) Extract the fitting results: center: Semimajor axis: Semi-minor axis: Rotation Angle:
Citation Information
Patent Citations
Head wearing type eye control system based on pupil recognition positioning
CN103838378A
Sight tracking method based on near-to-eye camera
CN113342161A
Cerebral stroke preliminary screening analysis method based on eye movement abnormity automatic identification
CN116869470A
Pupil motion tracking method and apparatus, and device and storage medium
WO2024245215A1
Cited By
Microsurgery auxiliary system based on visual identification
CN120072216A
Device for actively detecting short-wave infrared aiming mirror
CN120742345A
Crane hook swing angle and swing length measuring system based on machine vision
CN121353413A
Part identifying and positioning method and system based on image segmentation
CN121366154A
Method for extracting near-eye pupil contour
CN121564782A