Ambient light brightness detection method and related device

By analyzing the image data collected by the camera and correcting the ambient light data based on the distance between the highlights and the center point of the image, the problem of large fluctuations in the ambient light brightness in the prior art is solved, the detection accuracy and stability are improved, and the equipment cost is reduced.

CN119274513AActive Publication Date: 2025-01-07HONOR DEVICE CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410397645.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-02
Publication Date
2025-01-07
Estimated Expiration
2044-04-02

AI Technical Summary

Technical Problem

When existing electronic devices detect ambient light brightness, the brightness value fluctuates greatly, resulting in a reduction in user experience and additional ambient light detection devices are required, which increases equipment cost and complexity.

Method used

By analyzing the image data collected by the camera, finding the brightest or brightest point, assuming it is the light source position, and correcting the detected ambient light data based on the distance between the bright point and the center point of the image to reduce the impact of the light source position on the data. The output results are more stable.

Benefits of technology

It improves the accuracy and stability of the camera's ambient light brightness detection, reduces equipment costs, improves user experience, and reduces dependence on ambient light detection devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119274513A_ABST
    Figure CN119274513A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an ambient light brightness detection method and a related device, and relates to the technical field of terminals. The method comprises the steps that the brightest or brighter points in an image can be found out by analyzing image data collected by a camera, the bright points with the larger probability are the positions of light sources, in order to reduce the influence of the positions of the light sources on the ambient light data, the detected ambient light data can be corrected based on the distance between the bright points and the central point of the image, and the accuracy of the ambient light data is improved. Therefore, the data fluctuation of the ambient light detected by the camera is small, and the output result is relatively stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a method for detecting ambient light brightness and a related device. Background Art

[0002] The display screens of some electronic devices have an automatic brightness adjustment function. The automatic brightness adjustment function can automatically adjust the display screen brightness according to the ambient light brightness to adapt to the light intensity in different environments, thereby reducing the power consumption of the electronic device.

[0003] However, in some implementations, the brightness value of the ambient light detected by the electronic device fluctuates greatly and is not accurate enough, which reduces the user experience. Summary of the invention

[0004] The ambient light brightness detection method and related devices provided in the embodiments of the present application can find the brightest or relatively bright points in the image by analyzing the image data collected by the camera. These bright spots are most likely the positions of the light sources. In order to reduce the influence of the light source position on the ambient light data, the detected ambient light data can be corrected based on the distance between the bright spot and the center point of the image, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0005] In a first aspect, an embodiment of the present application provides a method for detecting ambient light brightness, the method comprising:

[0006] Based on the first image captured by the camera, first data indicating the brightness of the ambient light is obtained; the first data is compensated by a first value to obtain the first ambient light brightness, wherein the first value is related to the first distance, and the first distance includes the distance between the brightest point in the first image and the center point of the first image; based on the second image captured by the camera, second data indicating the brightness of the ambient light is obtained; the second data is compensated by a second value to obtain the second ambient light brightness, wherein the second value is related to the second distance, and the second distance includes the distance between the brightest point in the second image and the center point of the second image, the second distance is greater than the first distance, and the second value is greater than the first value. In this way, the detected ambient light data is corrected based on the distance between the bright point and the center point of the image, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0007] In one possible implementation, the first value is linearly related to the first distance, and the coefficient of the first distance is a positive number. When the first distance is small, since the accuracy of the camera detecting the ambient light brightness is high, the ambient light brightness can be compensated less, and the first value can be small. When the first distance is large, the accuracy of the camera detecting the ambient light brightness is low, so the ambient light brightness can be compensated more, and the first value can be large. In this way, the detected ambient light data can be corrected based on the first distance, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0008] In one possible implementation, the first value satisfies the following formula:

[0009] raw_data2=k×d+raw_data.

[0010] Wherein, raw_data2 is the first value, d is the first distance, k is the coefficient of the first distance, and raw_data is the first data. Different k values ​​can be set for different ambient light brightness, so that corresponding adjustments can be made for different ambient lights, thereby more accurately compensating for the ambient light brightness.

[0011] In a possible implementation, before compensating the first data for the first value to obtain the first ambient light brightness, the method further includes: determining a coefficient of the first distance; compensating the first data for the first value to obtain the first ambient light brightness, including: obtaining the first value based on the first distance and the coefficient of the first distance, and compensating the first data for the first value to obtain the first ambient light brightness. In this way, by determining a suitable coefficient of the first distance, the first data can be compensated more accurately to obtain the first ambient light brightness that matches the actual environment, thereby improving the accuracy of display brightness adjustment and enhancing user experience.

[0012] In a possible implementation, determining the coefficient of the first distance includes: calculating the third ambient light brightness, the third ambient light brightness is related to the first data; if the third ambient light brightness belongs to the first range, the coefficient of the first distance is the first coefficient; or, if the third ambient light brightness belongs to the second range, the coefficient of the first distance is the second coefficient; or, if the third ambient light brightness belongs to the third range, the coefficient of the first distance is the third coefficient; wherein the ambient light brightness of the first range is less than the ambient light brightness of the second range, the ambient light brightness of the second range is less than the ambient light brightness of the third range, and the first coefficient, the second coefficient and the third coefficient are all different. Different ranges correspond to different ambient light brightnesses, for example, the first range can correspond to a scene with darker ambient light brightness; the second range can correspond to a scene with brighter ambient light brightness; the third range can correspond to a scene with high ambient light brightness. In this way, different coefficients can be set for different ambient light brightnesses, and corresponding adjustments can be made for different environments, so as to more accurately compensate for the ambient light brightness. In addition, since electronic devices often use lux values ​​to measure the brightness of ambient light, it is more convenient for electronic devices to use lux values ​​for data calibration, and it is convenient to apply to production line production.

[0013] In a possible implementation, the brightness of the third ambient light satisfies the following formula:

[0014] lux0=calibration coefficient×LuxValueConvert(raw_data).

[0015] Among them, lux0 is the third ambient light brightness, raw_data is the first data, LuxValueConvert is a data calibration function, which is used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera. In this way, using this formula to calculate the initial lux value, there is no need to calculate the distance from the brightest point to the center point, nor is there any need to consider the value of the default coefficient corresponding to the distance from the brightest point to the center point, which reduces the computing power of the electronic device and improves the execution efficiency of the electronic device.

[0016] In a possible implementation, the brightness of the third ambient light satisfies the following formula:

[0017] lux0=calibration coefficient×LuxValueConvert(k0×d+raw_data).

[0018] Among them, lux0 is the third ambient light brightness, d is the first distance, k0 is the default coefficient, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera. The formula containing the default coefficient is used to calculate the initial lux value. Since the influence of the distance from the brightest point to the center point on the ambient light brightness is taken into account, the current ambient light brightness, that is, the initial lux value, can be calculated more accurately, so that it can be more reasonably judged whether the current use of the default coefficient to calculate the ambient light brightness is reasonable.

[0019] In a possible implementation, the coefficient of the first distance is related to the first data. Since the first data is obtained first and the first value is calculated later, the coefficient of the first distance is determined according to the first data, and there is no need to use the default coefficient or calculate the initial lux value. The corresponding coefficient can be determined according to the interval where the first data is located, which can reduce the number of times the lux value is calculated, reduce the computing power of the electronic device, and improve the operating efficiency of the electronic device.

[0020] In a possible implementation, if the first data belongs to the fourth range, the coefficient of the first distance is the fourth coefficient; or, if the first ambient light brightness belongs to the fifth range, the coefficient of the first distance is the fifth coefficient; or, if the first ambient light brightness belongs to the sixth range, the coefficient of the first distance is the sixth coefficient; wherein the ambient light brightness of the fourth range is less than the ambient light brightness of the fifth range, the ambient light brightness of the fifth range is less than the ambient light brightness of the sixth range, and the fourth coefficient, the fifth coefficient and the sixth coefficient are all different. Different ranges of the first data can correspond to different ambient light brightnesses. For example, the fourth range can correspond to a scene with darker ambient light brightness; the fifth range can correspond to a scene with brighter ambient light brightness; and the sixth range can correspond to a scene with high ambient light brightness. In this way, different coefficients can be set for different ranges of the first data, so as to make corresponding adjustments to different environments and compensate for the ambient light brightness more accurately.

[0021] In a possible implementation, the brightness of the first ambient light satisfies the following formula:

[0022] lux=calibration coefficient×LuxValueConvert(raw_data2).

[0023] Among them, lux is the first ambient light brightness, raw_data2 is the first value, LuxValueConvert is a data calibration function, which is used to calibrate the difference between the first value and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera. In this way, the electronic device can perform ambient light compensation on the raw data raw_data collected by the front camera to obtain raw_data2, and calibrate raw_data2 to obtain the lux value, thereby reducing the difference in hardware devices of the front camera, and calibrating the difference between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment, thereby improving the accuracy of the ambient light brightness detected by the front camera.

[0024] In a possible implementation, the electronic device includes a camera service module, a sensor service module, a camera control module, a sensor control module, and a camera driver. Before obtaining the first data indicating the brightness of the ambient light based on the first image captured by the camera, the method further includes: sending a brightness monitoring instruction to the sensor control module based on the sensor service module; calling the first interface based on the Android interface definition language AIDL service based on the brightness monitoring instruction based on the sensor control module, the first interface being used to register a callback function in the camera control module; calling the second interface based on the hardware abstract layer interface definition language HIDL service based on the sensor control module, transmitting the first instruction to the camera service module, the first instruction being used to instruct the camera to capture an image and obtain data indicating the brightness of the ambient light; calling the first function in the camera control module based on the first instruction based on the camera service module; executing the first function based on the camera control module to control the camera driver to power on the camera, initialize the camera register, and create a reading thread for the brightness of the ambient light. When the front camera is used instead of the ambient light detection device, the image output resource will not be configured for the front camera, and the front camera will not capture images for display on the display screen. In this way, the resource consumption of the front camera can be reduced, thereby improving the performance of the electronic device.

[0025] In a possible implementation, after obtaining the first data indicating the ambient light brightness based on the first image captured by the camera, the method further includes: reporting the first data to the camera control module based on the camera driver; compensating the first data with a first value to obtain the first ambient light brightness, including: compensating the first data with a first value to obtain the first ambient light brightness based on the camera control module, the sensor control module or the camera driver. In this way, when the distance between the brightest point of the original data and the center point of the original data is small, the ambient light brightness can be compensated less. When the distance between the brightest point of the original data and the center point of the original data is large, the ambient light brightness can be compensated more.

