Data processing method and device, electronic equipment and storage medium

By determining the integration time corresponding to different functions in electronic devices, and using equivalent number grouping and accumulation technology, the problem of detection abnormality of optical sensors when switching integration time is frequently solved, multi-functional parallel processing is realized, and the accuracy and efficiency of detection are improved.

CN120151671APending Publication Date: 2025-06-13BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311704329.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

When existing optical sensors frequently switch the integration time, they can easily lead to abnormal detection and hardware problems are difficult to solve.

Method used

By determining the integral time corresponding to different functions in the electronic device, and collecting sensing data based on the smaller integral time, using equivalent number grouping and accumulation techniques, the required second sensing data is obtained, thereby achieving multifunctional parallel processing.

Benefits of technology

It avoids sensing data faults and hardware problems caused by frequent switching of integral time, and realizes multi-functional parallel processing without changing the hardware, improving the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120151671A_ABST
    Figure CN120151671A_ABST
Patent Text Reader

Abstract

The invention relates to a data processing method and device, electronic equipment and a storage medium, and the method comprises the steps: determining first integral time corresponding to a first function and second integral time corresponding to a second function when the first function and the second function of the electronic equipment are in an on state; the optical sensor acquires sensing data according to an acquisition frequency determined based on the first integration time to obtain a plurality of first sensing data, and performs processing corresponding to the first function on the first sensing data to obtain a first processing result; and obtaining second sensing data based on the first sensing data corresponding to the second integration time, and performing processing corresponding to the second function on the second sensing data to obtain a second processing result. The first function and the second function can be detected at the same time, and the fault problem of sensing data in time caused by frequent switching of the integral time of the optical sensor and the hardware problem caused by switching are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular, to a data processing method, apparatus, electronic device, and storage medium. Background Art

[0002] Currently, common optical sensors on the market have different functions, and different functions have different requirements for the acquisition frequency of the optical sensors, and the corresponding integration time of the optical sensors will also be different. For example, an optical sensor can be used for stroboscopic detection and ambient light detection. Stroboscopic detection has high requirements for the acquisition frequency of the optical sensor. In the case of a high acquisition frequency, the integration time of the optical sensor needs to be short enough. Therefore, when performing stroboscopic detection, the integration time of the optical sensor needs to be set to a short integration time. Ambient light detection requires a long integration time, and sufficient photosensitive information can be obtained only with a long integration time to ensure the accuracy of ambient light calculation.

[0003] Therefore, if different functions are to be achieved simultaneously, the integration time of the optical sensor needs to be switched, and switching the integration time requires frequently writing to the integration time register. Frequent writing to the register may result in write failures and unknown hardware problems, causing abnormal detection of the optical sensor. Summary of the Invention

[0004] The present disclosure provides a data processing method, apparatus, electronic device, and storage medium to overcome the problem of abnormal detection of an optical sensor caused by frequently switching the integration time.

[0005] According to a first aspect of an embodiment of the present disclosure, a data processing method is provided, including:

[0006] When both the first function and the second function of the electronic device are in an enabled state, determining a first integration time corresponding to the first function and a second integration time corresponding to the second function; wherein, the first integration time is less than the second integration time;

[0007] The optical sensor of the electronic device collects sensing data at an acquisition frequency determined based on the first integration time, obtains a plurality of first sensing data, and performs processing corresponding to the first function on the first sensing data to obtain a first processing result;

[0008] Based on the first sensing data corresponding to the second integration time, obtaining second sensing data, and performing processing corresponding to the second function on the second sensing data to obtain a second processing result.

[0009] In some embodiments, the obtaining second sensing data based on the first sensing data corresponding to the second integration time includes:

[0010] Based on the first integration time and the second integration time, determine the equivalent number of the first sensing data corresponding to the second integration time;

[0011] Group the multiple first sensing data with the equivalent number of first sensing data that are continuous in time as a group, to obtain multiple data groups; wherein, each second integration time corresponds to one data group;

[0012] Accumulate the first sensing data in each of the data groups respectively, to obtain the second sensing data corresponding to each second integration time.

[0013] In some embodiments, the processing the first sensing data corresponding to the first function to obtain a first processing result includes:

[0014] Successively store each of the collected first sensing data into a preset first-in first-out queue;

[0015] When the number of the first sensing data in the first-in first-out queue reaches a first number, read the first number of first sensing data from the first-in first-out queue, and process the first number of first sensing data corresponding to the first function to obtain the first processing result.

