Pupil boundary detection method and system based on multi-algorithm fusion
Through the pupil boundary detection method of multi-algorithm fusion, infrared camera and image processing algorithm are used to optimize image preprocessing, and the Sobel operator and Hough transform are combined to accurately map the pupil boundary. The detection accuracy and reliability problems in low-quality and dynamically changing images are solved, and efficient pupil boundary detection is achieved.
Patent Information
- Application Number
- CN202510550547.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-09-12
AI Technical Summary
When processing low-quality or dynamically changing images, the accuracy and reliability of pupil detection in existing technologies are reduced. In particular, when lighting and environmental factors have a significant impact, a single algorithm is difficult to adapt to the changes, resulting in reduced accuracy in iris recognition and gaze tracking. In addition, it is difficult to balance processing speed and accuracy in dynamic scenes, limiting its applicability in high-demand environments.
A pupil boundary detection method based on multi-algorithm fusion is adopted, including image data acquisition by infrared camera, grayscale conversion, median filtering, local contrast enhancement, Sobel operator analysis, Hough transform circular fitting, displacement consistency analysis and other steps. It optimizes image preprocessing and accurately detects pupil boundaries. The detection accuracy and responsiveness are improved through multi-algorithm cascade detection and biological characteristic verification.
It effectively improves the accuracy and clarity of pupil boundary detection, reduces the misjudgment rate, enhances the response capability to dynamic changes, and improves the accuracy and reliability in medical monitoring and biometric systems.
Smart Images