[0026] In a second aspect, an embodiment of the present application provides a device for detecting ambient light brightness, which may be an electronic device, or a chip or chip system in an electronic device. The device may include a processing unit. The processing unit is used to implement any method related to processing performed by the electronic device in the first aspect or any possible implementation of the first aspect. When the device is an electronic device, the processing unit may be a processor. The device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the electronic device implements the method described in the first aspect or any possible implementation of the first aspect. When the device is a chip or chip system in an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the electronic device implements the method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), or a storage unit in the electronic device located outside the chip (for example, a read-only memory, a random access memory, etc.).

[0027] Exemplarily, the processing unit is used to obtain first data indicating the brightness of ambient light based on a first image captured by a camera; is also used to compensate the first data for a first value to obtain the first ambient light brightness; is used to obtain second data indicating the brightness of ambient light based on a second image captured by the camera; is also used to compensate the second data for a second value to obtain the second ambient light brightness.

[0028] In a possible implementation manner, the first value is linearly correlated with the first distance, and the coefficient of the first distance is a positive number.

[0029] In a possible implementation, the first value satisfies the following formula:

[0030] raw_data2=k×d+raw_data.

[0031] Among them, raw_data2 is the first value, d is the first distance, k is the coefficient of the first distance, and raw_data is the first data.

[0032] In a possible implementation, the processing unit is used to determine a coefficient of the first distance; and is also used to obtain a first value based on the first distance and the coefficient of the first distance, and compensate the first data for the first value to obtain a first ambient light brightness.

[0033] In one possible implementation, the processing unit is used to calculate the brightness of the third ambient light; it is also used to determine that if the brightness of the third ambient light belongs to the first range, the coefficient of the first distance is the first coefficient; or, if the brightness of the third ambient light belongs to the second range, the coefficient of the first distance is the second coefficient; or, if the brightness of the third ambient light belongs to the third range, the coefficient of the first distance is the third coefficient.

[0034] In a possible implementation, the brightness of the third ambient light satisfies the following formula:

[0035] lux0=calibration coefficient×LuxValueConvert(raw_data).

[0036] Wherein, lux0 is the third ambient light brightness, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0037] In a possible implementation, the brightness of the third ambient light satisfies the following formula:

[0038] lux0=calibration coefficient×LuxValueConvert(k0×d+raw_data).

[0039] Wherein, lux0 is the third ambient light brightness, d is the first distance, k0 is the default coefficient, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0040] In a possible implementation manner, the coefficient of the first distance is related to the first data.

[0041] In one possible implementation, if the first data belongs to the fourth range, the coefficient of the first distance is the fourth coefficient; or, if the first ambient light brightness belongs to the fifth range, the coefficient of the first distance is the fifth coefficient; or, if the first ambient light brightness belongs to the sixth range, the coefficient of the first distance is the sixth coefficient.

[0042] In a possible implementation, the brightness of the first ambient light satisfies the following formula:

[0043] lux=calibration coefficient×LuxValueConvert(raw_data2).

[0044] Wherein, lux is the first ambient light brightness, raw_data2 is the first value, LuxValueConvert is a data calibration function used to calibrate the difference between the first value and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0045] In one possible implementation, the processing unit is used to send a brightness monitoring instruction to the sensor control module based on the sensor service module; it is also used to call a first interface based on the Android interface definition language AIDL service based on the brightness monitoring instruction based on the sensor control module; it is also specifically used to call a second interface based on the hardware abstraction layer interface definition language HIDL service based on the sensor control module to pass a first instruction to the camera service module; it is also used to call a first function in the camera control module based on the first instruction based on the camera service module; it is also used to execute the first function based on the camera control module to control the camera driver to power on the camera, initialize the camera registers and create a reading thread for the ambient light brightness.

[0046] In one possible implementation, the processing unit is used to report first data to the camera control module based on the camera driver; and is also used to compensate the first data with a first value based on the camera control module, the sensor control module or the camera driver to obtain a first ambient light brightness.

[0047] In a third aspect, an embodiment of the present application provides an electronic device, comprising one or more processors and a memory, wherein the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.

[0048] In a fourth aspect, the present application provides a chip or a chip system, which is applied to an electronic device, and the chip or chip system includes one or more processors and a communication interface, wherein the communication interface and at least one processor are interconnected through a line, and the one or more processors are used to call computer instructions so that the electronic device executes the method described in the first aspect or any possible implementation of the first aspect. Among them, the communication interface in the chip can be an input / output interface, a pin or a circuit, etc.

[0049] In a possible implementation, the chip or chip system described above in the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).

[0050] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.

[0051] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program code. When the computer program code runs on an electronic device, the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.

[0052] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0055] Figure 3 A schematic diagram comparing the field of view angles of a camera and an ambient light detection device provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of the field of view angle test results of a camera and an ambient light detection device provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the fluctuation of the ambient light brightness value of a camera provided in an embodiment of the present application;

[0058] Figure 6 A line graph of the movement of a light source position and the change of the ambient light brightness value provided in an embodiment of the present application;

[0059] Figure 7 A schematic diagram of a flow chart of a method for detecting ambient light brightness provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of data interaction between a camera control module and a sensor control module provided in an embodiment of the present application;

[0061] Fig. 9 A schematic diagram of a method for detecting ambient light brightness provided in an embodiment of the present application;

[0062] Fig.10A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below:

[0064] 1. FOV: Field of view (FOV), which indicates the maximum angle range that the camera can capture. If the object to be photographed is within this angle range, the object to be photographed can be captured by the camera. If the object to be photographed is outside this angle range, the object to be photographed will not be captured by the camera. Generally speaking, the larger the field of view of the camera, the larger the shooting range and the shorter the focal length; the smaller the field of view of the camera, the smaller the shooting range and the longer the focal length.

[0065] 2. Terminology

[0066] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0067] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0068] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.

[0069] 3. Electronic equipment

[0070] The electronic device of the embodiment of the present application may also be a terminal device in any form. For example, the electronic device may include: a mobile phone, a tablet computer, a PDA, a laptop computer, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, an electronic device in a 5G network or a public land mobile communication network (public land mobile communication network) to be evolved in the future. Mobile network, PLMN) and the like, the embodiments of the present application are not limited to this.

[0071] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.

[0072] In addition, in the embodiments of the present application, the electronic device may also be an electronic device in an Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.

[0073] The electronic devices in the embodiments of the present application may also be referred to as: user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.

[0074] In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.

[0075] For example, Figure 1 A schematic structural diagram of an electronic device is shown.

[0076] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0077] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may include hardware, software, or a combination of software and hardware.

[0078] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0079] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the above-mentioned memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved. For example, in an embodiment of the present application, the processor 110 may be used to process the startup of the ambient light detection function, compensate for the ambient light, adjust the brightness of the display screen, etc.

[0080] It is understandable that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0081] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, at least one application required for a function, etc. The data storage area may store data created during the use of the electronic device, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor. For example, in an embodiment of the present application, the internal memory 121 can be used to store the camera to replace the ambient light detection device to collect the ambient light brightness and the relevant code for compensating for the ambient light.

[0082] The sensor module 180 may include a distance sensor, a temperature sensor, or an ambient light sensor, etc.

[0083] The electronic device can realize the display function through GPU, display screen 194 and application processor, etc. Among them, GPU is a microprocessor for image processing, connecting display screen 194 and application processor. GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information. The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor, etc.

[0084] In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1. The camera 193 may be used to capture static images or videos. For example, in the embodiment of the present application, the camera 193 may have an ambient light detection function and an image acquisition function.

[0085] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0086] Figure 2 It is a software structure block diagram of the electronic device of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer.

[0087] The application layer can also be called the application layer, which can include a series of application packages. Figure 2 As shown, the application package may include applications such as a camera, an ambient light detection application, etc. Applications may include system applications and third-party applications.

[0088] The application framework layer can also be called the Framework layer, FWK layer or framework layer, etc. The Framework layer can provide an application programming interface (API) and a programming framework for the application of the application layer. The Framework layer can include some predefined functions.

[0089] The API provided by the Framework layer may include interfaces related to camera services, interfaces related to sensor services, and interfaces related to other services. Interfaces related to different services may be defined as different service modules. For example, interfaces related to camera services may be defined as camera service modules, interfaces related to sensor services may be defined as sensor service modules, and interfaces related to other services may be defined as other service modules (not shown in the figure).

[0090] The camera service module may include submodules such as ICameraSerivce and CameraSerivce. CameraService can be used to implement communication between the application that needs to call the camera in the application layer and the camera control module of the HAL layer.

[0091] Among them, the applications that need to call the camera may include camera applications, face unlocking applications, ambient light detection applications, etc. The ambient light detection application can be used to detect whether the display screen of the electronic device is on or off, and can also transmit a screen-on message to the sensor service module. The ambient light detection application can be a system application or a third-party application, which is not limited in the embodiments of this application.

[0092] The sensor service module can include sub-modules such as SensorManager and SensorSerivce. SensorManager can be used to adjust the brightness of the display screen of the electronic device according to the detected ambient light brightness. SensorSerivce can be used to implement communication between applications that need to call sensors in the application layer and the sensor control module of the hardware abstract layer (HAL). Android runtime includes core libraries and virtual machines. Android runtime is responsible for the control and management of the Android system.

[0093] The hardware abstraction layer is an abstract structure between the kernel layer and the Android runtime. The hardware abstraction layer can be a package of hardware drivers, providing a unified interface for upper-layer applications to call.

[0094] The hardware abstraction layer may include a camera control module, a sensor control module, and other control modules.

[0095] In an embodiment of the present application, the camera control module may include a camera function customization submodule, a CHI-CDK submodule, a CAMX submodule, etc. Among them, the camera function customization submodule is used to obtain the ambient light brightness detected by the camera when the camera is used as an ambient light detection device, and send the ambient light brightness to the sensor control module. The CHI-CDK submodule includes a customizable code implementation set that can realize communication between different modules in an electronic device. The CAMX submodule includes a code implementation set of a general functional interface that can realize the process of skipping the configuration of image output resources for the camera.

[0096] The sensor control module may include an ambient light service control submodule, which provides multiple interfaces, including an Active interface, a DeActive interface, etc. Among them, the Active interface can be used to turn on the ambient light detection function of the camera. The DeActive interface can be used to turn off the ambient light detection function of the camera.

[0097] The kernel layer is the layer between hardware and software. The kernel layer may include display drivers, camera drivers, sensor drivers, etc.

[0098] It should be noted that the embodiments of the present application are only illustrated using the Android system as an example. In other operating systems (such as Windows system, IOS system, etc.), as long as the functions implemented by each functional module are similar to those in the embodiments of the present application, the solutions of the present application can also be implemented.