[0016] In some embodiments, the data processing method further includes:

[0017] After reading the first number of first sensing data in the first-in first-out queue, clear the second number of first sensing data that was stored in the first-in first-out queue first; wherein, the second number is less than the first number;

[0018] In the case of collecting the second number of first sensing data, successively store the second number of first sensing data into the first-in first-out queue.

[0019] In some embodiments, the data processing method further includes:

[0020] When it is detected that the first function is switched to the off state and the second function remains in the on state, the optical sensor performs sensing data acquisition according to the acquisition frequency determined based on the second integration time, to obtain third sensing data;

[0021] Process the third sensing data corresponding to the second function to obtain a third processing result.

[0022] In some embodiments, the processing the first sensing data corresponding to the first function to obtain a first processing result includes:

[0023] Process the first sensing data corresponding to the first function to obtain the light flashing frequency and / or light flashing intensity;

[0024] Processing the second sensing data corresponding to the second function to obtain a second processing result includes:

[0025] Process the second sensing data corresponding to the second function to obtain the light intensity.

[0026] In some embodiments, the data processing method further includes:

[0027] When the electronic device detects a photographing event, switch the first function and the second function to the on state;

[0028] When it is detected that both the first function and the second function are switched to the off state, turn off the optical sensor.

[0029] According to a second aspect of the embodiments of the present disclosure, there is provided a data processing apparatus, including:

[0030] A determination module configured to determine a first integration time corresponding to the first function and a second integration time corresponding to the second function when both the first function and the second function of the electronic device are in the on state; wherein, the first integration time is less than the second integration time;

[0031] A first processing module configured to collect sensing data by the optical sensor of the electronic device at a collection frequency determined based on the first integration time, obtain a plurality of first sensing data, and process the first sensing data corresponding to the first function to obtain a first processing result;

[0032] A second processing module obtains second sensing data based on the first sensing data corresponding to the second integration time, and processes the second sensing data corresponding to the second function to obtain a second processing result.

[0033] In some embodiments, the second processing module is further configured to:

[0034] Determine the equivalent number of the first sensing data corresponding to the second integration time based on the first integration time and the second integration time;

[0035] Group the plurality of first sensing data with the equivalent number of first sensing data that are continuous in time as a group to obtain a plurality of data groups; wherein, each second integration time corresponds to a data group;

[0036] Accumulate the first sensing data in each of the data groups respectively to obtain the second sensing data corresponding to each of the second integration times.

[0037] In some embodiments, the first processing module is further configured to:

[0038] Successively store each of the collected first sensing data into a preset first-in, first-out queue;

[0039] When the number of the first sensing data in the first-in, first-out queue reaches a first quantity, read the first quantity of first sensing data from the first-in, first-out queue, and perform processing corresponding to the first function on the first quantity of first sensing data to obtain the first processing result.

[0040] In some embodiments, the first module is further configured to:

[0041] After reading the first quantity of first sensing data in the first-in, first-out queue, clear the second quantity of first sensing data that was stored in the first-in, first-out queue first; wherein, the second quantity is less than the first quantity;

[0042] In the case of collecting the second quantity of first sensing data, successively store the second quantity of first sensing data into the first-in, first-out queue.

[0043] In some embodiments, the second processing module is further configured to:

[0044] When it is detected that the first function switches to the off state and the second function remains in the on state, the optical sensor performs sensing data acquisition according to the acquisition frequency determined based on the second integration time to obtain third sensing data;

[0045] Perform processing corresponding to the second function on the third sensing data to obtain a third processing result.

[0046] In some embodiments, the first processing module is further configured to:

[0047] Perform processing corresponding to the first function on the first sensing data to obtain a light flicker frequency and / or a light flicker intensity;

[0048] The second processing module is further configured to:

[0049] Perform processing corresponding to the second function on the second sensing data to obtain an illumination intensity.

[0050] In some embodiments, the determination module is further configured to:

[0051] When the electronic device detects a photo-taking event, switching the first function and the second function to the on state;

[0052] When it is detected that both the first function and the second function are switched to an off state, the optical sensor is turned off.

[0053] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0054] processor;

[0055] a memory configured to store processor-executable instructions;

[0056] Wherein, the processor is configured to execute the data processing method described in the first aspect above when calling the executable instructions in the memory.

[0057] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the data processing method described in the first aspect above.