Figure CN120635125A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pupil boundary detection, and in particular to a pupil boundary detection method and system based on multi-algorithm fusion. Background Art
[0002] Pupil boundary detection is a computer vision technology specifically used to identify and locate the edge of the pupil in eye images. It involves multiple image processing algorithms, including edge detection, morphological transformation, Hough transform, etc., to accurately determine the position and size of the pupil. This technology is very critical in many applications, such as iris recognition systems, gaze tracking equipment, and medical diagnostic tools. Accurate pupil identification can greatly improve the overall system's ability to interpret eye movements or gaze direction.
[0003] Among them, the multi-algorithm fusion pupil boundary detection method is a method that improves the accuracy and robustness of pupil boundary detection by combining multiple image processing algorithms, including image segmentation technology combined with machine learning methods to optimize the detection process and reduce misjudgment. It has a wide range of uses and is particularly suitable for occasions that require extremely high accuracy, such as high-security biometric systems and medical monitoring equipment. By integrating multiple technologies, it can overcome the limitations that a single algorithm may encounter and achieve more reliable pupil detection.
[0004] Existing technologies often exhibit shortcomings when processing low-quality or dynamically changing images, especially when image quality is significantly affected by lighting and environmental factors. Existing single-algorithm processing methods are difficult to adapt to changes, resulting in reduced accuracy and reliability of pupil detection. For example, in iris recognition and gaze tracking, a single algorithm cannot effectively distinguish between the true pupil boundary and similar structures in the image, especially when the pupil is partially obscured or blurred, which reduces the accuracy of recognition and tracking. Existing technologies have difficulty achieving a balance between processing speed and accuracy in dynamic scenarios, which is particularly critical in applications that require real-time feedback, such as real-time medical monitoring and security systems, limiting their applicability in high-demand environments. Summary of the Invention
[0005] In order to solve the problem that the existing technology often shows shortcomings when processing low-quality or dynamically changing images, especially when the image quality is greatly affected by lighting and environmental factors, the existing single algorithm processing method is difficult to adapt to changes, resulting in reduced accuracy and reliability of pupil detection. For example, in iris recognition and gaze tracking, a single algorithm cannot effectively distinguish between the real pupil boundary and similar structures in the image, especially when the pupil is partially blocked or blurred, which reduces the accuracy of recognition and tracking. The existing technology is difficult to strike a balance between processing speed and accuracy in dynamic scenes, which is particularly critical in applications that require real-time feedback, such as real-time medical monitoring and security systems, limiting its applicability in high-demand environments. The embodiment of the present invention provides a pupil boundary detection method and system based on multi-algorithm fusion. The technical solution is as follows:
[0006] On the one hand, a pupil boundary detection method based on multi-algorithm fusion is provided, comprising the following steps:
[0007] S1: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixels in the image are detected, converted into a grayscale image, and the contrast and brightness of the grayscale image are adjusted to generate a grayscale refinement layer;
[0008] S2: Based on the grayscale refinement layer, median filtering is performed on the 3×3 neighborhood of each pixel, the original pixel value is replaced by the median grayscale value, the local contrast of the image is further refined, and the edge distinction in the current image is corrected to obtain a local contrast enhancement layer;
[0009] S3: Based on the local contrast enhancement layer, the Sobel operator is used to analyze the edge gradient of the image, the edge points are determined, the Hough transform is used to perform circular fitting on the edge points, and the pupil boundary is defined and the annular boundary is mapped to obtain pupil boundary mapping information;
[0010] S4: Based on the pupil boundary mapping information, analyzing the displacement data of the pupil center between consecutive frames, comparing the position changes between consecutive frames, evaluating whether the position changes are consistent with the expected eye movement, detecting whether there is an abnormal movement trajectory, and obtaining displacement consistency data;
[0011] S5: Analyze the frames of abnormal movement trajectory according to the displacement consistency data, recalculate the pupil position in the frame, correct the target frame data, and obtain the pupil position correction result.
[0012] On the other hand, the grayscale refinement layer includes the image grayscale equalization result, contrast adjustment effect, and brightness optimization point; the local contrast enhancement layer includes filtering clarity, edge preservation index, and local contrast enhancement area; the pupil boundary mapping information includes edge gradient details, circular fitting area, and boundary clarity level; the displacement consistency data includes displacement trajectory continuity, inter-frame change consistency, and abnormal motion mark; and the pupil position correction result includes data correction effect and positioning accuracy verification result.
[0013] On the other hand, the steps for obtaining the grayscale refinement layer are specifically as follows:
[0014] S101: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixel points in the image are detected, the grayscale value is calculated based on the weighted average of the three RGB channels, and a full-image grayscale image is constructed;
[0015] S102: Based on the full grayscale image, identifying the grayscale range of the image, adjusting the minimum and maximum grayscale intervals of the image by linear stretching, remapping the pixel grayscale, optimizing the image contrast and brightness, and obtaining contrast and brightness parameters;
[0016] S103: Calculate the grayscale difference between adjacent pixels based on the contrast and brightness parameters, identify edge gradients, screen pixels in key areas of grayscale changes, reconstruct grayscale edge details, refine edge visibility of the grayscale image, and generate a grayscale refinement layer.
[0017] On the other hand, the step of obtaining the local contrast enhancement layer is specifically as follows:
[0018] S201: Based on the grayscale refinement layer, a 3×3 neighborhood of each pixel is delineated, the grayscales of all pixels in the neighborhood are extracted and sorted, the median grayscale is selected as the new grayscale of the center pixel, the entire image is traversed, the noise interference distribution is corrected, and a median grayscale reconstructed image is obtained;
[0019] S202: reconstructing the image based on the median grayscale, obtaining the grayscale difference between each pixel and its neighborhood, calculating the grayscale difference ratios of consecutive pixels in the horizontal and vertical directions, determining pixel regions where the difference ratios are higher than a local contrast benchmark, and locating grayscale change regions near edges to obtain edge transition coefficients;
[0020] S203: Based on the edge transition coefficient, grayscale adjustment is performed on the edge and non-edge areas in the image, grayscale jumps of the edge portion are optimized, edge differentiation is corrected, and a local contrast enhancement layer is obtained.
[0021] On the other hand, the steps for obtaining pupil boundary mapping information are specifically as follows:
[0022] S301: Based on the local contrast enhancement layer, horizontal and vertical grayscale gradients of pixels are obtained, and edge gradient strength is determined by calculating the grayscale change rate and directional difference of adjacent pixels. Pixels with grayscale changes exceeding an edge detection benchmark are screened to identify key edge areas of the image.
[0023] S302: Analyzing the spatial distribution and geometric symmetry of edge points in the key edge region of the image, determining whether a circular structure can be formed by measuring the geometric distance between the edge points, determining potential circular boundaries, and obtaining circular boundary estimation data;
[0024] S303: Calling the circular boundary estimation data, combining it with the identified edge points, applying Hough transform to perform circular fitting, defining the pupil boundary according to the continuous closure degree and symmetry of the edge points, determining and mapping the annular boundary of the pupil, and obtaining pupil boundary mapping information.
[0025] On the other hand, according to the spatial distribution and geometric symmetry of the edge points, the formula is adopted:
[0026]
[0027] Calculate the geometric distance deviation between edge points and determine whether they can form a circular structure by measuring the geometric distance between edge points. i Represents the geometric distance deviation of the i-th edge point, d ij Represents the distance from the i-th edge point to the j-th edge point, Represents the average distance between all measured edge points, σ d represents the standard deviation of the distances between all measured edge points, and n represents the total number of measured edge points.
[0028] On the other hand, the steps for obtaining the displacement consistency data are specifically as follows:
[0029] S401: extracting the horizontal and vertical coordinate data of the pupil center in consecutive frames based on the pupil boundary mapping information, calculating the coordinate difference of the center point for each pair of consecutive frames, analyzing the movement distance and direction between frames, and establishing an inter-frame motion dataset;
[0030] S402: Based on the inter-frame motion data set, compare the changes in displacement angles and distances between consecutive frames, identify abnormal motion sequences with directional fluctuations, detect whether there are unexpected motion trajectories, and generate abnormal motion indicators;
[0031] S403: Based on the abnormal motion index, analyze the average directional consistency of the displacement changes between consecutive frames in the interval, compare it with the expected motion, determine whether the smoothness of the motion meets the stability requirements, and obtain displacement consistency data.
[0032] On the other hand, the comparison of the displacement angle and distance changes between consecutive frames adopts the formula:
[0033]
[0034] Calculate the fluctuation of displacement angle and identify abnormal motion sequences with directional fluctuations, where Δθ z Represents the zth frame to the z+nth frame z The displacement angle fluctuation between frames, θ z Represents the displacement angle of the z-th frame, θ z+k represents the displacement angle of the z+k frame, d z,z+k Represents the displacement distance between the zth frame and the z+kth frame, n z represents the number of consecutive frames, and k represents the difference in the number of subsequent frames starting from the current frame z.
[0035] On the other hand, the steps for obtaining the pupil position correction result are specifically as follows:
[0036] S501: Based on the displacement consistency data, frames showing abnormal motion trajectories are identified in consecutive frames, the coordinate points of the pupil positions in the frames are analyzed, and the magnitude of the displacement abnormality is calculated by comparing and counting the deviations between the pupil coordinates of each frame and its normal motion trajectory, thereby obtaining abnormal trajectory analysis data;
[0037] S502: Based on the abnormal trajectory analysis data, the pupil center coordinates of the corresponding frame are recalculated, and the current frame coordinate point is corrected in combination with the continuous trajectory trend of the previous and next frames to optimize the pupil positioning accuracy of each frame and obtain the pupil position correction result.
[0038] On the other hand, a multi-algorithm fusion pupil boundary detection system is provided, which is applied to the multi-algorithm fusion pupil boundary detection method, including:
[0039] The image preprocessing module detects the RGB channel parameters of the pixels in the eye image data collected by the infrared camera, converts it into a grayscale image, optimizes the grayscale distribution, adjusts the contrast and brightness of the grayscale image, refines the edge visibility of the grayscale image, and generates a grayscale refinement layer;
[0040] The image noise optimization module performs median filtering on the 3×3 neighborhood of each pixel based on the grayscale refinement layer, replaces the original pixel value with the median grayscale value, further refines the local contrast of the image, corrects the edge distinction in the current image, and obtains a local contrast enhancement layer;
[0041] The edge detection and fitting module uses the Sobel operator to analyze the edge gradient of the image based on the local contrast enhancement layer, determines the edge points, performs circular fitting on the edge points using the Hough transform, determines the accuracy of the circular area, defines the pupil boundary, maps the annular boundary, and obtains pupil boundary mapping information;
[0042] The dynamic displacement analysis module analyzes the displacement data of the pupil center between consecutive frames based on the pupil boundary mapping information, compares the position changes between consecutive frames, evaluates whether the position changes are consistent with the expected eye movement, detects whether there are abnormal movement trajectories, and obtains displacement consistency data;
[0043] The pupil position correction module analyzes the frames of abnormal movement trajectory according to the displacement consistency data, compares the statistical data, recalculates the pupil position in the frame, corrects the target frame data, and obtains the pupil position correction result.
[0044] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0045] By applying infrared camera and image processing algorithms, the image preprocessing process is optimized, and through multi-algorithm fusion, accurate detection of pupil boundaries is achieved. Median filtering and local contrast enhancement are specifically optimized for noise and edge information in the image, effectively improving the accuracy of edge detection and image clarity. By combining the Sobel operator with the Hough transform, the pupil boundary is accurately mapped, greatly reducing the misjudgment rate and enhancing the response capability to dynamic changes, so that it can show high accuracy and reliability in continuous monitoring scenarios such as medical monitoring and biometric systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 It is a flow chart of the main steps of the present invention;
[0048] Figure 2 is a flow chart of the steps of S1 of the present invention;
[0049] Figure 3 This is a flow chart of the steps of S2 of the present invention;
[0050] Figure 4 This is a flow chart of the steps of S3 of the present invention;
[0051] Figure 5 This is a flow chart of the steps of S4 of the present invention;
[0052] Figure 6 This is a flow chart of the steps of S5 of the present invention;
[0053] Figure 7is a system block diagram of the present invention;
[0054] Figure 8 This is an example diagram of the system hardware implementation of the present invention. DETAILED DESCRIPTION
[0055] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0056] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as an "exemplary" in the present invention should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner. Furthermore, in the embodiments of the present invention, "and / or" can mean both or either of the two.
[0057] In the embodiments of the present invention, the terms "image" and "picture" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same. The terms "of," "corresponding," and "corresponding" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same.
[0058] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.
[0059] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0060] The embodiment of the present invention provides a pupil boundary detection method based on multi-algorithm fusion, such as Figure 1 As shown, the following steps are included:
[0061] S1: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixels in the image are detected, converted into a grayscale image, and the grayscale distribution is optimized. The contrast and brightness of the grayscale image are adjusted, the edge visibility of the grayscale image is refined, and a grayscale refinement layer is generated.
[0062] S2: Based on the grayscale refinement layer, median filtering is performed on the 3×3 neighborhood of each pixel, replacing the original pixel value with the median grayscale value, optimizing image noise while preserving edge information, and then refining the local contrast of the image, correcting the edge distinction in the current image, to obtain a local contrast enhancement layer;
[0063] S3: Based on the local contrast enhancement layer, the Sobel operator is used to analyze the edge gradient of the image, determine the edge points, and use the Hough transform to perform circular fitting on the edge points to determine the accuracy of the circular area. The pupil boundary is defined and the annular boundary is mapped to obtain the pupil boundary mapping information;
[0064] S4: Based on the pupil boundary mapping information, analyze the displacement data of the pupil center between consecutive frames, compare the position changes between consecutive frames, evaluate whether the position changes are consistent with the expected eye movement, detect whether there are abnormal movement trajectories, and obtain displacement consistency data;
[0065] S5: Based on the displacement consistency data, analyze the frames with abnormal movement trajectories, compare the statistical data, recalculate the pupil position in the frame, correct the target frame data, optimize the pupil positioning accuracy of each frame, and obtain the pupil position correction result.
[0066] By inputting the eye image, image preprocessing is performed, and then multi-algorithm cascade detection (Hough circle transform, adaptive threshold detection, morphological processing) is combined to verify the biological characteristics (grayscale mean < threshold). If the verification fails, it switches from the three algorithms and finally outputs the result (x, y, r) to obtain the pupil boundary parameters;
[0067] 1. For image preprocessing, the original eye image is input and grayscale conversion - median filter denoising - CLAHE contrast enhancement - global contrast stretching - Gaussian blur smoothing is performed to obtain an enhanced grayscale image (preprocessed image).
[0068] 2. For multi-algorithm cascade detection, based on the pre-processed image,
[0069] By Algorithm 1 (if it fails, switch to suitable for low-noise circular pupil):
[0070] Hough circle transform
[0071] Gaussian blur 7x7 kernel, σ=1.0, Canny edge detection (threshold 20-60), minRadius=20, maxRadius=60;
[0072] Through Algorithm 2 (if it fails, switch to Algorithm 2, suitable for uneven lighting and non-circular pupils):
[0073] Adaptive thresholding and contour detection
[0074] Adaptive Gaussian threshold (window size 11, C = 2), detect external contours (cv2, RETR_EXTERNAL), ellipse fitting and circle approximation (radius = (MA + ma) / 4);
[0075] Through Algorithm 3 (suitable for high contrast and noise interference):
[0076] Fixed threshold and morphological operations
[0077] Fixed threshold segmentation (threshold = 45), morphological opening operation (3x3 kernel), extraction of maximum contour and minimum enclosing circle;
[0078] Perform biological characteristic verification and finally obtain the detection results (circle x, y, radius r).
[0079] 3. Verification of biological characteristics
[0080] Calculate the average grayscale value of the pupil area (create a pupil area mask and calculate the average grayscale value of pixels in the area)
[0081] Grayscale mean threshold judgment
[0082] I_mean=(1 / N)*∑I(x,y)
[0083] Valid=(I_mean<80)
[0084] For grayscale conversion
[0085] Formula: I gray (x,y)=0.299·R(x,y)+0.587·G(x,y)+0.114·B(x,y);
[0086] Among them, R(x,y), G(x,y), B(x,y) are the red, green, and blue components of the input RGB image at the pixel (x,y), I gray (x, y) is the converted grayscale value. This formula is based on the human eye's perception weights of RGB colors (in accordance with the ITU-R BT.601 standard) and converts the color image into a grayscale image, reducing the complexity of subsequent calculations and highlighting the pupil area.
[0087] For the median filter output
[0088] Formula: I filtered (x,y)=median{I(x+i,y+j)∣(i,j)∈W};
[0089] Where I(x+i,y+j) is the grayscale value within a window W (e.g., 5x5, containing 25 pixels) centered at (x,y), and median{·} is the median of all pixels within the window. This formula is used to remove salt and pepper noise (such as glare). It preserves edge information better than mean filtering and is suitable for eye image processing.
[0090] For CLAHE local histogram equalization
[0091] formula:
[0092] I enhanced (x,y)=CDF(I(x,y))·(L-1)
[0093]
[0094] Where h(k) is the grayscale histogram of the local grid (e.g., 8x8), N is the total number of pixels in the grid (64 pixels), clipLimit is the contrast limit threshold (e.g., 3.0), CDF(I) is the cumulative distribution function, which limits over-enhancement, and L is the number of grayscale levels (256). This formula enhances the contrast between the pupil and iris through local equalization while limiting over-amplification of noise.
[0095] For contrast stretching
[0096] formula:
[0097] Among them, I(x,y): input grayscale value, I min ,I max : minimum and maximum grayscale values of the image, I stretched (x,y): The stretched grayscale value, normalized to 0-255. This formula globally adjusts the grayscale range to enhance the visibility of the pupil area.
[0098] For Gaussian blur kernel function
[0099] formula:
[0100] Where G(x, y) is the value of the Gaussian kernel at position (x, y), and σ is the standard deviation (e.g., 1.0). This formula defines a 5x5 Gaussian kernel (e.g., 5x5) to smooth the image and reduce the interference of high-frequency noise on edge detection.
[0101] Gradient strength for Canny edge detection
[0102] formula:
[0103] Among them, G x (x,y),G y (x, y): The horizontal and vertical gradients of the image, calculated by the Sobel operator. G(x, y): The gradient intensity of the pixel point (x, y). This formula is used for edge detection in the Hough circle transform (the threshold in this article is 20-60) to extract pupil boundary features.
[0104] For Hough circle transform
[0105] Formula: H(a,b,r)=∑ (x,y)∈E δ((xa) 2 +(yb)2 -r 2 );
[0106] Where H(a, b, r) is the vote count of the circle center (a, b) and radius r in Hough space, E is the set of edge points (obtained by Canny detection), and δ(·) is an indicator function that counts votes when its value is 0. This formula quantifies the support of edge points for the circular boundary and is used to quickly locate the circular boundary of the pupil.
[0107] For adaptive threshold segmentation
[0108] formula:
[0109] T(x,y)=μ(x,y)-C
[0110]
[0111] Where T(x, y) is the local threshold of pixel (x, y), μ(x, y) is the weighted average centered on (x, y) (for example, if the window is 11x11, Gaussian weights are used), C is a constant (for example, 2), and G(i, j) is the Gaussian weight. This formula segments the pupil area based on the local grayscale characteristics and adapts to uneven lighting.
[0112] For the ellipse fitting mean radius
[0113] formula:
[0114] Among them, MA, ma: the length of the major and minor axes of the ellipse (calculated by contour fitting), r avg : Approximate circular radius. This formula simplifies the elliptical boundary of a non-circular pupil into a circle to adapt to changes in viewing angle.
[0115] For morphological opening
[0116] formula:
[0117] Among them, I eroded : The image after corrosion, K: structural element (for example, a 3x3 kernel). This formula corrodes first and then dilates to remove small area noise (such as eyelash interference) and retain the main pupil boundary.
[0118] Grayscale mean for biological feature verification
[0119] formula:
[0120]
[0121] valid=(I mean <T threshold );
[0122] Where, I(x, y): grayscale value of the pixel in the mask M (detection area), N: total number of pixels in the mask, I mean : Average gray value, T threshold : Threshold (80 in this article). This formula verifies whether the detection area meets the low grayscale characteristics of the pupil and filters out false detections.
[0123] Weighted fusion of results
[0124] formula:
[0125] Among them, C i ,r i : The center coordinates and radius of the circle detected by the i-th algorithm, w i : The weight of the ith algorithm (which can be dynamically adjusted based on the grayscale mean or detection confidence), k: The number of algorithms that have passed the verification, C final ,r final : The center and radius of the fused circle. This formula can be used to fuse the results of multiple algorithms to improve the accuracy of the final output.
[0126] The grayscale refinement layer includes the image grayscale equalization results, contrast adjustment effects, and brightness optimization points. The local contrast enhancement layer includes filtering clarity, edge preservation indicators, and local contrast enhancement areas. The pupil boundary mapping information includes edge gradient details, circular fitting areas, and boundary clarity levels. The displacement consistency data includes displacement trajectory continuity, inter-frame change consistency, and abnormal motion markers. The pupil position correction results include data correction effects and positioning accuracy verification results.
[0127] like Figure 2 As shown in the figure, the steps for obtaining the grayscale refinement layer are as follows:
[0128] S101: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixel points in the image are detected, the grayscale value is calculated based on the weighted average of the three RGB channels, and a full-image grayscale image is constructed;
[0129] The color channel value of each pixel in the image is extracted, and the brightness values of the red, green, and blue channels of each pixel are read in turn. For each pixel, the values of the three channels are weighted according to the set ratio and converted into a single grayscale value. In a 640×480 pixel image, there are more than 300,000 pixels. Each pixel performs a three-channel weighted conversion operation to generate a corresponding grayscale value. All grayscale values are arranged in a row and column structure into a new two-dimensional image matrix. During the image conversion process, for example, for a certain central pixel, its red, green, and blue channel values can be 80, 90, and 100. The grayscale value obtained after weighted calculation is a certain integer value, which replaces the original RGB three-channel combination. This operation is processed pixel by pixel in the entire image. The overall structure of the image remains consistent at the pixel coordinate level. Only the color information is changed from three channels to a single channel grayscale value, realizing the construction of grayscale information for the entire image.
[0130] S102: Based on the full grayscale image, identify the image grayscale range, adjust the minimum and maximum grayscale intervals of the image by linear stretching, remap the pixel grayscale, optimize the image contrast and brightness, and obtain contrast and brightness parameters;
[0131] After completing the grayscale construction of the entire image, the grayscale value range of all pixels in the entire image is extracted to find the span between the minimum grayscale value and the maximum grayscale value in the entire image. The grayscale span is used as the basis for image stretching. According to the linear mapping strategy, the pixel values in the original grayscale range are redistributed, and the pixels with concentrated grayscale values are mapped to the new interval range through calculation, so that the maximum grayscale is pulled to the target upper limit and the minimum grayscale is reduced to the target lower limit. For the pixels whose grayscale values are originally distributed in the middle range, their new values will be remapped according to the current remapping ratio. The new adjustment is that the remapping process processes each pixel separately. By reading the grayscale value pixel by pixel and converting the difference against the original maximum and minimum grayscale differences, all grayscale pixels are evenly stretched without changing the image structure, making the relatively dark or lack of contrast areas in the original image more obvious. For example, the original grayscale value of a pixel is 88, and it is linearly mapped to 96 in an image with a minimum grayscale value of 20 and a maximum grayscale value of 200. After performing this type of processing on the entire image, a new enhanced grayscale image is obtained, and the contrast and brightness parameters corresponding to the image are obtained.
[0132] S103: Calculate the grayscale difference between adjacent pixels based on contrast and brightness parameters, identify edge gradients, select pixels in key grayscale change regions, reconstruct grayscale edge details, refine edge visibility of the grayscale image, and generate a grayscale refinement layer;
[0133] Based on contrast and brightness parameters, the edge area of the grayscale image is refined. At each pixel position, a neighborhood window consisting of 9 pixels in 3 rows and 3 columns is constructed. The grayscale value of each pixel in the neighborhood is extracted respectively. The grayscale difference between the current central pixel and its adjacent pixels is calculated to determine whether the degree of grayscale change exceeds the edge judgment standard value. If the grayscale jump amplitude is greater than the set threshold, the pixel is marked as an edge change area. By comparing with the grayscale values of its surroundings, the direction of significant change is identified. The maximum gradient in this direction is selected to mark the key grayscale jump point. All marked areas are reconstructed. A processing mask is superimposed on the grayscale image to reduce the grayscale of non-critical areas to weaken background noise, retaining only edge change information. In this way, the image contour is enhanced. In the image reconstruction stage, the brightness enhancement amplitude is processed by region classification to highlight edge differences. The areas with weakened grayscale changes in the original image are reassigned to make the edge details clearer, and the output is a grayscale refinement layer with clearly discernible edge structure.
[0134] like Figure 3 As shown, the steps for obtaining the local contrast enhancement layer are as follows:
[0135] S201: Based on the grayscale refinement layer, a 3×3 neighborhood is defined for each pixel. The grayscales of all pixels in the neighborhood are extracted and sorted. The median grayscale is selected as the new grayscale of the center pixel. The entire image is traversed to correct the noise interference distribution and obtain a median grayscale reconstructed image.
[0136] Construct a local neighborhood window pixel by pixel in the entire image, and set the window structure to a nine-pixel area with 3 rows and 3 columns around each pixel, that is, including the central pixel and its eight adjacent pixels above, below, left, right, upper left, upper right, lower left, and lower right. Read the grayscale values of the nine pixels in the neighborhood in turn, and arrange the grayscale values as an unordered set. Sorting the arranged set in ascending order, extract the middle position element after sorting, and use it as the new grayscale value of the current central pixel. Replace the original pixel value with this value. For example, in the neighborhood of a certain pixel, the grayscale values of the nine pixels are [84, 90, 89, 91, 88, 93, 87, 85, 92], and sorting them gives [84, 8 5, 87, 88, 89, 90, 91, 92, 93], the median value is 89, then the new grayscale value of the central pixel is set to 89, repeat the above operation to traverse all pixels in the image, build a scanning order from the upper left corner to the lower right corner, and process all pixels row by row. Due to the lack of complete neighborhood pixels at the edge of the image, edge replication or symmetrical filling can be used to supplement the boundary data, thereby realizing median filtering of the entire image. This operation can effectively remove pixel anomalies caused by infrared interference, grayscale mutation or local noise, while avoiding blurring and damage to the edge structure. In the 640×480 image, a total of 307,200 median replacement operations need to be performed to obtain a median grayscale reconstructed image.
[0137] S202: Reconstructing the image based on the median grayscale, obtaining the grayscale difference between each pixel and its neighborhood, calculating the grayscale difference ratios of consecutive pixels in the horizontal and vertical directions, determining the pixel areas where the difference ratios are higher than the local contrast benchmark, and locating the grayscale change areas near the edges to obtain the edge transition coefficients;
[0138] For each pixel in the image, the grayscale values of its horizontally adjacent pixels and vertically adjacent pixels are extracted in turn. The difference between the central pixel and the adjacent pixels is calculated, and the horizontal difference and the vertical difference are recorded respectively. The difference result is then compared with the preset local contrast benchmark. The benchmark value is set as a fixed integer between 20 and 40 through the grayscale standard deviation value interval in the image. If the grayscale difference of a pixel in any direction exceeds the threshold, it is judged as a contrast mutation area. The grayscale difference of the contrast mutation area is below 20 for low contrast, above 40 for high contrast, and between 20 and 40 for intermediate transition value. In one step, the pixel points that meet the high contrast conditions are marked, and according to the relative coordinate position of the pixel point, the surrounding pixel range is extended to mark, the edge influence domain is constructed, the grayscale value change range is extracted in the area near the edge, the change slope in the horizontal and vertical directions of the edge area is measured, and the change trends in the two directions are compared. If the horizontal grayscale change is greater than the vertical one, the edge extension trend can be marked as horizontal distribution, otherwise it is marked as vertical distribution. The edge transition coefficient is constructed according to the judgment result, and mapping and annotation are performed in units of each pixel in the image. After performing the above operations on all areas in the image, the edge transition coefficient corresponding to the entire image is obtained.
[0139] S203: Based on the edge transition coefficient, grayscale adjustment is performed on the edge and non-edge areas in the image, grayscale jumps of the edge parts are optimized, edge differentiation is corrected, and a local contrast enhancement layer is obtained;
[0140] The edge coefficient value corresponding to each pixel in the image is read in sequence. In areas where the edge coefficient value is above a preset limit, the pixels in this area are judged as edge areas, and the rest of the area is judged as non-edge areas. Grayscale enhancement is performed in the edge areas. The current pixel is compared with the neighboring pixel with the largest grayscale difference. If the current pixel grayscale value is lower, the brightness is proportionally increased. If the current pixel grayscale value is higher, the brightness is proportionally decreased. The increase is linearly adjusted based on the size of the edge transition coefficient. For example, when the edge coefficient is 0.8, the adjustment ratio is within 12% of the original grayscale. Grayscale equalization is performed on non-edge areas and compared with the average grayscale value of the neighboring pixels. If the deviation from the average value exceeds 5, the grayscale value is corrected by interpolation to bring it closer to the average level. The grayscale adjustment range does not exceed 10% of the current grayscale. For areas in the image with excessive grayscale jumps, the jump strength is calculated and the grayscale increase or decrease of the pixels in this area is reset. The grayscale gradient of the boundary in the image is reconstructed. After the processing is completed, a local contrast enhancement layer with a clear edge transition relationship is constructed.
[0141] like Figure 4 As shown, the steps for obtaining pupil boundary mapping information are as follows:
[0142] S301: Based on the local contrast enhancement layer, the horizontal and vertical grayscale gradients of the pixels are obtained. The edge gradient strength is determined by calculating the grayscale change rate and directional difference of adjacent pixels. Pixels with grayscale changes exceeding the edge detection benchmark are screened to identify the key edge areas of the image.
[0143] For each pixel in the image, a grayscale comparison relationship between the horizontal and vertical directions is established, and the grayscale difference between the pixel and its adjacent pixel on the right is extracted as the horizontal gradient. At the same time, the grayscale difference between the pixel and the adjacent pixel below is extracted as the vertical gradient. The adjacent relationship of all pixels in the entire image is read, and the difference operation is traversed to obtain the grayscale change in the two directions. The grayscale change results in the horizontal and vertical directions are further compared to determine the difference in the direction of grayscale change. If the difference in both directions is higher than the set edge change sensitivity threshold of 20, it is marked as a bidirectional change point. If only one direction changes above the threshold, it is marked as a unidirectional change point. If the change in both directions is lower than 10, it is marked as a unidirectional change point. Marked as flat area pixels, after performing this judgment operation on all pixels, a preliminary gradient intensity map is obtained, and pixels whose grayscale changes exceed the edge detection benchmark value are further screened in the map. The benchmark value is the threshold obtained by multiplying the standard deviation of the grayscale changes of all pixels in the image by 1.2 and rounding it. If the pixel gradient intensity exceeds the benchmark, it is considered to be a potential edge point. For example, at a certain pixel, the horizontal grayscale difference is 26 and the vertical difference is 30. If the edge detection benchmark is 25, then the point is marked as a key change point. After performing the screening operation, all pixels that meet the conditions are summarized and recorded according to their image position to identify the key edge areas in the image with significant grayscale changes and continuous spatial distribution.
[0144] S302: Analyze the spatial distribution and geometric symmetry of edge points based on the key edge regions of the image, and determine whether they can form a circular structure by measuring the geometric distance between edge points, thereby determining potential circular boundaries and obtaining circular boundary estimation data;
[0145] According to the spatial distribution and geometric symmetry of edge points, the formula is adopted:
[0146]
[0147] Calculate the geometric distance deviation between edge points and determine whether they can form a circular structure by measuring the geometric distance between edge points. i Represents the geometric distance deviation of the i-th edge point. The geometric distance deviation refers to the "degree of deviation" between the distance from a certain edge point to all other edge points and the average value of all these distances. The deviation takes into account the average distance and the distribution of the distance (standard deviation), so that point sets of different scales and different data volumes can be fairly compared. The geometric distance deviation reflects the degree of fit between a point and the "ideal geometric structure" and is a key indicator for measuring symmetry and consistency.ij Represents the distance from the i-th edge point to the j-th edge point, which involves the straight-line distance between the two points. Represents the average distance between all measured edge points, σ d It represents the standard deviation of the distances between all measured edge points, indicating the variation or dispersion of the distances between edge points. n represents the total number of measured edge points.
[0148] If there is a set of values: d i1 =5.1cm, d i2 =4.9cm, d i3 =5.0cm;
[0149] is the average distance between all edge points, calculated as the arithmetic mean of all measured distances, for example:
[0150] σ d is the standard deviation, which indicates the degree of dispersion of the distance. The calculation formula is: Using the above data we can calculate:
[0151] n is the total number of edge points, obtained from the data set, for example, n=3.
[0152] Calculation process:
[0153] For each d ij Value, calculation For example, for d i1 :
[0154] Similarly, for d i2 and d i3 , calculated and
[0155] Sum all the values to get SR i :SR i =1.5+1.5+0.0≈3.
[0156] The result shows that the distance deviation of the i-th edge point is significant relative to other edge points, which can help determine whether the edge points can form a specific geometric structure, such as a circular structure. The size of the deviation value reflects the possibility of the point set forming a circle. The higher the consistency of the distance between edge points, the better the SR i The smaller it is, the more likely it is to form a circle.
[0157] S303: Calling the circular boundary estimation data, combining the identified edge points, applying Hough transform to perform circular fitting, defining the pupil boundary based on the continuous closure degree and symmetry of the edge points, determining and mapping the annular boundary of the pupil, and obtaining pupil boundary mapping information;
[0158] The position coordinates of each edge point in the estimated data are read, and the angular distribution density of each edge point in Cartesian coordinates is calculated one by one to determine whether it constitutes a complete closed structure. If the Euclidean distance between the starting point and the end point of the edge point is less than 5% of the image width, and the density of the intermediate points remains above 90% of the average value, the boundary is considered to be continuously closed. Then the angular change rate between all edge points and their adjacent points is read to determine whether the overall structure presents a symmetrical trend. The symmetry judgment standard is: the number of symmetrical point pairs with an error of no more than ±10 degrees in the relative angular position of the edge points around the central symmetry axis exceeds 60% of the total number of edge points. On the basis of meeting the above conditions, a circular fitting operation is performed on all edge points. All combinations of circle center and radius are traversed in the image coordinate space in turn. Each group of combinations is cross-compared with the current edge point distribution. It is determined how many edge points under the current circle center and radius are within the tolerance range of the circle. The tolerance is set to ±5% of the radius. A group of circular boundaries with the most overlapping points is fitted in the image as the final result, and the annular position area of the circular structure in the image is marked. The annular structure is defined as the pupil boundary and a mapping relationship of the annular boundary is established.
[0159] like Figure 5 As shown in FIG, the steps for obtaining displacement consistency data are as follows:
[0160] S401: Based on pupil boundary mapping information, extract the horizontal and vertical coordinate data of the pupil center in consecutive frames, calculate the coordinate difference of the center point for each pair of consecutive frames, analyze the movement distance and direction between frames, and establish an inter-frame motion dataset;
[0161] First, extract the coordinate value of the center point of the pupil boundary in each frame image, and use the horizontal position of the point as the x-coordinate and the vertical position as the y-coordinate. Perform the same process on all consecutive frames in the image sequence, and arrange the coordinate data of each frame in chronological order to construct a center point trajectory set under the frame sequence. Then, for any pair of consecutive frames, set as the i-th frame and the i+1-th frame, read the x-coordinate difference and the y-coordinate difference respectively, and calculate the pixel displacement in the horizontal and vertical directions. By squaring the difference in the two directions, summing them and taking the square root, the actual movement distance of the pupil center between the two frames is obtained. Then, combined with the directional difference of the x- and y-coordinates, the movement direction is determined to be left, right, or up. Or the specific components under, after performing this operation on all frame pairs, a continuous inter-frame displacement vector sequence based on the frame sequence number is formed, and each set of frame displacements is further constructed into a motion data set. In this data set, each element contains five data items consisting of the inter-frame number, the start and end center coordinates, the displacement length, and the direction vector. For example, the center coordinates of the pupil in the 20th frame are (105, 142), and the center coordinates of the 21st frame are (108, 146). The horizontal displacement is 3 pixels, the vertical displacement is 4 pixels, and the moving distance is about 5 pixels. This sample is recorded as an item in the data set. Repeat the operation until all inter-frame pairs are completed to establish an inter-frame motion data set.
[0162] S402: Based on the inter-frame motion data set, compare the changes in displacement angle and distance between consecutive frames, identify abnormal motion sequences with directional fluctuations, detect whether there is an unexpected motion trajectory, and generate an abnormal motion index;
[0163] Compare the changes in displacement angle and distance between consecutive frames using the formula:
[0164]
[0165] Calculate the fluctuation of displacement angle and identify abnormal motion sequences with directional fluctuations, where Δθ z Represents the zth frame to the z+nth frame z The displacement angle fluctuation between frames is a quantitative indicator that measures the amplitude of angle changes. It is used to indicate the instability of the movement direction of an object (pupil) at consecutive time points (consecutive frames of the video). It analyzes whether the angle (direction) is "stable" under the premise of considering the distance change. z Represents the displacement angle of the z-th frame, θ z+k represents the displacement angle of the z+k frame, d z,z+k Represents the displacement distance between the zth frame and the z+kth frame, n z represents the number of consecutive frames, and k represents the difference in the number of subsequent frames starting from the current frame z.
[0166] Given the actual detection data, the displacement angle data and distance data of five consecutive frames are:
[0167] θ z =30°,θ z+1 =31°,θ z+2 =33°,θ z+3 =35°,θ z+4 =36°;
[0168] d z,z+1 =2 mm, d z+1,z+2 =2 mm, d z+2,z+3 =2 mm, d z+3,z+4 =2 mm;
[0169] Let n z =4 means including the four frames after the current frame;
[0170] Cumulative distance:
[0171] d z,z+1 =2;
[0172] d z,z+2 =2+2=4;
[0173] d z,z+3 =2+2+2=6;
[0174] d z,z+4 =2+2+2+2=8;
[0175] The process of calculating the displacement angle fluctuation is as follows:
[0176]
[0177] The results show that the pupil displacement angle fluctuation in five consecutive frames of video is 1.438, reflecting the variation in pupil displacement angle within a given distance. Large fluctuations indicate abnormal movement of the pupil boundary and are a key indicator for detecting unexpected motion trajectories. By quantifying this fluctuation, the dynamic changes of the pupil can be effectively monitored, thereby providing accurate diagnostic reference in image analysis.
[0178] S403: Based on the abnormal motion index, the average directional consistency of the displacement changes between consecutive frames within the interval is analyzed and compared with the expected motion to determine whether the smoothness of the motion meets the stability requirements, thereby obtaining displacement consistency data;
[0179] Continuous frame data from all non-abnormal segments were extracted, and the inter-frame displacement vector direction was extracted from the frame segment. The angle between the displacement direction of each frame in each segment and the direction of the starting frame of the segment was compared, and the mean and variance of the angle were calculated. If the mean angle was less than 10 degrees and the variance was less than 5, it was judged to be directional consistency. The consistency evaluation data was compared with the expected eye movement path direction. The expected movement direction can be determined by the task setting. For example, if the gaze target moves from the upper left to the lower right of the screen, the expected displacement direction should be roughly towards the lower right. If the observed direction deviation is greater than 20 degrees and lasts for more than 5 frames, the segment data is marked as inconsistent with expectations. Further, the proportion of segments that meet the directional consistency conditions and whose direction difference is lower than the expected threshold is counted in all observed segments. If the proportion is higher than 80%, the segment is considered to meet the requirements of smooth movement. Otherwise, it is marked as unstable movement segment. Frame segments with high continuity, low direction fluctuation, and consistency with the expected path are extracted from all valid inter-frame data to form displacement consistency data.
[0180] like Figure 6 As shown in FIG, the steps for obtaining the pupil position correction result are as follows:
[0181] S501: Based on the displacement consistency data, frames showing abnormal motion trajectories are identified in the continuous frames, the coordinate points of the pupil positions in the frames are analyzed, and the magnitude of the displacement abnormality is calculated by comparing and counting the deviations between the pupil coordinates of each frame and its normal motion trajectory to obtain abnormal trajectory analysis data;
[0182] First, the pupil center coordinates of all frames in the image sequence are traversed, and a corresponding table of frame numbers and coordinates for each frame is established. The list of frame numbers marked as abnormal motion in the displacement consistency results is screened out, and the specific image position of the abnormal frame is located. The pupil center coordinates in each abnormal frame are compared with the coordinates it should have under the normal trajectory. The normal trajectory coordinates are estimated by linear interpolation from the coordinates of the two adjacent frames before and after. The difference between the actual coordinates of the current frame and the interpolation predicted coordinates is read, and the offset in the x-direction and y-direction are calculated respectively. The total offset distance is calculated based on these two offset values. Combined with the actual size of the image, the offset distance is converted into a pixel-level offset amplitude. If the value exceeds the diagonal length of the image, 3% is marked as a serious abnormal frame. For example, when the image resolution is 640×480, the image diagonal is about 800 pixels, and 3% is 24 pixels. If the center position of a frame deviates from the expected trajectory by more than 24 pixels, it is recorded as a serious deviation. After continuing to perform the above operations on all abnormal frames, the offset distance, offset direction, front and back trajectory reference points, actual coordinates of the center point, and estimated coordinates of all frames are summarized to form an abnormal trajectory analysis dataset corresponding to each frame. Each data item in this dataset contains five fields: abnormal frame number, original center coordinates, expected trajectory point coordinates, x-axis offset, and y-axis offset. The trajectory deviation set of all abnormal frames is summarized to form the abnormal trajectory analysis data.
[0183] S502: Based on the abnormal trajectory analysis data, the pupil center coordinates of the corresponding frame are recalculated, and the continuous trajectory trends of the previous and next frames are combined to correct the coordinate points of the current frame, optimize the pupil positioning accuracy of each frame, and obtain the pupil position correction result;
[0184] For each piece of data, the current frame number, the actual coordinate point, and the position information of the predicted coordinate point are extracted. First, with the current frame as the center, the center coordinates of the frames before and after it are read, and the line connecting the two points is used as the reference trajectory vector. The extension trend of the vector in the image coordinate system is calculated, and then the angle range of its deviation from the trajectory is determined in combination with the offset direction of the current frame. If the angle between the offset direction and the trajectory direction is less than 30 degrees, it is considered that the current frame offset mainly extends along the trajectory direction. When correcting, the current frame coordinates are interpolated back along the trajectory direction. If the angle exceeds 30 degrees, it is considered a vertical disturbance, and the projection regression method should be used to pull the current coordinate point back to the main line direction of the trajectory. The correction operation is to proportionally adjust the offset of the current frame in the x and y directions so that it is as close as possible to the center line of the trajectory constructed by the previous and next frames. In each correction, the correction amplitude is limited to no more than 80% of the maximum offset to avoid reverse overcompensation. After all abnormal frames have completed the correction operation, they are compared with the original frame data, and the coordinate changes and position error reduction before and after the correction are recorded. The corrected coordinates of each frame are rewritten into the trajectory table, and a new continuous frame center point sequence is output. The center position of the abnormal frame has been adjusted according to the trend of the previous and next trajectories, forming a continuous and smooth pupil coordinate sequence under a unified time axis, and the pupil position correction result is obtained.
[0185] like Figure 7 As shown in FIG, the multi-algorithm fusion pupil boundary detection system includes:
[0186] The image preprocessing module detects the RGB channel parameters of the pixels in the eye image data collected by the infrared camera, converts it into a grayscale image, optimizes the grayscale distribution, adjusts the contrast and brightness of the grayscale image, refines the edge visibility of the grayscale image, and generates a grayscale refinement layer;
[0187] The image noise optimization module performs median filtering on the 3×3 neighborhood of each pixel based on the grayscale refinement layer, replaces the original pixel value with the median grayscale value, and then refines the local contrast of the image and corrects the edge distinction in the current image to obtain a local contrast enhancement layer.
[0188] The edge detection and fitting module is based on the local contrast enhancement layer. It uses the Sobel operator to analyze the edge gradient of the image, determine the edge points, and use the Hough transform to perform circular fitting on the edge points to determine the accuracy of the circular area. It also defines the pupil boundary and maps the annular boundary to obtain the pupil boundary mapping information.
[0189] The dynamic displacement analysis module analyzes the displacement data of the pupil center between consecutive frames based on pupil boundary mapping information, compares the position changes between consecutive frames, evaluates whether the position changes are consistent with the expected eye movement, detects whether there are any abnormal movement trajectories, and obtains displacement consistency data;
[0190] The pupil position correction module analyzes the frames of abnormal movement trajectory based on the displacement consistency data, compares the statistical data, recalculates the pupil position in the frame, corrects the target frame data, and obtains the pupil position correction result.
[0191] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " as used herein generally indicates an "or" relationship between the associated objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.
[0192] In this disclosure, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0193] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0194] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0195] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0196] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of the device or unit, which can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0198] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0199] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0200] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. The pupil boundary detection method based on multi-algorithm fusion is characterized by: The method comprises: S1: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixels in the image are detected, converted into a grayscale image, and the contrast and brightness of the grayscale image are adjusted to generate a grayscale refinement layer; S2: Based on the grayscale refinement layer, median filtering is performed on the 3×3 neighborhood of each pixel, the original pixel value is replaced by the median grayscale value, the local contrast of the image is further refined, and the edge distinction in the current image is corrected to obtain a local contrast enhancement layer; S3: Based on the local contrast enhancement layer, the Sobel operator is used to analyze the edge gradient of the image, the edge points are determined, the Hough transform is used to perform circular fitting on the edge points, and the pupil boundary is defined and the annular boundary is mapped to obtain pupil boundary mapping information; S4: Based on the pupil boundary mapping information, analyzing the displacement data of the pupil center between consecutive frames, comparing the position changes between consecutive frames, evaluating whether the position changes are consistent with the expected eye movement, detecting whether there is an abnormal movement trajectory, and obtaining displacement consistency data; S5: Analyze the frames of abnormal movement trajectory according to the displacement consistency data, recalculate the pupil position in the frame, correct the target frame data, and obtain the pupil position correction result.
2. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The grayscale refinement layer includes the image grayscale equalization result, contrast adjustment effect, and brightness optimization point; the local contrast enhancement layer includes filtering clarity, edge preservation index, and local contrast enhancement area; the pupil boundary mapping information includes edge gradient details, circular fitting area, and boundary clarity level; the displacement consistency data includes displacement trajectory continuity, inter-frame change consistency, and abnormal motion markers; and the pupil position correction result includes data correction effect and positioning accuracy verification result.
3. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The steps for obtaining the grayscale refinement layer are specifically as follows: S101: Based on the eye image data collected by the infrared camera, the RGB channel parameters of the pixel points in the image are detected, the grayscale value is calculated based on the weighted average of the three RGB channels, and a full-image grayscale image is constructed; S102: Based on the full grayscale image, identifying the grayscale range of the image, adjusting the minimum and maximum grayscale intervals of the image by linear stretching, remapping the pixel grayscale, optimizing the image contrast and brightness, and obtaining contrast and brightness parameters; S103: Calculate the grayscale difference between adjacent pixels based on the contrast and brightness parameters, identify edge gradients, screen pixels in key areas of grayscale changes, reconstruct grayscale edge details, refine edge visibility of the grayscale image, and generate a grayscale refinement layer.
4. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The steps of obtaining the local contrast enhancement layer are specifically as follows: S201: Based on the grayscale refinement layer, a 3×3 neighborhood of each pixel is delineated, the grayscales of all pixels in the neighborhood are extracted and sorted, the median grayscale is selected as the new grayscale of the center pixel, the entire image is traversed, the noise interference distribution is corrected, and a median grayscale reconstructed image is obtained; S202: reconstructing the image based on the median grayscale, obtaining the grayscale difference between each pixel and its neighborhood, calculating the grayscale difference ratios of consecutive pixels in the horizontal and vertical directions, determining pixel regions where the difference ratios are higher than a local contrast benchmark, and locating grayscale change regions near edges to obtain edge transition coefficients; S203: Based on the edge transition coefficient, grayscale adjustment is performed on the edge and non-edge areas in the image, grayscale jumps of the edge portion are optimized, edge differentiation is corrected, and a local contrast enhancement layer is obtained.
5. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The steps for obtaining pupil boundary mapping information are specifically as follows: S301: Based on the local contrast enhancement layer, horizontal and vertical grayscale gradients of pixels are obtained, and edge gradient strength is determined by calculating the grayscale change rate and directional difference of adjacent pixels. Pixels with grayscale changes exceeding an edge detection benchmark are screened to identify key edge areas of the image. S302: Analyzing the spatial distribution and geometric symmetry of edge points in the key edge region of the image, determining whether a circular structure can be formed by measuring the geometric distance between the edge points, determining potential circular boundaries, and obtaining circular boundary estimation data; S303: Calling the circular boundary estimation data, combining it with the identified edge points, applying Hough transform to perform circular fitting, defining the pupil boundary according to the continuous closure degree and symmetry of the edge points, determining and mapping the annular boundary of the pupil, and obtaining pupil boundary mapping information.
6. The pupil boundary detection method based on multi-algorithm fusion according to claim 5, characterized in that: According to the spatial distribution and geometric symmetry of the edge points, the formula is adopted: Calculate the geometric distance deviation between edge points and determine whether they can form a circular structure by measuring the geometric distance between edge points. i Represents the geometric distance deviation of the i-th edge point, d ij Represents the distance from the i-th edge point to the j-th edge point, Represents the average distance between all measured edge points, σ d represents the standard deviation of the distances between all measured edge points, and n represents the total number of measured edge points.
7. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The steps for obtaining the displacement consistency data are specifically as follows: S401: extracting the horizontal and vertical coordinate data of the pupil center in consecutive frames based on the pupil boundary mapping information, calculating the coordinate difference of the center point for each pair of consecutive frames, analyzing the movement distance and direction between frames, and establishing an inter-frame motion dataset; S402: Based on the inter-frame motion data set, compare the changes in displacement angles and distances between consecutive frames, identify abnormal motion sequences with directional fluctuations, detect whether there are unexpected motion trajectories, and generate abnormal motion indicators; S403: Based on the abnormal motion index, analyze the average directional consistency of the displacement changes between consecutive frames in the interval, compare it with the expected motion, determine whether the smoothness of the motion meets the stability requirements, and obtain displacement consistency data.
8. The pupil boundary detection method based on multi-algorithm fusion according to claim 7, characterized in that: The comparison of the displacement angle and distance changes between consecutive frames adopts the formula: Calculate the fluctuation of displacement angle and identify abnormal motion sequences with directional fluctuations, where Δθ z Represents the zth frame to the z+nth frame z The displacement angle fluctuation between frames, θ z Represents the displacement angle of the z-th frame, θ z+k represents the displacement angle of the z+k frame, d z,z+k Represents the displacement distance between the zth frame and the z+kth frame, n z represents the number of consecutive frames, and k represents the difference in the number of subsequent frames starting from the current frame z.
9. The pupil boundary detection method based on multi-algorithm fusion according to claim 1, characterized in that: The steps for obtaining the pupil position correction result are specifically as follows: S501: Based on the displacement consistency data, frames showing abnormal motion trajectories are identified in consecutive frames, the coordinate points of the pupil positions in the frames are analyzed, and the magnitude of the displacement abnormality is calculated by comparing and counting the deviations between the pupil coordinates of each frame and its normal motion trajectory, thereby obtaining abnormal trajectory analysis data; S502: Based on the abnormal trajectory analysis data, the pupil center coordinates of the corresponding frame are recalculated, and the current frame coordinate point is corrected in combination with the continuous trajectory trend of the previous and next frames to optimize the pupil positioning accuracy of each frame and obtain the pupil position correction result.
10. A multi-algorithm fusion pupil boundary detection system, the system being used to implement the multi-algorithm fusion pupil boundary detection method according to any one of claims 1 to 9, characterized in that: The system comprises: The image preprocessing module detects the RGB channel parameters of the pixels in the eye image data collected by the infrared camera, converts it into a grayscale image, optimizes the grayscale distribution, adjusts the contrast and brightness of the grayscale image, refines the edge visibility of the grayscale image, and generates a grayscale refinement layer; The image noise optimization module performs median filtering on the 3×3 neighborhood of each pixel based on the grayscale refinement layer, replaces the original pixel value with the median grayscale value, further refines the local contrast of the image, corrects the edge distinction in the current image, and obtains a local contrast enhancement layer; The edge detection and fitting module uses the Sobel operator to analyze the edge gradient of the image based on the local contrast enhancement layer, determines the edge points, performs circular fitting on the edge points using the Hough transform, determines the accuracy of the circular area, defines the pupil boundary, maps the annular boundary, and obtains pupil boundary mapping information; The dynamic displacement analysis module analyzes the displacement data of the pupil center between consecutive frames based on the pupil boundary mapping information, compares the position changes between consecutive frames, evaluates whether the position changes are consistent with the expected eye movement, detects whether there are abnormal movement trajectories, and obtains displacement consistency data; The pupil position correction module analyzes the frames of abnormal movement trajectory according to the displacement consistency data, compares the statistical data, recalculates the pupil position in the frame, corrects the target frame data, and obtains the pupil position correction result.
Citation Information
Cited By
Drug production line remote monitoring method based on image processing
CN120876473A
Low-resolution infrared image goal recognition system
CN121505252A