[0099] The display screens of some electronic devices have an automatic brightness adjustment function. The automatic brightness adjustment function can automatically adjust the display screen brightness according to the ambient light brightness to adapt to the light intensity in different environments, thereby improving the user experience and reducing the power consumption of the electronic device.

[0100] In some implementations, an ambient light detection device may be configured in the electronic device. When the electronic device turns on the screen, the ambient light detection device may detect the ambient light brightness, and then the electronic device may adjust the brightness of the display screen based on the ambient light brightness detected by the ambient light detection device. However, this method of detecting the ambient light brightness requires the electronic device to be additionally configured with an ambient light detection device, which increases the cost of the electronic device.

[0101] In some other implementations, for electronic devices equipped with cameras, since the cameras can also have an ambient light brightness detection function, the cameras can be used on the electronic devices to replace ambient light detection devices, thereby reducing the cost of using the devices.

[0102] However, due to differences in hardware structure between cameras and ambient light detection devices, as well as differences in the positions of cameras and ambient light detection devices on electronic devices, the field of view of some cameras for detecting ambient light is smaller than the field of view of ambient light detection devices for detecting ambient light. As a result, when a user flips or moves the electronic device, the brightness value of the ambient light detected by the camera fluctuates greatly.

[0103] For example, Figure 3 As shown, Figure 3 a is a schematic diagram of the field of view angle θ1 of the camera 301 when receiving ambient light, Figure 3 FIG. b is a schematic diagram of the field of view angle θ2 of the ambient light detection device 302 when receiving ambient light.

[0104] It is understandable that the camera in the electronic device may include a front camera, a rear camera, etc. Considering that the display screen is arranged on the upper surface of the electronic device, the front camera is also arranged on the upper surface of the electronic device, and is located on the same side as the display screen, and the ambient light brightness on different sides of the electronic device is different to a certain extent, in order to make the adjusted display screen brightness more in line with the current environment, this application is described by taking the front camera as an example.

[0105] from Figure 3It can be seen that the device 3011 for detecting ambient light in the front camera 301 is usually located at the bottom of the front camera 301, and the diameter of the lens 3012 of the front camera 301 is relatively small. When the device 3011 receives ambient light, part of the light will be blocked by the lens 3012, making the field of view angle θ1 of the device 3011 smaller. It can also be understood that the field of view angle θ1 of the front camera 301 is relatively small.

[0106] The ambient light detection device 302 is generally close to the display screen of the electronic device, for example, located at the top of the display screen, or adjacent to the front camera, etc. It is understandable that the specific position of the ambient light detection device 302 may be different in different electronic devices, and the embodiment of the present application does not limit the specific position of the ambient light detection device 302. When the ambient light detection device 302 receives ambient light, the field of view angle θ2 of the ambient light detection device 302 is larger because the ambient light detection device 302 is less blocked by other hardware devices.

[0107] Figure 4 The figure shows the comparison of the field of view of the front camera and the ambient light detection device. The horizontal axis in the figure is the receiving angle of the ambient light, and the vertical axis is the relative response. The relative response can be understood as a relative concept. For example, taking a direct light environment with an intensity of 100 as an example, the relative response of the front camera can be understood as the percentage of the intensity of the light received by the front camera relative to the intensity of 100, and the relative response of the ambient light detection device can be understood as the percentage of the intensity of the direct light received by the ambient light detection device relative to the intensity of 100.

[0108] After testing, it is known that the angle at which the front camera receives ambient light is about ±45°, that is, the field of view of the front camera is about 90°. The angle at which the ambient light detection device receives ambient light is about ±90°, that is, the field of view of the ambient light detection device is about 180°. In other words, the field of view of the front camera is smaller than that of the ambient light detection device. In the same environment, due to the smaller field of view of the front camera, when the user flips or moves the electronic device, the brightness value of the ambient light detected by the front camera fluctuates greatly.

[0109] like Figure 5 As shown in Figure 1, it is assumed that there are light sources A, B, and C in a certain environment. Figure 5 In a, due to the small field of view of the front camera, light sources A and B are within the field of view of the front camera, while light source C is not within the field of view of the front camera. Figure 5 In b, since the field of view angle of the ambient light detection device is large, light source A, light source B and light source C are all located within the field of view angle range of the ambient light detection device.

[0110] When you turn over the electronic device, Figure 5 In c, since the field of view of the front camera is small, light source A is not within the field of view of the front camera, and light sources B and C are within the field of view of the front camera. Figure 5 In d, since the field of view of the ambient light detection device is large, light sources A, B and C are still within the field of view of the ambient light detection device.

[0111] It can be seen that due to the change in the position of the light source, the impact on the front camera detecting ambient light is greater, and the impact on the ambient light detection device detecting ambient light is smaller, causing the brightness value of the ambient light detected by the front camera to fluctuate greatly, while the brightness value of the ambient light detected by the ambient light detection device is relatively stable.

[0112] In view of this, the ambient light brightness detection method provided in the embodiment of the present application can find the brightest or relatively bright points in the image by analyzing the image data collected by the camera. These bright spots are most likely the positions of the light sources. In order to reduce the impact of the light source position on the ambient light data, the detected ambient light data can be corrected based on the distance between the bright spot and the center point of the image, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0113] In a possible scenario, the electronic device can be placed in a scene with relatively stable ambient light. For example, there is a strip of light above a certain space as a light source, and the display screen of the electronic device faces the light source. The electronic device can capture the original image through the front camera.

[0114] The front camera may include a complementary metal oxide semiconductor (CMOS) sensor inside, which can convert the optical information received by the front camera into a raw image. The raw image may be composed of a number of pixels. For example, the CMOS sensor can generate a raw image of 16×12=192 pixels. The value of each pixel in the raw image can represent the brightness of the pixel, and the electronic device can obtain raw data raw_data reflecting the brightness of the image based on the brightness value of the pixel in the raw image.

[0115] The original image in the embodiment of the present application may be an image used to reflect the brightness of the ambient light, that is, an image used to reflect the brightness of the ambient light. The original image may include an image used to be displayed on a display screen, or may include an image with lower pixels that is not used to be displayed on a display screen, that is, an image that is not used for user browsing.

[0116] It is understandable that, since the image displayed on the display screen has a high pixel, in order to reduce the image's occupation of the electronic device's memory, the front camera may not capture the image for display on the display screen, and the original image captured by the front camera has a low pixel, for example, the original image's pixel may be smaller than the lowest pixel of the image displayed on the display screen. In this way, the original image can only be used as raw data for the electronic device to analyze the ambient light brightness. By using an image with a smaller pixel, a smaller electronic device's memory can be occupied, thereby improving the operating efficiency of the electronic device.

[0117] Optionally, the original data raw_data may be obtained by averaging the brightness values ​​of all or part of the pixels in the original image, or by performing other operations on the brightness values ​​of all or part of the pixels in the original image, which is not limited in the embodiments of the present application.

[0118] Based on the reading mechanism inside the CMOS sensor, the raw data raw_data read by the electronic device may be as shown in the following Table 1. The raw data raw_data in Table 1 may also be understood as a data matrix.

[0119] Table 1

[0120] 18 18 19 22 34 36 37 43 37 46 48 49 255 42 31 28 18 19 20 25 38 41 42 51 44 59 57 146 255 44 30 28 18 19 20 29 43 47 48 58 53 64 63 255 148 42 30 28 18 19 20 31 48 52 56 62 65 72 66 255 61 38 31 30 19 19 20 33 54 56 64 61 84 87 212 255 57 35 32 30 19 19 21 35 56 57 72 65 94 102 255 115 49 36 34 30 19 20 21 31 48 55 75 72 101 118 255 77 43 37 35 28 18 19 20 26 39 55 67 78 101 255 255 64 40 37 34 28 18 19 20 23 48 62 55 78 91 255 89 49 39 38 31 28 18 19 20 22 51 62 52 68 96 255 66 40 38 35 30 27 18 19 19 21 39 59 56 62 255 195 47 37 36 31 29 26 18 19 19 20 28 49 52 46 255 55 38 36 34 30 28 25

[0121] It should be noted that, in the raw data collected by the front camera, the light source is located near the lower right corner of the middle of the raw data. As can be seen from Table 1, the pixels in the bold part of the data are also located in the local area near the lower right corner of the middle of the overall pixels. The pixels in these bold parts are relatively large, indicating that the brightness of these places in the raw data is also relatively large.

[0122] The electronic device can convert the raw data raw_data collected by the front camera into a lux value, wherein the lux value can represent the light intensity of the ambient light, and both the raw data raw_data and the lux value can represent the brightness of the ambient light. When the raw_data increases, the lux value will also increase. The increase ratio of the two can be the same or different, which is not limited in the embodiments of the present application.

[0123] In a possible implementation, the conversion relationship between raw_data and lux value can satisfy the following formula:

[0124] lux = production line calibration coefficient × LuxValueConvert (raw_data).

[0125] Among them, the production line calibration coefficient is used to calibrate the difference between the front camera and the ideal camera in the electronic device. Among them, the ideal camera can also be called a standard camera. Exemplarily, before the electronic device leaves the factory, the front camera in the electronic device can be tested and compared with the standard camera. If there is no difference or the difference is small between the front camera and the standard camera, the production line calibration coefficient can be 1; if there is a deviation between the front camera and the standard camera, the production line calibration coefficient can be greater than 1 or less than 1. In this way, through the production line calibration coefficient, the electronic device can calibrate the hardware difference between the front camera and the standard camera, thereby reducing the difference in hardware devices of the front camera and improving the accuracy of the front camera in detecting the brightness of ambient light.

[0126] The LuxValueConvert function is a data calibration function, which is used to calibrate the difference between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment. In some scenarios, since the LuxValueConvert function can convert raw_data into lux values, the LuxValueConvert function can also be called a conversion function.

[0127] For example, the LuxValueConvert function can put raw_data into an expected function to obtain the ambient brightness information lux, wherein the expected function can be obtained by fitting the test data.

[0128] In a possible implementation, the brightness of the measurement environment can be set in a standard light box in the laboratory, and the unit can be accurate to 1lux. By gradually increasing the ambient brightness, the corresponding raw_data can be obtained. After obtaining a large amount of data, the most appropriate fitting function type and function coefficient can be evaluated and selected through function fitting.

[0129] However, due to the limited light sensitivity of the front camera itself, there is a certain error between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment. For example, when the ambient light is stable, for example, when the ambient light brightness raw_data value is 400, the electronic device can be turned over and the ambient light brightness detected by the front camera can be tested.

