A light sensor data processing method, device, terminal equipment and medium
By calculating the product of the target ratio of the light sensor and the shortest integral time, the light intensity data within the corresponding time length is obtained and processed, and the problem of the light sensor being difficult to react in the short integral mode and the poor anti-interference ability of the light sensor in the long integral mode is solved, and the light sensor data processing with high accuracy and high anti-interference ability is achieved.
Patent Information
- Application Number
- CN202210778551.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-06-30
AI Technical Summary
When collecting data, existing light sensors are difficult to react to detailed data in short integral mode. In long integral mode, the light sensitivity is high but the anti-interference ability is poor, making it difficult to achieve high accuracy and high anti-interference ability at the same time.
By obtaining the target ratio of the light sensor, determining the product of the target ratio and the target shortest integral time, obtaining the original light intensity data within the corresponding time length, and processing based on the preset deinterference algorithm to obtain the target light intensity data.
While acquiring detailed data in the short integral mode, it simulates the high light sensitivity and high interference resistance in the long integral mode, improving the accuracy of the light sensor data acquisition.
Smart Images

Figure CN115130062B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a light sensor data processing method, device, terminal equipment and medium. Background Art
[0002] Light sensors are widely used in mobile phones, tablets and other terminal devices. They are sensors used to detect the intensity of external light. The light intensity value obtained by the light sensor is mainly used to adjust the screen brightness so that the screen brightness matches the current ambient light. According to the length of time the light sensor detects the ambient light intensity, it can be divided into two modes: short integration and long integration. In short integration mode, more detailed data of ambient light information can be obtained. When the light sensor is used under the screen, the ambient light value when the screen is turned off briefly can be obtained, but the light sensitivity is low and easily disturbed; in long integration mode, the light sensitivity is high and not easily disturbed by the environment, but it cannot reflect the details of ambient light changes.
[0003] Therefore, how to make the data collected by the light sensor reflect the detailed data in the short integration mode and also achieve high light sensitivity and high anti-interference in the long integration mode has become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a light sensor data processing method, apparatus, terminal device and medium to solve the problem of low accuracy of data collected by light sensors in the prior art.
[0005] In a first aspect, some embodiments of the present application provide a light sensor data processing method, the method comprising:
[0006] Acquire a target ratio of the light sensor to be processed that is stored, wherein the target ratio is determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor;
[0007] determining a product of the target ratio and the target shortest integration time;
[0008] Acquire raw light intensity data collected by the light sensor within a time length corresponding to the product;
[0009] The raw light intensity data is processed based on a preset interference removal algorithm to obtain target light intensity data and output it.
[0010] In a second aspect, some embodiments of the present application further provide a light sensor data processing device, the device comprising:
[0011] An acquisition module, used for acquiring a target ratio of a light sensor to be processed, which is stored and determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor;
[0012] A determination module, used to determine the product of the target ratio and the target shortest integration time;
[0013] The processing module is used to obtain the original light intensity data collected by the light sensor within the time length corresponding to the product; process the original light intensity data based on a preset interference removal algorithm to obtain target light intensity data and output it.
[0014] In a third aspect, some embodiments of the present application further provide a terminal device, the terminal device comprising:
[0015] Display, processor and memory;
[0016] The display is used to display the screen display area;
[0017] The memory is used to store the processor executable instructions;
[0018] The processor is configured to execute the instructions to implement any of the above light sensor data processing methods.
[0019] In a fourth aspect, some embodiments of the present application further provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described light sensor data processing methods.
[0020] Some embodiments of the present application provide a light sensor data processing method, device, terminal device and medium, in which a target ratio of a light sensor to be processed is obtained, and the target ratio is determined according to the target shortest integration time of the light sensor and the target longest integration time of the light sensor; the product of the target ratio and the target shortest integration time is determined, and the original light intensity data collected by the light sensor within the time length corresponding to the product is obtained; the original light intensity data is processed based on a preset interference removal algorithm to obtain the target light intensity data and output. In some embodiments of the present application, the target ratio is determined according to the target shortest integration time and the target longest integration time, and the original light intensity data collected within the time length corresponding to the product is obtained according to the product of the target ratio and the target shortest integration time, and the original light intensity data is processed based on a preset interference removal algorithm to obtain the target light intensity data collected by the light sensor in the simulated long integration time. The target light intensity data collected by the light sensor in the simulated long integration time not only reflects the detail data in the short integration mode, but also removes interference, thereby achieving high light sensitivity and high anti-interference in the long integration mode, and improving the accuracy of the data collected by the light sensor. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of the structure of a terminal device 100 equipped with a light sensor is shown;
[0023] Figure 2 is a software structure block diagram of a terminal device 100 according to an embodiment of the present application;
[0024] Figure 3 A schematic diagram of a light sensor data processing process provided in some embodiments of the present application;
[0025] Figure 4 A schematic diagram of a process for determining a target shortest integration time provided in some embodiments of the present application;
[0026] Figure 5 A schematic diagram of a process for determining a target maximum integration time provided in some embodiments of the present application;
[0027] Figure 6 A schematic diagram of a light sensor data processing process provided in some embodiments of the present application;
[0028] Figure 7 A schematic diagram of a light sensor data processing process provided in some embodiments of the present application;
[0029] Figure 8 A schematic diagram of a time threshold determination process provided for some embodiments of the present application;
[0030] Fig. 9 A schematic diagram of light sensor data processing provided in some embodiments of the present application;
[0031] Fig.10 A schematic diagram of the structure of a light sensor data processing device provided in some embodiments of the present application;
[0032] Fig.11 Another structural schematic diagram of a terminal device provided for some embodiments of the present application. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiment is only a part of the embodiment of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of this application.
[0034] In order to improve the accuracy of data collected by a light sensor, some embodiments of the present application provide a light sensor data processing method, the method comprising: obtaining a target ratio of the light sensor to be processed, which is saved and determined based on a target shortest integration time of the light sensor and a target longest integration time of the light sensor; determining the product of the target ratio and the target shortest integration time, and obtaining raw light intensity data collected by the light sensor within a time length corresponding to the product; processing the raw light intensity data based on a preset de-interference algorithm, obtaining target light intensity data and outputting it.
[0035] Figure 1 FIG. 1 shows a schematic diagram of a terminal device 100 equipped with a light sensor. It should be understood that Figure 1 The terminal device 100 shown is only an example, and the terminal device 100 may have more Figure 1 The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0036] Figure 1 FIG. 1 is a block diagram showing a hardware configuration of a terminal device 100 according to an exemplary embodiment. Figure 1 As shown, the terminal device 100 includes: a radio frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a wireless fidelity (Wi-Fi) module 170, a processor 180, a Bluetooth module 181, and a power supply 190 and other components.
[0037] The RF circuit 110 can be used to receive and send signals during the process of sending and receiving information or making calls. It can receive downlink data from the base station and hand it over to the processor 180 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.
[0038] The memory 120 can be used to store software programs and data. The processor 180 executes various functions and data processing of the terminal device 100 by running the software programs or data stored in the memory 120. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The memory 120 stores an operating system that enables the terminal device 100 to run. In the present application, the memory 120 can store an operating system and various application programs, and can also store program codes for executing the light sensor data processing method of some embodiments of the present application.
[0039] The display unit 130 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 100. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal device 100, which may collect user touch operations thereon or near the touch screen, such as clicking a button.
[0040] The display unit 130 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device 100. Specifically, the display unit 130 may include a display screen 132 disposed on the front of the terminal device 100. The display screen 132 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 130 may be used to display the screen display area of the terminal device in the present application.
[0041] The touch screen 131 may be covered on the display screen 132, or the touch screen 131 and the display screen 132 may be integrated to realize the input and output functions of the terminal device 100, and the integrated touch screen may be referred to as a touch display screen. In the present application, the display unit 130 may display the application and the corresponding operation steps.
[0042] The camera 140 can be used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the processor 180 for conversion into a digital image signal.
[0043] The terminal device 100 may further include at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, and a temperature sensor 154. The terminal device 100 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.
[0044] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal device 100. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output. The terminal device 100 can also be configured with a volume button for adjusting the volume of the sound signal, and can also be used to combine other buttons to adjust the closed area. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then the audio data is output to the RF circuit 110 to be sent to, for example, another terminal device, or the audio data is output to the memory 120 for further processing.
[0045] Wi-Fi is a short-range wireless transmission technology. The terminal device 100 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170, which provides users with wireless broadband Internet access.
[0046] The processor 180 is the control center of the terminal device 100. It uses various interfaces and lines to connect various parts of the entire terminal device. It executes various functions of the terminal device 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 180. In the present application, the processor 180 can run the operating system, application programs, user interface display and touch response, as well as the light sensor data processing method of some embodiments of the present application. In addition, the processor 180 is coupled to the display unit 130.
[0047] The Bluetooth module 181 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device 100 can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 181 to exchange data.
[0048] The terminal device 100 also includes a power supply 190 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption. The terminal device 100 can also be configured with a power button for powering on and off the terminal device, as well as locking the screen and other functions.
[0049] Figure 2 It is a software structure block diagram of a terminal device 100 according to an embodiment of the present application.
[0050] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0051] The application layer can include a series of application packages.
[0052] like Figure 2 As shown, the application package may include phone, MMS, Wi-Fi, WeChat, information, alarm clock, gallery, calendar, WLAN and other applications.
[0053] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0054] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0055] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0056] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, short messages, etc.
[0057] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying images.
[0058] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including connection, disconnection, etc.).
[0059] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.
[0060] The notification manager enables applications to display notification information (such as the content of short messages) in the status bar. It can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0061] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0062] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0063] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0064] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0065] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0066] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0067] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0068] A 2D (animation mode) graphics engine is a drawing engine for 2D drawing.
[0069] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0070] The terminal device 100 in the embodiment of the present application may be an electronic device including but not limited to a smart phone, a tablet computer, a wearable electronic device (such as a smart watch), a laptop computer, and the like.
[0071] Figure 3 A schematic diagram of a light sensor data processing process provided in some embodiments of the present application, the process specifically includes the following steps:
[0072] S301: Obtaining a target ratio of a light sensor to be stored for data processing, wherein the target ratio is determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor.
[0073] The light sensor data processing process provided in the embodiment of the present application is applicable to a terminal device, which may be Figure 1 or Figure 2 The terminal device shown.
[0074] Since the light sensor can obtain more detailed data of ambient light information in the short integration mode, the long integration mode has high light sensitivity and is not easily affected by environmental interference, but cannot reflect the details of ambient light changes. Therefore, in order to make the data collected by the light sensor reflect both the detailed data in the short integration mode and the high light sensitivity and high anti-interference in the long integration mode, thereby improving the accuracy of the data collected by the light sensor, in some embodiments of the present application, the data collected by the light sensor within the target shortest integration time for detecting the ambient light intensity in the short integration mode can be used to simulate the effect of the data collected by the light sensor within the long integration time for detecting the ambient light intensity in the long integration mode.
[0075] In some embodiments of the present application, a target ratio of a light sensor to be processed that is stored may be obtained, and the target ratio is determined based on the target shortest integration time and the target longest integration time of the light sensor to be processed. The target shortest integration time and the target longest integration time may be pre-configured by a user of the terminal device, the target shortest integration time may be the minimum value corresponding to the nominal integration time range of the light sensor, and the target longest integration time may be the maximum value corresponding to the nominal integration time range of the light sensor.
[0076] In some embodiments of the present application, a target ratio can be calculated based on the acquired target shortest integration time and target longest integration time and saved, so that the next time the light sensor is processed for data, the corresponding target ratio can be directly obtained without the need to recalculate the target ratio, thereby saving computing resources.
[0077] Specifically, in some embodiments of the present application, the purpose is to simulate the effect of long integration based on short integration. Therefore, the quotient of the target longest integration time and the target shortest integration time can be calculated, and the obtained quotient is the target ratio of the light sensor to be processed.
[0078] S302: Determine the product of the target ratio and the target shortest integration time; and obtain raw light intensity data collected by the light sensor within a time length corresponding to the product.
[0079] In some embodiments of the present application, the length of time to obtain the raw light intensity data collected by the light sensor can be determined based on the obtained target ratio to simulate the long integration effect.
[0080] In some embodiments of the present application, the product of the target ratio and the target shortest integration time may be determined, and the raw light intensity data collected by the light sensor within the time length corresponding to the product may be obtained.
[0081] S303: Processing the original light intensity data based on a preset interference removal algorithm to obtain target light intensity data and output it.
[0082] After the raw light intensity data is acquired, each acquired raw light intensity data may be processed based on a preset interference removal algorithm to obtain and output target light intensity data.
[0083] In some embodiments of the present application, some high-frequency interference and low-frequency interference in the original light intensity data can be removed by taking an average value, and the obtained average value can be output as the target light intensity data. In some embodiments of the present application, other interference removal algorithms can be used to remove interference items in the original light intensity data, so as to obtain and output the target light intensity data, wherein the interference removal algorithm can also be a low-pass filter, a high-pass filter, or a spectrum analysis algorithm.
[0084] In some embodiments of the present application, a target ratio is determined based on a target shortest integration time and a target longest integration time, and based on the product of the target ratio and the target shortest integration time, raw light intensity data collected within a time length corresponding to the product is obtained, and the raw light intensity data is processed based on a preset interference removal algorithm to obtain target light intensity data collected by the light sensor within a simulated long integration time. The target light intensity data collected by the light sensor within the simulated long integration time not only reflects the detail data in the short integration mode, but also removes interference, thereby achieving high light sensitivity and high anti-interference performance in the long integration mode, and improving the accuracy of the data collected by the light sensor.
[0085] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, based on the above embodiments, in some embodiments of the present application, the process of determining the target shortest integration time includes:
[0086] Obtaining the saved first shortest integration time of the light sensor;
[0087] Determining a first duration of a black screen state of the terminal device according to a pulse width modulation (PWM) mode of the terminal device on which the light sensor is installed;
[0088] If the first shortest integration time is greater than half of the first duration, the first shortest integration time is determined as the target shortest integration time; otherwise, half of the first duration is determined as the target shortest integration time.
[0089] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, in some embodiments of the present application, the target shortest integration time can also be determined by combining the shortest integration time supported by the light sensor hardware and the pulse width modulation (PWM) mode of the terminal device where the light sensor is installed.
[0090] In some embodiments of the present application, the first shortest integration time of the light sensor can be obtained and saved. The first shortest integration time can be configured in advance by the user of the terminal device according to the nominal integration time of the light sensor, that is, the shortest integration time supported by the light sensor hardware. And according to the PWM mode of the terminal device where the light sensor is installed, the first duration of the terminal device being in a black screen state is determined, wherein the first duration can be determined by calculating the frequency of the PWM mode of the terminal device, or the user of the terminal device can input and save the first duration in advance according to the various parameters of the terminal device where the light sensor is installed.
[0091] For the light sense under the screen, short integration is mainly used to obtain the ambient light value that is not affected by the screen. In some embodiments of the present application, the shortest integration time can be shorter than the first duration of the screen being in a black screen state when the organic light-emitting diode (OLED) screen is in PWM mode. In some embodiments of the present application, after determining the first shortest integration time and the first duration, it can be determined whether the first shortest integration time is greater than half of the first duration. If so, the first shortest integration time can be determined as the target shortest integration time; if not, half of the first duration can be determined as the target shortest integration time.
[0092] Specifically, assuming that the first shortest integration time obtained is 384μs, according to the PWM mode of the terminal device where the light sensor is installed, the first duration that the terminal device is in the black screen state is determined to be 694μs. Since 384>(694 / 2), that is, the first shortest integration time is greater than half of the first duration, the first shortest integration time 384μs can be determined as the target shortest integration time.
[0093] The process of determining the target shortest integration time provided by some embodiments of the present application is described below in conjunction with a specific embodiment. Figure 4 A schematic diagram of a process for determining a target shortest integration time provided in some embodiments of the present application, the process comprising:
[0094] S401: Obtain the first shortest integration time supported by the light sensor hardware.
[0095] S402: Determine a first duration that the terminal device is in a black screen state according to a PWM mode of the terminal device where the light sensor is installed, and determine half of the first duration as a second shortest integration time.
[0096] S403: Selecting the largest integration time from the first shortest integration time and the second shortest integration time as the target shortest integration time.
[0097] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, based on the above embodiments, in some embodiments of the present application, the process of determining the target maximum integration time includes:
[0098] Obtaining a saved first longest integration time of the light sensor;
[0099] From each pre-saved integration time, select a second time length that is greater than the first preset time length; determine the smallest integration time in the second time length as the second longest integration time;
[0100] If the first longest integration time is greater than the second longest integration time, the second longest integration time is determined as the target maximum integration time; otherwise, the first longest integration time is determined as the target maximum integration time.
[0101] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, in some embodiments of the present application, the longest integration time supported by the light sensor hardware and environmental influences may be comprehensively considered to determine the target longest integration time.
[0102] In some embodiments of the present application, the first maximum integration time of the light sensor can be obtained and saved. The first maximum integration time can be pre-configured by the user of the terminal device according to the nominal integration time of the light sensor, that is, the maximum integration time supported by the light sensor hardware.
[0103] Usually, the integration time of the sensor is configured according to a fixed time interval. In some embodiments of the present application, multiple integration times are pre-stored, and a second time length greater than the first preset time length can be selected from each pre-stored integration time. Among them, each pre-stored integration time can be 192, 384, 576, etc., and the specific setting of each stored integration time is not limited in some embodiments of the present application, and those skilled in the art can set it according to different parameters of different light sensors.
[0104] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, in some embodiments of the present application, in order to ensure that the raw light intensity data collected by the sensor can effectively avoid environmental influences, the corresponding duration can be pre-configured according to possible environmental problems. For example, the influence of the fixed signal period of the artificial light source can be avoided. The fixed signal period of the artificial light source is generally 16ms. In some embodiments of the present application, the user of the terminal device can pre-configure the first preset sub-duration to be 16ms. In order to avoid the influence of the fixed signal period of the artificial light source, the longest integration time can be greater than the signal period of 16ms. The calibration coefficient is an important parameter of the light sensor. In order to ensure that the light sensor can meet the shortest integration time required for different calibration coefficients, in some embodiments of the present application, the shortest integration time corresponding to different calibration coefficients is pre-saved. For example, when the calibration coefficient is 0.3, the corresponding shortest integration time is 32ms. The shortest integration time 32ms can be saved as the second preset sub-duration.
[0105] In order to ensure that the light sensor can effectively avoid environmental influences and meet the minimum integration time required for different calibration coefficients, in some embodiments of the present application, the maximum value can be selected from the saved first preset sub-time length and the second preset sub-time length as the first preset time length and saved. That is, if the first preset sub-time length is greater than the second preset sub-time length, the first preset sub-time length is determined as the first preset time length and saved; otherwise, the second preset sub-time length is determined as the first preset time length and saved.
[0106] After the first preset time length is determined, each second time length greater than the first preset time length can be selected from each pre-saved integration time, and the minimum integration time in each second time length can be determined as the second longest integration time.
[0107] After determining the first maximum integration time and the second maximum integration time, it can be determined whether the first maximum integration time is greater than the second maximum integration time. If so, the second integration time can be determined as the target maximum integration time; otherwise, the first maximum integration time is determined as the target maximum integration time.
[0108] Specifically, assuming that the first longest integration time is 384 μs and the second longest integration time is 326 μs, since 384>326, that is, the first shortest integration time is greater than the second longest integration time, the first shortest integration time 384 μs can be determined as the target longest integration time.
[0109] The following describes a process of determining the target maximum integration time provided by some embodiments of the present application in conjunction with a specific embodiment. Figure 5A schematic diagram of a process for determining a target maximum integration time provided in some embodiments of the present application, the process comprising:
[0110] S501: Obtain the first longest integration time supported by the light sensor hardware.
[0111] S502: Select the maximum value from each saved preset sub-time length as the first preset time length, and select each second time length greater than the first preset time length from each pre-saved integration time; determine the minimum integration time in each second time length as the second longest integration time.
[0112] S503: Selecting the shortest integration time from the first longest integration time and the second longest integration time as the target longest integration time.
[0113] In order to further improve the accuracy of the data collected by the light sensor in the simulated long integration time, on the basis of the above embodiments, in some embodiments of the present application, after obtaining the target ratio of the light sensor to be stored for data processing and before determining the product of the target ratio and the shortest integration time, the method further includes:
[0114] If the target ratio is not an integer, the target ratio is rounded up to obtain a first ratio, and the target ratio is updated using the first ratio.
[0115] In order to further improve the accuracy of the data collected by the light sensor in the simulated long integration time, after obtaining the target ratio of the light sensor to be processed, before determining the product of the target ratio and the shortest integration time, it can be determined whether the target ratio is an integer. If so, the target ratio can be rounded up to obtain a first ratio, and the target ratio can be updated using the first ratio, wherein the update can be understood as modifying the original saved target ratio. Thus, the determined target ratio satisfies the following relationship: target longest integration time < target ratio * target shortest integration time < (target ratio + 1) * target shortest integration time.
[0116] Specifically, for example, the target ratio of the light sensor to be processed is 3.43. Since the target ratio is not an integer, the target ratio 3.43 can be rounded up to obtain a first ratio 4, and the first ratio 4 is used to update the target ratio.
[0117] The following describes the sensor data processing process provided by some embodiments of the present application in conjunction with a specific embodiment. Figure 6 A schematic diagram of a light sensor data processing process provided in some embodiments of the present application, the process comprising the following steps:
[0118] S601: Obtain a target ratio of a light sensor to be stored for data processing.
[0119] S602: Determine whether the target ratio is an integer. If not, execute S603; if so, directly execute S604.
[0120] S603: Round up the target ratio to obtain a first ratio, and use the first ratio to update the target ratio.
[0121] S604: acquiring raw light intensity data collected by the light sensor within a time length corresponding to the product of the target ratio and the target shortest integration time, and processing the raw light intensity data based on a preset interference removal algorithm to obtain and output target light intensity data.
[0122] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, based on the above embodiments, in some embodiments of the present application, before obtaining the target ratio of the light sensor to be processed, the method further includes:
[0123] Determine whether the time interval between the current time and the last time the data collected by the light sensor is processed is greater than or equal to the saved time threshold; if so, perform a subsequent operation of obtaining the saved target ratio of the light sensor to be processed.
[0124] In order to further improve the accuracy of the data collected by the light sensor during the simulated long integration time, in some embodiments of the present application, the data collected by the light sensor may be processed according to a preset period.
[0125] Before obtaining the saved target ratio of the light sensor to be processed, the current time and the saved time of the last processing of the data collected by the light sensor can be obtained, and it is determined whether the time interval between the current time and the last processing of the data collected by the light sensor is greater than or equal to the saved time threshold. If so, the subsequent operation of obtaining the saved target ratio of the light sensor to be processed can be performed; if not, continue to wait, and the data processing should be stopped during the waiting period to avoid data simulation abnormalities.
[0126] Figure 7 A schematic diagram of the light sensor data processing process provided in some embodiments of the present application, such as Figure 7 As shown, the process includes the following steps:
[0127] S701: Acquire the current first time and the saved second time of the last processing of the data collected by the light sensor.
[0128] S702: Calculate the time interval between the first time and the second time.
[0129] S703: Determine whether the time interval is greater than or equal to the saved time threshold, if so, execute S704; if not, execute S701.
[0130] S704: Obtain a target ratio of the light sensor to be processed that is stored, obtain raw light intensity data based on the target ratio, and process the raw light intensity data based on a preset interference removal algorithm to obtain target light intensity data.
[0131] In the above embodiments, the process of obtaining raw light intensity data according to the target ratio and processing the raw light intensity data based on a preset interference removal algorithm to obtain target light intensity data has been described in detail and will not be repeated in some embodiments of the present application.
[0132] In some embodiments of the present application, the time threshold may be any time length. However, in order to improve the efficiency of light sensor data processing, based on the above embodiments, in some embodiments of the present application, the process of determining the time threshold includes:
[0133] Get the saved cycle threshold;
[0134] Determine whether the cycle threshold is greater than the time length corresponding to the product saved when the data collected by the light sensor was processed last time; if so, save the cycle threshold as the time threshold; otherwise, save the time length corresponding to the product saved when the data collected by the light sensor was processed last time as the time threshold.
[0135] In order to improve the efficiency of light sensor data processing, in some embodiments of the present application, a saved cycle threshold can be obtained, which can be pre-saved by the user of the terminal device, or sent by the terminal device where the light sensor to be processed is installed. After receiving the cycle threshold, the terminal device saves the cycle threshold. Specifically, the cycle threshold can be the reporting time required by the terminal device.
[0136] After obtaining the saved cycle threshold, it can be determined whether the cycle threshold is greater than the time length corresponding to the product saved when the data collected by the light sensor was processed last time; if so, the cycle threshold can be saved as the time threshold; otherwise, the time length corresponding to the product saved when the data collected by the light sensor was processed last time is saved as the time threshold. In other words, the cycle for processing the data collected by the light sensor can be greater than or equal to the product of the target ratio and the target shortest integration time, which can be expressed as data processing cycle ≥ target ratio * target shortest integration time. When the saved cycle threshold is greater than the target ratio * target shortest integration time, the data collected by the light sensor can be processed according to the cycle required by the saved cycle threshold.
[0137] The following describes a specific embodiment of the process for determining the time threshold provided in some embodiments of the present application. Figure 8 A schematic diagram of a time threshold determination process provided in some embodiments of the present application, the process includes the following steps:
[0138] S801: Receive and save the reporting cycle sent by the terminal device where the light sensor is installed.
[0139] S802: Obtain the product of the target ratio and the target shortest integration time saved when the data collected by the light sensor was processed last time.
[0140] S803: Determine whether the reporting period is greater than the time length corresponding to the product, if so, execute S804; if not, execute S805.
[0141] S804: Save the reporting period as a time threshold.
[0142] S805: Save the time length corresponding to the product as a time threshold.
[0143] The light sensor data processing provided by some embodiments of the present application is described in detail below in conjunction with another specific embodiment. Fig. 9 A schematic diagram of light sensor data processing provided in some embodiments of the present application, the process includes the following steps:
[0144] S901: Determine a target shortest integration time according to a first shortest integration time of the light sensor and a PWM mode of a terminal device in which the light sensor is installed.
[0145] S902: Determine a target maximum integration time according to a first maximum integration time of the light sensor, each pre-stored integration time, and a first preset duration.
[0146] S903: Determine a target ratio according to the target shortest integration time and the target longest integration time.
[0147] S904: Obtain the raw light intensity data collected by the light sensor within the time length corresponding to the product of the target ratio and the target shortest integration time, process the raw light intensity data based on a preset interference removal algorithm to obtain target light intensity data, and report the target light intensity data to the terminal device where the light sensor is installed.
[0148] Fig.10 A schematic diagram of the structure of a light sensor data processing device provided in some embodiments of the present application, such as the Fig.10 As shown, the device comprises:
[0149] An acquisition module 1001 is used to acquire a target ratio of a light sensor to be processed, where the target ratio is determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor;
[0150] A determination module 1002 is used to determine the product of the target ratio and the target shortest integration time;
[0151] The processing module 1003 is used to obtain the original light intensity data collected by the light sensor within the time length corresponding to the product; process the original light intensity data based on a preset interference removal algorithm to obtain target light intensity data and output it.
[0152] In a possible implementation manner, the acquisition module 1001 is further used to acquire a saved first shortest integration time of the light sensor;
[0153] The determination module 1002 is also used to determine the first duration that the terminal device is in a black screen state according to the pulse width modulation (PWM) mode of the terminal device on which the light sensor is installed; if the first shortest integration time is greater than half of the first duration, the first shortest integration time is determined as the target shortest integration time; otherwise, half of the first duration is determined as the target shortest integration time.
[0154] In a possible implementation manner, the acquisition module 1001 is further used to acquire a saved first longest integration time of the light sensor;
[0155] The determination module 1002 is also used to select a second time length that is greater than the first preset time length from each pre-saved integration time; determine the minimum integration time in the second time length as the second maximum integration time; if the first maximum integration time is greater than the second maximum integration time, determine the second maximum integration time as the target maximum integration time; otherwise, determine the first maximum integration time as the target maximum integration time.
[0156] In a possible implementation, the determination module 1002 is further configured to, if the target ratio is not an integer, round up the target ratio to obtain a first ratio, and use the first ratio to update the target ratio.
[0157] In a possible implementation, the acquisition module 1001 is further used to determine whether the time interval between the current time and the last time the data collected by the light sensor was processed is greater than or equal to a saved time threshold; if so, a subsequent operation of acquiring the saved target ratio of the light sensor to be processed is performed.
[0158] In a possible implementation, the acquisition module 1001 is further used to acquire a saved cycle threshold;
[0159] The determination module 1002 is further used to determine whether the period threshold is greater than the time length corresponding to the product saved when the data collected by the light sensor was processed last time; if so, the period threshold is saved as the time threshold; otherwise, the time length corresponding to the product saved when the data collected by the light sensor was processed last time is saved as the time threshold.
[0160] Based on the same inventive concept, Fig.11 Another structural diagram of a terminal device provided in some embodiments of the present application, such as Fig.11 As shown, it includes: one or more (including two) processors 1101 and a communication interface 1102.
[0161] The processor 1101 stores a computer program. When the program is executed by the processor 1101, the processor 1101 executes the steps of the light sensor data processing method in any of the above embodiments.
[0162] Optionally, the terminal device further includes a memory 1103, which may include a read-only memory and a random access memory, and provides operation instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory (NVRAM).
[0163] In some embodiments, Fig.11 As shown, the memory 1103 stores the following elements, execution modules or data structures, or their subsets, or their extended sets.
[0164] like Fig.11As shown, in some embodiments of the present application, corresponding operations are performed by calling operation instructions stored in the memory 1103 (the operation instructions may be stored in the operating system).
[0165] like Fig.11 As shown, the processor 1101 controls the processing operation of the head-end device, and the processor can also be called a central processing unit (CPU).
[0166] like Fig.11 As shown, the memory 1103 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory 1103 may also include an NVRAM. For example, in an application, the communication interface and the memory are coupled together through a bus system 1104, wherein the bus system 1104 may include a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, in Fig.11 Various buses are labeled as bus system 1104 .
[0167] Based on the above embodiments, the present application also provides a computer-readable storage medium, which stores a computer program executable by a processor. When the program runs on the processor, the processor implements the steps of the light sensor data processing method in any of the above embodiments.
[0168] Since the principle of solving the problem by the computer-readable medium provided above is similar to the light sensor data processing method, after the processor executes the computer program in the computer-readable medium above, the steps implemented can refer to the above embodiment, and the repeated parts will not be repeated.
[0169] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0170] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0171] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0172] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0173] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A light sensor data processing method, characterized in that: The method comprises: Acquire a target ratio of the light sensor to be processed that is stored, wherein the target ratio is determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor; determining a product of the target ratio and the target shortest integration time; Acquire raw light intensity data collected by the light sensor within a time length corresponding to the product; Processing the raw light intensity data based on a preset interference removal algorithm to obtain target light intensity data and output the target light intensity data; The process of determining the target shortest integration time includes: Obtaining the saved first shortest integration time of the light sensor; Determining a first duration of a black screen state of the terminal device according to a pulse width modulation (PWM) mode of the terminal device on which the light sensor is installed; If the first shortest integration time is greater than half of the first duration, the first shortest integration time is determined as the target shortest integration time; otherwise, half of the first duration is determined as the target shortest integration time; The process of determining the target maximum integration time includes: Obtaining a saved first longest integration time of the light sensor; From each pre-saved integration time, select a second time length that is greater than the first preset time length; determine the smallest integration time in the second time length as the second longest integration time; If the first longest integration time is greater than the second longest integration time, the second longest integration time is determined as the target longest integration time; otherwise, the first longest integration time is determined as the target longest integration time; After acquiring the target ratio of the light sensor to be processed and before determining the product of the target ratio and the shortest integration time, the method further includes: If the target ratio is not an integer, rounding up the target ratio to obtain a first ratio, and using the first ratio to update the target ratio; The quotient of the target longest integration time and the target shortest integration time, the obtained quotient is the target ratio of the light sensor to be processed; The target ratio is an integer. The target ratio is rounded up to obtain a first ratio, and the target ratio is updated using the first ratio so that the determined target ratio satisfies the following relationship: target longest integration time < target ratio * target shortest integration time < (target ratio + 1) * target shortest integration time.
2. The method according to claim 1, characterized in that Before obtaining the target ratio of the light sensor to be processed, the method further includes: Determine whether the time interval between the current time and the last time the data collected by the light sensor is processed is greater than or equal to the saved time threshold; if so, perform a subsequent operation of obtaining the saved target ratio of the light sensor to be processed.
3. The method according to claim 2, characterized in that The process of determining the time threshold includes: Get the saved cycle threshold; Determine whether the cycle threshold is greater than the time length corresponding to the product saved when the data collected by the light sensor was processed last time; if so, save the cycle threshold as the time threshold; otherwise, save the time length corresponding to the product saved when the data collected by the light sensor was processed last time as the time threshold.
4. A light sensor data processing device, characterized in that: The device comprises: An acquisition module, used for acquiring a target ratio of a light sensor to be processed, which is stored and determined according to a target shortest integration time of the light sensor and a target longest integration time of the light sensor; A determination module, used to determine the product of the target ratio and the target shortest integration time; A processing module, used to obtain the original light intensity data collected by the light sensor within the time length corresponding to the product; process the original light intensity data based on a preset interference removal algorithm to obtain target light intensity data and output it; Wherein, the acquisition module is further used to acquire the saved first shortest integration time of the light sensor; The determination module is further used to determine a first duration of time that the terminal device is in a black screen state according to a pulse width modulation (PWM) mode of the terminal device on which the light sensor is installed; if the first shortest integration time is greater than half of the first duration, the first shortest integration time is determined as the target shortest integration time; otherwise, half of the first duration is determined as the target shortest integration time; The acquisition module is further used to acquire the saved first longest integration time of the light sensor; The determination module is further configured to select a second time length greater than the first preset time length from each pre-saved integration time; determine the smallest integration time in the second time lengths as the second longest integration time; if the first longest integration time is greater than the second longest integration time, determine the second longest integration time as the target longest integration time; otherwise, determine the first longest integration time as the target longest integration time; The determination module is further configured to, if the target ratio is not an integer, round up the target ratio to obtain a first ratio, and use the first ratio to update the target ratio; The quotient of the target longest integration time and the target shortest integration time, the obtained quotient is the target ratio of the light sensor to be processed; The target ratio is an integer. The target ratio is rounded up to obtain a first ratio, and the target ratio is updated using the first ratio so that the determined target ratio satisfies the following relationship: target longest integration time < target ratio * target shortest integration time < (target ratio + 1) * target shortest integration time.
5. A terminal device, characterized in that: The terminal device comprises: Display, processor and memory; The display is used to display the screen display area; The memory is used to store the processor executable instructions; The processor is configured to execute the instructions to implement the light sensor data processing method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the light sensor data processing method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Data collection method, terminal equipment and storage medium
CN113116357A
Method and device for determining environment illumination intensity and storage medium
CN113763856A