Processing Method, Related Device and Storage Medium Based on Measured Distance
The method and device address inconsistent pupil observation by automatically adjusting image capture based on measured distance, enhancing standardization and safety in clinical evaluations.
Patent Information
- Application Number
- CN202510628353.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-05-15
AI Technical Summary
When doctors observe the patient's pupil, it is difficult for doctors to accurately judge the distance between the pupil pen and the pupil, resulting in the examination results vary from person to person and lack of standardization.
The distance between the pupil and the pupil pen is measured by the distance measuring device, and the opening and closing of image acquisition is automatically controlled, and the current state is determined based on the measured distance and device state, so as to standardize image acquisition.
It improves the standardization and accuracy of pupil observation, reduces artificial errors, saves energy, and assists doctors in better analyzing pupil changes.
Smart Images

Figure CN120130920B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of distance measurement, and more particularly to a processing method based on measured distance, related devices and storage media. Background Art
[0002] The pupillary light reflex (PLR) is an important clinical indicator for evaluating the function of the nervous system. It refers to the reflex activity of the pupil to control the amount of light entering the eye by adjusting its size when stimulated by light. During diagnosis, a doctor can irradiate the pupil with a pupil pen and observe the reflex activity of the pupil. However, in the related art, the doctor usually needs to bring the light source device close to the patient's pupil for observation. How to grasp the appropriate pupil observation distance often depends on manual experience judgment, resulting in the inspection operation effects varying from person to person and being not standard enough. Summary of the Invention
[0003] The embodiments of the present application provide a processing method based on measured distance, related devices and storage media, which can determine the state of the distance measurement device by measuring the distance, so as to start image acquisition and record the change of the pupil.
[0004] In a first aspect, the embodiments of the present application provide a processing method based on measured distance, which is applied to a distance measurement device having an image acquisition function. The method includes: obtaining a first data set, where the data in the first data set is the distance collected by the distance measurement device; determining the current state of the distance measurement device according to the first data set and the previous state of the distance measurement device; and starting or closing image acquisition according to the current state of the distance measurement device.
[0005] Through this solution, after the distance measurement device collects the distance, it can determine the current state according to the collected distance and the previous state of the distance measurement device. Thus, the distance measurement device can perform subsequent operations according to the current state. For example, start or close image acquisition. That is to say, the distance measurement device can automatically start image acquisition according to the measured distance without manual operation, so that in subsequent operations, related operations can be performed more standardly according to the results of image acquisition. For example, when the distance measurement device is used to assist a doctor in observing the pupil, the distance collected by the distance acquisition device can be the distance to the pupil. Thus, when observing the pupil, image acquisition can be started standardly according to the state of the distance acquisition device. Thus, in subsequent operations, the doctor can observe and analyze the pupil according to the collected image.
[0006] Second aspect, an embodiment of the present application provides a distance measuring device, including: a housing, a ranging component, an image acquisition device, and a processor. The ranging component and the image acquisition device are both mechanically connected to the housing, and the ranging component and the image acquisition device are both communicatively connected to the processor; the processor is configured to execute the method described in the first aspect above.
[0007] Third aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions that, when running on a computer, cause the computer to execute the method described in the first aspect.
[0008] Fourth aspect, an embodiment of the present application provides a computing device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. Wherein, when the processor executes the computer program, the method described in the first aspect is implemented.
[0009] Fifth aspect, an embodiment of the present application provides a chip, which includes a processor coupled to a transceiver for executing the technical solution provided in the first aspect of the embodiments of the present application. In a possible design, the chip may also be a dedicated hardware structure for implementing the technical solution provided in the first aspect above. For example, the processing related to the neural network model may be implemented by a dedicated neural network processor or a graphics processor.
[0010] Sixth aspect, an embodiment of the present application provides a chip system, which includes a processor for implementing the functions involved in the first aspect above. For example, generating or processing the information involved in the method provided in the first aspect.
[0011] In a possible design, the above chip system further includes a memory, and the memory is connected to the processor through a circuit structure. The memory is used to store the program instructions and data necessary for the terminal. The chip system may be composed of chips or may include chips and other discrete devices. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface. The communication interface is used to receive the data and / or information that needs to be processed. The processor obtains the data and / or information from the communication interface, processes the data and / or information, and outputs the processing result through the communication interface. The communication interface may be an input / output interface.
[0012] Seventh aspect, an embodiment of the present application provides a computer program product containing instructions that, when the computer program product runs on a computer, cause the computer to execute the method provided in the first aspect above. Description of the Drawings
[0013] By referring to the accompanying drawings and reading the detailed description of the embodiments of the present application, the objectives, features, and advantages of the embodiments of the present application will become easy to understand. Among them:
[0014] Figure 1 It is a schematic structural diagram of a distance measuring device in an embodiment of the present application;
[0015] Figure 2 It is a schematic flowchart of the method provided in an embodiment of the present application;
[0016] Figure 3 It is a schematic diagram of the state of the pupil detection device in an embodiment of the present application;
[0017] Figure 4 It is a schematic diagram of the distance collected by the pupil detection device in an embodiment of the present application;
[0018] Figure 5 It is another schematic flowchart of the method provided in an embodiment of the present application;
[0019] Figure 6 a is a schematic diagram of the first image untreated in an embodiment of the present application;
[0020] Figure 6 b is a schematic diagram of the first image after gradient magnitude processing in an embodiment of the present application;
[0021] Figure 6 c is a schematic diagram of the second image in an embodiment of the present application;
[0022] Figure 7 a is a schematic diagram of the second image after mask filtering in an embodiment of the present application;
[0023] Figure 7 b is a schematic diagram of the image after the second image after mask filtering is converted into the HSV color space in an embodiment of the present application;
[0024] Figure 7 c is a schematic diagram of the iris edge image in an embodiment of the present application;
[0025] Figure 8 a is a schematic diagram of the focus area image in an embodiment of the present application;
[0026] Figure 8 b is a schematic diagram of the binary image in an embodiment of the present application;
[0027] Figure 8 c is a schematic diagram of the region of interest in an embodiment of the present application;
[0028] Figure 9 It is a schematic flowchart of the process of collecting and analyzing images in some embodiments of the present application;
[0029] Figure 10 It is another schematic structural diagram of the distance measuring device in an embodiment of the present application;
[0030] Figure 11 A structural schematic diagram of a computing device according to an embodiment of the present application.
[0031] In the figure: 100, a housing; 200, a ranging component; 300, an image acquisition device. Specific embodiments
[0032] In the specification, claims and above-mentioned drawings of the embodiments of the present application, terms such as "first", "second", etc. are used to distinguish similar objects (for example, the first xx and the second xx respectively represent different xx, and other similars), and are not necessarily used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments described here can be implemented in an order different from that illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or modules does not necessarily have to be limited to those clearly listed steps or modules, but may include other steps or modules not clearly listed or inherent to these processes, methods, products or devices. The division of modules in the embodiments of the present application is only a logical division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed to multiple circuit modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
[0033] In the related art, when a doctor examines a patient's pupil, they can only determine the distance between the pupil pen and the pupil based on experience, irradiate the pupil at this distance and observe the pupil. This makes the doctor's observation of the pupil often vary from person to person and is not standardized enough.
[0034] The embodiments of the present application provide a processing method based on distance measurement, related devices and storage media, which can be applied to a distance measurement device (which can also be called a ranging device). The distance measurement device can be a pupil detection device, and the pupil detection device has an image acquisition function. The pupil detection device can be fixed to the pupil pen. Or, a pupil pen is provided on the pupil detection device. The processing method based on distance measurement provided by the embodiments of the present application can judge the state of the pupil detection device according to the distance measured by the pupil detection device, and turn on or off image acquisition according to the state of the pupil detection device. Thus, the distance for observing the pupil can be better determined, which is beneficial to the observation of the pupil.
[0035] In addition, in some embodiments of the present application, the number of distances measured by the pupil detection device corresponding to each state is different. By adjusting the number of distances measured by the pupil detection device, the pupil detection device has different distance measurement response times in different states. It has high speed in the state where rapid response is required, and reduces the measurement state update speed in the state where rapid response is not required, saving energy.
[0036] For example, when a doctor picks up a pupil pen to irradiate a patient's pupil, it can be determined that the pupil detection device is in the observation state, and image acquisition is started. After the doctor irradiates the patient's pupil, it can be determined that the pupil detection device is in the end-of-observation state, and image acquisition is turned off. Thus, the doctor can analyze the acquired images to better determine the patient's condition. In addition, it can also reduce the time for the doctor to irradiate the patient's pupil, reducing the damage to the eyes. Among them, the above-mentioned images can be one or more, and multiple images can form a video, and the doctor can analyze the acquired video.
[0037] It can be understood that a pupil pen refers to a light source that can emit light and irradiate the pupil, such as a flashlight.
[0038] The processing method based on the measured distance provided by the embodiments of the present application can also be applied to other scenarios. For example, the distance measurement device is installed on a vehicle, and the state of the distance measurement device is judged by the distance between the vehicle and surrounding objects, and image acquisition is started or image acquisition is turned off according to the state of the distance measurement device. For example, when the distance between the vehicle and surrounding objects is less than 1 meter, the distance measurement device is in the observation state, and image acquisition is started. Thus, when there is a risk of collision, real-time images are recorded. Another example is that the distance measurement device is installed on an elderly person's protective clothing, and the state of the distance measurement device is judged by the distance between the elderly person and surrounding objects, and image acquisition is started or image acquisition is turned off according to the state of the distance measurement device. For example, when the elderly person is falling, the distance measurement device will be in the observation state and image acquisition will be started. Thus, the family members or manufacturers of the elderly person can summarize the scenarios where the elderly person often falls based on the acquired images and take preventive measures in advance.
[0039] Refer to Figure 1 , the distance measurement device may include a housing 100, a distance measurement component 200, an image acquisition device 300, and a processor (not shown in the figure).
[0040] Among them, the distance measurement component is used to measure the distance, and the image acquisition device is used to acquire images. The distance measurement component and the image acquisition device are both mechanically connected to the housing, such as fixedly connected or detachably connected. The distance measurement component 200 and the image acquisition device 300 are both communicatively connected to the processor. It can be understood that the connection method of the mechanical connection can be a direct connection or an indirect connection.
[0041] Exemplarily, the distance measurement component 200 is a laser distance measurement component, an infrared distance measurement component, etc.
[0042] Exemplarily, the image acquisition device 300 is a camera.
[0043] In some embodiments, the distance measurement device further includes a light source, and the light source is communicatively connected to the processor.
[0044] Referring to Figure 2 , Figure 2 is a flowchart of a processing method based on distance measurement provided by an embodiment of the present application. Taking the distance measurement device as a pupil detection device as an example, the method will be introduced below. The method includes steps 101-103.
[0045] Step 101, the pupil detection device obtains a first data set.
[0046] Among them, the data in the first data set are the distances collected by the pupil detection device.
[0047] The pupil detection device can collect distances, and the multiple collected distances form a first data set. For example, the 190 distances collected by the pupil detection device are shown in Table 1 respectively.
[0048] Table 1 190 distances collected by the pupil detection device
[0049]
[0050] Step 102, the pupil detection device determines the current state of the pupil detection device according to the first data set and the previous state of the pupil detection device.
[0051] Among them, the states of the pupil detection device include an observation state and a non-observation state. The observation state is the state of performing image acquisition, and the non-observation state is the state of not performing image acquisition.
[0052] Referring to Figure 3 , Figure 3Schematic diagram of the state of the pupil detection device according to the embodiments of the present application. In some embodiments, the observation state includes the start observation state and the ongoing observation state. The non-observation state includes the active state, the end observation state, and the standby state. Among them, the standby state is the state of the pupil detection device in the standby stage. For example, the pupil detection device is fixedly connected to the pupil pen, and the pupil pen is placed on the table. The active state is the state of the pupil detection device in the active stage when the user uses it. For example, the doctor picks up the pupil pen from the table. Another example is the process of the doctor putting the pupil pen back on the table after observing the patient's pupil. The start observation state is the state of the pupil detection device in the start observation stage when the user uses it. For example, when the doctor holds the pupil pen to observe the patient's pupil and just points the pupil pen at the patient's pupil. The ongoing observation state is the state of the pupil detection device in the ongoing observation stage when the user uses it. For example, the doctor is observing the patient's pupil. The end observation state is the state of the pupil detection device in the end observation stage when the user uses it. For example, after the doctor observes the patient's pupil, the pupil pen is placed on the table.
[0053] By setting the observation state and the non-observation state, and distinguishing the observation state into the start observation state and the ongoing observation state, and the non-observation state into the active state, the end observation state, and the standby state. It is realized to distinguish the state of the pupil detection device according to the user's common operation process, so that in subsequent operations, corresponding processing can be carried out according to the current state of the pupil detection device.
[0054] In some embodiments, the pupil detection device determines the current state of the pupil detection device based on the currently collected distance, the previous distance, and the previous state of the pupil detection device.
[0055] Exemplarily, referring to Table 1, the first distance collected by the pupil detection device is 410, and the state of the pupil detection device is the initial state, and the initial state is the standby state. The second distance collected by the pupil detection device is 410, and the previous state is the standby state. Since the absolute value of the difference between the second distance collected by the pupil detection device and the previous distance (the first distance) collected by the pupil detection device is less than the preset difference. For example, the preset difference is 150. The current state of the pupil detection device remains unchanged and is still the standby state.
[0056] Another exemplarily, still referring to Table 1, the 50th distance collected by the pupil detection device is 410, and the 51st distance is 240. When the pupil detection device collects the 50th distance, the state is the standby state. Since the absolute value of the difference between the 51st distance and the 50th distance is greater than the preset difference, the current state of the pupil detection device changes to the active state.
[0057] Step 103: The pupil detection device turns on or off image acquisition according to its current state.
[0058] In some embodiments, when the current state of the pupil detection device is the active state or the standby state, the pupil detection device does not turn on image acquisition. Or rather, the pupil detection device does not change the state of image acquisition. If image acquisition has already been turned on, it continues with image acquisition. If image acquisition has not been turned on, it continues to not turn on image acquisition. This reduces the on and off operations of the image sensor and improves the coherence of the video.
[0059] In some embodiments, the pupil detection device turns on image acquisition according to its current state. The pupil detection device turns off image acquisition according to its previous state and current state.
[0060] In some embodiments, when the current state of the pupil detection device is the start observation state, image acquisition is turned on.
[0061] In some embodiments, when the current state of the pupil detection device is the observing state, image acquisition is turned on.
[0062] In some embodiments, when the current state of the pupil detection device is the end observation state, the pupil detection device turns off image acquisition.
[0063] In some embodiments, when the current state of the pupil detection device is the end observation state and its previous state is the observation state, the pupil detection device turns off image acquisition.
[0064] Refer to Figure 4 , Figure 4 For the schematic diagram of the distances collected by the pupil detection device. The horizontal axis is the Nth distance collected by the pupil detection device, with the unit being individual, and N is a positive integer. The vertical axis is the distance collected by the pupil detection device, with the unit being millimeter.
[0065] For example, intervals 1 to 7 represent the standby state, active state, start observation state, observing state, end observation state, active state, and standby state in sequence. When the state of the pupil detection device is the start observation state, the pupil detection device turns on image acquisition. Subsequently, when the pupil detection device is in the observing state, the pupil detection device is still performing image acquisition. Then, when the pupil detection device is in the end observation state, the pupil detection device turns off image acquisition.
[0066] Taking a doctor's examination of a patient's pupil as an example, the pupil detection device is fixed on a pupil pen. The pupil pen is placed in the pocket on the chest, and the state of the pupil detection device is the standby state. Then, the doctor picks up the pupil pen, and the state of the pupil detection device becomes the active state. Then, the doctor uses the pupil pen to irradiate the patient's pupil, and the state of the pupil detection device becomes the start observation state. The doctor continuously observes the patient's pupil, and the state of the pupil detection device is the ongoing observation state. After the doctor finishes the observation, the pupil pen is put back into the pocket, and the state of the pupil detection device successively becomes the end observation state, the active state, and the standby state. Thus, during the process of the doctor observing the patient's pupil, the pupil detection device can start collecting images when the doctor starts the observation and stop collecting images when the doctor ends the observation. The images collected by the pupil detection device can assist the doctor in examining the patient's pupil and be used as a record of the condition in subsequent treatments.
[0067] In some embodiments, the pupil detection device can output photos or video files through image acquisition. As exemplified above, through operations such as analyzing and processing the images, it can assist the doctor's work.
[0068] In some embodiments, referring to Figure 5 , enabling image acquisition includes steps 1100 to step 1200.
[0069] Step 1100, the pupil detection device creates a video file.
[0070] Among them, the video file name format is: Auto_YYYYMMDDHHMMSS.mp4, and the time is the time when the current state of the pupil detection device changes to the start observation state.
[0071] In some embodiments, the Moving Picture Experts Group (MPEG) format is used to compress and store the video. As a result, the compressed video occupies less space, enabling the video to be stored on low-computing-power embedded and edge computing devices, saving space.
[0072] Step 1200, the pupil detection device sends the focal length to the image acquisition device, and the image acquisition device starts image acquisition according to the focal length.
[0073] In some embodiments, the image acquisition device is a camera. The processor in the pupil detection device can send the focal length to the camera. The camera can collect images through this focal length.
[0074] In some embodiments, the pupil detection device sends the focal length to the image acquisition device through the Camera Serial Interface (CSI) or the Flexible Printed Circuit (FPC) interface.
[0075] The focal length sent by the pupil detection device to the image acquisition device can be determined according to the first value. For detailed content, please refer to the following description and will not be elaborated here.
[0076] It can be understood that there is no requirement for the order between step 1100 and step 1200. Step 1100 can be executed first, step 1200 can be executed first, or step 1100 and step 1200 can be executed simultaneously.
[0077] In some embodiments, the method in the above embodiments further includes step 201.
[0078] Step 201: Adjust the data in the data window according to the current state of the pupil detection device.
[0079] Wherein, the data window is composed of part of the data in the first dataset.
[0080] The distance collected by the pupil detection device can be used to set the data window, and part of the data is used as the data in the data window. Taking Table 1 above as an example, assume that the default number of data in the data window is 20. Then when the pupil detection device collects the 20th distance, the data in the data window is the 1st distance to the 20th distance. When the pupil detection device collects the 21st distance, the data in the data window is the 2nd distance to the 21st distance.
[0081] In some embodiments, when the pupil detection device is in the observation state, the number in the data window is the first number. When the pupil detection device is in the non-observation state, the number in the data window is the second number, and the first number is less than the second number. For example, the first number is 15 and the second number is 25.
[0082] In some embodiments, when the current state of the pupil detection device is the observation state (including the start observation state and the ongoing observation state), the number of data in the data window can be adjusted to the first value. When the current state of the pupil detection device is the end observation state, the number of data in the data window can be adjusted to the second value. When the current state of the pupil detection device is the active state, the number of data in the data window can be adjusted to the third value. When the current state of the pupil detection device is the standby state, the number of data in the data window can be adjusted to the fourth value. Exemplarily, the first value is 10, the second value is 20, the third value is 20, and the fourth value is 25. Another example is that the first value is 10, the second value is 25, the third value is 30, and the fourth value is 40.
[0083] Taking Table 1 above as an example, assume that the first value is 10, the second value is 20, the third value is 20, the fourth value is 25, and the starting default value is 25. When the pupil detection device collects the 1st to 25th distances, there are 25 data in the data window, and the current state of the pupil detection device is the standby state. When the pupil detection device collects the 26th to 50th distances, the current state of the pupil detection device is still the standby state, and there are 25 data in the data window. When the pupil detection device collects the 27th to 51st distances, the current state of the pupil detection device is the active state, and the number of data in the data window is adjusted to 20. When the pupil detection device collects the 81st to 100th distances, the current state of the pupil detection device is the start observation state, and the data in the data window is adjusted to 10. When the pupil detection device collects the 101st to 120th distances, the current state of the pupil detection device is the observing state, and there are 10 data in the data window. When the pupil detection device collects the 121st to 130th distances, the current state of the pupil detection device is the end observation state, and the data in the data window is adjusted to 20. When the pupil detection device collects the 131st to 150th distances, the current state of the pupil detection device is the active state, and the window data corresponding to the active state is also 20, and the number of data in the data window remains unchanged. When the pupil detection device collects the 151st to 175th distances, the current state of the pupil detection device is the standby state, and the data in the data window is adjusted to 25.
[0084] Thus, according to the current state of the pupil detection device, the data in the data window is adjusted. It can make the pupil detection device more accurate when confirming the next state through the window data. When it is necessary to frequently determine the state of the pupil detection device, a smaller number of data is used. When it is not necessary to frequently determine the state of the pupil detection device, a larger number of data is used. When the time consumed by the pupil detection device for each distance acquisition remains unchanged, collecting more distances requires a longer time, thereby reducing the operations of the pupil detection device for judging the state. In addition, with more distance data in the data window, the influence of individual abnormal data on the state result judgment can be reduced, improving the accuracy of state judgment.
[0085] In some embodiments, step 102 above may be implemented as step 202.
[0086] Step 202, the pupil detection device determines the current state of the pupil detection device according to the distance corresponding to the pupil detection device and the previous state of the pupil detection device.
[0087] Wherein, the distance corresponding to the pupil detection device is determined based on the data in the data window.
[0088] The data window includes partial data sequentially obtained from the first dataset based on the previous state of the pupil detection device.
[0089] In some embodiments, the distance corresponding to the pupil detection device includes: a first value and a second value. The first value is used to represent the overall level of the data in the data window, and the second value is used to represent the stability of the data in the data window.
[0090] In some examples, the first value is the average value, median value, or mode of the data window. Taking the first value as the average value of the data window as an example. Referring to Table 1, assuming the data in the data window is the 1st distance to the 20th distance collected by the pupil detection device, the average value corresponding to the pupil detection device is 410.
[0091] In some examples, the second value is the variance, standard deviation, range, interquartile range, coefficient of variation, mean absolute deviation, kurtosis, or skewness of the data window. Taking the second value as the standard deviation of the data window as an example. Referring to Table 1, assuming the data in the data window is the 1st distance to the 20th distance collected by the pupil detection device, the standard deviation of the distance corresponding to the pupil detection device is 0.
[0092] In some other embodiments, the distance corresponding to the pupil detection device is the last distance in the data window. Referring to Table 1, assuming the data in the data window is the 1st distance to the 20th distance collected by the pupil detection device, the distance corresponding to the pupil detection device is 410.
[0093] Exemplarily, assume that the state of the pupil detection device is the initial state, and the initial state is the standby state. If the average value is greater than 400 and the standard deviation is greater than 2, the state changes. Referring to Table 1, the data in the data window collected by the pupil detection device is the 1st data to the 25th data, the average value of the data in the data window is 410, and the standard deviation is 0. Since the standard deviation of the pupil detection device is less than 2, it does not meet the condition for state change, and it is determined that the state of the pupil detection device remains the standby state.
[0094] In some embodiments, when the first value is greater than the first threshold and less than the second threshold, and the second value is not greater than the third threshold, the pupil detection device determines that the current state of the pupil detection device is the observation state.
[0095] Exemplarily, the first value is the average value of the data in the window, the second value is the standard deviation of the data in the window, the first threshold is 40 mm, the second threshold is 70 mm, and the third threshold is 5. Taking Table 1 as an example, assume that the pupil detection device judges the 81st to 100th distances collected, and the obtained average value is 51 mm and the standard deviation is 0.7746. The pupil detection device can determine that the current state is the observation state.
[0096] In some embodiments, if the first value is greater than the first threshold and less than the second threshold, the second value is not greater than the third threshold, and the previous state of the pupil detection device is the observing state or the starting to observe state, then the pupil detection device determines that the current state of the pupil detection device is the observing state.
[0097] In some embodiments, if the first value is greater than the first threshold and less than the second threshold, the second value is not greater than the third threshold, and the previous state of the pupil detection device is not the observing state, then the pupil detection device determines that the current state of the pupil detection device is the starting to observe state.
[0098] Exemplarily, still taking the first value as the average value, the second value as the standard deviation, and the first to third thresholds as 40, 75, and 5 respectively. Referring to Table 1, assuming that the pupil detection device judges the distances from the 101st to the 110th collected, and the previous state of the pupil detection device is the active state; the average value can be obtained as 51 and the standard deviation as 0.7746, satisfying that the average value is greater than 40 and less than 70, and the standard deviation is less than 5. Since the previous state of the pupil detection device is not the observing state, the current state of the pupil detection device is the starting to observe state. Then, when the pupil detection device judges the distances from the 111th to the 120th collected, the average value can still be obtained as 51 and the standard deviation as 0.7746, satisfying that the average value is greater than 40 and less than 70, and the standard deviation is less than 5. Since the previous state of the pupil detection device becomes the starting to observe state, the current state of the pupil detection device is the observing state.
[0099] Referring to Formula 1, Formula 1 shows the judgment logic of the observing state and the starting to observe state in some embodiments of the present application. Among them, represents the current state, represents the previous state, represents the first threshold, represents the second threshold, represents the first value, the second value, represents the third threshold, represents the starting to observe state, represents the observing state.
[0100]
[0101] The above method for determining the starting to observe state and the observing state sets the starting to observe state as a transition state before the pupil detection device enters the observing state. This makes the judgment of the observing state by the pupil detection device more accurate and reduces misjudgment. Thus, it reduces the image shooting caused by misjudgment and the resource occupation caused by image shooting. It is particularly applicable to the pupil detection device in the embodiments of the present application with limited storage resources.
[0102] In some examples, the first threshold is 10 millimeters and the second threshold is 40 millimeters. In the scenario where a doctor examines the pupil, the distance between the pupil pen and the pupil is about 10 to 40 millimeters. Thus, in this example, the first threshold and the second threshold are set according to the application scenario of the pupil detection device, making the set thresholds more suitable for the actual application.
[0103] In some examples, the first threshold and the second threshold are determined according to the distance between the pupil detection device and the light source of the pupil pen and a preset threshold. The preset threshold can be a threshold determined according to the user's usage habit. For example, the preset threshold for the first threshold is 10 millimeters, and the preset threshold for the second threshold is 40 millimeters. For example, if the light source of the pupil pen is 30 millimeters in front of the measurement sensor of the pupil detection device in the measurement direction, then the first threshold is 30 millimeters plus the preset threshold of 10 millimeters for the first threshold, which is equal to 40 millimeters. The second threshold is 30 millimeters plus the preset threshold of 40 millimeters for the second threshold, which is equal to 70 millimeters. Thus, the first threshold is obtained as 40 millimeters, and the second threshold is 70 millimeters. In this example, the first threshold and the second threshold can be set according to the distance between the pupil detection device and the light source of the pupil pen and the habit of the user using the pupil detection device, making the judgment of the current state of the pupil detection device more accurate and more conducive to the pupil detection device to perform the preset operation. For example, the preset operation is to collect an image in the observation state.
[0104] In some embodiments, when the second value is not less than (or greater than or equal to) the third threshold and the previous state of the pupil detection device is not the observation state, the pupil detection device determines that the current state of the pupil detection device is the active state.
[0105] Exemplarily, still taking the second value as the standard deviation and the third threshold as 5. Referring to Table 1, assuming that the pupil detection device judges the distances from the 131st to the 150th collected, and the previous state of the pupil detection device is the end measurement state. The standard deviation can be obtained as 57.76, which satisfies that the standard deviation is greater than 5. Since the previous state of the pupil detection device is not the observation state, the current state of the pupil detection device is the active state.
[0106] In some embodiments, when the first value is not greater than (or less than or equal to) the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the pupil detection device is the non-observation state, the pupil detection device determines that the current state of the pupil detection device is the standby state.
[0107] Exemplarily, still taking the first value as the average value, the second value as the standard deviation, and the first to third thresholds as 40, 75, and 5 respectively. Referring to Table 1, assuming that the pupil detection device judges the 161st to 180th distances collected, and the previous state of the pupil detection device is the standby state. The average value can be obtained as 410 and the standard deviation as 0.7746; it satisfies that the average value is greater than 70 and the standard deviation is less than 5. The previous state of the pupil detection device is the standby state, which belongs to the non-observation state, so the current state of the pupil detection device is the standby state.
[0108] In some embodiments, when the second value is not less than the third threshold and the previous state of the pupil detection device is the observing state, the pupil detection device determines that the current state of the pupil detection device is the active state or the end-observation state.
[0109] In some embodiments, when the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the pupil detection device is the observation state, the pupil detection device determines that the current state of the pupil detection device is the end-observation state or the standby state.
[0110] In some examples, the pupil detection device determines the current state of the pupil detection device according to the non-observation state counter. The non-observation state counter is used to indicate the cumulative number of times that the state before the current state is the non-observation state.
[0111] In some examples, when the second value is not less than the third threshold, the pupil detection device increments the non-observation state counter by 1. If the previous state of the pupil detection device is the observing state and the non-observation state counter is not less than the fourth threshold, the pupil detection device determines that the current state of the pupil detection device is the end-observation state.
[0112] In some examples, when the second value is not less than the third threshold, the pupil detection device increments the non-observation state counter by 1. If the previous state of the pupil detection device is the observing state and the non-observation state counter is less than the fourth threshold, the pupil detection device determines that the current state of the pupil detection device is the active state.
[0113] In some examples, when the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, the pupil detection device increments the non-observation state counter by 1. If the previous state of the pupil detection device is the observing state or the ready-to-observe state and the non-observation state counter is not less than the fourth threshold, the pupil detection device determines that the current state of the pupil detection device is the end-observation state.
[0114] In some examples, the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the pupil detection device increments the non-observation state counter by 1. If the previous state of the pupil detection device is the observing state or the ready-to-observe state, and the non-observation state counter is less than the fourth threshold, the pupil detection device determines that the current state of the pupil detection device is the standby state.
[0115] In some examples, the initial value of the non-observation state counter is 0. If the non-observation state counter is equal to the fourth threshold, the non-observation state counter is cleared to zero. By setting the initial value to 0 and setting the non-observation state counter to be cleared after reaching the fourth threshold, the value of the non-observation state counter is restricted, so that the state of the pupil detection device can be determined according to the non-observation state counter. Furthermore, further processing is performed according to the state of the pupil detection device.
[0116] Referring to Formula 2, Formula 2 shows the judgment logic of the active state and the end-observation state in some embodiments of the present application. Among them, represents the current state, represents the previous state, the second value, represents the third threshold, represents the value of the non-observation state counter, represents the fourth threshold, represents the active state, represents the observing state.
[0117] Formula 2
[0118] Referring to Formula 3, Formula 3 shows the judgment logic of the standby state and the end-observation state in some embodiments of the present application. Among them, represents the current state, represents the previous state, represents the first threshold, represents the second threshold, represents the first value, the second value, represents the third threshold, represents the value of the non-observation state counter, represents the fourth threshold, represents the end-observation state, represents the standby state.
[0119] Formula 3
[0120] Through the above solution, in the embodiments of the present application, the state of the pupil detection device is judged according to the order of possible states that may occur during actual operation of the pupil detection device and the collected distance. Thus, in subsequent steps, the number of data in the window collected by the pupil detection device is adjusted according to the judged state, increasing the accuracy of state judgment. Thus, corresponding processing is performed according to the current state of the pupil detection device.
[0121] The above embodiments illustrate how the pupil detection device determines the current state according to the collected distance and performs image acquisition processing of turning on or off according to the current state. The following embodiments provide methods related to image acquisition processing. This method includes step 401.
[0122] Step 401, if the first value is not less than the first threshold and not greater than the second threshold, the pupil detection device obtains the first focal length corresponding to the first value.
[0123] Exemplarily, the pupil detection device may pre-store the first focal length corresponding to the first value. For example, the first value is the average value of the data in the data window. Among them, the range of the focal length corresponding to the first value stored in the pupil detection device may be that the first value is not less than the first threshold and not less than the second threshold. Referring to Table 2, Table 2 shows the corresponding relationship between some first values and the first focal length when the first value is the average value of the data in the data window.
[0124] Table 2 Corresponding relationship between the first value and the first focal length
[0125]
[0126] It can be understood that the corresponding relationship between the first value and the first focal length may be stored in the form of a table, may also be stored in the form of a formula, or may be stored in other forms.
[0127] The first focal length corresponding to the first value pre-stored in the pupil detection device may be stored in the storage space of the pupil detection device, or may be stored in a storage space outside the pupil detection device. In the case where the first focal length corresponding to the first value is stored in a storage space outside the pupil detection device, the pupil detection device may be communicatively connected to this storage space, so as to obtain the first focal length corresponding to the stored first value.
[0128] In some embodiments, step 401 is located before step 103. The turning on of image acquisition in step 103 may be implemented as step 402.
[0129] Step 402, the pupil detection device acquires an image through the first focal length.
[0130] When the pupil detection device starts image acquisition, it can use the first focal length corresponding to the first value obtained as the focal length for image acquisition. Thus, during image acquisition, different first focal lengths can be obtained according to the different distances between the pupil detection device and the target to be acquired. This makes it easier to acquire clear images and is more conducive to subsequent analysis of the acquired images. The above embodiments exemplarily illustrate the process of determining the state based on the distance detected by the pupil detection device and performing image acquisition according to the state. Taking the acquisition of images in the form of a video as an example, the present application also provides the following embodiments. The following embodiments can process the video acquired by the pupil detection device, locate the pupil through the iris, and obtain the region of interest. Thus, the pupil detection device can identify the region of interest in the video and identify the scaling speed of the pupil. The method of the embodiments of the present application includes step 501 and step 502.
[0131] Step 501, the pupil detection device reads the pupil image.
[0132] In some examples, the pupil detection device can read the images acquired in the above embodiments. For example, it reads the video file created through step 1100. The video file is processed frame by frame, the frame images are stored in a variable multi-dimensional array, and frame counting is performed on each frame image. For example, the first frame image is counted as 1, the next frame image after the first frame image is counted as 2, and so on. The following takes the processing of frame images as an example for illustration.
[0133] In some examples, the pupil detection device regards all the images acquired through the above embodiments as pupil images and performs frame counting on these images.
[0134] In some other examples, the pupil detection device processes the images acquired through the above embodiments, regards the images with pupils in the images as pupil images, and performs frame counting on these filtered pupil images.
[0135] In some other examples, the data acquired by the pupil detection device is stored in image format, and the pupil detection device can directly read the stored images.
[0136] Step 502, the pupil detection device determines the region of interest of the pupil image.
[0137] In some examples, the pupil detection device intercepts the region of interest of the frame image and regards the region near the pupil as the region of interest. Exemplarily, taking the iris as the target, it is used as the region near the pupil. Since the pupil is within the range of the iris and the area of the pupil is small, using the iris to distinguish the region of interest can not only retain the key pupil image but also greatly reduce the size of the frame image. By intercepting the region of interest, the computing resources consumed in subsequent processing of the frame image can be reduced.
[0138] The method for intercepting the region of interest is introduced below. This method includes Step 601 - Step 605.
[0139] In Step 601, the pupil detection device performs frame skipping processing on the pupil image to obtain a first image.
[0140] Among them, the first image is the frame image after frame skipping processing.
[0141] The pupil detection device reads the frame count of the current frame image. If the remainder of the current frame count divided by the frame skipping number is 0, then this image is the first image. Subsequently, continue to process this image. The frame skipping number can be a preset number, such as values of 2, 3, 4, etc. Through frame skipping processing, the number of frame images processed by the pupil detection device can be reduced, and the calculation consumption can be reduced.
[0142] In Step 602, the pupil detection device performs edge detection on the first image to filter the eyelash features in the first image and obtain the first image after processing the eyelashes. Step 602 includes Step 6021 and Step 6022.
[0143] In Step 6021, the pupil detection device calculates the gradient of the first image to obtain the gradient magnitude of the image.
[0144] The pupil detection device can calculate the horizontal gradient component and the vertical gradient component of the first image. Refer to Formula 4.
[0145] Formula 4
[0146] Among them, I represents the first image, represents the horizontal gradient component of the first image, represents the vertical gradient component of the first image, x represents the horizontal gradient component, and y represents the vertical gradient component.
[0147] In some examples, the pupil detection device copies a first image and calculates the horizontal gradient component and the vertical gradient component through the copied first image.
[0148] The pupil detection device calculates the gradient magnitude of the first image. Refer to Formula 5.
[0149] Formula 5
[0150] Among them, represents the gradient magnitude of the first image, represents the horizontal gradient component of the first image, represents the vertical gradient component of the first image.
[0151] In Step 6022, the pupil detection device obtains a second image according to the gradient magnitude of the first image.
[0152] Among them, the second image is the first image after removing the eyelashes.
[0153] The pupil detection device filters the vertical morphological structures appearing in the first image through a direction-sensitive convolution kernel. Thus, the upper and lower eyelashes are filtered to reduce the interference with the recognition of the pupil image.
[0154] Among them, the direction-sensitive convolution kernel K refers to Formula 6.
[0155] Formula 6
[0156] The pupil detection device performs convolution processing on each pixel point of the first image with reference to Formula 7.
[0157] Formula 7
[0158] Among them, each pixel point of the first image is represented by a horizontal component x and a vertical component y. represents the pixel point of the first image with a horizontal component of x and a vertical component of y - 1. represents the function of the convolution processing process.
[0159] The formula for convolving all pixel points in a first image can be simplified to Formula 8.
[0160]
[0161] The pupil detection device normalizes the first image after gradient magnitude processing, with a range of 0 to 255. The normalization formula is shown in Formula 9. Through normalization, the influence of the gradient operation on the image is eliminated.
[0162] Formula 9
[0163] See Figure 6 a to Figure 6 c. Figure 6 a is a schematic diagram of the unprocessed first image of the embodiment of the present application. Figure 6 b is a schematic diagram of the first image of the embodiment of the present application after gradient magnitude processing. Figure 6 c is a schematic diagram of the second image of the embodiment of the present application.
[0164] It can be understood that the unprocessed first image can be the image collected by the image acquisition device in the above steps, or the image collected by the image acquisition device after being processed, such as cropping, color adjustment, etc.
[0165] Step 603: The pupil detection device filters the pixels in the iris edge region of the second image to obtain an iris edge image. Step 603 includes Step 6031 and Step 6032.
[0166] Among them, the iris edge image refers to an image that extracts the edge of the iris. For example, a linear edge image composed of white discrete points on the pupil edge.
[0167] Step 6031: The pupil detection device sets a mask for the second image to obtain a second image filtered by the mask.
[0168] The pupil detection device sets a mask initialized to all white and having the same size as the second image, that is, the value of the mask is 1.
[0169] The pupil detection device performs binarization processing on the second image to obtain the binarized second image. Referring to Formula 10, the binarized second image is subjected to a bitwise AND operation with the second image to generate a second image filtered by the mask. Among them, the binarized second image is a mask image composed of 0 or 1, and the second image is a grayscale image of 0 - 255. By performing a bitwise AND operation on the binarized second image and the second image, the pixels with a gray value of 1 in the second image are deducted, so that in subsequent processing, the second image filtered by the mask is strengthened. The second image filtered by the mask is shown in Figure 7 Figure a.
[0170] Formula 10
[0171] Among them, represents the second image filtered by the mask, represents the binarized second image, represents the second image.
[0172] Step 6032: The pupil detection device performs HSV color space range filtering on the second image filtered by the mask.
[0173] Among them, the image HSV represents hue H, saturation S, and brightness V. The second image filtered by the mask is converted from a BGR - format image to an HSV image and is subjected to range filtering through the iris edge color range to obtain a pupil mask , and the range of the pupil mask is the image within the edge of the iris. The expression of the pupil mask is shown by Formula 11. Among them, the iris edge color range is between the fifth threshold and the sixth threshold. L represents the fifth threshold, , U represents the sixth threshold, .
[0174] Formula 11
[0175] Referring to Formula 12, the pupil mask is subjected to a bitwise AND operation with the second image filtered by the mask to obtain an iris edge image.
[0176] Formula 12
[0177] Among them, represents the iris edge image, represents the image after the second image filtered by the mask is converted into the HSV color space, represents the pupil mask. See Figure 7 b and Figure 7 c, Figure 7 b is the image after the second image filtered by the mask is converted into the HSV color space, Figure 7 c is the iris edge image.
[0178] Step 604, the pupil detection device calculates a focus mask based on the iris edge image to obtain a focus area image.
[0179] The pupil detection device can perform mask processing on the iris edge image to obtain a focus area image. Exemplarily, the pupil detection device obtains the width W and height H of the iris edge image, sets the focus size ratio, and calculates to obtain the border width w and border height h. For example, if the focus size ratio is set to 80%, then 10% is intercepted from each of the upper and lower directions of the iris edge image, and 10% is intercepted from each of the left and right directions. The pupil detection device converts the iris edge image into a grayscale image to obtain the grayscale-converted iris edge image. The pupil detection device sets a first mask with an initial pixel value of 255 and performs a bitwise AND operation on the grayscale-converted iris edge image using the first mask to mask the area outside the border of the grayscale-converted iris edge image and retain the area inside the border of the grayscale-converted iris edge image. This area can be called the focus area. The expression of the first mask is shown in Formula 13. Among them, represents the first mask, b represents the border width, H represents the height of the iris edge image, and W represents the width of the iris edge image.
[0180] Formula 13
[0181] Referring to Formula 14, Formula 14 is that the pupil detection device performs a bitwise AND operation on the grayscale-converted iris edge image using the first mask to obtain a focus area image. Refer to Figure 8 a, Figure 8 a is a schematic diagram of the focus area image.
[0182] Formula 14
[0183] Among them, Represents the focal area image, Represents the first mask, Represents the iris edge image after grayscale conversion.
[0184] The images collected in the above steps may contain redundant image regions. For example, regions outside the iris. Considering that when medical staff use a pupil pen to detect a patient's pupil, they will align the pupil pen with the pupil, the image brightness near the pupil will be higher. The iris edge image can be further filtered to intercept the redundant regions and filter out the regions outside the border of the grayscale-converted iris edge image, reducing the noise and computational amount of the finally extracted region of interest. During the subsequent analysis of the image, computing power can be saved. Exemplarily, the 10% region on the right side of the image is the region outside the iris, and this region can be intercepted.
[0185] In some embodiments, after step 604, step 6041 may further be included.
[0186] Step 6041, the pupil detection device performs image enhancement on the focal area image.
[0187] Referring to Formula 15, the pupil detection device can perform image enhancement on the grayscale-converted iris edge image through Formula 15 to obtain the enhanced image.
[0188] Wherein, represents the image before and after enhancement, α is the contrast coefficient, and β is the brightness adjustment amount.
[0189] Formula 15
[0190] In some embodiments, the values of α and β are between 0 and 255.
[0191] In some embodiments, α = 50 and β = 50.
[0192] Step 605, the pupil detection device determines the region of interest according to the enhanced image.
[0193] Step 605 includes step 6051 and step 6052.
[0194] Step 6051, the pupil detection device performs an erosion operation on the enhanced image to obtain the eroded image.
[0195] Referring to Formula 16, the pupil detection device uses a 3×3 or 3×1 structuring element to erode the enhanced image to obtain the eroded image.
[0196] Formula 16
[0197] Wherein, represents the pixel value of the corroded image at the position , represents the structuring element, which defines the neighborhood of the erosion operation, represents an offset in the structuring element, represents the pixel value of the enhanced image at the position .
[0198] By selecting a 3×3 or 3×1 structuring element, the corroded image has a better effect. The overall image becomes clearer, and the vertical line features are also clearer.
[0199] By performing an erosion operation on the enhanced image, small noise points are eliminated, making the enhanced image more regular and reducing the boundary of the enhanced image.
[0200] Step 6052, the pupil detection device binarizes the corroded image to obtain a binary image.
[0201] Referring to Formula 17, the pupil detection device binarizes the corroded image to obtain a binary image. Among them, the pixel value of the corroded image is set to 255, and the pixel values of the remaining areas are 0. The remaining areas are filtered by the seventh threshold. The value of the seventh threshold can be determined according to experience. For example, after trying different values as the seventh threshold multiple times, the value corresponding to the binary image with the best effect can be determined as the seventh threshold. Refer to Figure 8 b, Figure 8 b is a schematic diagram of the binary image.
[0202] Formula 17
[0203] Among them, represents the binary image, represents the corroded image, represents the seventh threshold.
[0204] Step 6053, the pupil detection device determines the minimum bounding box of the binary image.
[0205] Among them, the minimum bounding box of the binary image is the region of interest of the pupil image.
[0206] The pupil detection device can update the first variable the second variable by traversing non-zero points row by row. By traversing non-zero points column by column, the third variable and the fourth variable are updated. After traversing the binary image, the region enclosed by the first variable to the fourth variable can be obtained, and this region is the region of interest.
[0207] Traversing non-zero points line by line can refer to traversing the binary image from top to bottom or from bottom to top, checking whether there are non-zero points. If there is a non-zero point, return the position of that point, use the position with the smallest coordinate in the y direction as the first variable, and use the position with the largest coordinate in the y direction as the first variable. Traversing non-zero points column by column can refer to traversing the binary image from left to right or from right to left, checking whether there are non-zero points. If there is a non-zero point, return the position of that point, use the position with the smallest coordinate in the x direction as the third variable, and use the position with the largest coordinate in the x direction as the fourth variable. Exemplarily, the first variable to the fourth variable can be determined by formulas 18 to 21. The region of interest is represented by formula 22. Refer to Figure 8 c, Figure 8 The range within the c frame is the region of interest.
[0208] Formula 18
[0209] Formula 19
[0210] Formula 20
[0211] Formula 21
[0212] Formula 22
[0213] Among them, represents the first variable, represents the second variable, represents the third variable, represents the fourth variable, and ROI represents the region of interest.
[0214] Through the above method, the pupil detection device can identify the region of interest in the collected video. Among them, the region of interest includes the pupil. Thus, in subsequent operations, the pupil detection device can better analyze the pupil through the region of interest, such as analyzing the change speed of the pupil, etc., to assist the doctor in the analysis.
[0215] In some embodiments, the pupil detection device may be provided with a first button, and the doctor can press the first button.
[0216] Refer to Figure 9 , Figure 9 is a schematic flowchart of collecting and analyzing images in some embodiments of this application. In some embodiments, the above method further includes step 901 and step 902.
[0217] Step 901, when the pupil detection device recognizes that the first button is pressed, start video recording.
[0218] In step 902, when the pupil detection device recognizes that the first button is pressed again, video analysis is enabled.
[0219] In some examples, the pupil detection device may further include a light source and a second button. The pupil detection device can activate the light source by recognizing that the second button is pressed.
[0220] In some examples, the pupil detection device may include a light source but not a second button. The pupil detection device can distinguish whether the operation is to activate the light source, start video recording, or enable video analysis by recognizing the duration of the first button being pressed. For example, if the doctor long - presses the first button, video recording is started or video analysis is performed; if the first button is short - pressed, the light source is activated.
[0221] In some other embodiments, when the pupil detection device recognizes that the first button is pressed, video analysis is enabled.
[0222] In some other embodiments, when the pupil detection device recognizes that the first button is pressed, it determines whether to start video recording. If video recording has already been started, video recording is paused and video analysis is enabled. If video recording has not been started, video recording is started.
[0223] The above describes the processing method based on distance measurement in the embodiments of the present application. The following introduces the distance measurement device that executes the above - mentioned processing method based on distance measurement.
[0224] Refer to Figure 10 , such as Figure 10 shown in another schematic structural diagram of a distance measurement device, which can perform distance measurement, determine the state of the distance measurement device based on the measured distance, and turn on or off image acquisition according to the state of the distance measurement device. The distance measurement device in the embodiments of the present application can implement the steps corresponding to the distance measurement method executed in the corresponding embodiments in the above Figure 2 . The functions implemented by the distance measurement device can be realized by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware. The distance measurement device may include an input - output module 601 and a processing module 602. The functional implementation of the processing module 602 and the input - output module 601 can refer to the operations executed in the corresponding embodiments in Figure 2 , which will not be elaborated here. For example, the processing module 602 can be used to control operations such as transceiver and acquisition of the input - output module 601.
[0225] The input - output module 601 is configured to obtain a first data set; wherein, the data in the first data set is the distance collected by the distance measurement device.
[0226] The processing module 602 is configured to determine the current state of the distance measurement device according to the first data set and the previous state of the distance measurement device; and turn on or off image acquisition according to the current state of the distance measurement device. The state of the distance measurement device includes an observation state and a non-observation state. The observation state is a state in which image acquisition is performed, and the non-observation state is a state in which image acquisition is not performed.
[0227] In some embodiments, determining the current state of the distance measurement device according to the first data set and the previous state of the distance measurement device includes: determining the current state of the distance measurement device according to the distance corresponding to the distance measurement device and the previous state of the distance measurement device; the distance corresponding to the distance measurement device is determined based on the data in the data window; the data window includes partial data sequentially obtained from the first data set based on the previous state of the distance measurement device.
[0228] In some embodiments, the distance corresponding to the distance measurement device includes: a first value and a second value. The first value is used to represent the overall level of the data in the data window, and the second value is used to represent the stability of the data in the data window. Determining the current state of the distance measurement device according to the distance corresponding to the distance measurement device and the previous state of the distance measurement device includes: if the first value is greater than a first threshold and less than a second threshold, the second value is not greater than a third threshold, and the previous state of the distance measurement device is an observing state or a starting to observe state, then determining that the current state of the distance measurement device is an observing state; if the first value is greater than the first threshold and less than the second threshold, the second value is not greater than the third threshold, and the previous state of the distance measurement device is not an observing state, determining that the current state of the distance measurement device is a starting to observe state; if the second value is not less than the third threshold and the previous state of the distance measurement device is not an observing state, determining that the current state of the distance measurement device is an active state; if the second value is not less than the third threshold and the previous state of the distance measurement device is an observing state, determining that the current state of the distance measurement device is an active state or an ending observation state; if the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the distance measurement device is a non-observing state, determining that the current state of the distance measurement device is a standby state; if the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the distance measurement device is an observing state, determining that the current state of the distance measurement device is an ending observation state or a standby state. The observing state includes a starting to observe state and an observing state, and the non-observing state includes an active state, an ending observation state, and a standby state.
[0229] The first value is the average value, median value or mode of the data window; the second value is the variance, standard deviation, range, interquartile range, coefficient of variation, mean absolute deviation, kurtosis or skewness of the data window.
[0230] Turn on or off image acquisition according to the current state of the distance measurement device, including: if the current state of the distance measurement device is the start observation state, turn on image acquisition; if the current state of the distance measurement device is the end observation state, turn off image acquisition.
[0231] In some embodiments, the current state of the distance measurement device is determined according to the distance corresponding to the distance measurement device and the previous state of the distance measurement device, and further includes: if the second value is not less than the third threshold, the non-observation state counter is incremented by 1; if the previous state of the distance measurement device is the observing state and the non-observation state counter is not less than the fourth threshold, it is determined that the current state of the distance measurement device is the end observation state; if the previous state of the distance measurement device is the observing state and the non-observation state counter is less than the fourth threshold, it is determined that the current state of the distance measurement device is the active state; if the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, the non-observation state counter is incremented by 1; if the previous state of the distance measurement device is the observing state or the ready-to-observe state and the non-observation state counter is not less than the fourth threshold, the current state of the distance measurement device is the end observation state; if the previous state of the distance measurement device is the observing state or the ready-to-observe state and the non-observation state counter is less than the fourth threshold, it is determined that the current state of the distance measurement device is the standby state; the non-observation state counter is used to indicate the cumulative number of times that the state before the current state is the non-observation state.
[0232] In some embodiments, when the distance measurement device is in the observation state, the data in the data window is the first quantity; when the distance measurement device is in the non-observation state, the data in the data window is the second quantity, and the first quantity is less than the second quantity.
[0233] In some embodiments, before turning on image acquisition, the method further includes: if the first value is not less than the first threshold and not greater than the second threshold, obtain the first focal length corresponding to the first value; turning on image acquisition includes acquiring an image through the first focal length.
[0234] In the embodiments of the present application, the processing module 602 determines the state of the distance measurement device according to the measured distance, and turns on or off image acquisition according to the state of the distance measurement device. Thus, image acquisition is standardly turned on, which is beneficial to subsequent analysis of the acquired images.
[0235] In some embodiments, the distance measurement device can also analyze the acquired image to obtain the region of interest. For example, referring to the above steps 501 and 502, the distance measurement device reads the pupil image and determines the region of interest of the pupil image. Thus, the distance measurement device can identify the region of interest in the pupil image with less computing resources, reducing waste of resources.
[0236] The distance measurement device 60 in the embodiments of the present application has been described above from the perspective of modular functional entities. Next, the distance measurement device in the embodiments of the present application will be described from the perspective of hardware processing.
[0237] It should be noted that Figure 10 The physical devices corresponding to the input / output module 601 shown may be transceivers, radio frequency circuits, communication modules, input / output (I / O) interfaces, etc., and the physical device corresponding to the processing module 602 may be a processor.
[0238] Figure 10 The devices shown may all have a structure as Figure 11 shown. When Figure 10 the distance measurement device 60 shown has a structure as Figure 11 shown, Figure 11 the processor and transceiver in it can implement the same or similar functions as the processing module 602 and the input / output module 601 provided in the corresponding device embodiment of the device. Figure 11 The memory in it stores the computer program that the processor needs to call when executing the above-mentioned processing method based on the measured distance.
[0239] The embodiments of the present application also relate to a chip system, which includes at least one processor and an interface circuit. The processor includes a plurality of vector storage units. The processor is used to execute the interaction of instructions and / or data through the interface circuit, so that the chip system executes the method in any of the above embodiments.
[0240] In a possible implementation, the chip system may also directly include a memory, and a computer program or computer instructions are stored in the memory.
[0241] Exemplarily, the memory can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).
[0242] An embodiment of the present application further relates to a processor, which includes a plurality of storage units for calling a computer program or computer instructions stored in the memory, so that the processor executes the method described in any of the above embodiments.
[0243] Exemplarily, in an embodiment of the present application, the processor is an integrated circuit chip with the ability to process signals. For example, the processor can be an FPGA, a general-purpose processor, a DSP, an ASIC, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, an SoC, a CPU, a network processor (NP), a microcontroller unit (MCU), a PLD, or other integrated chips, which can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. In a possible implementation manner, an embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores program code. When the program code runs on the computer, the computer is caused to execute the above method embodiments.
[0244] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For parts not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0245] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0246] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.
[0247] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0248] In addition, in each embodiment of the embodiments of the present application, the various functional modules can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0249] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0250] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0251] The technical solutions provided in the embodiments of the present application have been introduced in detail above. Specific examples are used in the embodiments of the present application to illustrate the principles and implementation manners of the embodiments of the present application. The descriptions of the above embodiments are only used to help understand the method and its core idea of the embodiments of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the embodiments of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation on the embodiments of the present application.
Claims
1. A processing method based on measured distance, characterized in that Applied to a distance measurement device having an image acquisition function, the method includes: Obtain a first data set, where the data in the first data set is the distance collected by the distance measurement device; Determine the current state of the distance measurement device according to the first data set and the previous state of the distance measurement device; Turn on or turn off image acquisition according to the current state of the distance measurement device; The states of the distance measurement device include an observation state and a non-observation state. The observation state is the state of performing image acquisition, and the non-observation state is the state of not performing image acquisition; The determining the current state of the distance measurement device according to the first data set and the previous state of the distance measurement device includes: Determine the current state of the distance measurement device according to the distance corresponding to the distance measurement device and the previous state of the distance measurement device; The distance corresponding to the distance measurement device is determined based on the data in a data window; the data window includes a part of the data sequentially obtained from the first data set based on the previous state of the distance measurement device; The distance corresponding to the distance measurement device includes: a first value and a second value. The first value is used to represent the overall level of the data in the data window, and the second value is used to represent the stability of the data in the data window; The determining the current state of the distance measurement device according to the distance corresponding to the distance measurement device and the previous state of the distance measurement device includes: If the first value is greater than a first threshold and less than a second threshold, the second value is not greater than a third threshold, and the previous state of the distance measurement device is the observing state or the starting to observe state, then determine that the current state of the distance measurement device is the observing state; If the first value is greater than a first threshold and less than a second threshold, the second value is not greater than a third threshold, and the previous state of the distance measurement device is not the observing state, then determine that the current state of the distance measurement device is the starting to observe state; If the second value is not less than the third threshold and the previous state of the distance measurement device is not the observing state, then determine that the current state of the distance measurement device is the active state; If the second value is not less than the third threshold and the previous state of the distance measurement device is the observing state, then determine that the current state of the distance measurement device is the active state or the ending of the observing state; If the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the distance measurement device is the non-observing state, then determine that the current state of the distance measurement device is the standby state; If the first value is not greater than the first threshold or not less than the second threshold, and the second value is not greater than the third threshold, and the previous state of the distance measurement device is the observing state, then determine that the current state of the distance measurement device is the ending of the observing state or the standby state; The observing state includes the starting to observe state and the observing state, and the non-observing state includes the active state, the ending of the observing state, and the standby state.
2. The method according to claim 1, characterized in that, The first value is the mean, median, or mode of the data window; the second value is the variance, standard deviation, range, interquartile range, coefficient of variation, mean absolute deviation, kurtosis, or skewness of the data window; the turning on or off of image acquisition according to the current state of the distance measuring device includes: if the current state of the distance measuring device is the start observation state, then turn on image acquisition; if the current state of the distance measuring device is the end observation state, then turn off image acquisition.
3. The method according to claim 1 or 2, characterized in that, The determining of the current state of the distance measuring device according to the distance corresponding to the distance measuring device and the previous state of the distance measuring device further includes: If the second value is not less than a third threshold, then increment the non-observation state counter by 1. If the previous state of the distance measuring device is the observation state and the non-observation state counter is not less than a fourth threshold, then determine that the current state of the distance measuring device is the end observation state; if the previous state of the distance measuring device is the observation state and the non-observation state counter is less than the fourth threshold, determine that the current state of the distance measuring device is the active state; If the first value is not greater than a first threshold or not less than a second threshold, and the second value is not greater than the third threshold, then increment the non-observation state counter by 1; if the previous state of the distance measuring device is the observation state or the ready-to-observe state and the non-observation state counter is not less than the fourth threshold, then the current state of the distance measuring device is the end observation state; if the previous state of the distance measuring device is the observation state or the ready-to-observe state and the non-observation state counter is less than the fourth threshold, then determine that the current state of the distance measuring device is the standby state; The non-observation state counter is used to indicate the cumulative number of times that the state before the current state is the non-observation state.
4. The method according to claim 1 or 2, characterized in that, When the distance measuring device is in the observation state, the data in the data window is a first quantity; when the distance measuring device is in the non-observation state, the data in the data window is a second quantity, and the first quantity is less than the second quantity.
5. The method according to claim 1, wherein Before turning on image acquisition, the method further includes: If the first value is not less than the first threshold and not greater than the second threshold, then obtain the first focal length corresponding to the first value; Turning on image acquisition includes acquiring an image through the first focal length.
6. A distance measuring device, characterized in that, Includes: A housing, a distance measuring component, an image acquisition device, and a processor. The distance measuring component and the image acquisition device are both mechanically connected to the housing, and the distance measuring component and the image acquisition device are both communicatively connected to the processor; the processor is configured to execute the method according to any one of claims 1-5 above.
7. A computing device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and executable on the processor. Wherein, the processor executes the computer program to implement the method according to any one of claims 1-5.
8. A computer program product comprising computer instructions, characterized in that, When the computer instruction is executed by the processor, it implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Intelligent household electrical appliance control method and device, electronic equipment and storage medium
CN113759732A