[0130] Ideally, for scenes with stable ambient light, the raw_data value of the ambient light brightness detected by the front camera should be stable around 400 and should not change significantly when the electronic device is flipped.

[0131] However, in actual testing, we can get Figure 6The line graph of the light source position movement and the raw_data value change is shown. It can be understood that the light source position can be understood as the distance between the brightest or brighter point in the original image and the center point of the original image, or it can be understood as the distance between the brightest point with the largest or larger pixel value in the original data and the center point of the original data in pixel units. For ease of description, the embodiment of the present application takes the brightest point in the original data as an example for explanation. Among them, Figure 6 The horizontal axis is the distance between the brightest point in the original data and the center point of the original data. Figure 6 The vertical axis is the raw_data value of the ambient light brightness detected by the camera.

[0132] As can be seen from the figure, when the distance between the brightest point of the raw data and the center point of the raw data is 0, that is, when the brightest point is at the center point of the raw data, it can be said that the light source is facing the front camera. At this time, the raw_data value of the ambient light brightness detected by the front camera is close to the theoretical value of 400, and the detection result is more accurate.

[0133] As the brightest point gradually moves away from the center point of the raw data, the vertical angle between the corresponding light source and the front camera gradually increases, and the raw_data value of the ambient light brightness detected by the front camera gradually decreases, and the error between the ambient light brightness detected by the front camera and the theoretical value of 400 increases. For example, when the distance between the brightest point in the raw data and the center point of the raw data is 10, the raw_data value of the ambient light brightness detected by the front camera is about 250, which is far from the theoretical value of 400. In other words, the position of the light source has a greater impact on the fluctuation of the ambient light brightness detected by the front camera.

[0134] In order to compensate for the data fluctuation of ambient light caused by the flipping or movement of the electronic device, the raw data raw_data collected by the front camera can be calibrated before calculating the lux brightness value, so that the front camera can remain stable when detecting the ambient light brightness, thereby improving the accuracy of display brightness adjustment.

[0135] according to Figure 6 From the line graph, we can see that the data fluctuation of the ambient light brightness detected by the front camera can satisfy the following formula:

[0136] y=-16.318x+407.14.

[0137] Where y is the ambient light brightness value, and x is the distance between the brightest point of the original data and the center point of the original data.

[0138] According to the above formula, the distance between the brightest point of the original data and the center point of the original data is inversely proportional to the ambient light brightness value. Therefore, the embodiment of the present application can compensate for the ambient light brightness according to the distance between the brightest point of the original data and the center point of the original data.

[0139] Exemplarily, when the distance between the brightest point of the original data and the center point of the original data is small, the accuracy of the front camera detecting the ambient light brightness is high, and the ambient light brightness can be compensated less. When the distance between the brightest point of the original data and the center point of the original data is large, the accuracy of the front camera detecting the ambient light brightness is low, and the ambient light brightness can be compensated more. Therefore, the ambient light brightness can be reversely compensated based on the above formula.

[0140] For example, the specific ambient light brightness compensation can satisfy the following formula:

[0141] raw_data2=16.318×d+raw_data.

[0142] Among them, raw_data2 is the value after the ambient light brightness compensation is performed on the original data, d is the distance between the brightest point of the original data and the center point of the original data, and raw_data is the original data.

[0143] In a possible implementation, the electronic device may determine the brightest point in the original data based on the data in Table 1. The specific code implementation is as follows:

[0144]

[0145]

[0146] Among them, the findMaxWindow function is a function for determining the brightest point in the original data. In the parameters of the findMaxWindow function, data[][COLS] is used to represent the two-dimensional matrix of the original data raw_data, *maxSum is used to record the maximum window sum, *maxRow is used to record the horizontal position of the brightest point in the original data, and *maxCol is used to record the vertical position of the brightest point in the original data.

[0147] It can be understood that according to the above code, the embodiment of the present application uses each group of 3×3 data to cyclically query the position of the brightest spot in the original data. This is because the 3×3 data can include a center point, and by comparing the brightness of the center point of each group of data at various positions in the original data, the position of the brightest spot in the original data can be determined.

[0148] Optionally, each group of 2×2, 4×4, 5×5, etc. data may be used to find the position of the brightest point in the original data, which is not limited in the embodiment of the present application. However, since it is inconvenient to determine the position of the center point in 2×2 and 4×4 data, and the calculation dimension of each group of 5×5 data is large for the original data of 16×12 pixels, which increases the computing power of the electronic device, the embodiment of the present application takes each group of 3×3 data as an example for exemplary description.

[0149] After determining the position of the brightest point in the raw data, the electronic device can calculate the distance d between the brightest point and the center point of the raw data. The distance d can also be understood as the distance in pixels from the brightest point to the center point of the raw data. Taking the above 16×12 pixel raw data as an example, the horizontal position of the center point in the raw data is 8, and the vertical position of the center point in the raw data is 6.

[0150] Then the distance d from the brightest point to the center point of the original data can satisfy the following formula:

[0151]

[0152] Optionally, when calculating raw_data2, the incident angle from the brightest point to the camera may be used instead of the distance d for calculation, which is not limited in the embodiment of the present application.

[0153] It should be noted that in the above compensation formula for calculating the ambient light brightness raw_data2, the coefficient 16.318 is obtained by testing under a certain ambient light brightness (for example, the ambient light brightness is 400) scene, and different coefficient values ​​can be obtained under different ambient light brightness. Therefore, the specific value of the coefficient is not limited in the embodiment of the present application.

[0154] After testing, it can be known that the value raw_data2 after ambient light brightness compensation of the original data is positively correlated with the distance from the brightest point to the center point, and is positively correlated with the original data raw_data. When the original data raw_data remains unchanged, the greater the distance from the brightest point to the center point, the greater the value raw_data2 after ambient light brightness compensation of the original data; when the distance from the brightest point to the center point remains unchanged, the greater the original data raw_data, the greater the value raw_data2 after ambient light brightness compensation of the original data.

[0155] The positive correlation between raw_data2 and the distance from the brightest point to the center point may include a linear correlation, an exponential correlation, etc. between raw_data2 and the distance from the brightest point to the center point, which is not limited in the present embodiment. Taking the linear correlation between raw_data2 and the distance from the brightest point to the center point as an example, the ambient light brightness compensation may satisfy the following formula:

[0156] raw_data2=k×d+raw_data.

[0157] Among them, raw_data2 is the value after ambient light brightness compensation for the original data, d is the distance between the brightest point of the original data and the center point of the original data, k is the coefficient corresponding to the distance from the brightest point to the center point, and k is a positive number, and raw_data is the original data.

[0158] When determining the coefficient corresponding to the distance from the brightest point to the center point, in a possible implementation, the electronic device can segment the ambient light brightness lux value. For example, when the lux value is in the first interval, the first coefficient can be used to calculate raw_data2; when the lux value is in the second interval, the second coefficient can be used to calculate raw_data2; when the lux value is in the third interval, the third coefficient can be used to calculate raw_data2, etc. The embodiment of the present application does not specifically limit the interval division of the lux value and the coefficient value.

[0159] For example, the lux value of the first interval can be [0,500), corresponding to the scene with dark ambient light brightness; the lux value of the second interval can be [500,5000), corresponding to the scene with bright ambient light brightness; the lux value of the third interval can be [5000,20000], corresponding to the scene with high ambient light brightness. In this way, different coefficients can be set for different ambient light brightness, and corresponding adjustments can be made for different environments, so as to compensate for the ambient light brightness more accurately.

[0160] Taking the segmentation of the ambient light brightness lux value as an example, since the raw_data2 value is calculated first and the lux value is calculated later, the electronic device can first calculate the initial lux value, and determine the coefficient corresponding to the distance from the brightest point to the center point according to the initial lux value, that is, the coefficient used to calculate raw_data2.

[0161] In a possible implementation method for calculating the initial lux value, the initial lux value can satisfy the following formula:

[0162] lux0=calibration coefficient×LuxValueConvert(raw_data).

[0163] Among them, lux0 is the initial lux value, raw_data is the raw data, LuxValueConvert is the data calibration function, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0164] It is understandable that when using the above formula to calculate the initial lux value, there is no need to calculate the distance from the brightest point to the center point, nor is there any need to consider the value of the default coefficient corresponding to the distance from the brightest point to the center point, thereby reducing the computing power of the electronic device and improving the execution efficiency of the electronic device.

[0165] In another possible implementation of calculating the initial lux value, the electronic device may first calculate the initial lux value using a default coefficient, and the initial lux value may satisfy the following formula:

[0166] lux0=calibration coefficient×LuxValueConvert(k0×d+raw_data).

[0167] Among them, lux0 is the initial lux value, d is the distance from the brightest point to the center point, k0 is the default coefficient, and raw_data is the original data.

[0168] Furthermore, the electronic device can determine whether the default coefficient used is reasonable according to the segmented interval of the initial lux value. The default coefficient can be set according to experience, and the default coefficient can be the first coefficient, the second coefficient, the third coefficient, or other values, which are not limited in the embodiments of the present application.

[0169] It can be understood that by using the formula containing the default coefficient to calculate the initial lux value, the current ambient light brightness, that is, the initial lux value, can be calculated more accurately because the influence of the distance from the brightest point to the center point on the ambient light brightness is taken into account. This can more reasonably determine whether the current use of the default coefficient to calculate the ambient light brightness is reasonable.

[0170] Taking the calculated initial lux value in the first interval as an example, if the default coefficient is equal to the first coefficient, or the default coefficient is closest to the first coefficient compared to the second coefficient and the third coefficient, it means that it is reasonable to use the default coefficient, and the current ambient light brightness can be accurately and effectively compensated.

[0171] If the default coefficient is not equal to the first coefficient, and compared with the first coefficient, the default coefficient is closest to the second coefficient or the third coefficient, it means that the current use of the default coefficient is not reasonable and cannot compensate for the ambient light brightness more accurately and effectively. The electronic device can further use the second coefficient or the third coefficient that is closest to the default coefficient to recalculate the lux value.

[0172] Taking the use of the second coefficient as an example, when the interval of the calculated lux value is in the second interval, the second interval corresponds to the second coefficient, which means that the use of the second coefficient is more reasonable and can accurately and effectively compensate for the current ambient light brightness. In this way, the front camera can maintain stability when detecting ambient light brightness, improve the accuracy of display brightness adjustment, and enhance user experience.

[0173] When the interval where the calculated lux value is located is in the third interval, the third interval does not correspond to the second coefficient, which means that the use of the second coefficient is not reasonable. The electronic device can use the third coefficient to calculate the lux value again until the interval where the lux value calculated by the electronic device is located corresponds to the coefficient used by the electronic device.

