Infrared signal processing method, controller, electronic device and storage medium
Patent Information
- Application Number
- CN202611156539.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-30
AI Technical Summary
然而,红外传感器当前接收到的红外信号容易受到环境光等因素的干扰,影响仿生宠物对目标对应的遮挡事件的监测精度
[0017]在本申请的第四方面,还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机设备执行第一方面所述的方法。
Smart Images

Figure CN123016667A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of infrared signal processing technology, and in particular to an infrared signal processing method, controller, electronic device and storage medium. Background Technology
[0002] As urbanization progresses and people's work pace accelerates, there is a growing need for bionic pets to help them relax. Bionic pets are machines that can mimic and possess the characteristics of real pets. They closely resemble real pets in appearance and are easier to care for. Bionic pets can engage in simple communication and interaction with people, providing companionship in place of real pets, and are thus gaining increasing popularity.
[0003] In existing technologies, bionic pets can sense a user's hand and torso movements at close range using infrared sensors. Typically, bionic pets sample the analog electrical signal from the infrared signal currently received by the sensor and compare the resulting sample value with a fixed threshold to determine the presence of a target within the sensing range. However, the infrared signal currently received by the sensor is easily interfered with by factors such as ambient light, affecting the bionic pet's accuracy in detecting occlusion events corresponding to targets. Summary of the Invention
[0004] This application provides an infrared signal processing method, controller, electronic device, and storage medium that can obtain the latest reference value at the first sampling time based on the N samples collected at the first sampling time. Monitoring occlusion events based on this reference value is beneficial to improving the monitoring accuracy of occlusion events.
[0005] To address the aforementioned technical problems, the embodiments of this application provide the following technical solutions: In a first aspect of this application, an infrared signal processing method is provided, wherein an infrared light signal emitted by an infrared emitting unit is an infrared emitted signal, and an infrared light signal received by an infrared receiving unit is an infrared received signal, wherein the infrared received signal includes a reflected signal of the infrared emitted signal, and the infrared receiving unit converts the infrared received signal into an analog electrical signal; the method includes: acquiring a sampled value collected at a first sampling time, and acquiring sampled values collected at each of the N-1 sampling times that are before the first sampling time and closest to the first sampling time, to obtain N sampled values corresponding to the first sampling time, wherein the sampled values are the sampled values of the analog electrical signal, and N is a positive integer not less than 2; determining a reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time; acquiring sampled values collected at a second sampling time, wherein the second sampling time is after the first sampling time; and monitoring an occlusion event of the infrared emitted signal based on the reference value corresponding to the first sampling time and the sampled values collected at the second sampling time.
[0006] In the embodiments of this application, the controller can acquire the sampled value collected at the first sampling time, and acquire the sampled values collected at each of the N-1 sampling times that are closest to the first sampling time and are before the first sampling time, to obtain the N sampled values corresponding to the first sampling time; that is, the N sampled values corresponding to the first sampling time are the N latest samples acquired at the first sampling time; therefore, the controller determines the reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time, and can obtain the latest reference value at the first sampling time; this reference value can be dynamically updated with changes in ambient light. Compared with monitoring infrared emission signal occlusion events based on a fixed threshold and sampled values collected at the second sampling time, the embodiments of this application that monitor infrared emission signal occlusion events based on a reference value and sampled values collected at the second sampling time have higher environmental adaptability and anti-infrared light interference performance, which is beneficial to improving the monitoring accuracy of infrared emission signal occlusion events.
[0007] In some embodiments, the occlusion event includes a first occlusion event; the monitoring of the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time includes: determining the reference value corresponding to the second sampling time based on N sampled values corresponding to the second sampling time; if the reference value corresponding to the second sampling time, and the reference values corresponding to each of the M sampling times before the second sampling time and closest to the second sampling time are all greater than a preset reference value threshold, then it is determined that a first occlusion event has been detected; wherein, M is a positive integer not less than 2, the M sampling times include the first sampling time, the reference value corresponding to any sampling time is calculated from the N sampled values corresponding to any sampling time, and the N sampled values corresponding to any sampling time include: the sampled value collected at any sampling time, and the sampled values collected at each of the N-1 sampling times before the any sampling time and closest to the any sampling time.
[0008] In some embodiments, the occlusion event includes a first occlusion event, and the method further includes: upon detecting the first occlusion event, reporting the first occlusion event to the application layer and entering a locked state; in the locked state, ceasing to report the first occlusion event to the application layer; acquiring the sampled value collected at a third sampling time, and determining a reference value corresponding to the third sampling time based on the N sampled values corresponding to the third sampling time; if the reference value corresponding to the third sampling time is not greater than a preset reference value threshold, and the reference values corresponding to each of the P consecutive sampling times closest to the third sampling time before the third sampling time are not greater than the preset reference value threshold, then releasing the locked state; wherein the application layer is capable of executing a preset interactive action in response to detecting the first occlusion event, the third sampling time is after the second sampling time, and P is a positive integer not less than 2.
[0009] In some embodiments, determining the reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time includes: calculating the average value of the N sampled values corresponding to the first sampling time to obtain the reference value corresponding to the first sampling time.
[0010] In some embodiments, the changing trend of the sampled values over time includes a stable trend, an upward trend, and a downward trend; the step of determining the benchmark value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time includes: if the changing trend of each of the N sampled values over time is a stable trend, then the benchmark value corresponding to the first sampling time is determined based on the N sampled values corresponding to the first sampling time.
[0011] In some embodiments, the occlusion event includes a second occlusion event; Q sampling times are further included between the second sampling time and the first sampling time, where Q is a positive integer not less than 1; the monitoring of the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampling value collected at the second sampling time further includes: if the sampling value collected at the first sampling time is not greater than the sampling value collected at the previous sampling time, the sampling values collected at each of the first sampling time, the Q sampling times, and the second sampling time increase sequentially forward with the sampling time, and the first sampling time, the Q sampling times, and the second sampling time... If the increment between any two adjacent sampling times is greater than a preset target increment threshold, then the trend of the sampled value change at the second sampling time is determined to be upward. If the trend of the sampled value change is upward, the sampled value at the fourth sampling time is obtained, which is after the second sampling time. If the sampled value corresponding to the fourth sampling time, and each sampled value in the S consecutive sampling times closest to the fourth sampling time before the fourth sampling time, decreases sequentially forward with the sampling time, then the trend of the sampled value change is determined to be downward from the fourth sampling time, and a second occlusion event is identified. Wherein, S is a positive integer not less than 1.
[0012] In some embodiments, before monitoring the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time, the method further includes: if the sampled value corresponding to each of the first sampling time, the Q sampling times, and the second sampling time is less than a preset sampled value threshold, then the preset initial increment threshold is increased to obtain a preset target increment threshold.
[0013] In some embodiments, the method further includes: if the change trend of the sampled value is a downward trend, and if the absolute difference between the sampled value collected at each of the K sampling times before the fifth sampling time and the benchmark value corresponding to the first sampling time is not greater than a preset absolute difference threshold, then it is determined that the change trend of the sampled value at the fifth sampling time has entered a stable state, where K is a positive integer not less than 1.
[0014] In some embodiments, when the trend of the sampled value is upward, the duration of the upward trend is recorded; if the duration is greater than a preset duration threshold, the trend of the sampled value is forcibly set to a downward trend.
[0015] In a second aspect of this application, a controller is also provided, the controller comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0016] In a third aspect of this application, an electronic device is also provided, the electronic device including the controller described in the second aspect.
[0017] In a fourth aspect of this application, a computer-readable storage medium is also provided, the computer-readable storage medium storing computer-executable instructions for causing a computer device to perform the method described in the first aspect.
[0018] It should be understood that the description in the Summary of the Invention section is not intended to limit the key or essential features of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0020] Figure 1 This is a schematic diagram of the hardware structure of an electronic device for performing a signal processing method for an infrared sensor, provided in some embodiments of this application; Figure 2 This is a schematic flowchart of an infrared signal processing method provided in some embodiments of this application; Figure 3 This is a schematic diagram of the hardware structure of a controller for performing an infrared signal processing method according to some embodiments of this application. Detailed Implementation
[0021] The principles and spirit of this disclosure will be described below with reference to several exemplary embodiments illustrated in the accompanying drawings. It should be understood that these specific embodiments are described merely to enable those skilled in the art to better understand and implement this disclosure, and are not intended to limit the scope of this disclosure in any way. In the following description and claims, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art.
[0022] As used herein, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "an embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects and are used only to distinguish the objects referred to, without implying a particular spatial order, temporal order, order of importance, etc., of the objects referred to.
[0023] For example, Figure 1 Schematic diagrams of an electronic device for performing a signal processing method for an infrared sensor, according to some embodiments of this application, are provided. For example... Figure 1 As shown, the electronic device 100 includes a controller 10, an analog-to-digital converter 20, and an infrared sensor 30; wherein the controller 10 is communicatively connected to the analog-to-digital converter 20, and the analog-to-digital converter 20 is communicatively connected to the infrared sensor 30. The analog-to-digital converter 20 can be integrated inside the controller 10, or it can be connected to the controller 10 as a separate device.
[0024] Specifically, the infrared sensor 30 includes an infrared emitting unit (infrared emitting tube) 31 and an infrared receiving unit (infrared receiving tube) 32; wherein, the infrared emitting unit 31 can be connected to the controller, and the infrared receiving unit 32 is connected to the analog-to-digital converter 20. The infrared emitting unit 31 is used to emit infrared signals. The infrared signal emitted by the infrared emitting unit 31 is defined as an infrared emitted signal, and the infrared signal received by the infrared receiving unit is defined as an infrared received signal. The infrared receiving unit 32 is used to receive the emitted signal formed after the infrared emitted signal is reflected by an obstacle, and converts the light intensity of the infrared received signal into an analog electrical signal. This analog electrical signal is a continuous voltage signal. The controller 10 can control the analog-to-digital converter 20 to acquire the continuous voltage form of the analog electrical signal output by the infrared sensor 30, and control the analog-to-digital converter 20 to periodically sample the analog electrical signal to obtain the sampled values of the analog electrical signal at multiple discrete sampling times.
[0025] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device 100. The electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or have different component arrangements.
[0026] In the embodiments of this application, the electronic device can specifically be a bionic pet, or it can be any suitable electronic device with close-range human-computer interaction needs, such as a smart doll, a desktop companion robot, a sensor lamp, a sensor trash can, an in-vehicle interactive ornament, or an interactive exhibit in an exhibition hall. Here, close range usually refers to within 1 meter, for example: 5cm to 50cm.
[0027] The following explanation uses an electronic device as an example of a bionic pet. The bionic pet can use infrared sensors to sense the user's hand and torso movements at close range, recognize user interactions such as approaching, moving away, and waving (occlusion events), and execute corresponding preset interactive actions based on the user's interactions, such as initiating head shaking, sound emission, and light effects.
[0028] However, the detection accuracy of infrared sensors is easily affected by the following factors: (1) Ambient light: Ambient light such as sunlight and lamps contains infrared light signals, and infrared light signals in ambient light can also be received by the infrared receiving unit; (2) Device discreteness: Different infrared emitting units and different infrared receiving units have different field parameters. For the same second infrared light signal, the light intensity of the second infrared light signal detected by different infrared emitting units is different; (3) Transmission power variation: During the use of infrared sensors, due to the influence of factors such as device aging or temperature changes, the power of the first infrared light signal emitted by the infrared emitting unit will gradually change; (4) Power supply fluctuation: For example, the voltage and / or current of the power supply of the infrared emitting unit fluctuate; (5) Abnormal receiving end: For example, the infrared receiving unit is affected by factors such as dust blocking.
[0029] Furthermore, in existing technologies, the controller samples the analog electrical signal output by the infrared sensor through an analog-to-digital converter. After obtaining the current sample value, it typically compares the current sample value with a pre-set fixed threshold to determine whether a target (such as a user) exists within the sensing range. This method cannot reliably identify the rise, peak, and fall processes of the analog electrical signal, and it is also difficult to distinguish whether the interaction event corresponding to the target is a short-term approach event or a continuous occlusion event.
[0030] In view of this, embodiments of this application provide an infrared signal processing method, controller, electronic device, and storage medium, which can determine a reference value based on the latest multiple sampled values corresponding to a first sampling time. This reference value can dynamically change with changes in ambient light and the characteristics of the infrared sensor, which is beneficial to improving the perception accuracy of the bionic pet in response to user interaction behavior. To facilitate the reader's understanding of this application, specific embodiments are described below.
[0031] For example, Figure 2 Flowcharts of signal processing methods for infrared sensors provided in some embodiments of this application are shown. These methods are applied to electronic devices, such as… Figure 1 Electronic devices 100. For example... Figure 2 As shown, the method includes the following steps: Step S21: The controller acquires the sampled value collected at the first sampling time, and acquires the sampled value collected at each of the N-1 sampling times that are closest to the first sampling time and are before the first sampling time, to obtain N sampled values corresponding to the first sampling time, where the sampled value is the sampled value of the analog electrical signal, and N is a positive integer not less than 2.
[0032] In the embodiments of this application, the controller can transmit an infrared signal through an infrared transmitting unit and receive an infrared receiving signal through an infrared receiving unit. After the infrared receiving unit converts the infrared receiving signal into an analog electrical signal, the controller acquires the analog electrical signal and controls the analog-to-digital converter to periodically process the analog electrical signal to obtain the sampled value of the analog electrical signal corresponding to each sampling time, and one sampled value corresponds to one sampling time.
[0033] In some embodiments, to reduce the cache occupied by storing sampled values, the cache is used to store only N sampled values. After the controller obtains a sampled value collected at any sampling time, it updates the N sampled values stored in the cache based on the sampled value collected at that sampling time. Thus, the cache is used only to store the N sampled values corresponding to that sampling time. The N sampled values corresponding to that sampling time include the sampled value collected at that sampling time, and the sampled values collected at each of the N-1 sampling times preceding and closest to that sampling time.
[0034] In some embodiments, N can be any suitable value such as 9, 10 or 11, and those skilled in the art can set the actual value of N according to actual needs.
[0035] Step S22: The controller determines the reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time.
[0036] In some embodiments, step S22 specifically includes: the controller calculating the average of N sampled values corresponding to the first sampling time to obtain a reference value corresponding to the first sampling time. In this embodiment, using the average of N sampled values as a reference value helps to suppress high-frequency random noise, smooth signal fluctuations, and reduce computational load.
[0037] In some embodiments, step S22 specifically includes: the controller performs median filtering on the N sampled values corresponding to the first sampling time to obtain a reference value corresponding to the first sampling time. In this embodiment, obtaining the reference value by performing median filtering on the N sampled values can effectively eliminate impulse noise (i.e., isolated outliers) caused by sudden changes in ambient light or electromagnetic interference. Compared with the method of calculating the average of the N sampled values to obtain the reference value, the median filtering method can better preserve the true trend of signal change while removing impulse noise, and avoid the reference value being skewed by a single abnormal sampled value.
[0038] In other embodiments, step S22 specifically includes: the controller calculating the exponential moving average of the N sampled values corresponding to the first sampling time to obtain the reference value corresponding to the first sampling time. In this embodiment, by adjusting the smoothing coefficient, the smoothness of the reference value and the response speed to changes in the current signal can be flexibly balanced to adapt to application scenarios with different dynamic characteristics.
[0039] In some embodiments, step S22 specifically includes: the controller adaptively filters the N sampled values corresponding to the first sampling time to obtain a reference value corresponding to the first sampling time. In this embodiment, the reference value is obtained by adaptively filtering the N sampled values. The filtering coefficients can be dynamically adjusted according to the statistical characteristics of the sampled values (such as noise variance and signal rate of change), so that the reference value has good smoothness when the signal is stable, has fast tracking capability when the signal changes abruptly, and takes into account both noise interference resistance and response sensitivity.
[0040] In some embodiments, the changing trend of the sampled values over time includes a stable trend, an upward trend, and a downward trend; step S22 specifically includes: if the changing trend of each of the N sampled values over time is a stable trend, then a baseline value corresponding to the first sampling time is determined based on the N sampled values corresponding to the first sampling time. The first sampling time can be any sampling time where the changing trend is in a stable state; for example, the first sampling time can be the current sampling time where the changing trend is in a stable state.
[0041] Step S23: The controller acquires the sampled value collected at the second sampling time, which is after the first sampling time.
[0042] In some embodiments, the second sampling time is after the first sampling time, and the first sampling time and the second sampling time are two adjacent sampling times.
[0043] Step S24: The controller monitors the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time.
[0044] In embodiments of this application, the occlusion event includes a first occlusion event and / or a second occlusion event; wherein the occlusion time of the infrared emission signal by the first occlusion event is greater than the occlusion time of the infrared emission signal by the second occlusion event.
[0045] Specifically, in some embodiments, the occlusion event includes a first occlusion time, and step S24 specifically includes: the controller determines a reference value corresponding to the second sampling time based on N sampled values corresponding to the second sampling time; if the reference value corresponding to the second sampling time, and the reference values corresponding to each of the M sampling times before the second sampling time and closest to the second sampling time are all greater than a preset reference value threshold, then the controller determines that a first occlusion event has been detected; wherein, M is a positive integer not less than 2, the M sampling times include the first sampling time, the reference value corresponding to any sampling time is calculated from the N sampled values corresponding to any sampling time, and the N sampled values corresponding to any sampling time include: the sampled value collected at any sampling time, and the sampled values collected at each of the N-1 sampling times before any sampling time and closest to any sampling time.
[0046] Specifically, in some embodiments, the occlusion event includes a first occlusion time. After step S24, the method further includes: when the controller detects the first occlusion event, the controller reports the detection of the first occlusion event to the application layer and enters a locked state; in the locked state, the controller stops reporting the detection of the first occlusion event to the application layer; the controller obtains the sampled value collected at the third sampling time, and determines the reference value corresponding to the third sampling time based on the N sampled values corresponding to the third sampling time; if the reference value corresponding to the third sampling time is not greater than a preset reference value threshold, and the reference values corresponding to each of the P consecutive sampling times before the third sampling time and closest to the third sampling time are not greater than the preset reference value threshold, then the controller releases the locked state; wherein, the application layer can respond to the detection of the first occlusion event by executing a preset interactive action, the third sampling time is after the second sampling time, and P is a positive integer not less than 2. In this embodiment, the application layer is only triggered to execute an interactive action once during the duration of the first occlusion event. The first occlusion event may specifically be that the user continuously stays in the direction in which the infrared emitting unit emits an infrared signal. The preset interactive actions can be at least one of the following: body movement actions, vocal actions, and light feedback actions; for example, the bionic pet's head shaking, tail wagging, limb swaying, playing sound effects, lighting up / gradually changing lights, etc.
[0047] In some embodiments, the occlusion event includes a second occlusion event; there are also Q sampling times between the second sampling time and the first sampling time, where Q is a positive integer not less than 1; step S24 specifically includes: if the sampled value collected at the first sampling time is not greater than the sampled value collected at the previous sampling time, the sampled values collected at each sampling time in the first sampling time, the Q sampling times, and the second sampling time increase sequentially forward with the sampling time, and the increment between the sampled values collected at every two adjacent sampling times in the first sampling time, the Q sampling times, and the second sampling time is greater than a preset target increment threshold, then it is determined that the change trend of the sampled value at the second sampling time has entered an upward trend; if the change trend of the sampled value is an upward trend, the sampled value collected at the fourth sampling time is obtained, the fourth sampling time being after the second sampling time; if the sampled value corresponding to the fourth sampling time, and the sampled values in the S consecutive sampling times closest to the fourth sampling time before the fourth sampling time decrease sequentially forward with the sampling time, then it is determined that the change trend of the sampled value has entered a downward trend from the fourth sampling time, and the second occlusion event is identified; where S is a positive integer not less than 1.
[0048] In other embodiments, the controller may also identify the second occlusion event (e.g., a rapid wave event or other instantaneous occlusion event) using at least one of the following methods: (i) Pulse width recognition method: The controller takes the total time from the rising trend of the sampled value to the falling trend and then back to the stable trend as the pulse width. When the pulse width is less than a preset pulse width threshold, the controller determines that the second occlusion event has been identified; (ii) Derivative recognition method: The controller calculates the first derivative of the sampled value with respect to the sampling time. When the absolute value of the first derivative is greater than a preset derivative threshold, the controller determines that the second occlusion event has been identified. This derivative threshold is used to distinguish between slowly changing signals and abruptly changing signals; (iii) Rate of change identification method: The controller takes the change of the sampled value in a unit time as the rate of change. When the rate of change is greater than the preset rate of change threshold, it is determined that the second occlusion event is identified; (iv) Frequency domain identification method: The controller performs Fourier transform or wavelet transform on the sampled value to extract the spectral features of the sampled value. When the energy proportion of the high frequency component in the spectrum is greater than the preset proportion threshold, it is determined that the second occlusion event is identified; (v) Model identification method: The controller inputs several sampled values into a pre-trained classification model. The classification model is trained based on the historical sampled value sequence labeled with the second occlusion event. The classification model outputs the classification result of whether the fluctuation of the sampled value is the second occlusion event.
[0049] In some embodiments, before step S24, the method further includes: if the sampled values corresponding to each of the first sampling time, the Q sampling times, and the second sampling time are all less than a preset sampling value threshold, then the preset initial increment threshold is increased to obtain a preset target increment threshold. If the sampled values corresponding to each of the first sampling time, the Q sampling times, and the second sampling time are not less than the preset sampling value threshold, then the preset target increment threshold is determined to be the preset initial increment threshold. In this embodiment, when the infrared receiving unit experiences abnormal conditions such as disconnection, poor contact, or abnormal signal fluctuations, the sampled values collected at the initial sampling time (e.g., the first sampling time, the Q sampling times, and the second sampling time) are lower than the preset sampling value threshold. By increasing the preset initial increment threshold, the controller prevents small voltage fluctuations from meeting the increment conditions for entering an upward trend, which helps reduce misjudgments caused by abnormal infrared receiving units and improves the accuracy of occlusion event monitoring and the robustness of the system.
[0050] In some embodiments, the above method further includes: when the trend of the sampled value is downward, if the absolute difference between the sampled value collected at each of the K sampling times before the fifth sampling time and the reference value corresponding to the first sampling time is not greater than a preset absolute difference threshold, then the controller determines that the trend of the sampled value at the fifth sampling time has entered a stable state, where K is a positive integer not less than 1.
[0051] In some embodiments, the method further includes: when the trend of the sampled value is upward, the controller records the duration of the upward trend; if the duration is greater than a preset duration threshold, the controller forcibly sets the trend of the sampled value to a downward trend.
[0052] In the embodiments of this application, when the sampled value shows a downward trend, the absolute difference between the current sampled value and the stored stable benchmark value is calculated. If the difference is not greater than a preset absolute difference threshold multiple times consecutively, the trend of the sampled value is determined to have returned to a stable state. Simultaneously, if the duration of the downward trend exceeds a preset duration threshold, the trend is forcibly restored to a stable state. This forms a complete judgment process of "signal rise—reaching peak—signal fall—returning to benchmark value," enabling the identification of occlusion events to be based on a multi-dimensional comprehensive judgment rather than a single fixed threshold, thus improving the accuracy of occlusion event monitoring.
[0053] In the embodiments of this application, the actual value of at least one of the following parameters—N, M, P, Q, K, and the preset duration threshold, the specific value of the preset absolute difference threshold, the preset reference value threshold, the preset target increment threshold, the preset sample value threshold, and the preset initial increment threshold—can be determined based on the model of the infrared sensor, the installation location of the infrared sensor, the sampling period for sampling the analog electrical signal, the distance between the infrared emitting unit and the infrared receiving unit, the size of the electronic device, and / or the sensing distance of the infrared sensor.
[0054] For example, Figure 3 The document presents schematic diagrams of the hardware structure of the controller provided in some embodiments of this application. For example... Figure 3 As shown, the controller 700 includes: One or more processors 710 and memory 720, Figure 3 Take the 710 processor as an example.
[0055] The processor 710 and memory 720 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0056] The memory 720, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of this application. The processor 710 executes various functional applications and data processing of the electronic device by running the non-volatile software programs, instructions, and modules stored in the memory 720, that is, implementing the methods in the above-described method embodiments.
[0057] The memory 720 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 720 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 720 may optionally include memory remotely located relative to the processor 710. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0058] The one or more modules are stored in the memory 720. When executed by the one or more processors 710, they perform the methods in any of the above method embodiments, for example, the methods described above. Figure 2 The method steps S21-S24 are described in the text.
[0059] The above-described product can perform the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for performing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application.
[0060] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example... Figure 3 One of the processors 710 can cause the one or more processors to perform the methods in any of the above method embodiments, for example, to perform the methods described above. Figure 2 The method steps S21-S24 are described in the text.
[0061] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0062] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; under the concept of the present invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the present invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method of processing an infrared signal, characterized by, The infrared signal emitted by the infrared emitting unit is an infrared emitted signal, and the infrared signal received by the infrared receiving unit is an infrared received signal. The infrared received signal includes the reflected signal of the infrared emitted signal, and the infrared receiving unit converts the infrared received signal into an analog electrical signal. The method includes: The sampled value collected at the first sampling time is obtained, and the sampled value collected at each of the N-1 sampling times that are closest to the first sampling time and are before the first sampling time is obtained, so as to obtain N sampled values corresponding to the first sampling time, wherein the sampled value is the sampled value of the analog electrical signal, and N is a positive integer not less than 2; The reference value corresponding to the first sampling time is determined based on the N sampled values corresponding to the first sampling time. Obtain the sampled value collected at the second sampling time, which is after the first sampling time; The occlusion event of the infrared emission signal is monitored based on the reference value corresponding to the first sampling time and the sampling value collected at the second sampling time.
2. The method of claim 1, wherein, The occlusion event includes the first occlusion event; The monitoring of the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time includes: The reference value corresponding to the second sampling time is determined based on the N sampled values corresponding to the second sampling time. If the reference value corresponding to the second sampling time, and the reference value corresponding to each of the M sampling times that are closest to the second sampling time before the second sampling time are all greater than the preset reference value threshold, then it is determined that the first occlusion event has been detected. Where M is a positive integer not less than 2, the M sampling times include the first sampling time, the reference value corresponding to any sampling time is calculated from the N sampling values corresponding to any sampling time, and the N sampling values corresponding to any sampling time include: the sampling value collected at any sampling time, and the sampling values collected at each of the N-1 sampling times that are before any sampling time and closest to any sampling time.
3. The method of claim 1, wherein, The occlusion event includes a first occlusion event, and the method further includes: Upon detecting the first occlusion event, report the detection of the first occlusion event to the application layer and enter a locked state; In the locked state, reporting of the detected first occlusion event to the application layer is stopped; Obtain the sampled value collected at the third sampling time, and determine the reference value corresponding to the third sampling time based on the N sampled values corresponding to the third sampling time; If the reference value corresponding to the third sampling time is not greater than the preset reference value threshold, and the reference value corresponding to each of the P consecutive sampling times before the third sampling time and closest to the third sampling time is not greater than the preset reference value threshold, then the locking state is released. The application layer can respond to the detection of the first occlusion event by executing a preset interactive action, the third sampling time is after the second sampling time, and P is a positive integer not less than 2.
4. The method of claim 1, wherein, The step of determining the reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time includes: Calculate the average of the N sampled values corresponding to the first sampling time to obtain the baseline value corresponding to the first sampling time.
5. The method of claim 1, wherein, The changing trend of the sampled values over time includes a stable trend, an upward trend, and a downward trend; The step of determining the reference value corresponding to the first sampling time based on the N sampled values corresponding to the first sampling time includes: If the changes in each of the N sampled values over time are all in a stable state, then the reference value corresponding to the first sampling time is determined based on the N sampled values corresponding to the first sampling time.
6. The method according to any one of claims 1 to 5, characterized in that, The occlusion event includes a second occlusion event; Between the second sampling time and the first sampling time, there are also Q sampling times, where Q is a positive integer not less than 1; The method of monitoring the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time further includes: If the sampled value collected at the first sampling time is not greater than the sampled value collected at the previous sampling time, and the sampled values collected at each of the first sampling time, the Q sampling times, and the second sampling time increase sequentially forward with the sampling time, and the increment between any two adjacent sampling times in the first sampling time, the Q sampling times, and the second sampling time is greater than a preset target increment threshold, then it is determined that the change trend of the sampled value at the second sampling time has entered an upward trend. When the trend of the sampled value is upward, the sampled value collected at the fourth sampling time is obtained, and the fourth sampling time is after the second sampling time; If the sampled value corresponding to the fourth sampling time, and each sampled value in the S consecutive sampling times closest to the fourth sampling time before the fourth sampling time decreases sequentially forward with the sampling time, then it is determined that the change trend of the sampled value enters a downward trend from the fourth sampling time, and the second occlusion event is identified. Where S is a positive integer not less than 1.
7. The method of claim 6, wherein, Before monitoring the occlusion event of the infrared emission signal based on the reference value corresponding to the first sampling time and the sampled value collected at the second sampling time, the method further includes: If the sampled values corresponding to each of the first sampling time, the Q sampling times, and the second sampling time are all less than a preset sampling value threshold, then the preset initial increment threshold is increased to obtain the preset target increment threshold.
8. The method of claim 6, wherein, The method further includes: If the trend of the sampled value is downward, and the absolute difference between the sampled value collected at each of the five sampling times and the K sampling times before the fifth sampling time and the reference value corresponding to the first sampling time is not greater than the preset absolute difference threshold, then it is determined that the trend of the sampled value at the fifth sampling time has entered a stable state, where K is a positive integer not less than 1.
9. The method of claim 6, wherein, The method further includes: When the sampled values show an upward trend, record the duration of the upward trend. If the duration exceeds a preset duration threshold, the change trend of the sampled value will be forcibly set to a downward trend.
10. A controller characterized by comprising: The controller includes: At least one processor, and The memory communicatively connected to the at least one processor, wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-9.
11. An electronic device, comprising: The electronic device includes the controller as described in claim 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer device to perform the method according to any one of claims 1-9.