[0058] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0059] The data processing method disclosed herein determines, when the first function and the second function of the electronic device are both in an on state, a first integration time corresponding to the first function and a second integration time corresponding to the second function, an optical sensor of the electronic device collects sensing data at a collection frequency determined based on the first integration time to obtain a plurality of first sensing data, processes the first sensing data corresponding to the first function to obtain a first processing result, obtains second sensing data based on the first sensing data corresponding to the second integration time, and processes the second sensing data corresponding to the second function to obtain a second processing result.

[0060] That is to say, when the optical sensor is required to collect data for the first function and the second function at the same time, the optical sensor only needs to collect the first sensor data at the collection frequency determined by the smaller first integration time. As for the second sensor data required for the second function, it can be directly determined based on the first sensor data corresponding to the second integration time. In this way, the detection and processing of the first function and the second function can be performed simultaneously, avoiding the time gap problem of the sensor data caused by frequent switching of the integration time of the optical sensor and the hardware problems caused by the switching.

[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.

[0063] Figure 1 is a schematic flowchart of a data processing method shown according to an exemplary embodiment Figure 1 .

[0064] Figure 2 is a schematic flowchart of a data processing method shown according to an exemplary embodiment Figure 2 .

[0065] Figure 3 is a schematic diagram of a data flow when an electronic device processes a first function and a second function simultaneously shown according to an exemplary embodiment.

[0066] Figure 4 is a schematic diagram of a data flow for processing first sensing data shown according to an exemplary embodiment.

[0067] Figure 5 is a schematic structural diagram of a data processing apparatus shown according to an exemplary embodiment.

[0068] Figure 6 is a schematic structural diagram of an electronic device shown according to an exemplary embodiment. Detailed Description of the Embodiments

[0069] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0070] In the specification, unless otherwise clearly stated, the terms "first" and "second" are only used for description to distinguish constituent elements and should not be construed as indicating an order. Unless otherwise clearly stated, terms such as "connected" and "fixed" should be understood in a broad sense, including but not limited to "connected" and "fixed" directly, indirectly, detachably, etc.

[0071] Figure 1 is a process of a data processing method shown according to an exemplary embodiment Figure 1 , as Figure 1 shown, the method mainly includes the following steps:

[0072] In step 101, when both the first function and the second function of the electronic device are in the on state, determine the first integration time corresponding to the first function and the second integration time corresponding to the second function; wherein, the first integration time is less than the second integration time.

[0073] It should be noted that this method can be applied to an electronic device. The electronic device may include a terminal device. Among them, the terminal device may include a mobile terminal and a fixed terminal. For example, a mobile phone, a tablet computer, a personal digital assistant, a laptop computer, a desktop computer, a wearable device, and a vehicle-mounted terminal, etc.

[0074] In this embodiment, the first function and the second function are functions that the electronic device and the optical sensor of the electronic device can cooperate to complete. The optical sensor is a type of sensor that uses the optical principle to detect and measure the properties or change states of the target object. That is, the first function and the second function are detection or measurement functions completed by the electronic device based on the sensing data of the optical sensor for corresponding data processing. For example: stroboscopic detection function, ambient light detection function, object distance detection function, object movement speed detection function, and so on.

[0075] Among them, the integration time of the optical sensor refers to the time when the electrical signal is accumulated after receiving an optical signal, that is, the integration time determines the length of time for the optical sensor to collect the optical signal. It can be understood that optical signals often have fluctuations and noises. A shorter integration time corresponds to a higher sampling frequency, which can improve the response speed and sensitivity, but may introduce larger noises for the detection of weak optical signals. A longer integration time can improve the stability and accuracy of signal detection, but will increase the response time and reduce the sensitivity.

[0076] Therefore, different detection requirements for different functions correspond to different integration times. When both the first function and the second function of the electronic device are in the on state, it means that the electronic device expects to cooperate with the optical sensor to complete the first function and the second function in parallel.

[0077] In the related art, the purpose of completing the first function and the second function in parallel can be achieved by frequently switching the integration time of the optical sensor, but this method will not only cause a time break in the sensing data, but also cause hardware problems due to frequent switching of the integration time. Or by adding an optical sensor to achieve the purpose of completing the first function and the second function in parallel, but this method will increase the hardware cost and is not conducive to the miniaturization and integration of the electronic device.