[0174] It is understandable that the calculation method when the initial lux value is in other ranges is similar to the above logic and will not be repeated here. Since electronic devices often use lux values ​​to measure the brightness of ambient light, it is more convenient for electronic devices to use lux values ​​for data calibration and is easy to apply to production lines.

[0175] In another possible implementation, the electronic device may also segment the ambient light brightness raw_data. The embodiment of the present application does not limit the specific interval division of raw_data and the value of the corresponding coefficient.

[0176] It can be understood that since the raw_data data is obtained first and the raw_data2 value is calculated later, when the ambient light brightness raw_data is segmented, there is no need to use the default coefficient. The corresponding coefficient can be determined according to the interval where the raw_data value is located. This can reduce the number of times the lux value is calculated, reduce the computing power of the electronic device, and improve the operating efficiency of the electronic device.

[0177] Figure 7 A schematic flow chart of a method for detecting ambient light brightness according to an embodiment of the present application is shown.

[0178] S701. After the screen of the electronic device is turned on, the ambient light detection function is started.

[0179] After the electronic device turns on the screen, the ambient light detection function can be started. The electronic device can power on the front camera and initialize the front camera to turn on the front camera, and then execute step S702 to detect the ambient light brightness through the front camera.

[0180] S702: The electronic device detects the brightness of the ambient light through the front camera.

[0181] After the front camera is powered on, the ambient light detection function of the front camera is turned on, and the electronic device can detect the ambient light brightness of the environment where the electronic device is located through the front camera, thereby executing step S703 to compensate for the ambient light brightness.

[0182] S703: The electronic device compensates for the ambient light brightness.

[0183] The specific implementation of compensating the ambient light brightness can refer to the description in the above embodiment, for example, reverse compensation of the ambient light brightness is performed based on the ambient light brightness compensation formula, etc., which will not be described in detail. In this way, when the distance between the brightest point of the original data and the center point of the original data is small, the ambient light brightness can be compensated less. When the distance between the brightest point of the original data and the center point of the original data is large, the ambient light brightness can be compensated more.

[0184] After the ambient light brightness is compensated, step S704 may be performed to automatically adjust the brightness of the display screen.

[0185] S704: Based on the compensated ambient light brightness, the electronic device adjusts the display brightness.

[0186] In a possible implementation, the ambient light brightness detected by the front camera can be based on the raw data raw_data output by the front camera, and the electronic device can perform ambient light brightness compensation on the raw data raw_data and generate an ambient light brightness lux value, and the electronic device can adjust the display brightness based on the lux value. For example, the electronic device can use the lux value as the adjusted display brightness; or the electronic device can obtain the default brightness of the display of the electronic device, and adjust the default brightness based on the lux value to obtain the adjusted display brightness.

[0187] It is understandable that the camera service module of the Framework layer can control the opening and closing of the front camera by sending instructions to the camera control module of the HAL layer. The sensor service module of the Framework layer can control the opening and closing of the ambient light detection device by sending instructions to the sensor control module of the HAL layer. When the front camera is used instead of the ambient light detection device, the opening and closing of the front camera needs to be controlled by the instructions sent by the sensor service module.

[0188] Since the sensor control module cannot pass the instructions issued by the sensor service module to the front camera, while the camera control module can pass the instructions issued by the camera service module to the front camera, in order to realize the front camera replacing the ambient light detection device, it is necessary to establish a control path between the camera service module and the sensor control module, so as to realize the control of the front camera with the help of the camera service module.

[0189] It is understandable that the camera service module can be used as an independent process, and the sensor control module can also be used as an independent process. Therefore, when establishing the control path between the camera service module and the sensor control module, it can be established based on the hardware abstraction layer interface definition language (HAL interface definition language, HIDL) service. Among them, the HIDL service can be used to define the interface between the Framework layer and the HAL layer based on Binder communication.

[0190] After establishing the control path between the camera service module and the sensor control module, it is also necessary to establish a data path between the camera control module and the sensor control module, so that after turning on the ambient light detection function of the front camera, the camera control module can transmit the ambient light brightness detected by the front camera to the sensor control module, and then the sensor control module reports it to the sensor service module, thereby realizing the adjustment of the display brightness.

[0191] Figure 8 A schematic diagram of data interaction between the camera control module and the sensor control module is shown.

[0192] S801. The camera control module initializes the Android interface definition language (AIDL) service.

[0193] Initializing the AIDL service may include a process of pulling up the AIDL service. By initializing the AIDL service, communication between the camera control module and the sensor control module may be established. In a possible implementation, the camera control module may initialize the AIDL service in the CHK-CDK submodule.

[0194] It is understandable that the camera control module can initialize the AIDL service during the startup process of the electronic device, and can also initialize the AIDL service when communication is required between the camera control module and the sensor control module. The embodiment of the present application does not limit the timing of initializing the AIDL service.

[0195] S802: The sensor service module sends a brightness monitoring instruction to the sensor control module.

[0196] After the electronic device is turned on, the ambient light detection application in the application layer can transmit a screen-lighting message to the sensor service module. The screen-lighting message may include the package name of the ambient light detection application. The screen-lighting message can be used to instruct the sensor service module to adjust the brightness of the electronic device display.

[0197] When the sensor service module receives the screen-on message, the sensor service module may send a brightness monitoring instruction to the sensor control module. The brightness monitoring instruction may be used to instruct the sensor control module to obtain the ambient light brightness. The brightness monitoring instruction may be in the form of a callback function, so that after the sensor control module obtains the ambient light brightness, the ambient light brightness can be returned to the sensor service module.

[0198] In a possible implementation, the SensorManager of the sensor service module can generate a brightness monitoring instruction based on the screen light message transmitted by the ambient light detection application. The SensorService of the sensor service module can send the brightness monitoring instruction to the sensor control module.

[0199] S803: The sensor control module calls the first interface and registers a data callback function in the camera control module.

[0200] After the sensor control module receives the brightness monitoring instruction, the sensor control module can call the first interface based on the AIDL service and register the data callback function in the camera control module. The first interface can be used to turn on the ambient light detection function of the front camera, and the first interface can include the Active interface of the ambient light service control submodule.

[0201] It is understandable that the sensor control module calls the first interface and needs to declare the first interface before registering the data callback function in the camera control module. In a possible implementation, the camera control module and the sensor control module can register the callback interface respectively. When the callback interface registration in the camera control module and the sensor control module is completed, the registration of the data callback function in the camera control module is completed. Optionally, the camera control module can register the callback interface in the camera function customization submodule, and the sensor control module can register the callback interface in the ambient light service control submodule.

[0202] After the sensor control module calls the first interface to turn on the ambient light detection function of the front camera, the sensor control module can register a data callback function in the camera control module. Through the data callback function, the camera control module can transmit the ambient light brightness detected by the front camera to the sensor control module, thereby establishing a data path between the camera control module and the sensor control module, so that the front camera can replace the ambient light device.

[0203] S804: The sensor control module calls the second interface to transmit the first instruction to the camera service module.

[0204] Generally, cameras include two types: front cameras and rear cameras, and there is at least one front camera and rear camera respectively. The front camera and rear camera respectively have multiple functions, including at least one of a photo taking function, a face unlocking function, and an ambient light detection function. In order to distinguish different types of cameras and different functions of the same type of camera, the embodiment of the present application can abstract multiple logical cameras according to the type of camera and its function, and each logical camera corresponds to an identifier.

[0205] For example, based on the photo-taking function of the front camera, a logical camera A can be abstracted; based on the ambient light detection function of the front camera, a logical camera B can be abstracted. Logical camera A and logical camera B can correspond to the same front camera or to different front cameras. In the embodiment of the present application, the photo-taking function of logical camera A, i.e., the front camera, can be identified as Camera ID=1, and the ambient light detection function of logical camera B, i.e., the front camera, can be identified as Camera ID=4.

[0206] In an embodiment of the present application, the sensor control module may generate a first instruction through a first interface, and then transmit the first instruction to the camera service module through a second interface.

[0207] The second interface may include a libcamera2ndk_vendor interface of a sensor control module, etc. The first instruction may include an Open Camera instruction. The first instruction may include a first identifier, which corresponds to an ambient light detection function of a front camera, for example, Camera ID=4. The first instruction may also include a first package name, which may be a package name of an ambient light detection application.

[0208] S805. The camera service module calls the first function of the camera control module to control the camera driver to power on the front camera, initialize the camera registers, and create a reading thread for the ambient light brightness.

[0209] S806: The camera control module powers on the front camera, initializes the camera register, and creates a thread for reading the ambient light brightness.

[0210] It can be understood that the processes of powering on the front camera, initializing the camera register, etc. may include the relevant processes of turning on the front camera, and may also include the process of powering on and initializing the front camera.

[0211] In a possible implementation, after the CameraService of the camera service module obtains the first instruction, the first function can be called based on the first identifier in the first instruction to turn on the ambient light detection function of the front camera. In this way, the front camera can be used instead of the ambient light detection device. Among them, the first function can be used to turn on any function of any camera in the electronic device, and the first function can include the Open Camera function in CAMX in the camera control module.

[0212] When the front camera is used instead of the ambient light detection device, the front camera needs to detect the ambient light brightness without collecting images. In order to reduce the power consumption of the front camera, the camera service module can call the process related to turning on the ambient light detection function of the front camera in the first function based on the first identifier, such as applying for resource cache, powering on the front camera, initializing the camera register, creating a reading thread for the ambient light brightness, etc. The camera service module can skip the processes that are not related to turning on the ambient light detection function of the front camera, such as the process of configuring the output resources, etc.

[0213] The camera control module can generate corresponding control instructions by executing the first function. The camera control module can also send the control instructions to the camera driver, thereby controlling the camera driver to apply for resource cache for the front camera, power on the front camera, initialize the camera register, create a reading thread, etc.

[0214] The created reading thread can be used to read and calculate the ambient light brightness detected by the front camera. Optionally, the reading thread can periodically read the ambient light brightness detected by the front camera. Based on the initialization of the camera register, the reading thread can write the period of the ambient light brightness detected by the front camera, the frequency of the ambient light brightness detected by the front camera, etc. into the register, thereby controlling the operation of the front camera.

[0215] In the embodiment of the present application, when the front camera is used instead of the ambient light detection device, no image output resources will be configured for the front camera, and the front camera will not collect images for display on the display screen. In this way, the resource consumption of the front camera can be reduced, thereby improving the performance of the electronic device.

[0216] S807 , the camera driver reports raw data raw_data to the camera control module.

[0217] The camera driver can obtain the original image captured by the front camera and read the raw data raw_data of the original image.

