Methods for determining ambient light, methods for adjusting screen brightness, and electronic devices
By establishing a binding relationship between the cutout task and the thread, the timing of the cutout operation is optimized, which solves the problem of inaccurate determination of ambient light in screen brightness adjustment and achieves matching between screen brightness and external ambient brightness.
Patent Information
- Application Number
- CN202310209414.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-02-27
AI Technical Summary
In existing technologies, the determination of ambient light is inaccurate when adjusting screen brightness, resulting in a mismatch between screen brightness and ambient light, which affects the accuracy of adjustment.
By establishing a binding relationship between the cutout task and the thread, the cutout operation and the reading operation are ensured to be performed on the same storage module. Combined with the screen display frequency, the timing of the cutout operation is optimized to improve the accuracy of ambient light determination.
It improves the accuracy of ambient light determination, ensures that the screen brightness matches the ambient brightness, and reduces the phenomenon of abnormal screen brightness adjustment.
Smart Images

Figure CN118550497B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of screen display technology, and in particular to a method for determining ambient light, a method for adjusting screen brightness, and an electronic device. Background Technology
[0002] Automatically adjusting screen brightness to match ambient light is a basic function of mobile phones and other electronic devices. When the ambient light increases, the screen brightness automatically increases; when the ambient light decreases, the screen brightness automatically decreases.
[0003] Adjusting screen brightness requires ambient light information. In related technologies, ambient light information can be determined by a sensor located beneath the screen to detect under-screen ambient light, and by an image obtained after performing a matting operation on the displayed image. The matted image is stored in a storage unit. Sometimes, when reading the stored content, discrepancies may occur between the read and saved content. This discrepancy leads to inaccurate determination of the ambient light, thus affecting the accuracy of adjusting screen brightness based on ambient light.
[0004] Therefore, improving the accuracy of determined ambient light is a pressing technical problem that needs to be solved. Summary of the Invention
[0005] In view of this, this application provides a method for determining ambient light, a method for adjusting screen brightness, and an electronic device, which can improve the accuracy of determining ambient light.
[0006] In a first aspect, this application provides a method for determining ambient light, which can be applied to electronic devices including screens. The method includes: upon detecting a first image in a compositing process and determining that a matting operation will be performed on the first image, determining a target storage module, generating a first matting task, and establishing a binding relationship between the first matting task and a first thread; wherein the target storage module is a storage module rotated among a set of preset storage modules for storing a second image, the second image is the image obtained after the first matting task performs a matting operation on the first image, and the first thread is a thread rotated among a set of preset threads for reading image information of the second image from the target storage module; when detecting a first image in a compositing process and determining that a matting operation will be performed on the first image, determining a target storage module, generating a first matting task, and establishing a binding relationship between the first matting task and a first thread; wherein, upon detecting a first image in a compositing process and determining that a first image is in a compositing process, determining a target storage module, generating a first matting task, and establishing a binding relationship between the first matting task and a first thread; wherein, upon detecting a first image ... When the conditions for performing a cutout operation are met, a first cutout task is triggered to perform a cutout operation on the first image displayed on the screen. When the cutout operation performed by the first cutout task on the first image displayed on the screen is successfully completed, a second image is saved to the target storage module, and a first thread is triggered to read the image information of the second image from the target storage module and send the image information of the second image read from the target storage module to the first processing module. The first processing module is triggered to determine the target ambient light information based on the first initial ambient light information and the image information of the second image sent by the first thread. The first initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
[0007] The technical solution provided in this embodiment establishes a binding relationship between the first image matting task and the first thread. After the first image matting task performs an image matting operation on the first image, the resulting second image is saved to the target storage module. The first thread reads the image information of the second image from the target storage module. This avoids the situation in the prior art where the saving operation and the reading operation correspond to different storage modules. Since the saving operation and the reading operation are performed on the same storage module, the content read and the content saved are consistent. When determining the ambient light, the image information of the second image read by the first thread from the target storage module can truly reflect the influence of the content displayed on the screen on the ambient light. Therefore, adopting this embodiment is beneficial to improving the accuracy of the determined ambient light.
[0008] It should be noted that in some possible implementations, the first processing module may be a sensor located below the screen.
[0009] In conjunction with the first aspect, in one embodiment, the method for determining ambient light may further include: when the first matting task fails to perform a matting operation on a first image displayed on the screen, saving the first matting task to a matting task queue, the first matting task is also used to perform a matting operation on a third image, the third image being the first image detected after the matting operation fails that is in the compositing process and is determined to be subject to the matting operation; when the conditions for performing a matting operation on the third image are met, triggering the first matting task to perform a matting operation on the third image displayed on the screen; when the first matting task successfully completes the matting operation on the third image displayed on the screen, saving the fourth image obtained after the first matting task performs the matting operation on the third image to a target storage module, and triggering a first thread to read the image information of the fourth image from the target storage module, and triggering the first thread to send the image information of the fourth image read from the target storage module to a first processing module, triggering the first processing module to determine target ambient light information based on second initial ambient light information and the image information of the fourth image sent by the first thread, the second initial ambient light information being ambient light information detected in real time by a sensor set below the screen.
[0010] The technical solution provided in this embodiment, when the first cutout task fails to perform a cutout operation on the image displayed on the screen, saves the first cutout task to the cutout task queue. When the cutout operation needs to be performed again, the first cutout task performs the cutout operation and saves the image obtained by the cutout operation to the target storage module. The first thread reads the image information from the target storage module after saving the image obtained by the first cutout task, so that the read content is consistent with the saved content. When determining the ambient light, the image information of the fourth image read by the first thread from the target storage module can truly reflect the influence of the content displayed on the screen on the ambient light. Therefore, even if the cutout operation fails, it can still be guaranteed that the subsequent save and read operations correspond to the same storage module. Therefore, adopting this embodiment is beneficial to improving the accuracy of the determined ambient light.
[0011] In conjunction with the first aspect, in one embodiment, the method for determining ambient light may further include: detecting the current display frequency of the screen when any image processing synthesis process is detected; and determining that a matting operation will be performed on any image when the display frequency is not greater than a first threshold.
[0012] This embodiment provides the criteria for determining whether to perform a matting operation on an image in the compositing process. When the screen display frequency is no greater than a first threshold, a matting operation is determined to be performed on each frame of the image in the compositing process. This embodiment is beneficial for determining ambient light in a timely manner based on the updated content displayed on the screen when the screen display frequency is lower than the first threshold.
[0013] In conjunction with the first aspect, in one embodiment, the method for determining ambient light may further include: determining a first time interval when the display frequency is greater than a first threshold; the first time interval is the interval between a first initial moment and a second initial moment, the first initial moment is the initial moment when any image is in the compositing process, and the second initial moment is the initial moment when the image preceding the image that is closest to the image and is determined to be subject to a matting operation is in the compositing process; determining that a matting operation will be performed on the image when the first time interval is greater than a second threshold; and determining that a matting operation will not be performed on the image when the first time interval is not greater than the second threshold.
[0014] This embodiment provides the criteria for determining whether to perform a matting operation on an image in the compositing process. When the screen display frequency is greater than a first threshold, it is determined whether a first time interval is greater than a second threshold. If the first time interval is greater than the second threshold, it is determined that a matting operation will be performed on the image; if the first time interval is not greater than the second threshold, it is determined that no matting operation will be performed on the image. This embodiment addresses the issue that frequent matting operations can negatively impact the performance of electronic devices when the screen display frequency is high. Therefore, by only determining whether to perform a matting operation when the first time interval is greater than the second threshold, this embodiment facilitates timely ambient light detection while avoiding the impact of frequent matting operations on the performance of electronic devices.
[0015] In conjunction with the first aspect, in one implementation, the condition for performing a matting operation on any image is met, including: when a first signal is acquired, determining that the condition for performing a matting operation on the any image is met; the first signal is a signal generated after the any image in the compositing process is completed and displayed on the screen.
[0016] In conjunction with the first aspect, in one implementation, the condition for performing a matting operation on any image is met, including: determining that the condition for performing a matting operation on the any image is met when a second signal generated by the second processing module is received; the second processing module is used to trigger the generation of the second signal after determining that the compositing of the any image in the compositing process is completed and displayed on the screen.
[0017] Secondly, this application provides a screen brightness adjustment method, which executes the ambient light determination method provided in the first aspect or any possible implementation of the first aspect to determine target ambient light information, and adjusts the screen brightness of the electronic device according to the target ambient light information.
[0018] Thirdly, this application provides an electronic device, including: a screen, a sensor disposed below the screen, a memory, and one or more processors, wherein the screen, the sensor, the memory, and the processors are coupled; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method provided in the first aspect, any possible implementation of the first aspect, or the second aspect.
[0019] Fourthly, this application provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the method provided in the first aspect, any possible implementation of the first aspect, or the second aspect.
[0020] Fifthly, this application provides a computer program product including instructions that, when the computer program product is run on a computer, cause the computer to perform, according to the instructions, the first aspect, any possible implementation of the first aspect, or the method provided in the second aspect.
[0021] It is understood that the beneficial effects achieved by the screen brightness adjustment method of the second aspect, the electronic device of the third aspect, the computer-readable storage medium of the fourth aspect, and the computer program product of the fifth aspect provided above can be referred to the beneficial effects of the first aspect and any possible implementation thereof, which will not be repeated here. Attached Figure Description
[0022] Figure 1 This is a diagram illustrating how related technologies store and retrieve content displayed on a screen;
[0023] Figure 2 This is a flowchart illustrating a method for determining ambient light provided in an embodiment of this application;
[0024] Figure 3 This is a flowchart illustrating a method for determining ambient light according to another embodiment of this application;
[0025] Figure 4 This is a schematic diagram of the image processing process provided in the embodiments of this application;
[0026] Figure 5 This is a schematic diagram illustrating the relationship between screen display frequency and image matting provided in an embodiment of this application;
[0027] Figure 6 This is another schematic diagram illustrating the relationship between screen display frequency and image matting provided in an embodiment of this application;
[0028] Figure 7This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0029] Figure 8 This is a block diagram of a software system for an electronic device provided in an embodiment of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0031] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0032] When using electronic devices with screens such as mobile phones and tablets, the screen brightness automatically adjusts according to the ambient brightness. However, in some technologies, the screen brightness sometimes exhibits abrupt changes that don't match the ambient brightness. Analysis revealed that this is caused by a mismatch between the image cutout information obtained by the processor and the content currently displayed on the screen. See also... Figure 1 , Figure 1 This is a schematic diagram illustrating the storage and retrieval of content displayed on a screen using related technologies. For simplicity, this embodiment uses a mobile phone as an example. The mobile phone has multiple storage modules (e.g., three). These three modules are: Module 0 (buffer0), Module 1 (buffer1), and Module 2 (buffer2), used to rotate and store images obtained from the cutout operation. Correspondingly, three rotating threads are set up: Thread 0, Thread 1, and Thread 2, used to read image information from the storage modules. A rotating task queue is also set up to perform the cutout operation: Task 0 (cutout task 0 with handle id = 0), Task 1 (cutout task 0 with handle id = 1), and Task 2 (cutout task 0 with handle id = 2). Figure 1 The rounded rectangle in the diagram schematically represents the storage module used for rotating and storing the image obtained from the cutout operation.
[0033] Next, examples and analyses of the shortcomings of the relevant technologies will be provided. The processing of images on the screen includes steps 1 to 6, wherein:
[0034] Step 1: Assuming the phone screen was previously displaying a black image, after the cutout operation, all three buffers are filled with black images, such as... Figure 1 The 0th row, with index 0, shows the initial storage state of the three buffers.
[0035] Step 2: Assume the image displayed on the phone screen switches from a black screen to a white screen, and prepare to start the cutout operation.
[0036] Step 3: Assume that the current rotation is to fill buffer 0 with matting data, generating a matting task with handle id = 0, and adding the matting task with handle id = 1 to the matting task queue. When the matting conditions are met, the matting task with handle id = 0 in the queue is executed. If the matting operation is successfully completed, the matting data obtained is stored in buffer 0. Buffer 0 stores the white image data corresponding to the white image obtained from the matting operation. The image data stored in the three buffers are as follows: Figure 1 As shown in the first row with sequence number 1, the cutout task with handle id=0 is subsequently removed from the cutout task queue.
[0037] Then, Thread 0 reads the data stored in buffer 0 and sends it to the sensor located under the screen for detecting ambient light. In other words, buffer 0 is filled with a white image, and Thread 0 reads the white image data stored in buffer 0 and sends it to the sensor. It should be noted that the module receiving the white image data read from buffer 0 by Thread 0 can be the sensor or other processing modules with processing capabilities; this is not limited here.
[0038] Step 4: Next, the loop turns to buffer1. Buffer1 triggers the generation of a cutout task with handle id=1 and adds it to the cutout task queue. Assuming that the cutout task with handle id=1 fails to execute, buffer1 is not updated, and the cutout task with handle id=1 accumulates in the queue. At this time, the corresponding Thread1 idles, neither reading cutout data nor transmitting data to the sensor. In other words, buffer1 is not updated, and it still contains the original black image data.
[0039] Step 5: Then, the loop turns to buffer 2. Buffer 2 triggers the generation of a cutout task with handle id=2, and this task is placed into the cutout task queue. At this time, the cutout task with handle id=1 that has been piling up in the queue will be executed. If the cutout operation is successfully completed, buffer 1 is filled with a white image, and the task with handle id=2 continues to pile up in the queue. The loop turns to Thread 2 to read the data in buffer 2 and send it to the sensor. At this time, the data stored in buffer 2 has not been updated and is still the original black image data. That is, when the white image interface is displayed on the screen, black image data is abnormally read and sent to the sensor. According to the formula: Real ambient light = Original ambient light - Blending noise, it should be noted that blending noise may be generated by various factors. For simplicity, blending noise is represented by the data sent to the processing module by the thread obtained by the processing module. The blending noise value originally corresponds to the grayscale value of 255 of the white image, but now the blending noise is abnormally calculated as 0. In other words, the calculated grayscale value corresponding to the actual ambient light is too high, causing the phone's brightness to adjust abnormally and the screen to become abnormally bright.
[0040] Step 6: Then, the loop turns to buffer 0. Buffer 0 triggers the generation of a cutout task with handle id=0 and puts the cutout task with handle id=0 into the cutout task queue. At this time, the cutout task with handle id=2 that has been piled up in the cutout task queue will be executed. If the cutout operation is successfully completed, buffer 2 will be filled with a white image. The cutout task with handle id=0 will pile up in the queue. The loop turns to Thread 0 to retrieve the data from buffer 0. At this time, buffer 0 has not been updated and is still the white image data that was filled in step 3.
[0041] It should be noted that in some implementations, to reduce data transmission, if the data read by the current thread is the same as the data corresponding to the image obtained from the previous cutout operation, the data read by the current thread may not be sent to the sensor until the screen changes color and the data corresponding to the image obtained from the cutout operation changes, at which point the data read by the thread will be sent to the sensor again. Therefore, if an error occurs in step 5, the error may persist until the image obtained from the cutout operation changes.
[0042] It should be noted that because the read buffer is inconsistent with the buffer updated in the current frame, the screen noise obtained by the sensor does not match the current content displayed on the screen. Specifically, when the problem occurs, if the image matting operation fails in one frame but succeeds in the next frame, Thread2 might read data from buffer2 and send it to the sensor upon successful matting. However, the data in buffer2 is not actually updated upon successful matting; instead, the data in buffer1 is updated. To solve this problem, the solution provided in this application is to bind the matting task to the thread. Taking the previous scenario as an example, when the matting operation succeeds in the next frame after a failed operation, Thread1 continues to read the updated data from buffer1 and send it to the sensor. In other words, the matting task is bound to the thread, and when the matting operation in the current frame is successfully completed, the buffer storing the matted image is the same buffer read by the thread. This helps the processing module obtain the actual image information obtained from the matting operation, thus improving the accuracy of the determined ambient light.
[0043] It should be noted that the electronic devices involved in the embodiments of this application are electronic devices with screens, specifically mobile phones, tablets, smart wearable devices, etc., and the specific type of electronic device is not limited in the embodiments of this application. For ease of understanding, the method for determining ambient light provided in this application will be described in detail below using a mobile phone as an example.
[0044] See Figure 2 , Figure 2 This is a flowchart illustrating a method for determining ambient light according to an embodiment of this application. In this embodiment, the method for determining ambient light includes steps 201 to 203, wherein:
[0045] 201. When a first image in the compositing process is detected and it is determined that a matting operation will be performed on the first image, a target storage module is determined, a first matting task is generated, and a binding relationship is established between the first matting task and the first thread.
[0046] The target storage module is a storage module that is rotated among a number of preset storage modules to store the second image. The second image is the image obtained after the first image matting task performs an image matting operation on the first image. The first thread is a thread that is rotated among a number of preset threads to read image information from the target storage module.
[0047] It should be noted that the compositing process has a step, and the display of the first image on the screen after compositing also takes a step, such as... Figure 4 As shown, in one embodiment, at t01 The first image enters the synthesis process at time t, triggering the generation of the first message. 02 The synthesis process is completed at all times, in t 03 Once the first image is displayed on the screen, the electronic device generates a second message, calls a second interface function to query this second message, and upon receiving the second message, determines that the conditions for performing a cutout operation on the first image are met, triggering the first cutout task to perform the cutout operation on the first image displayed on the screen. It should be noted that the cutout operation can be performed on the entire screen or on a portion of the screen. For example, the cutout area can be set to a square area with a side length of 50 pixels, centered on the sensor set at the bottom of the screen.
[0048] In a different embodiment, where the electronic device calls a second interface function to determine whether the first image has been fully displayed on the screen, a first module in the electronic device (such as a chip in the electronic device) has the function of detecting whether the synthesized image has been fully displayed on the screen, and when the first image is fully displayed on the screen, the first module is triggered to generate a third message to perform a cutout operation on the first image. When the electronic device receives the third message, it triggers a first cutout task to perform a cutout operation on the first image displayed on the screen.
[0049] When an image is in the compositing process, the electronic device is triggered to send a first signal, notifying that an image is in the compositing process. Calling the first interface function that queries this first signal can determine whether an image is in the compositing process. Figure 4 As shown, assuming at t 01 If the first image is in the compositing process, the electronic device is triggered to generate a first message. After the first interface function obtains the first message, it determines that a first image in the compositing process has been detected.
[0050] When an image is in the compositing process, it's necessary to further determine whether to perform a matting operation on that image. To reduce the power consumption of electronic devices, while considering both real-time performance and power efficiency, we can determine whether to perform a matting operation on the image currently in the compositing process based on the screen's display frequency. When any image is detected in the compositing process, the screen's current display frequency is detected; a first threshold is set to 100Hz. It should be noted that the first threshold can also be other values, and the specific value can be set based on experience. For example... Figure 5As shown, if the current screen frequency is less than 100Hz, for example, if the current screen frequency is 60Hz or 90Hz, then it can be determined that the matting operation will be performed on each frame of the image in the compositing process. If the current screen frequency is greater than a first threshold, then it can be determined that frame-by-frame matting will be performed. For example, if the current screen frequency is 120Hz, then it can be determined that frame-by-frame matting will be performed on the image in the current compositing process.
[0051] In non-continuous image matting, the specific image to be matted is determined by referring to the interval between adjacent frames corresponding to a first threshold. When the display frequency is greater than the first threshold, a first time interval is determined. The first time interval is the interval between a first initial moment and a second initial moment. The first initial moment is the initial moment when any image is in the compositing process, and the second initial moment is the initial moment when the image preceding the first image that is closest to the first image and is determined to have its matting operation performed is in the compositing process. When the first time interval is greater than the second threshold, it is determined that the matting operation will be performed on the first image; when the first time interval is not greater than the second threshold, it is determined that the matting operation will not be performed on the first image. For example, when the first threshold is 100Hz, the interval between adjacent frames is 10ms, and 10ms is set as the second threshold. If the current screen display frequency is 120Hz... Figure 6 The image shows three adjacent images: Image 1, Image 2, and Image 3, which are at the initial time of the compositing process, t1, t2, and t3 respectively. 01 t 11 t 21 The synthesis was completed at time t. 02 t 12 t 22 The completion times displayed on the screen are t and t, respectively. 03 t 13 t 23 Assuming image one will be subject to image matting, whether images two and three will also be subject to image matting depends on... Figure 6 The time interval is determined as follows: if the time interval is no more than 10ms, the current frame will not be subjected to the matting operation; if the time interval is greater than 10ms, the current frame will be subjected to the matting operation. Figure 6 If Δt1 = 8.3ms and Δt1 < 10ms, then image matting will not be performed on image two. If Δt2 = 16.6ms and Δt1 > 10ms, then image matting will be performed on image three.
[0052] 202. When the conditions for performing a cutout operation on the first image are met, the first cutout task is triggered to perform a cutout operation on the first image displayed on the screen.
[0053] 203. When the first image matting task successfully completes the image matting operation on the first image displayed on the screen, the second image is saved to the target storage module, the first thread is triggered to read the image information of the second image from the target storage module, and the first thread is triggered to send the image information of the second image read from the target storage module to the first processing module, and the first processing module is triggered to determine the target ambient light information based on the first initial ambient light information and the image information of the second image sent by the first thread.
[0054] The technical solution provided in this embodiment establishes a binding relationship between the first image matting task and the first thread. After the first image matting task performs an image matting operation on the first image, the resulting second image is saved to the target storage module. The first thread reads the image information of the second image from the target storage module. This avoids the situation in the prior art where the saving operation and the reading operation correspond to different storage modules. Since the saving operation and the reading operation are performed on the same storage module, the content read and the content saved are consistent. When determining the ambient light, the image information of the second image read by the first thread from the target storage module can truly reflect the influence of the content displayed on the screen on the ambient light. Therefore, adopting this embodiment is beneficial to improving the accuracy of the determined ambient light.
[0055] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a method for determining ambient light according to an embodiment of this application. In this embodiment, the method for determining ambient light includes steps 301 to 306, wherein:
[0056] 301. When a first image in the compositing process is detected and it is determined that a matting operation will be performed on the first image, a target storage module is determined, a first matting task is generated, and a binding relationship is established between the first matting task and the first thread.
[0057] The target storage module is a storage module that is rotated among a number of preset storage modules to store the second image. The second image is the image obtained after the first image matting task performs an image matting operation on the first image. The first thread is a thread that is rotated among a number of preset threads to read image information from the target storage module.
[0058] It should be noted that the compositing process has a step, and the display of the first image on the screen after compositing also takes a step, such as... Figure 4 As shown, in one embodiment, at t 02 The synthesis process is completed at all times, in t 03Once the first image is fully displayed on the screen, the electronic device sends a second message indicating that the image display is complete. This message is then used to query a second interface function. Upon receiving the second message, the function determines that the conditions for performing a cutout operation on the first image are met and triggers the first cutout task to perform the cutout operation on the first image displayed on the screen. It should be noted that the cutout operation can be performed on the entire screen or on a specific area. For example, it can be set that the cutout area is a square region with sides of 50 pixels, centered on the sensor located at the bottom of the screen.
[0059] In another embodiment, unlike the electronic device calling the second interface function to determine whether the first image has been displayed on the screen, when the first module in the electronic device, such as a chip, has the function of detecting whether the synthesized image has been displayed on the screen, and when the first image is displayed on the screen, a third message is triggered to perform a cutout operation on the first image. When the electronic device receives the third message, it triggers the first cutout task to perform a cutout operation on the first image displayed on the screen.
[0060] When an image is in the compositing process, the electronic device will send a first signal to notify that an image is in the process. Calling the first interface function that queries this first signal can determine whether an image is in the compositing process. Figure 4 As shown, assuming at t 01 When the first image is in the compositing process, the electronic device is triggered to generate the first message. After the first interface function obtains the first message, it determines that a first image in the compositing process has been detected.
[0061] To reduce the power consumption of electronic devices, when an image is in the compositing process, it is necessary to further determine whether to perform a matting operation on that image. Balancing real-time performance and power consumption, we determine whether to perform a matting operation on the image currently in the compositing process based on the screen display frequency. When any image is detected in the compositing process, the current screen display frequency is detected; a first threshold can be set to 100Hz, such as... Figure 5 As shown, if the current display frequency of the screen is less than 100Hz, such as 60Hz or 90Hz, then the matting operation is performed on each frame of the image in the compositing process. If the current display frequency of the screen is greater than the first threshold of 100Hz, then frame-by-frame matting is performed. For example, if the current display frequency of the screen is 120Hz, then frame-by-frame matting is performed on the image in the current compositing process.
[0062] When performing non-continuous image matting, the specific image to be matted can be determined by referring to the interval between adjacent frames corresponding to a first threshold. When the display frequency is greater than the first threshold, a first time interval is determined. The first time interval is the interval between a first initial moment and a second initial moment. The first initial moment is the initial moment when any image is in the compositing process, and the second initial moment is the initial moment when the image preceding the first image that is closest to the first image and is determined to have its matting operation performed is in the compositing process. When the first time interval is greater than the second threshold, it is determined that the matting operation will be performed on the first image; when the first time interval is not greater than the second threshold, it is determined that the matting operation will not be performed on the first image. For example, when the first threshold is 100Hz, the interval between adjacent frames is 10ms, and 10ms is set as the second threshold. Figure 6 As shown, if the current display frequency of the screen is 120Hz, Figure 6 The image shows three adjacent images: Image 1, Image 2, and Image 3, which are at the initial time of the compositing process, t1, t2, and t3 respectively. 01 t 11 t 21 The synthesis was completed at time t. 02 t 12 t 22 The completion times displayed on the screen are t and t, respectively. 03 t 13 t 23 Assuming image one will be subject to image matting, whether images two and three will also be subject to image matting depends on... Figure 6 The time interval is determined as follows: if the time interval is no more than 10ms, the current frame will not be subjected to the matting operation; if the time interval is greater than 10ms, the current frame will be subjected to the matting operation. Figure 6 If Δt1 = 8.3ms and Δt1 < 10ms, then image matting will not be performed on image two. If Δt2 = 16.6ms and Δt1 > 10ms, then image matting will be performed on image three.
[0063] 302. When the conditions for performing a cutout operation on the first image are met, the first cutout task is triggered to perform a cutout operation on the first image displayed on the screen.
[0064] 303. Determine whether the image cutout operation was successfully completed.
[0065] If yes, proceed to step 304; otherwise, proceed to step 305.
[0066] 304. When the first image matting task successfully completes the image matting operation on the first image displayed on the screen, the second image is saved to the target storage module, the first thread is triggered to read the image information of the second image from the target storage module, and the first thread is triggered to send the image information of the second image read from the target storage module to the first processing module, and the first processing module is triggered to determine the target ambient light information based on the first initial ambient light information and the image information of the second image sent by the first thread.
[0067] 305. Save the first cutout task to the cutout task queue. The first cutout task is also used to perform cutout operation on the third image. The third image is the first image detected after the cutout operation fails that is in the compositing process and is determined to be subject to cutout operation. When the conditions for performing cutout operation on the third image are met, the first cutout task is triggered to perform cutout operation on the third image displayed on the screen.
[0068] 306. When the first cutout task successfully completes the cutout operation on the third image displayed on the screen, the fourth image obtained after the first cutout task performs the cutout operation on the third image is saved to the target storage module, and the first thread is triggered to read the image information of the fourth image from the target storage module, and the first thread is triggered to send the image information of the fourth image read from the target storage module to the first processing module. The first processing module is triggered to determine the target ambient light information based on the second initial ambient light information and the image information of the fourth image sent by the first thread. The second initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
[0069] The technical solution provided in this embodiment, when the first cutout task fails to perform a cutout operation on the image displayed on the screen, saves the first cutout task to the cutout task queue. When the cutout operation needs to be performed again, the first cutout task performs the cutout operation and saves the image obtained by the cutout operation to the target storage module. The first thread reads the image information from the target storage module after saving the image obtained by the first cutout task, so that the read content is consistent with the saved content. When determining the ambient light, the image information of the fourth image read by the first thread from the target storage module can truly reflect the influence of the content displayed on the screen on the ambient light. Therefore, even if the cutout operation fails, it can still be guaranteed that the subsequent save and read operations correspond to the same storage module. Therefore, adopting this embodiment is beneficial to improving the accuracy of the determined ambient light.
[0070] Based on the ambient light determination method provided in the embodiments of this application, this application also provides a screen brightness adjustment method. The screen brightness adjustment method includes: obtaining target ambient light information using the ambient light determination method described in any of the preceding embodiments, and then adjusting the brightness of the electronic device's screen according to the obtained target ambient light information. The ambient light determination method is as described above and will not be repeated here. When adjusting the screen brightness using this embodiment, the adjusted brightness matches the ambient light.
[0071] Next, the electronic devices involved in the embodiments of this application will be described.
[0072] Figure 7 This is a structural schematic diagram of an electronic device 700 provided in an embodiment of this application, which can specifically be a mobile phone, tablet computer, wearable device, or other similar device. See also Figure 7 The electronic device 700 may include a processor 710, an external memory interface 720, an internal memory 721, a universal serial bus (USB) interface 730, a charging management module 740, a power management module 741, a battery 742, an antenna 1, an antenna 2, a mobile communication module 750, a wireless communication module 760, an audio module 770, a speaker 770A, a receiver 770B, a microphone 770C, a headphone jack 770D, a sensor module 780, buttons 790, a motor 791, an indicator 792, a camera 793, a screen 794, and a subscriber identification module (SIM) card interface 795, etc. The sensor module 780 may include a pressure sensor 780A, a gyroscope sensor 780B, a barometric pressure sensor 780C, a magnetic sensor 780D, an accelerometer sensor 780E, a distance sensor 780F, a proximity light sensor 780G, a fingerprint sensor 780H, a temperature sensor 780J, a touch sensor 780K, an ambient light sensor 780L, a bone conduction sensor 780M, etc.
[0073] The processor 710 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0074] The controller can serve as the nerve center and command center of the electronic device 700. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.
[0075] The processor 710 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 710 is a cache memory. This memory can store instructions or data that the processor 710 has just used or that are used repeatedly. If the processor 710 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 710, and thus improves the efficiency of the system.
[0076] Electronic device 700 implements display functions through a GPU, a screen 794, and an application processor. The GPU is a microprocessor for image processing, connecting the screen 794 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 710 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0077] Screen 794 is used to display images, videos, etc. Screen 794 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Minied, MicroLED, Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 700 may include one or N screens 794, where N is an integer greater than 1.
[0078] Electronic device 700 can achieve shooting function through ISP, camera 793, video codec, GPU, screen 794 and application processor.
[0079] The ISP (Image Signal Processor) is used to process data fed back from the camera 793. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's image sensor. The light signal is converted into an electrical signal, and the image sensor transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimizations on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be integrated into the camera 793.
[0080] Camera 793 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, electronic device 700 may include one or N cameras 793, where N is an integer greater than 1.
[0081] The external storage interface 720 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 700. The external memory card communicates with the processor 710 through the external storage interface 720 to perform data storage functions, such as saving music, video, and other files on the external memory card.
[0082] Internal memory 721 can be used to store computer-executable program code, which includes instructions. Processor 710 executes various functional applications and data processing of electronic device 700 by running the instructions stored in internal memory 721. Internal memory 721 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created by electronic device 700 during use (such as audio data, phonebook, etc.). Furthermore, internal memory 721 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0083] The accelerometer 780E can detect the magnitude of acceleration of the electronic device 700 in various directions (generally three axes). When the electronic device 700 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 780E can also be used to identify the attitude of the electronic device 700, and can be applied to applications such as screen orientation switching and pedometers. Of course, the accelerometer 780E can also be combined with the gyroscope sensor 780B to identify the attitude of the electronic device 700, and can be applied to screen orientation switching.
[0084] The gyroscope sensor 780B can be used to determine the motion attitude of the electronic device 700. In some embodiments, the gyroscope sensor 780B can determine the angular velocity of the electronic device 700 around three axes (i.e., the x, y, and z axes). The gyroscope sensor 780B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 780B detects the angle of the electronic device 700's shake, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 700 through reverse movement, thus achieving image stabilization. The gyroscope sensor 780B can also be used in landscape / portrait switching, navigation, and motion-sensing game scenarios.
[0085] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 700. In other embodiments of this application, the electronic device 700 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0086] The electronic devices provided in this application embodiment can be user equipment (UE), such as mobile terminals (e.g., mobile phones), tablet computers, desktop computers, laptop computers, handheld computers, netbooks, personal digital assistants (PADs), and other devices.
[0087] In addition, an operating system runs on top of the aforementioned components. Examples include Apple's iOS operating system, Google's Android open-source operating system, and Microsoft's Windows operating system.
[0088] The software system of the electronic device 700 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. To more clearly illustrate the display optimization method during screen rotation provided in this application embodiment, this application embodiment uses a layered Android system as an example to exemplify the software system of the electronic device 700.
[0089] Figure 8 This is a block diagram of a software system for an electronic device 700 provided in an embodiment of this application. See also... Figure 8 An electronic device may include a hardware layer and a software layer. The layered architecture of the Android system may include an application layer, an application framework layer, a system library layer, and a kernel layer. In some alternative embodiments, the electronic device's system may also include layers not mentioned in the above technical architecture, such as the Android Runtime.
[0090] The application layer can include a series of application packages, such as navigation apps, music apps, and video apps. For example... Figure 8 As shown, the application package may include applications such as video and chat, as well as the system user interface (System UI).
[0091] Video and chat applications are used to provide corresponding services to users. For example, users use video applications to watch videos, chat applications to chat with other users, and music applications to listen to music.
[0092] SystemUI is used to manage the user interface (UI) of electronic devices. In this embodiment, SystemUI is used to manage the display of composite images on the screen.
[0093] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. For example... Figure 8 As shown, the application framework layer may include a window management service (WMS), a display rotation module (also known as DisplayRotation), an application management service (AMS), and an input management module (also known as Input), etc.
[0094] WMS is used to manage window applications. The window manager can obtain the screen size, determine if a status bar exists, and perform tasks such as cropping images from the screen. In this embodiment, WMS can create and manage windows corresponding to the application.
[0095] The display rotation module controls screen rotation, allowing the screen to switch between portrait and landscape orientations. For example, when screen rotation is required, it notifies SurfaceFlinger to switch the application interface between portrait and landscape modes.
[0096] AMS is used to launch specific applications based on user actions. For example, after the image compositing process is completed, the image is triggered to be displayed prominently on the screen. After the image is displayed, the image that needs to be matted is triggered to perform the matting operation, and the application stack corresponding to the video application is created so that the video application can run normally.
[0097] The system library layer can include multiple functional modules, such as: sensor module (also known as sensor) and SurfaceFlinger.
[0098] The sensor module is used to acquire data collected by sensors, such as ambient light under the screen and gravity direction information of the electronic device. Alternatively, the sensor module can also adjust the screen brightness based on ambient light and determine the screen orientation (landscape or portrait) based on the gravity direction information of the electronic device, indicating whether the electronic device is in landscape or portrait mode.
[0099] Surfaceflinger is a system service used for creating, controlling, and managing layers.
[0100] In addition, the system library layer may include: a surface manager, media libraries, 3D graphics processing libraries (such as OpenGL ES), and 2D graphics engines (such as SGL). The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0101] The kernel layer is the layer between hardware and software. In this embodiment, the kernel layer includes at least a touch driver module and a display driver module.
[0102] The display driver module is used to display composite images on the screen based on image data provided by modules in the application framework layer and applications in the application layer. For example, a video application passes a frame of video image data to the display driver module, which then displays that frame on the touchscreen. Similarly, SystemUI passes image data to the display driver module, which then displays the composite image on the screen.
[0103] The touch driver module is used to monitor the capacitance values of different areas of the touchscreen. When a user clicks or swipes on the touchscreen, the capacitance value of the clicked or swipe area changes. The touch driver module can detect the changes in capacitance values of different areas of the touchscreen and send capacitance change messages to the input management module. The capacitance change messages carry information such as the magnitude of the change in capacitance value (or capacitance sampling value) of each area of the touchscreen and the time of the change.
[0104] The input management module can determine the touch operation based on the reported capacitance value change message, and then send the recognized touch operation to other modules. The touch operation here can include click operation, drag operation, and specific gesture operation (such as swipe up gesture, swipe down gesture, etc.).
[0105] The hardware layer includes the screen and an ambient light sensor, which detects ambient light information beneath the screen. When the ambient light sensor has processing capabilities, it can acquire image information corresponding to the matting operation, determine the actual ambient light information based on the image information obtained from the matting operation and the detected ambient light information beneath the screen, and generate an adjustment signal to adjust the screen brightness based on the actual ambient light information.
[0106] It should be noted that although the embodiments of this application are described using the Android system as an example, the basic principles are also applicable to electronic devices based on operating systems such as iOS or Windows.
[0107] The above technical architecture lists the modules and devices that may be involved in this application in an electronic device. In practical applications, the electronic device may include all or part of the modules and devices of the above technical architecture, as well as other modules and devices not mentioned in the above technical architecture. Of course, it may also include only the modules and devices of the above technical architecture, and this embodiment does not limit this.
[0108] To facilitate understanding of the ambient light determination method provided in the embodiments of this application, the following will first be combined with... Figure 8 The technical architecture of the electronic device shown is illustrated using a mobile phone as an example to explain the implementation of the ambient light determination method provided in this application.
[0109] exist Figure 7 The processor 710 in the middle detects the first image in the compositing process and determines that a matting operation will be performed on the first image. It then determines the target storage module, generates the first matting task, and establishes a binding relationship between the first matting task and the first thread. The target storage module is a storage module used to store the second image that is rotated among a plurality of preset storage modules. The plurality of preset storage modules are located in the internal memory. The second image is the image obtained after the first matting task performs a matting operation on the first image. The first thread is a thread used to read the image information of the second image from the target storage module that is rotated among a plurality of preset threads.
[0110] When the processor 710 determines that the conditions for performing a cutout operation on the first image are met, it triggers the first cutout task to perform a cutout operation on the first image displayed on the screen.
[0111] When the first image cutout task successfully completes the image cutout operation on the first image displayed on the screen, the second image is saved to the target storage module, and the first thread is triggered to read the image information of the second image from the target storage module and send the image information of the second image read from the target storage module to the first processing module; the first processing module is triggered to determine the target ambient light information based on the first initial ambient light information and the image information of the second image sent by the first thread. The first initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
[0112] Furthermore, when the first matting task fails to perform a matting operation on the first image displayed on the screen, the first matting task is saved to the matting task queue. The first matting task is also used to perform a matting operation on the third image, which is the first image detected after the matting operation fails that is in the compositing process and is determined to be subject to the matting operation. When the conditions for performing a matting operation on the third image are met, the first matting task is triggered to perform a matting operation on the third image displayed on the screen.
[0113] When the first cutout task successfully completes the cutout operation on the third image displayed on the screen, the fourth image obtained after the first cutout task performs the cutout operation on the third image is saved to the target storage module. The first thread is triggered to read the image information of the fourth image from the target storage module and to send the image information of the fourth image read from the target storage module to the first processing module. The first processing module is triggered to determine the target ambient light information based on the second initial ambient light information and the image information of the fourth image sent by the first thread. The second initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
[0114] In some possible implementations, the processor 710 is also configured to: detect the current display frequency of the screen when any image processing compositing process is detected; and determine that a matting operation will be performed on any image when the display frequency is not greater than a first threshold.
[0115] In some possible implementations, the processor 710 is further configured to: determine a first time interval when the display frequency is greater than a first threshold; the first time interval is the interval between a first initial moment and a second initial moment, the first initial moment being the initial moment when any image is in the compositing process, and the second initial moment being the initial moment when the image preceding any image is closest to the image and is determined to be subject to a matting operation; determine that a matting operation will be performed on any image when the first time interval is greater than a second threshold; and determine that a matting operation will not be performed on any image when the first time interval is not greater than the second threshold.
[0116] In some possible implementations, the conditions for performing a matting operation on any image are met, including: determining that the conditions for performing a matting operation on any image are met when a first signal is acquired; the first signal is a signal generated after the compositing of any image in the compositing process is completed and displayed on the screen.
[0117] In some possible implementations, the conditions for performing a matting operation on any image are met, including: determining that the conditions for performing a matting operation on the any image are met when a second signal generated by the second processing module is received; the second processing module is used to trigger the generation of the second signal after determining that the compositing of any image in the compositing process is completed and displayed on the screen.
[0118] In some possible implementations, the processor 710 may also adjust the brightness of the screen of the electronic device according to the ambient light determination method described in any of the preceding method embodiments.
[0119] The technical solution provided in this application establishes a binding relationship between the first matting task and the first thread. After the first matting task performs a matting operation on the first image, the resulting second image is saved to the target storage module. The first thread reads the image information of the second image from the target storage module. This avoids the situation in the prior art where the saving operation and the reading operation correspond to different storage modules. In this embodiment, since the saving operation and the reading operation are performed on the same storage module, the content read is consistent with the content saved. When determining the ambient light, the image information of the second image read by the first thread from the target storage module can truly reflect the influence of the content displayed on the screen on the ambient light. Therefore, adopting this embodiment is beneficial to improving the accuracy of the determined ambient light.
[0120] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0121] This application provides a computer program product, which includes a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0122] This application implements all or part of the processes in the methods of the above embodiments, which can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographic device / electronic device, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0123] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0124] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0125] In the embodiments provided in this application, it should be understood that the disclosed methods and electronic devices can be implemented in other ways. For example, the device / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0128] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0129] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0130] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for determining ambient light, characterized in that, Applied to an electronic device including a screen, the method includes: When a first image is detected in the compositing process and it is determined that a matting operation will be performed on the first image, a target storage module is determined, a first matting task is generated, and a binding relationship is established between the first matting task and a first thread; wherein, the target storage module is a storage module used to store the second image that is rotated among a plurality of preset storage modules, the second image is the image obtained after the first matting task performs the matting operation on the first image, and the first thread is a thread used to read image information of the second image from the target storage module that is rotated among a plurality of preset threads; When the conditions for performing a cutout operation on the first image are met, the first cutout task is triggered to perform a cutout operation on the first image displayed on the screen; When the first image cutout task successfully completes the image cutout operation on the first image displayed on the screen, the second image is saved to the target storage module, and the first thread is triggered to read the image information of the second image from the target storage module, and the first thread is triggered to send the image information of the second image read from the target storage module to the first processing module; the first processing module is triggered to determine the target ambient light information based on the first initial ambient light information and the image information of the second image sent by the first thread, wherein the first initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
2. The method according to claim 1, characterized in that, The method further includes: When the first matting task fails to perform a matting operation on the first image displayed on the screen, the first matting task is saved to the matting task queue. The first matting task is also used to perform a matting operation on a third image, which is the first image detected after the matting operation fails that is in the compositing process and is determined to be subject to a matting operation. When the conditions for performing a matting operation on the third image are met, the first matting task is triggered to perform a matting operation on the third image displayed on the screen. When the first matting task successfully completes the matting operation on the third image displayed on the screen, the fourth image obtained after the first matting task performs the matting operation on the third image is saved to the target storage module. The first thread is triggered to read the image information of the fourth image from the target storage module and to send the image information of the fourth image read from the target storage module to the first processing module. The first processing module is triggered to determine the target ambient light information based on the second initial ambient light information and the image information of the fourth image sent by the first thread. The second initial ambient light information is the ambient light information detected in real time by the sensor set below the screen.
3. The method according to claim 1, characterized in that, The method further includes: When any image processing synthesis process is detected, the display frequency of the screen at that time is detected; When the display frequency is not greater than the first threshold, it is determined that a cutout operation will be performed on any of the images.
4. The method according to claim 3, characterized in that, The method further includes: When the display frequency is greater than the first threshold, a first time interval is determined; the first time interval is the interval between a first initial moment and a second initial moment, the first initial moment is the initial moment when any image is in the compositing process, and the second initial moment is the initial moment when the image preceding any image that is closest to any image and is determined to be subject to the matting operation is in the compositing process; When the first time interval is greater than the second threshold, it is determined that a cutout operation will be performed on any of the images; If the first time interval is not greater than the second threshold, it is determined that no image matting operation will be performed on any of the images.
5. The method according to any one of claims 1 to 4, characterized in that, The conditions for performing a matting operation on any image must be met, including: Upon receiving the first signal, it is determined that the condition for performing a matting operation on any of the images is met; the first signal is a signal generated after the compositing of any of the images in the compositing process is completed and displayed on the screen.
6. The method according to any one of claims 1 to 4, characterized in that, The conditions for performing a matting operation on any image must be met, including: When the second signal generated by the second processing module is received, it is determined that the condition for performing a matting operation on any of the images is met; the second processing module is used to trigger the generation of the second signal after determining that the compositing of any of the images in the compositing process is completed and displayed on the screen.
7. A method for adjusting screen brightness, characterized in that, The target ambient light information obtained by the method of any one of claims 1-6 is used to adjust the brightness of the screen of an electronic device.
8. An electronic device, characterized in that, include: The electronic device comprises a screen, a sensor disposed beneath the screen, a memory, and one or more processors, wherein the screen, the sensor, the memory, and the processor are coupled together; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes instructions that, when the computer program product is run on a computer, cause the computer to perform the method as described in any one of claims 1-7 according to the instructions.
Citation Information
Patent Citations
Screen brightness adjusting method, electronic equipment and storage medium
CN113889055A
Ambient light detection method, electronic equipment, chip system and storage medium
CN114461093A