A method and device for processing light-sensing data anti-shake and a computer-readable storage medium
By calculating the light sensitivity difference and brightness configuration flag variables, the problem of screen brightness jumps caused by inaccurate under-screen light sensor data is solved, and the stability of screen brightness and the automatic backlight function of mobile terminals are achieved.
Patent Information
- Application Number
- CN202211032842.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-08-26
AI Technical Summary
The data collected by the under-screen light sensor is easily affected by the screen, causing frequent changes in screen brightness and affecting the automatic backlight function of the mobile terminal.
By obtaining the current light sensitivity value, calculating the light sensitivity difference, and determining the brightness configuration flag variable based on the size of the light sensitivity difference, brightness configuration is performed only when the light sensitivity difference meets specific conditions, including filtering low-brightness scenes and accumulating light sensitivity differences, resetting intermediate variables, recording the number of times the light sensitivity value is 0, and dividing the brightness interval according to the light sensitivity value for adjustment.
It effectively prevents frequent jumps in light-sensing data, stabilizes screen brightness, avoids repeated jumps in screen brightness, and improves the stability of the automatic backlight function of mobile terminals.
Smart Images

Figure CN115373620B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of mobile terminal backlight adjustment, and in particular to a light sensing data anti-shake processing method, device, and computer-readable storage medium. Background Art
[0002] Light sensors, also known as light sensors, are sensors that sense light intensity and can adjust screen brightness based on ambient light levels. They are widely used in mobile devices. Light sensors operate based on the principle of the photoelectric effect. Conventional light sensors are typically located in locations such as the earpiece, microphone, and flash on mobile devices. These sensors are less affected by screen brightness and utilize mature technology, resulting in relatively accurate ambient brightness measurements.
[0003] However, with the increase in the screen-to-body ratio of mobile terminals, under-screen light sensors that can be placed under the display screen are now used. The under-screen light sensor module is used to collect data on the external ambient light; the display screen can configure the corresponding brightness according to the current ambient light.
[0004] However, the data collected by the under-screen light sensor will be affected by the screen and become inaccurate. If the screen image changes quickly, the collected data will also jump frequently, thereby affecting the automatic backlight function of the mobile terminal and causing the screen brightness to jump repeatedly. Summary of the Invention
[0005] Features and advantages of the invention are set forth in part in the following description, or may be obvious from the description, or may be learned through practice of the invention.
[0006] To overcome the problems of the prior art, the present invention provides a method for processing light-sensing data for anti-shake, comprising:
[0007] Obtain the current light sensitivity value, calculate the light sensitivity difference value based on it, and determine whether the brightness configuration flag variable is true or false according to the size of the light sensitivity difference value;
[0008] If the brightness configuration flag variable is false, determining whether to assign the brightness configuration flag variable a value of true according to the size of a first intermediate variable, where the first intermediate variable is the sum of the light sensitivity differences;
[0009] When the brightness configuration flag variable is true, the brightness configuration step is entered according to the current light sensitivity value.
[0010] In one embodiment of the present application, the light sensitivity difference is the difference between the current light sensitivity value and the previous light sensitivity value; when the absolute value of the light sensitivity difference is greater than a preset value, the brightness configuration flag variable is true.
[0011] In an embodiment of the present application, before calculating the light sensing difference value, it is first determined whether the current light sensing value is in the low brightness range. If not, the brightness configuration flag variable is true.
[0012] In an embodiment of the present application, the light sensing value in the low brightness range is greater than 0 and less than 40.
[0013] In an embodiment of the present application, when the brightness configuration flag variable is true and the current light sensing value is not 0, the first intermediate variable is reset to 0.
[0014] In an embodiment of the present application, denoting the current light sensing value as mlux, the brightness configuration step includes: when 0 < mlux < 10, configuring mlux = 10; when 10 <= mlux < 20, configuring mlux = 20; when 20 <= mlux < 30, configuring mlux = 30; keeping other mlux values unchanged.
[0015] In an embodiment of the present application, the brightness configuration step includes: if the current light sensing value is 0, determining whether to end the process according to the second intermediate variable, and the second intermediate variable is used to record the number of times the current light sensing value is 0.
[0016] In an embodiment of the present application, the brightness configuration step includes: when the current light sensing value is 0 and the second intermediate variable is greater than a predetermined value, saving the current light sensing value as the calculation parameter for the next calculation of the light sensing difference value.
[0017] The present application also proposes a light sensing data anti - shake processing device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the light sensing data anti - shake processing method as described in any one of the above.
[0018] The present application also proposes a computer - readable storage medium, on which a light sensing data anti - shake processing program is stored. When the light sensing data anti - shake processing program is executed by a processor, it implements the steps of the light sensing data anti - shake processing method as described in any one of the above.
[0019] A light sensing data anti - shake processing method, device, and computer - readable storage medium provided by the present invention prevent the light sensing values collected from frequently jumping by correcting the collected light sensing data, thereby affecting the automatic backlight function of the mobile phone and causing the screen brightness to repeatedly jump.
[0020] By reading the specification, those of ordinary skill in the art will better understand the features and content of these technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The present invention will be described in detail below with reference to the accompanying drawings and in combination with examples, and the advantages and implementation modes of the present invention will become more apparent. The contents shown in the accompanying drawings are only used to illustrate the present invention and do not constitute any limitation to the present invention. In the accompanying drawings:
[0022] Figure 1 Flowchart of an embodiment of a method for processing light-sensing data for anti-shake according to the present invention.
[0023] Figure 2 for Figure 1 FIG. 1 is a specific flow chart of step S10 in the light-sensing data anti-shake processing method.
[0024] Figure 3 for Figure 1 FIG. 1 is a specific flow chart of step S20 in the light sensing data anti-shake processing method.
[0025] Figure 4 for Figure 1 FIG. 1 is a specific flow chart of step S30 in the light sensing data anti-shake processing method.
[0026] Figure 5 for Figure 1 FIG. 1 is a specific flow chart of step S30 in the light sensing data anti-shake processing method. DETAILED DESCRIPTION
[0027] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0028] Example 1
[0029] Figure 1 Flowchart of the first embodiment of the light-sensing data anti-shake processing method of the present invention. This embodiment proposes a light-sensing data anti-shake processing method, the method comprising:
[0030] S10, obtaining the current light sensitivity value, and calculating the light sensitivity difference value based on the current light sensitivity value, and determining whether the brightness configuration flag variable is true or false according to the magnitude of the light sensitivity difference value;
[0031] Specifically, the software monitors the light value reported by the light sensor, saves the acquired light value as mlux, and initializes the brightness configuration flag variable updateBrightness=true.
[0032] The light difference value, luxdiff, is the difference between the current light value, mlux, and the previous light value, mlasetlux. The brightness configuration flag variable, updateBrightness, is assigned a value based on whether the absolute value of the luxdiff difference is greater than a preset value. If the absolute value of the light difference is greater than the preset value, the brightness configuration flag variable is set to true; otherwise, it is set to false. The preset value is 8 to 12, for example, 10.
[0033] S20: If the brightness configuration flag variable is false, determine whether to assign the brightness configuration flag variable a value of true based on the size of the first intermediate variable;
[0034] The first intermediate variable is the sum of the light sensitivity differences mSumlux. The light sensitivity differences in the first intermediate variable correspond to continuous light sensitivity values, and the brightness configuration flag variables corresponding to these light sensitivity values are all assigned false values.
[0035] When the absolute value of the first intermediate variable mSumlux is greater than a certain value, the brightness configuration flag variable updateBrightness is assigned a value of true; otherwise, the brightness configuration flag variable remains false. The specific value is 13 to 18, for example, 15.
[0036] S30: When the brightness configuration flag variable is true, enter the brightness configuration step according to the current light sensitivity value.
[0037] If the brightness configuration flag variable is false, the process is terminated directly or the process returns to step S10 without performing brightness configuration processing.
[0038] In this embodiment, the brightness is not adjusted for each light sensitivity value. The brightness configuration step is performed only when the brightness configuration flag variable corresponding to the light sensitivity value is true, so that the screen brightness no longer jumps repeatedly.
[0039] Example 2
[0040] Based on the above examples, please also refer to Figure 2 , Figure 2 The specific flow chart of step S10 in the light-sensing data anti-shake processing method shown in FIG. 1 is as follows:
[0041] S11. Get the current light value mlux and initialize the brightness configuration flag variable updateBrightness = true;
[0042] S12, determine whether the current light sensitivity value is in the low brightness range; if not, proceed to step S30; if so, proceed to step S13;
[0043] The light sensitivity value in the above low brightness range is greater than 0 and less than 40.
[0044] S13, obtaining the difference between the current light sensitivity value and the previous light sensitivity value, that is, the light sensitivity difference luxdiff;
[0045] S14, determine whether luxdiff is greater than 10 or less than -10; if so, proceed to step S15, if not, proceed to step S16;
[0046] S15, update brightness configuration flag variable updateBrightness = true, and go to step S20;
[0047] S16 , update the brightness configuration flag variable updateBrightness=false, and go to step S20 .
[0048] Before calculating the light sensitivity difference, this embodiment first filters the light sensitivity values in low-brightness scenes, and only processes data for low-brightness scenes with obvious brightness changes. The processing of light sensitivity values in high-brightness scenes remains basically unchanged, reducing the amount of data that needs to be processed.
[0049] Example 3
[0050] Based on any of the above examples, please also refer to Figure 3 , Figure 3 The specific flow chart of step S20 in the light-sensing data anti-shake processing method shown in FIG. 2 specifically includes:
[0051] S21, accumulating the light difference values obtained multiple times and summing mSumlux+=luxdiff;
[0052] The sum of the light sensitivity differences is the first intermediate variable introduced.
[0053] When the absolute value of mSumlux is greater than 15, the brightness configuration flag variable updateBrightness is assigned a value of true.
[0054] S22, determine whether updateBrightness = true & mlux! = 0 is satisfied; if so, proceed to step S23; if not, proceed to step S24;
[0055] S23, reset the accumulated light difference value and mSumlux=0;
[0056] It can be seen that when updateBrightness==true&&mlux!=0 is satisfied, the first intermediate variable will be reset to 0, thereby ensuring that the process of step S21 is not affected.
[0057] S24. Determine whether mSumlux>15 or mSumlux<-15. If so, proceed to step S25; if not, directly proceed to step S30. 15 is a preset specific value, and those skilled in the art can change the size of the specific value as needed.
[0058] S25 , set the update brightness configuration flag variable updateBrightness=true; reset the accumulated light difference mSumlux=0; and go to step S30 .
[0059] In this embodiment, when the brightness configuration flag variable is true and the current light sensitivity value is not 0, the first intermediate variable is reset to 0; or when the brightness configuration flag variable is updated from false to true, the first intermediate variable is also reset to 0.
[0060] Example 4
[0061] Based on any of the above examples, please also refer to Figure 4 , Figure 4 The specific flow chart of step S30 in the light-sensing data anti-shake processing method shown in FIG. 1 is shown in FIG. 2 , wherein step S30 specifically includes:
[0062] S31, determine whether the brightness configuration flag variable updateBrightness is true; if not, end the process; if so, go to step S32;
[0063] S32, determine whether mlux=0&&mrealDark<10 is satisfied; if so, proceed to step S33; if not, proceed to step S34;
[0064] Here, mrealDark is a second intermediate variable introduced to record the number of times the current light sensitivity value is 0. 10 is a predetermined value that can be set based on experience.
[0065] S33, accumulating the number of times the light sensitivity value is 0, returning to process mrealDark+=1 and ending the process;
[0066] S34, reset the number of times the accumulated light sensitivity value is 0 mrealDark=0;
[0067] S35. Record the current light sensitivity value as the last value for the next process, mlastlux=mlux; and proceed to step S36.
[0068] In this embodiment, a second intermediate variable, mrealDark, is introduced to record the number of times the mlux value is 0. When condition 1 (mlux == 0 && mrealDark < 10) is met, mrealDark is accumulated and the result is returned directly without performing brightness configuration processing. If condition 1 is not met, mrealDark is reset to 0 and the current light perception data, mlux, is saved as the next mlastlux.
[0069] In this embodiment, special processing is performed on data with a light sensor value mlux of 0, thereby largely avoiding the situation where mlux is 0 due to the user accidentally covering the light sensor.
[0070] Example 5
[0071] Based on any of the above examples, please also refer to Figure 5 , Figure 5 The specific flow chart of step S30 in the light-sensing data anti-shake processing method shown in FIG. 1 is shown in FIG. 2 , wherein step S30 specifically includes:
[0072] S36, determine whether mlux>0&&mlux<10 is satisfied, if so, proceed to step S37, if not, proceed to S38;
[0073] S37, set mlux=10, and go to step S43;
[0074] S38, determine whether mlux>=10&&mlux<20 is satisfied, if so, proceed to step S39, if not, proceed to S40;
[0075] S39, set mlux=20, and go to step S43;
[0076] S40, determine whether mlux>=20&&mlux<30 is satisfied, if so, proceed to step S41, if not, proceed to S42;
[0077] S41, set mlux=30, and go to step S43;
[0078] S42, keep the mlux value unchanged;
[0079] S43. Update the brightness according to the light sensitivity value mlux.
[0080] Following the above steps, we obtain the final light perception value (mlux). Using the preset brightness conversion formula, we determine the final screen brightness configuration value. This value is then configured in the screen driver to ensure the screen displays the required brightness. Different companies have different calculation formulas for brightness conversion, so this is not a limitation.
[0081] In this embodiment, the current light sensor value is denoted as mlux. When 0 < mlux < 10, mlux is configured to be 10; when 10 <= mlux < 20, mlux is configured to be 20; when 20 <= mlux < 30, mlux is configured to be 30; and other mlux values remain unchanged. It can be seen that in this embodiment, for darker scenarios, according to the value of ambient light, three fixed screen brightness intervals are divided, making the change in screen brightness more obvious.
[0082] Embodiment Six
[0083] Based on the above embodiments, the present invention further provides a light sensor data anti-shake processing device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the light sensor data anti-shake processing method described in any one of the above.
[0084] It should be noted that the above device embodiment and method embodiment belong to the same concept. The specific implementation process is described in detail in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the device embodiment, which will not be elaborated here.
[0085] Embodiment Seven
[0086] Based on the above embodiments, the present invention further provides a computer-readable storage medium, on which a light sensor data anti-shake processing program is stored. When the light sensor data anti-shake processing program is executed by a processor, it implements the steps of the light sensor data anti-shake processing method described in any one of the above.
[0087] It should be noted that the above medium embodiment and method embodiment belong to the same concept. The specific implementation process is described in detail in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the medium embodiment, which will not be elaborated here.
[0088] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of other identical elements in the process, method, article or device including that element.
[0089] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0090] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0091] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. A method for stabilizing light-sensing data, characterized in that: including: Obtain the current light sensing value, calculate the light sensing difference value based on this, and determine whether the brightness configuration flag variable is true or false according to the magnitude of the light sensing difference value; If the brightness configuration flag variable is false, determine whether to assign the value true to the brightness configuration flag variable according to the magnitude of the first intermediate variable, where the first intermediate variable is the sum of the light sensing difference values; When the brightness configuration flag variable is true, enter the brightness configuration step according to the current light sensing value.
2. The method for stabilizing light-sensing data according to claim 1, wherein: The light sensing difference value is the difference between the current light sensing value and the previous light sensing value; when the absolute value of the light sensing difference value is greater than a preset value, the brightness configuration flag variable is true.
3. The method for stabilizing light-sensing data according to claim 1, wherein: Before calculating the light sensing difference value, first determine whether the current light sensing value is in the low brightness range. If not, the brightness configuration flag variable is true.
4. The method for stabilizing light-sensing data according to claim 3, wherein: The light sensing value in the low brightness range is greater than 0 and less than 40.
5. The method for stabilizing light-sensing data according to claim 1, wherein: When the brightness configuration flag variable is true and the current light sensing value is not 0, the first intermediate variable is reset to 0.
6. The method for stabilizing light-sensing data according to claim 1, wherein: Denote the current light sensing value as mlux. The brightness configuration step includes: when 0 < mlux < 10, configure mlux = 10; when 10 <= mlux < 20, configure mlux = 20; when 20 <= mlux < 30, configure mlux = 30; keep other mlux values unchanged.
7. The method for stabilizing light-sensing data according to claim 1, wherein: The brightness configuration step includes: if the current light sensing value is 0, determine whether to end the process according to the second intermediate variable, where the second intermediate variable is used to record the number of times the current light sensing value is 0.
8. The method for stabilizing light-sensing data according to claim 7, wherein: The brightness configuration step includes: when the current light sensing value is 0 and the second intermediate variable is greater than a predetermined value, save the current light sensing value as the calculation parameter for the next calculation of the light sensing difference value.
9. A light-sensing data anti-shake processing device, characterized in that: The device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the light sensing data anti-shake processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that A light sensing data anti-shake processing program is stored on the computer-readable storage medium. When the light sensing data anti-shake processing program is executed by the processor, it implements the steps of the light sensing data anti-shake processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Screen sensing control method, screen sensing control device and terminal equipment
CN105959461A
Display brightness adjusting method and device, electronic equipment and storage medium
CN114792505A