[0218] After acquiring the raw data raw_data, the camera driver may report the raw data raw_data to the camera control module.

[0219] S808: The camera control module performs ambient light brightness compensation and / or calibration on the raw data raw_data.

[0220] The camera control module can implement ambient light brightness compensation and / or calibration of the raw data raw_data, which can refer to the description in the above embodiment, for example, ambient light brightness compensation is performed on the raw data raw_data based on the ambient light brightness compensation formula, etc., which will not be repeated here. Since the camera control module is at the hardware abstraction layer, it is convenient to process the business logic of the data collected by the camera, so that it is more convenient to distinguish the functions of different products at the hardware abstraction layer, and it is also convenient to call the mathematical library for floating-point operations, thereby improving the calculation speed of the electronic device.

[0221] Thus, when the distance between the brightest point of the original data and the center point of the original data is small, less ambient light brightness can be compensated. When the distance between the brightest point of the original data and the center point of the original data is large, more ambient light brightness can be compensated.

[0222] Optionally, ambient light brightness compensation and / or calibration of raw data raw_data can also be implemented in the camera driver module. After the camera driver obtains the raw data raw_data, it can perform ambient light brightness compensation and / or calibration on the raw data raw_data to obtain the ambient light brightness lux value. Since the kernel layer can support overwriting the raw_data_read function, the processing of the raw data raw_data is placed in the raw_data_read function, which can more easily implement the ambient light brightness compensation and / or calibration function of the raw data raw_data.

[0223] Optionally, ambient light brightness compensation and / or calibration of the raw data raw_data can also be implemented in the sensor control module. After the camera control module obtains the raw data raw_data, it can report the raw data raw_data to the sensor control module. Furthermore, the sensor control module can perform ambient light brightness compensation and / or calibration on the raw data raw_data to obtain the ambient light brightness lux value. In this way, since Raw_dara belongs to ambient light brightness information, and the brightness adjustment of the display screen of the electronic device is implemented through the sensor service module, in terms of business logic, ambient light brightness compensation and / or calibration of the raw data raw_data is implemented in the sensor control module, which facilitates the interaction of upper-layer services and data transmission between the hardware abstraction layer and the framework layer.

[0224] The module for implementing ambient light brightness compensation and / or ambient light brightness calibration is not limited in the embodiments of the present application.

[0225] S809: The camera control module transmits the ambient light brightness lux value to the sensor control module through the data callback function.

[0226] It can be understood that the ambient light brightness lux value can be generated by the camera control module based on the raw data raw_data.

[0227] In a possible implementation, the ambient light brightness lux value may include the ambient light brightness obtained after using the illumination compensation formula to compensate the raw data raw_data for ambient light brightness, and / or using the data calibration function to calibrate the raw data raw_data. The specific calculation formulas for ambient light brightness compensation and calibration can be referred to Figure 6 The relevant description of the corresponding embodiment will not be repeated here.

[0228] In another possible implementation, the ambient light brightness lux value can also be generated based on the raw data raw_data and the state parameters of the front camera, which state parameters may include the available state of the ambient light detection function of the front camera and the unavailable state of the ambient light detection function of the front camera, etc.

[0229] It should be noted that the ambient light brightness lux value and the raw data raw_data in the embodiment of the present application may not be a brightness value, but represent a type of brightness value. For example, the raw data raw_data may represent the brightness value output by the front camera at different times; the ambient light brightness lux value may represent the brightness value transmitted by the camera control module to the sensor control module at different times.

[0230] In a possible implementation, the camera driver can periodically obtain the raw data raw_data detected by the front camera through a reading thread, and report the raw data raw_data to the camera control module, so that the camera control module can obtain the raw data raw_data output by the front camera. The reading cycle may include 200ms, and the embodiment of the present application does not limit the specific reading cycle.

[0231] In another possible implementation, the camera driver can also periodically obtain the raw data raw_data detected by the front camera through a reading thread, and store the raw data raw_data in a cache. The camera control module can periodically read the raw data raw_data from the cache. Optionally, the reading cycle of the camera driver and the reading cycle of the camera control module can be the same or different.

[0232] After obtaining the raw data raw_data, the camera function customization submodule of the camera control module can generate the ambient light brightness lux value based on the raw data raw_data, and pass the ambient light brightness lux value to the ambient light service control submodule of the sensor control module through the pre-registered data callback function. In this way, the sensor control module can report the ambient light brightness to the sensor service module, thereby adjusting the display brightness of the electronic device.

[0233] S810: The sensor control module reports the ambient light brightness lux value to the sensor service module.

[0234] In a possible implementation, when the sensor service module sends a brightness monitoring instruction to the sensor control module, a callback function can be registered in the sensor control module. Through the callback function, the sensor control module can report the ambient light brightness lux value to the sensor service module.

[0235] In another possible implementation, the sensor service module may periodically read the ambient light brightness lux value of the sensor control module.

[0236] S811. The sensor service module adjusts the brightness of the display screen of the electronic device based on the lux value of the ambient light.

[0237] In a possible implementation, adjusting the brightness of the display screen may be setting the brightness of the display screen.

[0238] Exemplarily, the sensor service module can determine the brightness of the display screen based on the ambient light brightness lux value, and then set the brightness of the display screen to a certain brightness. The sensor service module can also determine the brightness of the display screen based on historical ambient light brightness and ambient light brightness lux value, and then set the brightness of the display screen to a certain brightness.

[0239] In another possible implementation, adjusting the brightness of the display screen may be adjusting the initial brightness based on the initial brightness of the display screen, wherein the initial brightness may be a brightness value preset by a developer.

[0240] Exemplarily, the sensor service module can determine the brightness of the display screen based on the ambient light brightness lux value, and then adjust the brightness of the display screen from the initial brightness to the determined brightness. The sensor service module can also determine the brightness of the display screen based on the historical ambient light brightness and the ambient light brightness lux value, and then adjust the brightness of the display screen from the initial brightness to the determined brightness.

[0241] Optionally, when adjusting the display screen brightness of the electronic device, it can be adjusted gradually, which can avoid excessive brightness changes affecting the user experience.

[0242] In a possible implementation, when adjusting the brightness of the display screen, the sensor service module can generate a brightness adjustment instruction, and then send the brightness adjustment instruction to the sensor control module. The sensor control module can pass the brightness adjustment instruction to the display screen driver, so that the display screen driver can adjust the brightness of the display screen based on the brightness adjustment instruction.

[0243] It is understandable that the above description uses the example of the electronic device turning on the screen for the first time when the device is turned on as an example. When the electronic device turns on the screen for a non-first time, the electronic device may not execute the process of initializing the AIDL service in step S801 and the process of registering the data callback function in step S803.

[0244] In the embodiment of the present application, when verifying whether the electronic device is currently using the ambient light brightness detection method of the embodiment of the present application, in a possible implementation, it is possible to first determine whether the electronic device can currently automatically dim by blocking the front camera. If the brightness of the display screen of the electronic device remains unchanged or does not change significantly after blocking the front camera, it means that the electronic device is currently unable to automatically dim, and the ambient light brightness detection method of the embodiment of the present application is not used. If the brightness of the display screen of the electronic device becomes dim after blocking the front camera, it means that the electronic device can currently automatically dim, and it is possible to use the ambient light brightness detection method of the embodiment of the present application, which requires further verification.

[0245] When the front camera is blocked and the electronic device can automatically adjust the light, it can be determined whether the front camera is powered on. For example, a multimeter can be used to detect whether the front camera is powered on.

[0246] When the front camera is powered on, it can be further verified whether the front camera is used to replace the ambient light detection device to detect the ambient light brightness. Exemplarily, the electronic device can read the raw data collected by the front camera based on the IIC protocol. The raw data can also be called IIC data. The IIC data can include raw_data, so that the change of raw_data with the ambient light brightness can be analyzed. If raw_data can change with the change of ambient light brightness, it means that the electronic device uses the front camera to replace the ambient light detection device to detect the ambient light brightness.

[0247] In the case where it is determined to use the front camera instead of the ambient light detection device to detect the ambient light brightness, the electronic device can be flipped or moved in a scene where the ambient light brightness remains unchanged to adjust the angle of the light source incident on the front camera, thereby obtaining the raw data of the ambient light brightness corresponding to different positions of the light source. If the raw data is related to the different field of view angles of the front camera, it means that the electronic device is currently using the ambient light brightness detection method of the embodiment of the present application.

[0248] The following specific embodiments are used to describe the method of the present application in detail. The following embodiments may be combined with each other or implemented independently, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0249] Fig. 9 The method for detecting the ambient light brightness of an embodiment of the present application is shown. The method includes:

[0250] S901. Obtain first data indicating ambient light brightness based on a first image captured by a camera.

[0251] In the embodiment of the present application, the camera may include a front camera of the electronic device, or may include a rear camera of the electronic device, etc., which is not limited in the embodiment of the present application.

[0252] The first data may include the original data raw_data in the above embodiment, and the first data may be understood as the original data corresponding to the first image.

[0253] The first image may be an image used to reflect the brightness of the ambient light, that is, an image used to reflect the brightness of the ambient light. The first image may include an image used to be displayed on a display screen, or may include an image with lower pixels that is not used to be displayed on a display screen, that is, an image that is not used for user browsing.

[0254] It is understandable that, since the pixels of the image displayed on the display screen are relatively high, in order to reduce the image's occupation of the electronic device's memory, the front camera may not capture the image for display on the display screen, and the pixels of the first image captured by the front camera are relatively low, for example, the pixels of the first image may be smaller than the lowest pixel of the image displayed on the display screen. In this way, the first image can be used as raw data for the electronic device to analyze the brightness of the ambient light. By using an image with a smaller pixel, a smaller electronic device memory can be occupied, thereby improving the operating efficiency of the electronic device.

[0255] S902: Compensate the first data with a first value to obtain a first ambient light brightness, wherein the first value is related to a first distance, and the first distance includes a distance between a brightest point in the first image and a center point of the first image.

[0256] In the embodiment of the present application, the first ambient light brightness may include the lux value in the above embodiment, and the electronic device may calculate the first ambient light brightness based on the first data. In the process of calculating the first ambient light brightness, due to the limitation of the photosensitivity accuracy of the camera itself, there is a certain error between the ambient light brightness detected by the camera and the ambient light brightness in the actual environment. Therefore, the electronic device may perform ambient light compensation on the first data so that the ambient light brightness detected by the camera can maintain a stable output.