[0078] For the first integration time corresponding to the first function and the second integration time corresponding to the second function, they can be determined according to the detection requirements of the first function and the second function. If the detection requirements require accuracy and precision, the integration time can be set to a longer integration time. If the detection requirements require a quick response to each optical signal and giving a result, the integration time can be set to a shorter integration time. Of course, in addition to considering the detection requirements of the function itself, the integration time corresponding to different functions can also be determined based on the detection performance of the optical sensor itself and the data processing ability of the electronic device.

[0079] In step 102, the optical sensor of the electronic device collects sensing data at the acquisition frequency determined based on the first integration time, obtains a plurality of first sensing data, and performs processing corresponding to the first function on the first sensing data to obtain a first processing result.

[0080] In this embodiment, the integration time of the optical sensor of the electronic device is set to a smaller first integration time, so that the optical sensor collects sensing data at the acquisition frequency determined by the first integration time, obtains a plurality of first sensing data. Then, after performing data processing corresponding to the first function on the first sensing data, the first processing result of the first function can be obtained.

[0081] Among them, the first integration time and the acquisition frequency are reciprocal to each other. Once the first integration time is determined, the optical sensor can collect a plurality of first sensing data at the corresponding acquisition frequency. For example: if the first integration time is 500 microseconds (μs), the acquisition frequency determined based on the first integration time is 2000 hertz (hz), which is equivalent to collecting once every 500 μs and collecting 2000 first sensing data in one second. The obtained plurality of first sensing data can be stored in the data register corresponding to the optical sensor for the processor to quickly access, or can be stored in the memory for storing a large amount of sensing data.

[0082] For the collected first sensing data, the electronic device can immediately perform processing corresponding to the first function on the first sensing data to obtain a first processing result, or can perform processing on the first sensing data when a calculation instruction related to the first function is detected to obtain a first processing result.

[0083] If the first function is an ambient light detection function, the type of the first sensing data, that is, the type of the electrical signal, is determined based on the type of the optical sensor (such as: photoresistor, photodiode, photodetector). Based on the conversion formula between the electrical signal (such as: resistance value, current value, voltage value) and the light intensity, the plurality of first sensing data are respectively substituted into the conversion formula between the electrical signal and the light intensity to obtain the ambient light intensity values at different times.

[0084] If the first function is the object distance detection function, the first sensing data is the transmission time from emitting the optical signal to receiving the optical signal. Based on the transmission time of the optical signal and the speed of light, the distance between the object and the optical sensor can be determined. Different functions correspond to different processing procedures. Of course, to improve the detection accuracy and precision, multiple first sensing data can be corrected, data with large differences from other sensing data can be screened out, and multiple preliminary results calculated can be averaged to obtain the final first processing result.

[0085] In step 103, based on the first sensing data corresponding to the second integration time, second sensing data is obtained, and the second sensing data is processed corresponding to the second function to obtain the second processing result.

[0086] In this embodiment, the first sensing data corresponding to the second integration time is determined from multiple first sensing data, and this is used as the second sensing data required for the second function. The second sensing data is processed with data processing corresponding to the second function to obtain the second processing result.

[0087] During the process of determining the second sensing data, it can start from any one of the first sensing data to determine the first sensing data corresponding to the second integration time, and at least one second sensing data is obtained. The number of determined second sensing data can be determined based on the detection requirements of the second function. If a processing result needs to be obtained quickly, a small number of second sensing data can be determined, and the small number of second sensing data can be processed to quickly obtain the processing result. If the accuracy of the processing result needs to be ensured, a large number of second sensing data can be determined, and mutual verification based on the large number of second sensing data can ensure the accuracy of the processing result.

[0088] For example: The first integration time is 500 μs, that is, the first sensing data is collected every 500 μs. If 100 pieces of first sensing data are collected, these 100 data are consecutive in time. Then, starting from the first piece of first sensing data, 40 pieces of first sensing data corresponding to the second integration time of 20 ms can be selected, that is, based on the 1st - 40th pieces of first sensing data, the first piece of second sensing data is obtained. Then, starting from the second piece of first sensing data, 40 pieces of first sensing data are selected, that is, based on the 2nd - 41st pieces of first sensing data, the second piece of second sensing data is obtained, and so on. 61 different second sensing data can be obtained.

[0089] Of course, based on the time when the detection object corresponding to the second function changes, the first sensing data corresponding to the second integration time can also be selected near this time to obtain the second sensing data. This can avoid the storage and processing of useless data and redundant data and improve the processing speed.

