Pupil detection method, device, apparatus and storage medium
By alternately lighting infrared light sources to acquire eye images, removing light spots, and then performing region growth and condition screening, the problem of light spots affecting pupil edge detection is solved, and more accurate pupil center localization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING 7INVENSUN TECH
- Filing Date
- 2022-01-13
- Publication Date
- 2026-06-16
AI Technical Summary
Existing pupil center detection algorithms are affected by light spots, resulting in inaccurate pupil edge detection.
The first and second infrared light sources are alternately lit to acquire the first and second eye images. The third eye image is generated by removing light spots. The seed points are used for region growth to determine the candidate pupil region and select the target pupil region according to the set conditions to determine the pupil center.
It improves the accuracy of pupil detection and eliminates the interference of light spot on pupil center detection.
Smart Images

Figure CN116486466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of eye-tracking technology, and in particular to a pupil detection method, device, equipment and storage medium. Background Technology
[0002] Existing pupil center detection algorithms process the original image (Image1). The light spot can affect the edge of the pupil, and the halo formed around the light spot can also affect pupil recognition. When the influence of the light spot on the pupil is large enough, whether it is fitted with a circle, fitted with an ellipse, or other fitting methods, it will affect the edge of the pupil, and thus affect the center point of the pupil. Summary of the Invention
[0003] This invention provides a pupil detection method, apparatus, device, and storage medium, which can improve the accuracy of pupil detection.
[0004] In a first aspect, embodiments of the present invention provide a pupil detection method, comprising:
[0005] Acquire a first eye image and a second eye image; wherein the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated;
[0006] A third eye image is obtained by removing light spots from the first and second eye images;
[0007] Seed points are determined in the third eye image, and region growth is performed based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions.
[0008] From the plurality of candidate pupil regions, determine the target pupil region that meets the set conditions;
[0009] The center point of the target pupil region is determined as the pupil center.
[0010] Secondly, embodiments of the present invention also provide a pupil detection device, comprising:
[0011] An eye image acquisition module is used to acquire a first eye image and a second eye image; wherein, the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated;
[0012] The third eye image acquisition module is used to remove light spots based on the first eye image and the second eye image to obtain a third eye image;
[0013] A seed point determination module is used to determine seed points in the third eye image, and perform region growth based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions.
[0014] The target pupil region determination module is used to determine a target pupil region that meets set conditions from the plurality of candidate pupil regions;
[0015] The pupil center determination module is used to determine the center point of the target pupil region as the pupil center.
[0016] Thirdly, embodiments of the present invention also provide a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the pupil detection method as described in the embodiments of the present invention.
[0017] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processing device, implements the pupil detection method as described in the embodiments of the present invention.
[0018] This invention discloses a pupil detection method, apparatus, device, and storage medium. The method involves acquiring a first eye image and a second eye image; wherein the first eye image is acquired when the eye is illuminated by a first infrared light source, and the second eye image is acquired when the eye is illuminated by a second infrared light source; the first and second infrared light sources are alternately illuminated; light spots are removed from the first and second eye images to obtain a third eye image; seed points are determined in the third eye image, and region growing is performed based on the seed points at multiple grayscale steps to obtain multiple candidate pupil regions; a target pupil region that meets set conditions is determined from the multiple candidate pupil regions; and the center point of the target pupil region is determined as the pupil center. The pupil detection method provided in this embodiment achieves pupil center detection by using the third eye image after removing light spots, eliminating the interference of light spots on pupil center detection, thereby improving the accuracy of pupil detection. Attached Figure Description
[0019] Figure 1 This is a flowchart of a pupil detection method according to Embodiment 1 of the present invention;
[0020] Figure 2a This is an example image of the first eye in Embodiment 1 of the present invention;
[0021] Figure 2b This is an example image of the second eye in Embodiment 1 of the present invention;
[0022] Figure 2c This is an example image of the third eye after removing light spots in Embodiment 1 of the present invention;
[0023] Figure 3 These are candidate pupil regions grown using different grayscale step sizes in Embodiment 1 of the present invention.
[0024] Figure 4 This is an example diagram illustrating the determination of the pupil center in Embodiment 1 of the present invention;
[0025] Figure 5 This is a schematic diagram of the structure of a pupil detection device according to Embodiment 2 of the present invention;
[0026] Figure 6 This is a schematic diagram of the structure of a computer device according to Embodiment 3 of the present invention. Detailed Implementation
[0027] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0028] Example 1
[0029] Figure 1 This is a flowchart of a pupil detection method provided in Embodiment 1 of the present invention. This embodiment is applicable to the detection of pupils in eye tracking. The method can be executed by a pupil detection device, such as... Figure 1 As shown, the method specifically includes the following steps:
[0030] Step 110: Obtain the first eye image and the second eye image.
[0031] The first eye image is captured when the first infrared light source illuminates the eye, and the second eye image is captured when the second infrared light source illuminates the eye. The first and second infrared light sources are alternately illuminated. The principle of alternating illumination is that when the first infrared light source is illuminated, the second infrared light source is off, and when the second infrared light source is illuminated, the first infrared light source is off; that is, only one infrared light source is currently illuminated to illuminate the eye. In this embodiment, the first and second infrared light sources are located in different positions. For example, assuming that the eye-tracking device has three infrared light sources A, B, and C, the three infrared light sources can be illuminated sequentially in the following order: ABCA to illuminate the eye.
[0032] Step 120: Remove light spots from the first eye image and the second eye image to obtain the third eye image.
[0033] The first and second eye images are the same size, meaning their height (H*W) is identical. The light spots in the first and second eye images are located in different positions. Merging the two images removes these light spots.
[0034] In this embodiment, the process of obtaining a third eye image by removing light spots from the first eye image and the second eye image can be as follows: obtaining the first gray value of a pixel in the first eye image and the second gray value of a pixel at the corresponding position in the second eye image; determining the minimum value between the first gray value and the second gray value as the target gray value; and determining the target gray value as the gray value of the pixel at the corresponding position in the third image.
[0035] Specifically, the first grayscale value of the pixel in the i-th row and j-th column of the first eye image and the second grayscale value of the pixel in the i-th row and j-th column of the second eye image are obtained. The minimum value of the first grayscale value and the second grayscale value is taken as the grayscale value of the pixel in the i-th row and j-th column of the third eye image. For example, Figure 2a This is an example image of the first eye. Figure 2b This is an example image of the second eye. Figure 2c This is an example image of the third eye after removing glare. Figure 2c As shown, the third eye image is based on Figure 2a and Figure 2b The image after removing light spots from the eye image.
[0036] Optionally, after obtaining the third eye image, the following step is also included: performing median filtering on the third eye image with a set kernel size.
[0037] The kernel size can be set to 3. The principle of median filtering is that the gray value of each pixel is set to the median of the gray values of all pixels within a neighborhood window (e.g., a 3x3 window centered on that pixel). Applying median filtering to the third eye image can make the edges of the third eye image clearer.
[0038] Step 130: Determine seed points in the third eye image, and perform region growing based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions.
[0039] The seed point can be the starting point for region growth. In this embodiment, the seed point can be a pixel whose grayscale value meets certain conditions.
[0040] Optionally, the seed point in the eye image can be determined by: using a set rectangle to translate and crop in the third eye image to obtain multiple sub-images; determining the sub-image with the smallest grayscale mean as the target sub-image; and determining the pixel with the smallest grayscale value in the target sub-image as the seed point.
[0041] The translation method for cropping can be either horizontal translation followed by vertical translation, or vertical translation followed by horizontal translation. If it's a horizontal translation, the step size can be less than or equal to the horizontal length of the rectangle; if it's a vertical translation, the step size can be less than or equal to the vertical length of the rectangle. This ensures that the third eye portion of the image is cropped without omission. The average grayscale value of the sub-image can be calculated by summing the grayscale values of all pixels in the sub-image and counting the sum of those summed pixels to obtain the average grayscale value of the sub-image.
[0042] Specifically, after using a rectangular frame to translate and crop multiple sub-images from the third eye image, the mean gray value of each sub-image is calculated, and the sub-image with the smallest mean gray value is determined as the target sub-image. Finally, the pixel with the smallest gray value in the target sub-image is determined as the seed point.
[0043] Here, the grayscale step size can be understood as the step size of grayscale values, and multiple grayscale steps can be from step size 1 to step size 10. The region growing method can be an eight-way connected component labeling algorithm; no specific limitation is made here. For example, Figure 3 These are candidate pupil regions grown using different grayscale step sizes in this embodiment. For example... Figure 3 As shown in the figure, the white area represents the candidate pupil area after region growth. It can be seen from the figure that different grayscale steps result in different region shapes.
[0044] Step 140: Determine the target pupil region that meets the set conditions from multiple candidate pupil regions.
[0045] The setting conditions can be that the size information, aspect ratio, and fill degree all meet the set conditions.
[0046] Specifically, the method for determining the target pupil region that meets the set conditions from multiple candidate pupil regions can be as follows: obtain the size information, aspect ratio, and fill degree of multiple candidate pupil regions respectively; and determine the candidate pupil region that meets the set conditions in terms of size information, aspect ratio, and fill degree as the target pupil region.
[0047] The size information can be understood as the number of pixels contained in the candidate pupil region. The aspect ratio can be understood as the ratio between the longest horizontal axis and the longest vertical axis in the candidate pupil region. The fill factor can be calculated by: determining the number of pixels contained in the candidate pupil region and the area of its circumscribed circle; and then dividing the number of pixels by the area of the circumscribed circle to obtain the fill factor. In this embodiment, the candidate pupil region is considered to meet the set conditions if its size information is within a first set range, its aspect ratio is within a second set range, and its fill factor is within a third set range. The first, second, and third set ranges are determined based on the actual pupil information.
[0048] Step 150: Determine the center point of the target pupil region as the pupil center.
[0049] In this embodiment, the center point of the target pupil region can be directly determined as the pupil center.
[0050] Optionally, the process of determining the center point of the target pupil region as the pupil center can be as follows: perform edge detection on the target pupil region to obtain a set of pupil edge points; perform convex hull operation on the set of pupil edge points; and determine the center point of the region enclosed by the set of pupil edge points after the convex hull operation as the pupil center.
[0051] Existing edge detection algorithms can be used to detect the edges of the target pupil region; no specific limitation is made here. The principle of convex hull operation is to connect the outermost edge points of the edge point set to form an elliptical region. For example, Figure 4 This is an example diagram illustrating the determination of the pupil center in this embodiment. For example... Figure 4 As shown, the white ring is the result of the convex hull operation on the edge point set. Finally, the center point of the region enclosed by the pupil edge point set after the convex hull operation is determined as the pupil center.
[0052] The technical solution of this embodiment involves acquiring a first eye image and a second eye image. The first eye image is captured when the eye is illuminated by a first infrared light source, and the second eye image is captured when the eye is illuminated by a second infrared light source. The first and second infrared light sources are alternately illuminated. Illumination spots are removed from the first and second eye images to obtain a third eye image. Seed points are determined in the third eye image, and region growing is performed based on these seed points at multiple grayscale steps to obtain multiple candidate pupil regions. A target pupil region that meets set conditions is determined from the multiple candidate pupil regions. The center point of the target pupil region is determined as the pupil center. By using the third eye image after removing illumination spots to detect the pupil center, the interference of illumination spots on pupil center detection is eliminated, thereby improving the accuracy of pupil detection.
[0053] Example 2
[0054] Figure 5 This is a schematic diagram of the structure of a pupil detection device provided in Embodiment 2 of the present invention. Figure 5 As shown, the device includes:
[0055] The eye image acquisition module 210 is used to acquire a first eye image and a second eye image; wherein, the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated;
[0056] The third eye image acquisition module 220 is used to remove light spots based on the first eye image and the second eye image to obtain a third eye image;
[0057] The seed point determination module 230 is used to determine seed points in the third eye image and perform region growth based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions.
[0058] The target pupil region determination module 240 is used to determine the target pupil region that meets the set conditions from multiple candidate pupil regions;
[0059] The pupil center determination module 250 is used to determine the center point of the target pupil region as the pupil center.
[0060] Optionally, the third eye image acquisition module 220 is also used for:
[0061] Obtain the first grayscale value of a pixel in the first eye image and the second grayscale value of a pixel at the corresponding position in the second eye image;
[0062] The minimum value between the first grayscale value and the second grayscale value is determined as the target grayscale value;
[0063] The target gray value is determined as the gray value of the pixel at the corresponding position in the third image.
[0064] Optionally, it also includes: a median filtering module, used for:
[0065] Median filtering with a set kernel size is applied to the third eye image.
[0066] Optionally, the seed point determination module 230 is also used for:
[0067] Multiple sub-images are obtained by translating and cropping within the third eye image using a defined rectangular bounding box;
[0068] The sub-image with the smallest grayscale mean is identified as the target sub-image;
[0069] The pixel with the smallest gray value in the target sub-image is determined as the seed point.
[0070] Optionally, the target pupil region determination module 240 is also used for:
[0071] The size, aspect ratio, and fill degree of multiple candidate pupil regions are obtained respectively.
[0072] Candidate pupil regions that meet the set conditions in terms of size, aspect ratio, and fill level are identified as target pupil regions.
[0073] Optionally, obtain the fill degree of the candidate pupil region, including:
[0074] Determine the number of pixels and the area of the circumcircle of the candidate pupil region;
[0075] The fill factor is obtained by dividing the area of the pixel by the area of the circumcircle.
[0076] Optionally, the pupil center determination module 250 is also used for:
[0077] Edge detection is performed on the target pupil region to obtain the pupil edge point set;
[0078] Perform convex hull operation on the set of pupil edge points;
[0079] The center point of the region enclosed by the set of pupil edge points after convex hull operation is determined as the pupil center.
[0080] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in this embodiment can be found in the methods provided in all the foregoing embodiments of the present invention.
[0081] Example 3
[0082] Figure 6 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 6 A block diagram of a computer device 312 suitable for implementing embodiments of the present invention is shown. Figure 6 The computer device 312 shown is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the present invention. Device 312 is a typical computing device for pupil detection.
[0083] like Figure 6 As shown, the computer device 312 is presented in the form of a general-purpose computing device. The components of the computer device 312 may include, but are not limited to: one or more processors 316, a storage device 328, and a bus 318 connecting different system components (including the storage device 328 and the processor 316).
[0084] Bus 318 represents one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. Examples of these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MCA) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0085] Computer device 312 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 312, including volatile and non-volatile media, removable and non-removable media.
[0086] Storage device 328 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 330 and / or cache memory 332. Computer device 312 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 334 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 6 Not shown; usually referred to as a "hard drive"). Although Figure 6 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a Compact Disc-Read Only Memory (CD-ROM), a Digital Video Disc-Read Only Memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 318 via one or more data media interfaces. Storage device 328 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0087] A program 336 having a set (at least one) of program modules 326 may be stored in, for example, a storage device 328. Such program modules 326 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 326 typically perform the functions and / or methods described in the embodiments of the present invention.
[0088] Computer device 312 can also communicate with one or more external devices 314 (e.g., keyboard, pointing device, camera, display 324, etc.), and with one or more devices that enable a user to interact with the computer device 312, and / or with any device that enables the computer device 312 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 322. Furthermore, computer device 312 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN)) and / or public networks, such as the Internet) via network adapter 320. As shown, network adapter 320 communicates with other modules of computer device 312 via bus 318. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with computer device 312, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.
[0089] The processor 316 executes various functional applications and data processing by running programs stored in the storage device 328, such as implementing the pupil detection method provided in the above embodiments of the present invention.
[0090] Example 4
[0091] This invention provides a computer-readable storage medium storing a computer program that, when executed by a processing device, implements the pupil detection method described in this invention. The computer-readable medium described above can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. For example, a computer-readable storage medium can be—but is not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0092] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0093] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0094] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a first eye image and a second eye image; wherein the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated; light spots are removed from the first eye image and the second eye image to obtain a third eye image; seed points are determined in the third eye image, and region growth is performed based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions; a target pupil region that meets set conditions is determined from the multiple candidate pupil regions; and the center point of the target pupil region is determined as the pupil center.
[0095] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0097] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0098] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0099] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0100] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A pupil detection method, characterized in that, include: Acquire a first eye image and a second eye image; wherein the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated; A third eye image is obtained by removing light spots from the first and second eye images; Seed points are determined in the third eye image, and region growth is performed based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions. From the plurality of candidate pupil regions, determine the target pupil region that meets the set conditions; The center point of the target pupil region is determined as the pupil center; The step of determining the target pupil region that meets the set conditions from the plurality of candidate pupil regions includes: The size information, aspect ratio, and fill degree of the multiple candidate pupil regions are obtained respectively; wherein, the size information is the number of pixels contained in the candidate pupil region, and the aspect ratio is the ratio between the longest horizontal axis and the longest vertical axis in the candidate pupil region; Candidate pupil regions whose size information, aspect ratio, and fill degree all meet the set conditions are determined as target pupil regions; The process of obtaining the fill degree of the candidate pupil region includes: Determine the number of pixels and the area of the circumcircle contained in the candidate pupil region; The fill factor is obtained by dividing the area of the pixel by the area of the circumscribed circle.
2. The method according to claim 1, characterized in that, A third eye image is obtained by removing light spots from the first and second eye images, including: Obtain the first grayscale value of a pixel in the first eye image and the second grayscale value of a pixel at the corresponding position in the second eye image; The minimum value between the first gray value and the second gray value is determined as the target gray value; The target gray value is determined as the gray value of the pixel at the corresponding position in the third image.
3. The method according to claim 1, characterized in that, After obtaining the third eye image, the following is also included: The third eye image is subjected to median filtering with a set kernel size.
4. The method according to claim 1 or 3, characterized in that, Determining seed points in the eye image includes: Multiple sub-images are obtained by translating and cropping a defined rectangular frame within the third eye image; The sub-image with the smallest grayscale mean is identified as the target sub-image; The pixel with the smallest gray value in the target sub-image is determined as the seed point.
5. The method according to claim 1, characterized in that, Determining the center point of the target pupil region as the pupil center includes: Edge detection is performed on the target pupil region to obtain a set of pupil edge points; Perform convex hull operation on the set of pupil edge points; The center point of the region enclosed by the set of pupil edge points after convex hull operation is determined as the pupil center.
6. A pupil detection device, characterized in that, include: An eye image acquisition module is used to acquire a first eye image and a second eye image; wherein, the first eye image is an image captured when the eye is illuminated by a first infrared light source, and the second eye image is an image captured when the eye is illuminated by a second infrared light source; the first infrared light source and the second infrared light source are alternately illuminated; The third eye image acquisition module is used to remove light spots based on the first eye image and the second eye image to obtain a third eye image; A seed point determination module is used to determine seed points in the third eye image, and perform region growth based on the seed points according to multiple gray-level steps to obtain multiple candidate pupil regions. The target pupil region determination module is used to determine a target pupil region that meets set conditions from the plurality of candidate pupil regions; A pupil center determination module is used to determine the center point of the target pupil region as the pupil center; The target pupil region determination module is further configured to: The size information, aspect ratio, and fill degree of the multiple candidate pupil regions are obtained respectively; wherein, the size information is the number of pixels contained in the candidate pupil region, and the aspect ratio is the ratio between the longest horizontal axis and the longest vertical axis in the candidate pupil region; Candidate pupil regions whose size information, aspect ratio, and fill degree all meet the set conditions are determined as target pupil regions; The process of obtaining the fill degree of the candidate pupil region includes: Determine the number of pixels and the area of the circumcircle contained in the candidate pupil region; The fill factor is obtained by dividing the area of the pixel by the area of the circumscribed circle.
7. A computer device, characterized in that, include: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the pupil detection method as described in any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processing device, it implements the pupil detection method as described in any one of claims 1-5.