[0257] The first value can be understood as the value after the first data is compensated for the ambient light brightness. The first value can include raw_data2 in the above embodiment. The specific process of calculating raw_data2 can refer to the relevant description in the above embodiment and will not be repeated. The first value related to the first distance can include that the first value is linearly related to the first distance, and can also include that the first value is exponentially related to the first distance, etc., which is not limited in the embodiment of the present application.

[0258] It can be understood that the first value of compensation is proportional to the distance between the brightest point in the first image and the center point of the first image. When the distance between the brightest point and the center point is small, the accuracy of the camera detecting the ambient light brightness is high, and the ambient light brightness can be compensated less, and the first value can be small. When the distance between the brightest point and the center point is large, the accuracy of the camera detecting the ambient light brightness is low, and the ambient light brightness can be compensated more, and the first value can be large.

[0259] S903: Obtain second data indicating the brightness of ambient light based on the second image captured by the camera.

[0260] In the embodiment of the present application, the second image is similar to the first image, and the second image may also be an image used to reflect the brightness of the ambient light, which will not be described in detail.

[0261] The second data may be understood as original data corresponding to the second image.

[0262] S904. Compensate the second data with a second value to obtain a second ambient light brightness, wherein the second value is related to a second distance, the second distance includes a distance between a brightest point in the second image and a center point of the second image, the second distance is greater than the first distance, and the second value is greater than the first value.

[0263] In the embodiment of the present application, the second ambient light brightness may include a lux value, and the electronic device may calculate the second ambient light brightness based on the second data. In the process of calculating the second ambient light brightness, due to the limitation of the photosensitivity accuracy of the camera itself, there is a certain error between the ambient light brightness detected by the camera and the ambient light brightness in the actual environment. Therefore, the electronic device may perform ambient light compensation on the second data so that the ambient light brightness detected by the camera can maintain a stable output.

[0264] The second value may be understood as a value after ambient light brightness compensation is performed on the second data. The second value may include raw_data2 in the above embodiment. The specific process of calculating raw_data2 may refer to the relevant description in the above embodiment and will not be repeated here.

[0265] The second value being related to the second distance may include the second value being linearly related to the second distance, or the second value being exponentially related to the second distance, etc., which is not limited in the embodiments of the present application.

[0266] It can be understood that the second value of compensation is proportional to the distance between the brightest point in the second image and the center point of the second image. When the distance between the brightest point and the center point is small, the accuracy of the camera detecting the ambient light brightness is high, and the ambient light brightness can be compensated less, and the second value can be smaller. When the distance between the brightest point and the center point is large, the accuracy of the camera detecting the ambient light brightness is low, and the ambient light brightness can be compensated more, and the second value can be larger.

[0267] The ambient light brightness detection method provided in the embodiment of the present application can find the brightest or relatively bright points in the image by analyzing the image data collected by the camera. These bright spots are most likely the positions of the light sources. In order to reduce the influence of the light source position on the ambient light data, the detected ambient light data can be corrected based on the distance between the bright spot and the center point of the image, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0268] Optional, in Fig. 9 On the basis of the corresponding embodiment, the first value is linearly related to the first distance, and the coefficient of the first distance is a positive number.

[0269] In the embodiment of the present application, the first value is linearly related to the first distance and the coefficient of the first distance is a positive number, which can be understood as the first value is proportional to the first distance. When the first distance is small, the first value is small; when the first distance is large, the first value is also large.

[0270] When the first distance is small, since the accuracy of the camera detecting the ambient light brightness is high, the ambient light brightness can be compensated less, and the first value can be small. When the first distance is large, the accuracy of the camera detecting the ambient light brightness is low, so the ambient light brightness can be compensated more, and the first value can be large. In this way, the detected ambient light data can be corrected based on the first distance, so that the ambient light data detected by the camera fluctuates less and the output result is relatively stable.

[0271] Optional, in Fig. 9 Based on the corresponding embodiment, the first value satisfies the following formula:

[0272] raw_data2=k×d+raw_data.

[0273] Among them, raw_data2 is the first value, d is the first distance, k is the coefficient of the first distance, and raw_data is the first data.

[0274] In the embodiment of the present application, the formula of the first value raw_data2 can refer to the relevant description in the above embodiment and will not be repeated here.

[0275] It can be understood that the k value can be set to a fixed value, which can be an empirical value preset in the electronic device. The k value can also be set to different values ​​according to the ambient light brightness. For example, different ambient light brightnesses can correspond to different k values, or different ambient light brightness ranges can correspond to different k values. Exemplarily, the k value can include 16.318 in the above embodiment, etc. The specific value of k is not limited in the embodiments of this application.

[0276] Different k values ​​can be set for different ambient light brightness, so that corresponding adjustments can be made to different ambient lights, thereby compensating for the ambient light brightness more accurately.

[0277] Optional, in Fig. 9 On the basis of the corresponding embodiment, before compensating the first data for the first value to obtain the first ambient light brightness, it may also include: determining the coefficient of the first distance; compensating the first data for the first value to obtain the first ambient light brightness may include: obtaining the first value based on the first distance and the coefficient of the first distance, and compensating the first data for the first value to obtain the first ambient light brightness.

[0278] In the embodiment of the present application, before compensating the first data with the first value, it is known from the formula corresponding to the first value that the coefficient of the first distance needs to be determined first. The value of the coefficient of the first distance can refer to the description in the above embodiment and will not be repeated here.

[0279] It can be understood that different values ​​of the coefficient of the first distance will result in different compensated first values. Therefore, the coefficient of the first distance can be determined based on the ambient light brightness lux value, or based on the first data, or based on other data, which is not limited in the embodiments of the present application.

[0280] By determining a suitable coefficient of the first distance, the first data can be compensated more accurately to obtain the first ambient light brightness that matches the actual environment, thereby improving the accuracy of display screen brightness adjustment and enhancing user experience.

[0281] Optional, in Fig. 9 On the basis of the corresponding embodiments, determining the coefficient of the first distance may include: calculating the third ambient light brightness, the third ambient light brightness is related to the first data; if the third ambient light brightness belongs to the first range, the coefficient of the first distance is the first coefficient; or, if the third ambient light brightness belongs to the second range, the coefficient of the first distance is the second coefficient; or, if the third ambient light brightness belongs to the third range, the coefficient of the first distance is the third coefficient; wherein, the ambient light brightness of the first range is less than the ambient light brightness of the second range, the ambient light brightness of the second range is less than the ambient light brightness of the third range, and the first coefficient, the second coefficient and the third coefficient are all different.

[0282] In the embodiment of the present application, the third ambient light brightness may include a lux value used to represent the ambient light brightness. The third ambient light brightness may be used as a lux value of a coefficient used to determine the first distance before calculating the first ambient light brightness.

[0283] The coefficient of the first distance can be determined according to the brightness of the third ambient light. The electronic device can divide the brightness of the third ambient light into different brightness ranges. The brightness of the third ambient light can be divided into one or more brightness ranges. The specific range of the division is not limited in the embodiment of the present application.

[0284] Exemplarily, taking the third ambient light brightness being divided into three ranges as an example, the first range may include [0, 500) in the above embodiment, the second range may include [500, 5000) in the above embodiment, and the third range may include [5000, 20000] in the above embodiment.

[0285] It is understandable that different ranges correspond to different ambient light brightnesses. For example, the first range may correspond to scenes with darker ambient light brightness; the second range may correspond to scenes with brighter ambient light brightness; and the third range may correspond to scenes with high ambient light brightness. In this way, different coefficients can be set for different ambient light brightnesses, and corresponding adjustments can be made for different environments, so as to more accurately compensate for the ambient light brightness. In addition, since electronic devices often use lux values ​​to measure the brightness of ambient light, it is more convenient for electronic devices to use lux values ​​for data calibration, and it is easy to apply to production line production.

[0286] Optional, in Fig. 9 Based on the corresponding embodiment, the brightness of the third ambient light satisfies the following formula:

[0287] lux0=calibration coefficient×LuxValueConvert(raw_data).

[0288] Wherein, lux0 is the third ambient light brightness, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0289] In the embodiment of the present application, the third ambient light brightness can be obtained based on the first data. The third ambient light brightness can include the initial lux value in the above embodiment.

[0290] It can be understood that when using this formula to calculate the initial lux value, there is no need to calculate the distance from the brightest point to the center point, nor is there any need to consider the value of the default coefficient corresponding to the distance from the brightest point to the center point, thereby reducing the computing power of the electronic device and improving the execution efficiency of the electronic device.

[0291] Optional, in Fig. 9 Based on the corresponding embodiment, the brightness of the third ambient light satisfies the following formula:

[0292] lux0=calibration coefficient×LuxValueConvert(k0×d+raw_data).

[0293] Wherein, lux0 is the third ambient light brightness, d is the first distance, k0 is the default coefficient, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0294] In the embodiment of the present application, the default coefficient can be set based on experience, and the default coefficient can be the same as or different from the first coefficient, the second coefficient, or the third coefficient.

[0295] It can be understood that by using the formula containing the default coefficient to calculate the initial lux value, the current ambient light brightness, that is, the initial lux value, can be calculated more accurately because the influence of the distance from the brightest point to the center point on the ambient light brightness is taken into account. This can more reasonably determine whether the current use of the default coefficient to calculate the ambient light brightness is reasonable.

[0296] Optional, in Fig. 9 On the basis of the corresponding embodiment, the coefficient of the first distance is related to the first data.

[0297] In the embodiment of the present application, since the first data is obtained first and the first value is calculated later, when determining the coefficient of the first distance based on the first data, there is no need to use the default coefficient or calculate the initial lux value. The corresponding coefficient can be determined based on the interval where the first data is located. This can reduce the number of times the lux value is calculated, reduce the computing power of the electronic device, and improve the operating efficiency of the electronic device.

[0298] Optional, in Fig. 9 On the basis of the corresponding embodiments, if the first data belongs to the fourth range, the coefficient of the first distance is the fourth coefficient; or, if the first ambient light brightness belongs to the fifth range, the coefficient of the first distance is the fifth coefficient; or, if the first ambient light brightness belongs to the sixth range, the coefficient of the first distance is the sixth coefficient; wherein, the ambient light brightness of the fourth range is less than the ambient light brightness of the fifth range, the ambient light brightness of the fifth range is less than the ambient light brightness of the sixth range, and the fourth coefficient, the fifth coefficient and the sixth coefficient are all different.

[0299] In an embodiment of the present application, the fourth coefficient may be the same as or different from the first coefficient, the second coefficient or the third coefficient; the fifth coefficient may be the same as or different from the first coefficient, the second coefficient or the third coefficient; the sixth coefficient may be the same as or different from the first coefficient, the second coefficient or the third coefficient, and the fourth coefficient, the fifth coefficient and the sixth coefficient are all different.