[0090] The present disclosure selects the smaller integration time from the first integration time corresponding to the first function and the second integration time corresponding to the second function, so that the optical sensor of the electronic device obtains a plurality of first sensing data according to the acquisition frequency determined by the smaller first integration time. In this way, the second sensing data can be directly determined based on the first sensing data corresponding to the second integration time, without switching the integration time to obtain the sensing data corresponding to different integration times simultaneously, achieving the parallel processing of multiple functions without changing the hardware and without interruption in data time.

[0091] In some embodiments, as Figure 2 shown, step 103 includes:

[0092] In step 1031, based on the first integration time and the second integration time, determine the equivalent number of the first sensing data corresponding to the second integration time;

[0093] In step 1032, group the plurality of first sensing data with the equivalent number of first sensing data that are continuous in time as a group to obtain a plurality of data groups; where each second integration time corresponds to one data group;

[0094] In step 1033, add up the first sensing data in each data group respectively to obtain the second sensing data corresponding to each second integration time, and perform processing corresponding to the second function on the second sensing data to obtain a second processing result.

[0095] In this embodiment, since the first integration time is less than the second integration time, the equivalent number of the first sensing data collected based on the acquisition frequency corresponding to the first integration time under the second integration time can be determined. That is, divide the second integration time by the first integration time to obtain the equivalent number.

[0096] For example: the first integration time is 500 μs, and the second integration time is 20 ms, then the equivalent number of the first sensing data collected every 500 μs under the 20 ms integration time is 40. Then, group the plurality of first sensing data with 40 consecutive first sensing data in terms of acquisition time as a group to obtain a plurality of data groups. The number of these data groups is equivalent to the number of the second sensing data collected every 20 ms. Finally, add up the first sensing data in each data group, and the sum value obtained by adding up each data group is the second sensing data. As Figure 3 shown, it is a data flow schematic diagram when the electronic device processes the first function and the second function simultaneously, where 500 μs is the first integration time and 20 ms is the second integration time.

[0097] It can be understood that the integration time of the optical sensor determines the length of time for collecting the optical signal. If the first integration time is 500 μs, it is equivalent to the collection time of the optical signal being 500 μs. If the second integration time is 20 ms, it is equivalent to the collection time of the optical signal being 20 ms. Then, by accumulating the first sensing data collected in 40 consecutive 500-μs intervals in time, the optical signal collected within 20 ms can be obtained. In this way, the sensing data collected by an optical sensor without switching the integration time can be used to complete the calculation and processing of multiple functions, which not only avoids modifying the hardware but also ensures the continuity of the data in time.

[0098] When obtaining the second sensing data, perform processing corresponding to the second function on the second sensing data. Taking the second function as the stroboscopic detection function as an example, since the stroboscopic detection function requires obtaining parameters such as the frequency of light flicker, the intensity of light flicker, and the change amplitude of light intensity through frequency-domain analysis, it is necessary to perform a Fourier transform on the second sensing data to obtain a spectrogram, determine the light flicker frequency based on the spectrogram, determine the light flicker intensity based on the peak value of the spectrogram, and determine the change amplitude of light intensity based on the difference between the peak value and the trough value of the spectrogram. In addition, during the process of performing a Fourier transform on the second sensing data, correction processing can also be performed on the second sensing data, and denoising filtering processing can be performed on the spectrogram to improve the accuracy of the second processing result.

[0099] In an embodiment, perform processing corresponding to the first function on the first sensing data to obtain a first processing result, including: sequentially storing each collected first sensing data into a preset first-in-first-out queue; when the number of first sensing data in the first-in-first-out queue reaches a first quantity, read the first quantity of first sensing data from the first-in-first-out queue, and perform processing corresponding to the first function on the first quantity of first sensing data to obtain a first processing result.

[0100] In this embodiment, since the first sensing data is obtained by the optical sensor according to the acquisition frequency corresponding to the first integration time, and the first integration time is a relatively short integration time, that is, the first sensing data is obtained at a relatively high acquisition frequency. Then, when the electronic device processes the first sensing data, it is very difficult to read and process the data at such a high acquisition frequency. For example, when the first integration time is 500 μs, it is equivalent to the optical sensor collecting the first sensing data every 500 μs, and the electronic device needs to read the first sensing data every 500 μs, which extremely tests the performance of the processor and memory of the electronic device. Reading data at such a high frequency will also generate extremely high power consumption.

