Ambient light detection method and electronic deviceTechnical Field
The present invention relates to the field of light measurement, and in particular, to an ambient light detection method and an electronic device.
Background
The current camera integrated in handheld terminal such as cell-phone, panel computer often can meet when shooing because lack the accurate judgement to the ambient light, and cause the problem that the photo is too bright or too dark. At present, high-end professional cameras such as digital single lens reflex cameras are equipped with a multi-point light measuring device, and surrounding environment light can be accurately judged through an RGB (three primary colors of color) sensor array, so that the shooting quality of photos is guaranteed.
However, in a high-end professional camera, since a photometric optical path is required to be the same as a shooting optical path, the structure is complicated, the size of the camera is difficult to be reduced, and the camera is expensive and difficult to be widely used.
Disclosure of Invention
In view of the above, the present invention provides an ambient light detection method and an electronic device to reduce the shooting cost and improve the shooting quality. The technical scheme is as follows:
in a first aspect, an ambient light detection method is provided, which is applied to an electronic device, where a first light sensor and a second light sensor are disposed in the electronic device, and the method includes:
acquiring first data acquired by the first light sensor and second data acquired by the second light sensor;
determining the light state of the current environment of the electronic equipment according to the first data and the second data;
and adjusting image input parameters or image output parameters of the electronic equipment according to the light state.
Wherein, the electronic device further includes an image acquisition unit, and then the adjusting the image input parameters of the electronic device according to the light state includes:
and adjusting the shooting parameters of the image acquisition unit according to the light state.
Wherein, the electronic device further includes a display unit, and the adjusting the image output parameter of the electronic device according to the light state includes:
and adjusting the display parameters of the display unit according to the light state.
Wherein the first light sensor and the second light sensor are located on different faces of the electronic device.
The first light sensor and the second light sensor are positioned on two opposite surfaces of the electronic equipment.
Wherein the method further comprises:
and controlling the difference between the moment of adjusting the shooting parameters of the image acquisition unit and the moment of acquiring the first data and the second data not to exceed a set duration.
Wherein, the first data that the said first light sensor of acquisition gathered, and the second data that the second light sensor gathered, include:
in a first appointed time, acquiring data acquired by the first light sensor and data acquired by the second light sensor according to appointed times;
and averaging the acquired data collected by the first light sensor to obtain the first data, and averaging the acquired data collected by the second light sensor to obtain the second data.
In a second aspect, an electronic device is provided, in which a first light sensor and a second light sensor are disposed, and the electronic device includes:
the acquisition module is used for acquiring first data acquired by the first light sensor and second data acquired by the second light sensor;
the determining module is used for determining the light state of the current environment of the electronic equipment according to the first data and the second data;
and the adjusting module is used for adjusting the image input parameters or the image output parameters of the electronic equipment according to the light state.
Wherein, the electronic equipment still includes the image acquisition unit, then the adjustment module includes:
and the input parameter adjusting unit is used for adjusting the shooting parameters of the image acquisition unit according to the light state.
Wherein, the electronic device further comprises a display unit, and then the adjusting module comprises:
and the output parameter adjusting unit is used for adjusting the display parameters of the display unit according to the light state.
Wherein the electronic device further comprises:
and the synchronization module is used for controlling the difference between the moment of adjusting the shooting parameters by the input parameter adjusting unit and the moment of acquiring the first data and the second data by the acquisition module not to exceed a set duration.
Wherein the acquisition module comprises:
the acquisition unit is used for acquiring the data acquired by the first light sensor and the data acquired by the second light sensor according to the appointed times within the appointed first time period;
and the calculating unit is used for averaging the data acquired by the first light sensor acquired by the acquiring unit to obtain the first data, and averaging the data acquired by the second light sensor acquired by the acquiring unit to obtain the second data.
Wherein the first light sensor and the second light sensor are located on different faces of the electronic device.
The first light sensor and the second light sensor are positioned on two opposite surfaces of the electronic equipment.
The electronic equipment is handheld equipment.
The technical scheme provided by the invention has the beneficial effects that: acquiring first data acquired by the first light sensor and second data acquired by the second light sensor; determining the light state of the current environment of the electronic equipment according to the first data and the second data; the image input parameters or the image output parameters of the electronic equipment are adjusted according to the light state, the structure is simple, the realization is easy, the price of the light sensor is low, the cost is reduced, the shooting quality is improved when the image input parameters are adjusted based on the light state of the current environment, the display effect is improved when the image output parameters are adjusted based on the light state of the current environment, and the application is more flexible and wide.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of an ambient light detection method provided inembodiment 1 of the present invention;
fig. 2 is a flowchart of an ambient light detection method provided inembodiment 2 of the present invention;
fig. 3 is a schematic diagram of an electronic device provided inembodiment 2 of the present invention, in which two light sensors are disposed;
fig. 4 is a flowchart of an ambient light detection method provided in embodiment 3 of the present invention;
fig. 5 is a schematic diagram of an electronic device provided in embodiment 3 of the present invention, in which four light sensors are disposed;
fig. 6 is a structural diagram of an electronic device provided in embodiment 4 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
Referring to fig. 1, the present embodiment provides an ambient light detection method applied to an electronic device, in which a first light sensor and a second light sensor are disposed, the method including:
101: acquiring first data acquired by a first light sensor and second data acquired by a second light sensor;
102: determining the light state of the current environment of the electronic equipment according to the first data and the second data;
103: and adjusting image input parameters or image output parameters of the electronic equipment according to the light state.
In this embodiment, the light sensors can sense ambient light conditions, the number of the light sensors is at least two, the light sensors are located on different surfaces of the electronic device, and at least one light sensor is arranged on the same surface as a camera of the electronic device. More precisely, being located on different faces of the electronic device means that the light ray sensors are located inside the electronic device, respectively detecting light rays coming from different faces of the electronic device. The different faces of the electronic device refer to the outer surface of the electronic device. Preferably on opposite sides of the electronic device. For example, there are two light sensors, one of which is placed on the front side of the electronic device and the other of which is placed on the back side of the electronic device. For another example, there are four light sensors, one of which is placed on the front side of the electronic device, the other is placed on the back side of the electronic device, and two of which are placed on the left and right sides of the electronic device, respectively.
In this embodiment, further, a difference between a height of the first light sensor or the second light sensor and a height of a lens of the electronic device does not exceed a preset threshold.
In this embodiment, the electronic device further includes an image acquisition unit, and the adjusting the image input parameter of the electronic device according to the light state includes:
and adjusting the shooting parameters of the image acquisition unit according to the light state.
In this embodiment, the electronic device further includes a display unit, and the adjusting the image output parameter of the electronic device according to the light state includes:
and adjusting the display parameters of the display unit according to the light state.
In this embodiment, the method further includes:
and controlling the difference between the moment of adjusting the shooting parameters of the image acquisition unit and the moment of acquiring the first data and the second data not to exceed a set duration.
In this embodiment, the acquiring first data collected by the first light sensor and second data collected by the second light sensor includes:
in a first appointed time, acquiring data acquired by the first light sensor and data acquired by the second light sensor according to appointed times;
and averaging the acquired data collected by the first light sensor to obtain the first data, and averaging the acquired data collected by the second light sensor to obtain the second data.
In the method provided by this embodiment, first data acquired by the first light sensor and second data acquired by the second light sensor are acquired; determining the light state of the current environment of the electronic equipment according to the first data and the second data; the image input parameters or the image output parameters of the electronic equipment are adjusted according to the light state, the structure is simple, the realization is easy, the price of the light sensor is low, the cost is reduced, the shooting quality is improved when the image input parameters are adjusted based on the light state of the current environment, the display effect is improved when the image output parameters are adjusted based on the light state of the current environment, and the application is more flexible and wide.
Example 2
Referring to fig. 2, the present embodiment provides an ambient light detection method, which is applied to an electronic device, where a first light sensor and a second light sensor are placed in the electronic device, the electronic device further includes an image acquisition unit and a display unit, and the method includes:
201: acquiring first data acquired by the first light sensor and second data acquired by the second light sensor;
202: determining the light state of the current environment of the electronic equipment according to the first data and the second data;
203: and adjusting the shooting parameters of the image acquisition unit according to the light state, or adjusting the display parameters of the display unit according to the light state.
In this embodiment, one of the first light sensor and the second light sensor may be disposed on a front side of the electronic device, and the other may be disposed on a back side of the electronic device, where determining the light state of the current environment of the electronic device according to the first data and the second data may include:
comparing the data of the light sensor placed on the front side of the electronic equipment with the data of the light sensor placed on the back side of the electronic equipment, and if the data of the light sensor placed on the front side of the electronic equipment is larger than the data of the light sensor placed on the back side of the electronic equipment and exceeds a preset threshold value, determining that the light state of the current environment is a direct light; and if the data of the light sensor arranged on the front side of the electronic equipment is smaller than the data of the light sensor arranged on the back side of the electronic equipment, determining that the light state of the current environment is backlight. Accordingly, the image input parameter or the image output parameter of the electronic device may be adjusted according to the front light or the back light.
In this embodiment, the electronic device includes but is not limited to: cell phones, tablet computers, and the like.
In this embodiment, the shooting parameters include, but are not limited to: exposure related parameters, a photometric method, white balance setting, and the like. Under different light states, the numerical values corresponding to the shooting parameters are different, so that the shooting parameters can be set according to the light state of the current environment, the shooting parameters are suitable for the current scene, and the shooting quality is ensured. Additionally, the display parameters include, but are not limited to: display brightness, etc. Under different light states, the display parameters are different, so that the display parameters can be set according to the light state of the current environment, the display parameters are suitable for the current scene, and the display effect is ensured. For example, if the light intensity of the current environment is weak, the display parameters may be adjusted to be weak, and if the light intensity of the current environment is strong, the display parameters may be adjusted to be bright.
In this embodiment, the height of the light sensor disposed in the electronic device may be any height, and preferably, the difference between the height of the light sensor and the height of the lens of the electronic device does not exceed a preset threshold, in this case, the light sensor and the lens of the electronic device may be considered to be at the same height, so that the surrounding light condition may be more accurately distinguished. The preset threshold may be set according to needs, and this embodiment is not particularly limited to this.
Referring to fig. 3, a schematic diagram of two light sensors disposed in an electronic device is shown. One Light Sensor (LS) is on the front side of the electronic device as shown in the left drawing, and the other Light Sensor (LS) is on the back side of the electronic device as shown in the right drawing, and the heights of the two Light sensors are the same as the height of the lens.
In this embodiment, the number of the light sensors may be at least four, and one of the light sensors is disposed on the front side of the electronic device, another one of the light sensors is disposed on the back side of the electronic device, and the other two of the light sensors are disposed on the left side and the right side of the electronic device respectively. Through setting up four at least light sensor, can guarantee to have more accurate judgement to the light condition in the space of 360 degrees to can improve and shoot the quality.
In this embodiment, further, the method further includes:
and controlling the difference between the moment of adjusting the shooting parameters of the image acquisition unit and the moment of acquiring the first data and the second data not to exceed a set duration. In particular, the control may be implemented using a synchronous clock control signal, which will not be described in greater detail herein.
In this embodiment, the acquiring first data collected by the first light sensor and second data collected by the second light sensor may include:
in a first appointed time, acquiring data acquired by the first light sensor and data acquired by the second light sensor according to appointed times;
and averaging the acquired data collected by the first light sensor to obtain the first data, and averaging the acquired data collected by the second light sensor to obtain the second data.
In the method provided by this embodiment, first data acquired by the first light sensor and second data acquired by the second light sensor are acquired; determining the light state of the current environment of the electronic equipment according to the first data and the second data; the image input parameters or the image output parameters of the electronic equipment are adjusted according to the light state, the structure is simple, the realization is easy, the price of the light sensor is low, the cost is reduced, the shooting quality is improved when the image input parameters are adjusted based on the light state of the current environment, the display effect is improved when the image output parameters are adjusted based on the light state of the current environment, and the application is more flexible and wide.
Example 3
Referring to fig. 4, the present embodiment provides an ambient light detection method, which is applied to an electronic device, where a first light sensor and a second light sensor are disposed in the electronic device, the electronic device further includes an image capturing unit, and the method includes:
401: acquiring first data acquired by the first light sensor and second data acquired by the second light sensor;
402: determining the light state of the current environment of the electronic equipment according to the first data and the second data;
403: and adjusting the shooting parameters of the image acquisition unit according to the light state, and controlling the difference between the time for adjusting the shooting parameters and the time for acquiring the first data and the second data not to exceed a set time length.
Specifically, the shooting parameters of the image acquisition unit are adjusted according to the light state, whether the current shooting parameters are suitable for the determined light state or not can be judged, and if not, the current shooting parameters are adjusted. The determination of whether the current shooting parameter is suitable for the light state may be implemented in various ways, such as determining whether the average brightness of the face reaches a predetermined value, and the like, and if so, the face is considered to be suitable for the determined scene, otherwise, the face is not suitable for the determined scene, which is not specifically limited in this embodiment.
In this embodiment, the electronic device includes but is not limited to: cell phones, tablet computers, and the like.
In this embodiment, the shooting parameters include, but are not limited to: exposure related parameters, a photometric method, white balance setting, and the like. Under different light states, the numerical values corresponding to the shooting parameters are different, so that the shooting parameters can be set according to the light state of the current environment, the shooting parameters are suitable for the current scene, and the shooting quality is ensured. Additionally, the display parameters include, but are not limited to: display brightness, etc. Under different light states, the display parameters are different, so that the display parameters can be set according to the light state of the current environment, the display parameters are suitable for the current scene, and the display effect is ensured. For example, if the light intensity of the current environment is weak, the display parameters may be adjusted to be weaker, and if the light intensity of the current environment is strong, the display parameters may be adjusted to be brighter.
In this embodiment, one of the first light sensor and the second light sensor may be disposed on a front side of the electronic device, and the other may be disposed on a back side of the electronic device, where determining the light state of the current environment of the electronic device according to the first data and the second data may include:
comparing the data of the light sensor placed on the front side of the electronic equipment with the data of the light sensor placed on the back side of the electronic equipment, and if the data of the light sensor placed on the front side of the electronic equipment is larger than the data of the light sensor placed on the back side of the electronic equipment and exceeds a preset threshold value, determining that the light state of the current environment is a direct light; and if the data of the light sensor arranged on the front side of the electronic equipment is smaller than the data of the light sensor arranged on the back side of the electronic equipment, determining that the light state of the current environment is backlight. Accordingly, the image input parameter or the image output parameter of the electronic device may be adjusted according to the front light or the back light.
In this embodiment, the number of the light sensors may be at least four, and one of the light sensors is disposed on the front side of the electronic device, another one of the light sensors is disposed on the back side of the electronic device, and the other two of the light sensors are disposed on the left side and the right side of the electronic device respectively. Through setting up four at least light sensor, can guarantee to have more accurate judgement to the light condition in the space of 360 degrees to improve and shoot the quality.
In this embodiment, the height of the light sensor disposed in the electronic device may be any height, and preferably, the difference between the height of the light sensor and the height of the lens of the electronic device does not exceed a preset threshold, in this case, the light sensor and the lens of the electronic device may be considered to be at the same height, so that the surrounding light condition may be more accurately distinguished. The preset threshold may be set according to needs, and this embodiment is not particularly limited to this.
Referring to fig. 5, a schematic diagram of four light sensors disposed in an electronic device is shown. One of the light sensors is arranged on the front side of the electronic device, as shown in the left figure, the other is arranged on the back side of the electronic device, as shown in the middle figure, and the other light sensor is arranged on the left side of the electronic device, as shown in the right figure, and the other light sensor is not shown in the figure. The heights of the four light ray sensors are all the same as the height of a lens of the electronic equipment.
In the method provided by this embodiment, first data acquired by the first light sensor and second data acquired by the second light sensor are acquired; determining the light state of the current environment of the electronic equipment according to the first data and the second data; the image input parameters or the image output parameters of the electronic equipment are adjusted according to the light state, the structure is simple, the realization is easy, the price of the light sensor is low, the cost is reduced, the shooting quality is improved when the image input parameters are adjusted based on the light state of the current environment, the display effect is improved when the image output parameters are adjusted based on the light state of the current environment, and the application is more flexible and wide.
Example 4
Referring to fig. 6, the present embodiment provides an electronic device, in which a first light sensor LS1 and a second light sensor LS2 are disposed, and the electronic device includes:
an obtainingmodule 601, configured to obtain first data collected by the first light sensor and second data collected by the second light sensor;
a determiningmodule 602, configured to determine a light status of a current environment of the electronic device according to the first data and the second data;
theadjusting module 603 is configured to adjust an image input parameter or an image output parameter of the electronic device according to the light state.
Wherein, the electronic equipment still includes the image acquisition unit, then the adjustment module includes:
and the input parameter adjusting unit is used for adjusting the shooting parameters of the image acquisition unit according to the light state.
Wherein, the electronic device further comprises a display unit, and then the adjusting module comprises:
and the output parameter adjusting unit is used for adjusting the display parameters of the display unit according to the light state.
Wherein, electronic equipment still includes the image acquisition unit, electronic equipment still includes:
and the synchronization module is used for controlling the difference between the time when the image acquisition unit acquires the image and the time when the acquisition module acquires the first data and the second data not to exceed the set duration.
Wherein the acquisition module comprises:
the acquisition unit is used for acquiring the data acquired by the first light sensor and the data acquired by the second light sensor according to the appointed times within the appointed first time period;
and the calculating unit is used for averaging the data acquired by the first light sensor acquired by the acquiring unit to obtain the first data, and averaging the data acquired by the second light sensor acquired by the acquiring unit to obtain the second data.
In this embodiment, the first light sensor and the second light sensor are located on different surfaces of the electronic device. Preferably, the first light sensor and the second light sensor are located on two opposite faces of the electronic device. For example, one of which is placed on the front side of the electronic device and the other on the back side of the electronic device.
Preferably, the number of the light sensors is at least four, one of the light sensors is arranged on the front side of the electronic device, the other light sensor is arranged on the back side of the electronic device, and the other light sensor is arranged on the left side and the right side of the electronic device respectively. Through setting up four at least light sensor, can guarantee to have more accurate judgement to the light condition in the space of 360 degrees to improve and shoot the quality.
In this embodiment, the difference between the height of the light sensor and the height of the lens of the electronic device does not exceed a preset threshold, so that the ambient light conditions can be more accurately identified. The preset threshold may be set according to needs, and this embodiment is not particularly limited to this.
In this embodiment, the electronic device is a handheld device, and includes but is not limited to: a mobile phone or a tablet computer, etc., which is not limited in this embodiment.
The above-mentioned device provided in this embodiment may perform the method provided in any of the above-mentioned method embodiments, and the detailed process is described in the method embodiments, which is not described herein again.
In the device provided by this embodiment, first data acquired by the first light sensor and second data acquired by the second light sensor are acquired; determining the light state of the current environment of the electronic equipment according to the first data and the second data; the image input parameters or the image output parameters of the electronic equipment are adjusted according to the light state, the structure is simple, the realization is easy, the price of the light sensor is low, the cost is reduced, the shooting quality is improved when the image input parameters are adjusted based on the light state of the current environment, the display effect is improved when the image output parameters are adjusted based on the light state of the current environment, and the application is more flexible and wide.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.