[0300] It is understandable that different ranges of the first data may correspond to different ambient light brightnesses, for example, the fourth range may correspond to scenes with darker ambient light brightness; the fifth range may correspond to scenes with brighter ambient light brightness; and the sixth range may correspond to scenes with high ambient light brightness. In this way, different coefficients may be set for different ranges of the first data, thereby making corresponding adjustments for different environments and more accurately compensating for ambient light brightness.

[0301] Optional, in Fig. 9 Based on the corresponding embodiment, the brightness of the first ambient light satisfies the following formula:

[0302] lux=calibration coefficient×LuxValueConvert(raw_data2).

[0303] Wherein, lux is the first ambient light brightness, raw_data2 is the first value, LuxValueConvert is a data calibration function used to calibrate the difference between the first value and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

[0304] In the embodiment of the present application, the brightness of the first ambient light can refer to the relevant description of the formula corresponding to the conversion relationship between raw_data and lux value in the above embodiment, which is not repeated here.

[0305] It can be seen from the formula that the electronic device can perform ambient light compensation on the raw data raw_data collected by the front camera to obtain raw_data2, and calibrate raw_data2 to obtain the lux value, thereby reducing the difference in hardware devices of the front camera, and calibrating the difference between the ambient light brightness detected by the front camera and the ambient light brightness in the actual environment, thereby improving the accuracy of the ambient light brightness detected by the front camera.

[0306] Optional, in Fig. 9On the basis of the corresponding embodiments, the electronic device includes a camera service module, a sensor service module, a camera control module, a sensor control module, and a camera driver. Before obtaining the first data for indicating the brightness of the ambient light based on the first image captured by the camera, it may also include: sending a brightness monitoring instruction to the sensor control module based on the sensor service module; calling the first interface based on the Android interface definition language AIDL service based on the brightness monitoring instruction by the sensor control module, and the first interface is used to register a callback function in the camera control module; calling the second interface based on the hardware abstraction layer interface definition language HIDL service based on the sensor control module, and passing the first instruction to the camera service module, the first instruction is used to instruct the camera to capture an image and obtain data for indicating the brightness of the ambient light; calling the first function in the camera control module based on the first instruction by the camera service module; executing the first function based on the camera control module to control the camera driver to power on the camera, initialize the camera registers and create a reading thread for the ambient light brightness.

[0307] In the embodiment of the present application, the interaction process between the specific camera service module, sensor service module, camera control module, sensor control module, and camera driver module can refer to Figure 8 The relevant descriptions in the corresponding embodiments are not repeated here.

[0308] Specifically, the brightness monitoring instruction sent to the sensor control module by the sensor service module can refer to the relevant description in step S802. The first interface called by the sensor control module can refer to the relevant description in step S803. The second interface called by the sensor control module to pass the first instruction to the camera service module can refer to the relevant description in step S804. The camera service module calls the first function in the camera control module based on the first instruction, which can refer to the relevant description in step S805. The camera control module executes the first function to control the camera driver to power on the camera, initialize the camera register and create a reading thread for the ambient light brightness, which can refer to the relevant description in step S806.

[0309] It is understandable that when the front camera is used instead of the ambient light detection device, no image output resources will be configured for the front camera, and the front camera will not collect images for display on the display screen. In this way, the resource consumption of the front camera can be reduced, thereby improving the performance of the electronic device.

[0310] Optional, in Fig. 9On the basis of the corresponding embodiment, after obtaining the first data for indicating the brightness of the ambient light based on the first image captured by the camera, it can also include: reporting the first data to the camera control module based on the camera driver; compensating the first data by a first value to obtain the first ambient light brightness, including: based on the camera control module, the sensor control module or the camera driver, compensating the first data by a first value to obtain the first ambient light brightness.

[0311] In the embodiment of the present application, the first data is reported to the camera control module based on the camera driver, and the related description in step S807 can be referred to. Based on the camera control module, the sensor control module or the camera driver, the first data is compensated with a first value to obtain the first ambient light brightness, and the related description in step S808 can be referred to.

[0312] Thus, when the distance between the brightest point of the original data and the center point of the original data is small, less ambient light brightness can be compensated. When the distance between the brightest point of the original data and the center point of the original data is large, more ambient light brightness can be compensated.

[0313] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0314] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the method steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0315] The embodiment of the present application can divide the functional modules of the device implementing the method according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0316] like Fig.10 FIG. 1 is a schematic diagram of a chip structure provided by an embodiment of the present application. The chip 1000 includes one or more (including two) processors 1001 , a communication line 1002 , a communication interface 1003 and a memory 1004 .

[0317] In some implementations, the memory 1004 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0318] The method described in the above embodiment of the present application can be applied to the processor 1001, or implemented by the processor 1001. The processor 1001 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware or software instructions in the processor 1001. The above processor 1001 can be a general processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 1001 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.

[0319] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 1004, and the processor 1001 reads the information in the memory 1004 and completes the steps of the above method in combination with its hardware.

[0320] The processor 1001 , the memory 1004 , and the communication interface 1003 may communicate with each other via the communication line 1002 .

[0321] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0322] The embodiment of the present application also provides a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium may include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0323] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0324] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.

[0325] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

Claims

1. A method for detecting ambient light brightness, characterized in that: The method comprises: Based on the first image captured by the camera, first data indicating the brightness of the ambient light is obtained; Compensating the first data with a first value to obtain a first ambient light brightness, wherein the first value is related to a first distance, and the first distance includes a distance between a brightest point in the first image and a center point of the first image; Based on the second image captured by the camera, obtaining second data indicating the brightness of the ambient light; The second data is compensated for a second value to obtain a second ambient light brightness, wherein the second value is related to a second distance, the second distance includes the distance between the brightest point in the second image and the center point of the second image, the second distance is greater than the first distance, and the second value is greater than the first value.

2. The method according to claim 1, characterized in that The first value is linearly correlated with the first distance, and the coefficient of the first distance is a positive number.

3. The method according to claim 1 or 2, characterized in that: The first value satisfies the following formula: raw_data2=k×d+raw_data; Among them, raw_data2 is the first value, d is the first distance, k is the coefficient of the first distance, and raw_data is the first data.

4. The method according to claim 2 or 3, characterized in that: Before compensating the first data with a first value to obtain a first ambient light brightness, the method further includes: determining a coefficient of the first distance; Compensating the first data with a first value to obtain a first ambient light brightness includes: The first value is obtained based on the first distance and a coefficient of the first distance, and the first data is compensated for the first value to obtain the first ambient light brightness.

5. The method according to claim 4, characterized in that The coefficient for determining the first distance includes: Calculating a third ambient light brightness, where the third ambient light brightness is related to the first data; If the brightness of the third ambient light belongs to the first range, the coefficient of the first distance is the first coefficient; Alternatively, if the third ambient light brightness belongs to the second range, the coefficient of the first distance is the second coefficient; Alternatively, if the third ambient light brightness belongs to a third range, the coefficient of the first distance is a third coefficient; The ambient light brightness in the first range is smaller than the ambient light brightness in the second range, the ambient light brightness in the second range is smaller than the ambient light brightness in the third range, and the first coefficient, the second coefficient and the third coefficient are all different.

6. The method according to claim 5, characterized in that The third ambient light brightness satisfies the following formula: lux0 = calibration factor × LuxValueConvert(raw_data); Among them, lux0 is the third ambient light brightness, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

7. The method according to claim 5, characterized in that The third ambient light brightness satisfies the following formula: lux0 = calibration factor × LuxValueConvert (k0 × d + raw_data); Among them, lux0 is the third ambient light brightness, d is the first distance, k0 is the default coefficient, raw_data is the first data, LuxValueConvert is a data calibration function used to calibrate the difference between the first data and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

8. The method according to claim 2 or 3, characterized in that: The coefficient of the first distance is related to the first data.

9. The method according to claim 8, characterized in that If the first data belongs to a fourth range, the coefficient of the first distance is a fourth coefficient; Alternatively, if the brightness of the first ambient light belongs to the fifth range, the coefficient of the first distance is the fifth coefficient; Alternatively, if the brightness of the first ambient light belongs to the sixth range, the coefficient of the first distance is the sixth coefficient; The ambient light brightness in the fourth range is smaller than the ambient light brightness in the fifth range, the ambient light brightness in the fifth range is smaller than the ambient light brightness in the sixth range, and the fourth coefficient, the fifth coefficient and the sixth coefficient are all different.

10. The method according to any one of claims 1 to 9, characterized in that: The first ambient light brightness satisfies the following formula: lux = calibration factor × LuxValueConvert(raw_data2); Among them, lux is the first ambient light brightness, raw_data2 is the first value, LuxValueConvert is a data calibration function used to calibrate the difference between the first value and the ambient light brightness in the actual environment, and the calibration coefficient is used to calibrate the difference between the camera and the standard camera.

11. The method according to any one of claims 1 to 10, characterized in that: The electronic device includes a camera service module, a sensor service module, a camera control module, a sensor control module, and a camera driver. Before obtaining first data indicating the brightness of ambient light based on a first image captured by the camera, the electronic device further includes: Sending a brightness monitoring instruction to the sensor control module based on the sensor service module; Based on the brightness monitoring instruction, the sensor control module calls a first interface based on an Android interface definition language AIDL service, where the first interface is used to register a callback function in the camera control module; Based on the sensor control module, a second interface based on a hardware abstraction layer interface definition language HIDL service is called to pass a first instruction to the camera service module, where the first instruction is used to instruct the camera to capture an image and obtain data used to indicate the brightness of the ambient light; Based on the camera service module and based on the first instruction, calling a first function in the camera control module; The first function is executed based on the camera control module to control the camera driver to power on the camera, initialize the camera register and create a reading thread for the ambient light brightness.

12. The method according to claim 11, characterized in that After obtaining first data indicating the brightness of ambient light based on the first image captured by the camera, the method further includes: Reporting the first data to the camera control module based on the camera driver; Compensating the first data with a first value to obtain a first ambient light brightness includes: Based on the camera control module, the sensor control module or the camera driver, the first data is compensated with the first value to obtain the first ambient light brightness.

13. An electronic device, characterized in that: The electronic device comprises: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1-12.

14. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method according to any one of claims 1-12.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 12.

16. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Screen brightness adjusting method and device, terminal and storage medium

    CN115831076A

  • Electronic apparatus

    JP2013007827A

  • Projection system, projection device, projection method and program

    JP2016075883A

  • Image sensor communication apparatus and method for compensating error

    KR1020120068665A

  • Alignment factor for ambient lighting calibration

    US20120019494A1