[0101] Therefore, for each first sensing data collected by the optical sensor, it is sequentially stored in a first-in-first-out (FIFO) queue according to the collection time sequence. When the number of the first sensing data in the queue reaches the first quantity, a batch of the first quantity of the first sensing data is read out from the FIFO queue at one time for subsequent processing. In this way, the power consumption generated during the data reading process can be reduced, and the successful completion of data reading and data processing can be ensured even when the processor performance and memory performance are average.

[0102] Among them, the first quantity can be determined based on the processing requirements corresponding to the first function. For example, when the first function is the stroboscopic detection function, and the stroboscopic detection function requires performing a Fourier transform on the first sensing data to obtain the frequency of the light flicker and the intensity of the light flicker in the frequency domain analysis, and the Fourier transform requires 512 first sensing data that are continuous in time, then the first quantity can be set to 512. Another example is that if the first function has extremely high requirements for detection accuracy and precision, and calculating 1000 first sensing data can meet the accuracy and precision requirements of the first function, then the first quantity can be set to 1000.

[0103] In an embodiment, after reading the first quantity of the first sensing data in the FIFO queue, the second quantity of the first sensing data that was stored in the FIFO queue first is cleared; where the second quantity is less than the first quantity; when the second quantity of the first sensing data is collected, the second quantity of the first sensing data is sequentially stored in the FIFO queue.

[0104] In this embodiment, among the first quantity of the first sensing data read each time, it may include data partially the same as the previously read sensing data and the latest detected data. In this way, it can not only make the fullest use of the first sensing data to the greatest extent, but also continuously and uninterruptedly complete the first function, and can also analyze the change trend of the detection result.

[0105] For example, if the first integration time is 500 μs and the first quantity is 512, then the 512 first sensing data are the data included within 256 ms (256 ms = 500 μs × 512). Then, the first function can be completed based on different 512 first sensing data corresponding to different time periods (i.e., different 256 ms), and the 512 first sensing data corresponding to different 256 ms can have some data in common. As Figure 4 shown, it is a data flow schematic diagram for processing the first sensing data.

[0106] As Figure 4As shown, after reading the first set of 512 first sensing data from the queue (the 512 data are continuous in time and correspond to a total of 256 ms), the 64 (second quantity) first sensing data stored earliest in the queue can be cleared, and then the 64 latest acquired first sensing data are stored to obtain a second set of 512 first sensing data. 448 data in the second set of 512 data are the same as those in the previous time. Subsequently, this method is cycled to continuously clear and store data. In this way, the sensing data are updated, and the full utilization of the sensing data acquired each time is achieved.

[0107] In some embodiments, when it is detected that the first function is switched to the off state and the second function remains in the on state, the optical sensor acquires sensing data at an acquisition frequency determined based on the second integration time to obtain third sensing data; the third sensing data is processed corresponding to the second function to obtain a third processing result.

[0108] In this embodiment, since the first integration time corresponding to the first function is relatively short, as long as the first function is in the on state, regardless of whether the second function is in the on state or the off state, the optical sensor acquires data at the acquisition frequency corresponding to the first integration time. Once it is detected that the first function is in the off state and the second function still remains in the on state, the integration time of the optical sensor needs to be switched to the second integration time so that the optical sensor acquires sensing data according to the second integration time. In this way, the obtained third sensing data can be directly used for the processing of the second function, saving the step of determining the equivalent number of second sensing data, and enabling the electronic device to obtain the second processing result corresponding to the second function more quickly.

[0109] In some embodiments, processing the first sensing data corresponding to the first function to obtain a first processing result includes: processing the first sensing data corresponding to the first function to obtain the light flicker frequency and / or the light flicker intensity; processing the second sensing data corresponding to the second function to obtain a second processing result includes: processing the second sensing data corresponding to the second function to obtain the light intensity.

[0110] In this embodiment, when the first function is the stroboscopic detection function, the processing corresponding to the first function may include Fourier transform, signal denoising processing, frequency correction processing, etc., and the first processing result may include the frequency of the light flicker and the intensity of the light flicker. When the second function is the ambient light detection function, the processing corresponding to the second function may include optical parameter calculation according to relevant optical principles, etc., and the second processing result may include the light intensity.

[0111] In some embodiments, when the electronic device detects a photographing event, the first function and the second function are switched to the on state; when it is detected that both the first function and the second function are switched to the off state, the optical sensor is turned off.

[0112] In this embodiment, the first function may be a stroboscopic detection function, and the second function is an ambient light detection function. Then, when the electronic device is in a photographing scenario, the first function and the second function are in the on state. Taking a mobile phone as an example of the electronic device, when the automatic backlight of the mobile phone is turned on, it is necessary to obtain ambient light data, that is, the second function is in the on state. At this time, when the camera is turned on to take a photo, stroboscopic data will be obtained, that is, the first function is in the on state.

[0113] In some other embodiments, when the electronic device is in an automatic brightness adjustment scenario, the second function (ambient light detection function) is also in the on state. When the electronic device is in the eye protection mode, the first function is also in the on state.

[0114] Of course, when it is detected that both the first function and the second function are switched to the off state, the electronic device turns off the optical sensor to reduce power consumption and save system resources.

[0115] Figure 5 A data processing device shown according to an exemplary embodiment is as Figure 5 shown, and the device includes:

[0116] A determination module 501, configured to determine a first integration time corresponding to the first function and a second integration time corresponding to the second function when both the first function and the second function of the electronic device are in the on state; wherein, the first integration time is less than the second integration time;

[0117] A first processing module 502, configured to collect sensing data by the optical sensor of the electronic device at a collection frequency determined based on the first integration time, obtain a plurality of first sensing data, and perform processing corresponding to the first function on the first sensing data to obtain a first processing result;

[0118] A second processing module 503, based on the first sensing data corresponding to the second integration time, obtains second sensing data, and performs processing corresponding to the second function on the second sensing data to obtain a second processing result.

[0119] In some embodiments, the second processing module is further configured to:

[0120] Based on the first integration time and the second integration time, determine the equivalent number of the first sensing data corresponding to the second integration time;

[0121] Group the multiple pieces of the first sensing data by taking the equivalent number of the first sensing data that is continuous in time as a group, to obtain a plurality of data groups; wherein, each second integration time corresponds to one data group;

[0122] Accumulate the first sensing data in each of the data groups respectively, to obtain the second sensing data corresponding to each second integration time.

[0123] In some embodiments, the first processing module is further configured to:

[0124] Sequentially store each piece of the collected first sensing data into a preset first-in-first-out queue;

[0125] When the number of the first sensing data in the first-in-first-out queue reaches a first quantity, read the first quantity of the first sensing data from the first-in-first-out queue, and perform processing corresponding to the first function on the first quantity of the first sensing data, to obtain the first processing result.

[0126] In some embodiments, the first module is further configured to:

[0127] After finishing reading the first quantity of the first sensing data in the first-in-first-out queue, clear the second quantity of the first sensing data that was stored in the first-in-first-out queue first; wherein, the second quantity is less than the first quantity;

[0128] In the case of collecting the second quantity of the first sensing data, sequentially store the second quantity of the first sensing data into the first-in-first-out queue.

[0129] In some embodiments, the second processing module is further configured to:

[0130] When it is detected that the first function switches to the off state and the second function maintains the on state, the optical sensor collects sensing data at a collection frequency determined based on the second integration time, to obtain third sensing data;

[0131] Perform processing corresponding to the second function on the third sensing data, to obtain a third processing result.

[0132] In some embodiments, the first processing module is further configured to:

[0133] Perform processing corresponding to the first function on the first sensing data, to obtain a light flash frequency and / or a light flash intensity;

[0134] The second processing module is further configured to:

[0135] Process the second sensing data corresponding to the second function to obtain the light intensity.

[0136] In some embodiments, the determining module is further configured to:

[0137] When the electronic device detects a photographing event, switch the first function and the second function to the on state;

[0138] When it is detected that both the first function and the second function are switched to the off state, turn off the optical sensor.

[0139] Regarding the data processing device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0140] As Figure 6 shown, an embodiment of the present disclosure further provides an electronic device 600, including:

[0141] A memory 604 for storing processor-executable instructions;

[0142] A processor 620, connected to the memory 604;

[0143] Wherein, the processor 620 is configured to execute the data processing method provided by any of the foregoing technical solutions.

[0144] A block diagram of an electronic device 600 shown according to an exemplary embodiment. For example, the electronic device 600 may be a smart phone, a tablet computer, a notebook computer, a portable learning machine, etc.

[0145] Referring to Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 618.

[0146] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, telephone call, data communication, camera operation, and recording operation. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0147] The memory 604 is configured to store various types of data to support the operation of the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, and the like. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.

[0148] The power supply component 606 provides power to various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.

[0149] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of the touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.

[0150] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 604 or transmitted via the communication component 618. In some embodiments, the audio component 610 further includes a speaker for outputting audio signals.

[0151] The I / O interface 612 provides an interface between the processing component 602 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.

[0152] The sensor assembly 614 includes one or more sensors for providing an assessment of the status of various aspects of the electronic device 600. For example, the sensor assembly 614 can detect the on / off state of the electronic device 600, the relative positioning of components, such as the display and keypad of the electronic device 600. The sensor assembly 614 can also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor assembly 614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0153] The communication component 618 is configured to facilitate communication between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 618 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 618 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0154] In an exemplary embodiment, the electronic device 600 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.

[0155] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 604 including instructions, is also provided. The above instructions can be executed by the processor 620 of the electronic device 600 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data writing device, etc.

[0156] An embodiment of the present application provides a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a processor of a computer, the computer can execute the data processing method described in the foregoing one or more technical solutions.

[0157] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present disclosure. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include known common knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and examples are only illustrative, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0158] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A data processing method, characterized in that, it includes: when both the first function and the second function of the electronic device are in the on state, determining a first integration time corresponding to the first function and a second integration time corresponding to the second function; wherein, the first integration time is less than the second integration time; the optical sensor of the electronic device collects sensing data according to the acquisition frequency determined based on the first integration time, obtains a plurality of first sensing data, and performs processing corresponding to the first function on the first sensing data to obtain a first processing result; based on the first sensing data corresponding to the second integration time, obtaining second sensing data, and performing processing corresponding to the second function on the second sensing data to obtain a second processing result.

2. The data processing method according to claim 1, characterized in that, the obtaining the second sensing data based on the first sensing data corresponding to the second integration time includes: based on the first integration time and the second integration time, determining the equivalent number of the first sensing data corresponding to the second integration time; grouping the plurality of first sensing data with the equivalent number of first sensing data that are continuous in time as a group to obtain a plurality of data groups; wherein, each second integration time corresponds to a data group; respectively adding up the first sensing data in each of the data groups to obtain the second sensing data corresponding to each second integration time.

3. The data processing method according to claim 1, characterized in that, the performing processing corresponding to the first function on the first sensing data to obtain a first processing result includes: sequentially storing each of the collected first sensing data into a preset first-in-first-out queue; when the number of the first sensing data in the first-in-first-out queue reaches a first number, reading the first number of first sensing data from the first-in-first-out queue, and performing processing corresponding to the first function on the first number of first sensing data to obtain the first processing result.

4. The data processing method according to claim 3, characterized in that, the method further includes: after finishing reading the first number of first sensing data in the first-in-first-out queue, clearing the second number of first sensing data that was stored in the first-in-first-out queue first; wherein, the second number is less than the first number; in the case of collecting the second number of first sensing data, sequentially storing the second number of first sensing data into the first-in-first-out queue.

5. The data processing method according to claim 1, characterized in that, the method further includes: in the case where it is detected that the first function is switched to the off state and the second function remains in the on state, the optical sensor collects sensing data according to the acquisition frequency determined based on the second integration time to obtain third sensing data; performing processing corresponding to the second function on the third sensing data to obtain a third processing result.

6. The data processing method according to claim 1, It is characterized in that processing the first sensing data corresponding to the first function to obtain a first processing result, including: processing the first sensing data corresponding to the first function to obtain a light flashing frequency and / or a light flashing intensity; processing the second sensing data corresponding to the second function to obtain a second processing result, including: processing the second sensing data corresponding to the second function to obtain an illumination intensity.

7. The data processing method according to claim 6, it is characterized in that the method further includes: when the electronic device detects a photographing event, switching the first function and the second function to the on state; when it is detected that both the first function and the second function are switched to the off state, turning off the optical sensor.

8. A data processing device, it is characterized in that including: a determination module configured to determine a first integration time corresponding to the first function and a second integration time corresponding to the second function when both the first function and the second function of the electronic device are in the on state; wherein, the first integration time is less than the second integration time; a first processing module configured to collect sensing data by the optical sensor of the electronic device at an acquisition frequency determined based on the first integration time, obtain a plurality of first sensing data, and process the first sensing data corresponding to the first function to obtain a first processing result; a second processing module configured to obtain second sensing data based on the first sensing data corresponding to the second integration time, and process the second sensing data corresponding to the second function to obtain a second processing result.

9. An electronic device, it is characterized in that including: a processor; a memory configured to store processor-executable instructions; wherein, the processor is configured to be able to execute the data processing method according to any one of claims 1 to 7 when calling the executable instructions in the memory.

10. A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the data processing method according to any one of claims 1 to 7 above.