Light source identification method and device, electronic equipment and readable storage medium
By acquiring the frequency domain signal of the light source and calculating its energy value, and determining whether the light source exhibits periodic changes based on preset conditions, the accuracy problem of electronic devices in identifying light sources is solved, thus improving the accuracy of light source identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- VIVO MOBILE COMM CO LTD
- Filing Date
- 2023-04-07
- Publication Date
- 2026-04-24
AI Technical Summary
When electronic devices identify light sources, existing technologies cannot accurately distinguish between DC and AC light sources, especially when the brightness of the light source fluctuates, leading to inaccurate determination results.
By acquiring the frequency domain signal of the target light source, calculating its energy value and determining the target value, and judging whether the light source exhibits periodic changes based on preset conditions, the type of light source can be accurately identified.
It improves the accuracy of electronic devices in identifying light sources and reduces the probability of DC light sources being misidentified as AC light sources or vice versa.
Smart Images

Figure CN116704318B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment technology, specifically relating to a light source identification method, device, electronic equipment, and readable storage medium. Background Technology
[0002] Typically, electronic devices can detect the brightness characteristics of the light source in their environment using a flicker sensor, and determine whether the light source is an AC or DC light source based on these brightness characteristics. The brightness of the AC light source changes periodically, while the brightness of the DC light source does not change periodically.
[0003] However, since the light source in the environment where the electronic device is located may be a DC light source, and the brightness of the DC light source may fluctuate, the determination result obtained by the electronic device based on the brightness characteristics of the light source may not be accurate. Summary of the Invention
[0004] The purpose of this application is to provide a light source identification method, device, electronic device, and readable storage medium, which can solve the problem that the determination result obtained by electronic devices based on the brightness characteristics of the light source is inaccurate.
[0005] In a first aspect, embodiments of this application provide a light source identification method, the method comprising: acquiring N frequency domain signals corresponding to a target light source, wherein the target light source is a light source in the environment where the electronic device is located, and N is a positive integer; determining a target value based on N energy values corresponding one-to-one with the N frequency domain signals, wherein the target value is used to characterize the fluctuation of the N frequency domain signals; determining the target light source as a first light source when the target value meets preset conditions, wherein the brightness of the first light source does not change periodically; and determining the target light source as a second light source when the target value does not meet preset conditions.
[0006] Secondly, embodiments of this application provide a light source identification device, which includes an acquisition module and a determination module. The acquisition module is used to acquire N frequency domain signals corresponding to a target light source, where the target light source is a light source in the environment where the light source identification device is located, and N is a positive integer. The determination module is used to determine a target value based on the N energy values corresponding to the N frequency domain signals acquired by the acquisition module. This target value characterizes the fluctuation of the N frequency domain signals. If the target value meets a preset condition, the target light source is determined to be a first light source, the brightness of which does not exhibit periodic changes. If the target value does not meet the preset condition, the target light source is determined to be a second light source, the brightness of which exhibits periodic changes.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the method described in the first aspect.
[0011] In this embodiment of the application, the electronic device can acquire N frequency domain signals corresponding to the target light source in the environment where the electronic device is located, and determine a target value based on the N energy values corresponding to the N frequency domain signals. The target value is used to characterize the fluctuation of the N frequency domain signals. Thus, when the target value meets the preset conditions, the electronic device can determine that the target light source is a first light source whose brightness does not change periodically, and when the target value meets the preset conditions, the electronic device can determine that the target light source is a second light source whose brightness changes periodically. Because the electronic device can determine a target value characterizing the fluctuation of N frequency domain signals based on N energy values corresponding to those N signals, and then determine whether the brightness of the target light source exhibits periodic variation by checking if this target value meets preset conditions, rather than determining periodicity based on the brightness characteristics of the target light source, the electronic device can accurately determine that the brightness of the target light source does not exhibit periodic variation when the target value meets the preset conditions. This reduces the probability of determining that the brightness of the target light source exhibits periodic variation when the brightness of the target light source does not exhibit periodic variation but fluctuates. Conversely, if the target value does not meet the preset conditions, the electronic device can accurately determine that the brightness of the target light source exhibits periodic variation, reducing the probability of determining that the brightness of the target light source does not exhibit periodic variation when the brightness of the target light source exhibits periodic variation and the amplitude of the brightness variation is small. Therefore, the accuracy of the determination results obtained by the electronic device can be improved. Attached Figure Description
[0012] Figure 1This is one of the flowcharts illustrating the light source recognition method provided in this application;
[0013] Figure 2 This is the second flowchart illustrating the light source identification method provided in this application;
[0014] Figure 3 This is the third flowchart illustrating the light source identification method provided in this application;
[0015] Figure 4 This is one of the structural schematic diagrams of the light source recognition device provided in the embodiments of this application;
[0016] Figure 5 This is a second schematic diagram of the structure of the light source recognition device provided in the embodiments of this application;
[0017] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0018] Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0020] The following will explain the terminology used in the embodiments of this application.
[0021] 1. DC electric light source and AC electric light source
[0022] Generally, a light source powered by direct current (DC) can be called a DC light source. The brightness of such a DC light source does not flicker at a certain frequency.
[0023] A light source powered by alternating current (AC) can be called an AC light source. The brightness of this AC light source will flicker at the AC operating frequency.
[0024] 2. Flicker phenomenon
[0025] When the light source in the environment where the electronic device is located is an alternating current (AC) light source, the brightness of the AC light source will flicker at the AC operating frequency. This will cause the signal strength to be different at different locations in the captured image, resulting in black and white stripes on the captured image, i.e., the flickering phenomenon.
[0026] 3. Other terms
[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0028] The light source recognition method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0029] The light source recognition method provided in this application can be applied to shooting scenarios.
[0030] Suppose a user takes a picture using an electronic device. The user triggers the device to display a preview interface. The device uses a flicker sensor to detect the brightness characteristics of the ambient light source and determines whether it is an AC or DC light source. However, there are possibilities: the ambient light source might be DC, and its brightness might fluctuate. In this case, the device might mistakenly identify it as AC based on the DC light source's brightness characteristics. Conversely, the ambient light source might be AC, and its brightness variation might be small. In this case, the device might mistakenly identify it as DC based on the AC light source's brightness characteristics. Therefore, the determination result obtained by the electronic device based on the light source's brightness characteristics may be inaccurate.
[0031] However, in this embodiment, after the user triggers the electronic device to display the shooting preview interface, the electronic device can acquire at least one frequency domain signal of the light source in the environment where the electronic device is located, and determine a signal value to characterize the fluctuation of the at least one frequency domain signal based on at least one energy value corresponding to the at least one frequency domain signal. Thus, the electronic device can determine that the light source in the environment where the electronic device is located is a DC light source if the signal value meets a preset condition; or determine that the light source in the environment where the electronic device is located is an AC light source if the signal value does not meet the preset condition. It can be understood that since the electronic device can determine the signal value to characterize the fluctuation of the at least one frequency domain signal based on at least one energy value corresponding to the at least one frequency domain signal, and determine whether the brightness of the light source in the environment where the electronic device is located changes periodically based on whether the signal value meets the preset condition, the electronic device can accurately determine that the brightness of the light source in the environment where the electronic device is located does not change periodically when the signal value meets the preset condition. This reduces the possibility that the electronic device might determine the brightness of the light source in the environment where the electronic device is located to be periodically changing when the light source in the environment where the electronic device is located is a DC light source and the brightness of the DC light source fluctuates, thus reducing the possibility that the electronic device might identify a DC light source as an AC light source. Alternatively, if the signal value does not meet the preset conditions, the electronic device can accurately determine that the brightness of the light source in the environment where the electronic device is located changes periodically. This reduces the possibility that when the light source in the environment where the electronic device is located is an AC light source and the brightness change amplitude of the AC light source is small, the electronic device will determine that the brightness of the light source in the environment where the electronic device is located does not change periodically. Therefore, the accuracy of the determination result made by the electronic device is improved.
[0032] Figure 1 A flowchart of a light source identification method provided in an embodiment of this application is shown. Figure 1 As shown, the light source identification method provided in this application embodiment may include the following steps 101 to 103, or may include the following steps 101, 102 and 104.
[0033] Step 101: The electronic device acquires N frequency domain signals corresponding to the target light source.
[0034] In this embodiment of the application, the target light source is the light source of the environment in which the electronic device is located, and N is a positive integer.
[0035] Optionally, in this embodiment of the application, when the electronic device displays a shooting preview interface, the electronic device can acquire at least one time-domain signal corresponding to the target light source, and generate a target spectrum diagram based on the at least one time-domain signal. The target spectrum diagram includes N frequency points, each frequency point corresponding to a frequency domain signal, so as to obtain N frequency domain signals.
[0036] In one scenario, when an electronic device displays a shooting preview interface, the electronic device can acquire at least one temporal signal corresponding to the target light source.
[0037] In another scenario, when the electronic device displays a shooting preview interface, the electronic device can obtain at least one temporal signal corresponding to the target light source based on the user's input to the shooting controls in the shooting preview interface.
[0038] Step 102: The electronic device determines the target value based on the N energy values corresponding to the N frequency domain signals.
[0039] In this embodiment of the application, the above target value is used to characterize the fluctuation of N frequency domain signals.
[0040] The target value can characterize the spectrum of N frequency domain signals.
[0041] Optionally, in this embodiment of the application, the electronic device may first determine the corresponding N energy values based on the N frequency domain signals, and then determine the target value based on the N energy values.
[0042] For each of the N frequency domain signals, the electronic device can first determine the amplitude of a frequency point corresponding to a frequency domain signal based on the target spectrum diagram, and then determine the value of the amplitude as an energy value corresponding to that frequency domain signal, and so on, thereby determining N energy values.
[0043] Optionally, in this embodiment, the target value can be any of the following: the average of N energy values, the median of N energy values, or M maxima. Wherein, the M maxima are the maximum values among the N energy values, and M is a positive integer.
[0044] Optionally, in this embodiment of the application, the electronic device may first sort the N energy values according to a target order, and then determine the median value of the sorted N energy values as the median value of the N energy values. The target order can be any of the following: descending order or ascending order.
[0045] Optionally, in the embodiments of this application, for each of the N energy values, the electronic device may determine an energy value as a maximum value if an energy value is greater than the previous energy value and the next energy value, and so on, thereby determining M maximum values.
[0046] For example, suppose there are N energy values including 5 energy values, such as energy value "1", energy value "3", energy value "5", energy value "2" and energy value "1", where energy value "5" is greater than energy value "3" and energy value "5" is greater than energy value "2". Therefore, the electronic device can determine energy value "5" as a maximum value.
[0047] Step 103: If the target value meets the preset conditions, the electronic device determines the target light source as the first light source.
[0048] Optionally, in one possible implementation of this application embodiment, the electronic device can compare the target value with a threshold to determine whether the target value meets a preset condition.
[0049] Furthermore, the target value is any one of the following: the average of N energy values, or the median of N energy values. The aforementioned preset condition includes: the target value is greater than a first threshold. Wherein, the first threshold is determined based on a first coefficient and a first maximum value; the first coefficient is greater than 0; the first maximum value is the largest of the M maximum values.
[0050] Specifically, the first coefficient can be 0.1.
[0051] Specifically, the first preset can be the product of the first coefficient and the first maximum value.
[0052] For example, assuming the target value is the average value of N energy values, if the average value of N energy values is greater than the product of the first coefficient and the first maximum value, max_value, for example, 0.1*max_value, then the target value can be considered to meet the preset condition. If the average value of N energy values is less than or equal to 0.1*max_value, then the target value can be considered to not meet the preset condition.
[0053] For example, suppose the target value is the median_value of N energy values. If the median_value of N energy values is greater than the product of the first coefficient and the first maximum value max_value, for example, 0.1*max_value, then the target value can be considered to meet the preset condition. If the median_value of N energy values is less than or equal to 0.1*max_value, then the target value can be considered to not meet the preset condition.
[0054] Thus, when the target value is the average or median of N energy values, the electronic device can accurately determine whether the target value meets the preset conditions based on whether the target value is greater than the first threshold, thereby accurately determining whether the brightness of the target light source changes periodically.
[0055] Optionally, in another possible implementation of this application embodiment, the electronic device may perform a target step to determine whether a target value meets a preset condition. The target step includes at least one of the following: comparing the number of target values with another threshold, or comparing a specific target value with yet another threshold.
[0056] Furthermore, the target value is: M maxima. The preset conditions include: the number M of the M maxima is greater than or equal to a second threshold; the first maxima is less than a third threshold; the second maxima is greater than a fourth threshold; wherein, the first maxima is: the largest maxima among the M maxima; the second maxima is: any maxima other than the first maxima among the top Q largest maxima among the M maxima, where Q is a positive integer less than or equal to M; the fourth threshold is: determined based on a second coefficient and the first maxima; the second coefficient is greater than 0.
[0057] In this embodiment of the application, if the brightness of the target light source does not change periodically, the spectrum of the target light source is more complex than that of a light source whose brightness changes periodically, that is, the spectrum of the target light source has more maxima. Therefore, a second threshold can be preset, and the brightness of the target light source can be determined as to whether the number of M maxima M is greater than or equal to the second threshold.
[0058] In this embodiment of the application, if the brightness of the target light source does not change periodically, the target light source usually does not have obvious periodic fluctuation signals (frequency domain signals). Therefore, the energy value corresponding to the frequency domain signal of the target light source is smaller than the energy value corresponding to the frequency domain signal of the light source whose brightness changes periodically. Thus, a third threshold can be preset, and the brightness of the target light source can be determined as to whether it changes periodically based on whether the first maximum value is less than the third threshold.
[0059] Optionally, in this embodiment, the second coefficient can be 0.5. The fourth threshold can be the product of the first maximum value and the second coefficient.
[0060] In this embodiment of the application, if the brightness of the target light source does not change periodically, the frequency domain signal of the target light source is widely distributed on the spectrum diagram and has multiple maxima with small differences. Therefore, the fourth threshold can be determined based on the first maxima and the second coefficient, and whether the brightness of the target light source changes periodically can be determined based on whether the second maxima is greater than the fourth threshold.
[0061] Thus, when the target value has M maxima, the electronic device can accurately determine whether the target value meets the preset conditions based on whether the number of M maxima M is greater than or equal to the second threshold, whether the first maxima is less than the third threshold, and whether the second maxima is greater than the fourth threshold, so as to accurately determine whether the brightness of the target light source changes periodically.
[0062] In this embodiment, the brightness of the first light source does not change periodically.
[0063] Optionally, in this embodiment, the first light source may specifically include a direct current light source. It should be noted that the first light source may also include other light sources whose brightness does not change periodically; this embodiment does not limit such sources.
[0064] It is understood that since the fluctuation of the first light source is not the same as that of other light sources (e.g., light sources with periodically changing brightness, i.e., the second light source in the following embodiments), and the characteristics of the spectrum of the first light source are not the same as those of the other light sources, it is possible to determine that the fluctuation of the target light source matches the fluctuation of the first light source and that the characteristics of the spectrum of the target light source matches the characteristics of the spectrum of the first light source by setting preset conditions and when the target value meets the preset conditions.
[0065] Step 104: If the target value does not meet the preset conditions, the electronic device determines the target light source as the second light source.
[0066] In this embodiment, the brightness of the second light source changes periodically.
[0067] Optionally, in this embodiment, the second light source may specifically include an alternating current light source. It should be noted that the second light source may also include other light sources with periodically changing brightness; this embodiment does not limit the specific light source described herein.
[0068] It is understandable that since the fluctuation of the second light source is not the same as that of the first light source, and the characteristics of the spectrum of the second light source are not the same as those of the spectrum of the first light source, the target light source can be identified as the second light source by setting preset conditions and determining that the fluctuation of the target light source matches the fluctuation of the second light source and that the characteristics of the spectrum of the target light source matches the characteristics of the spectrum of the second light source when the target value does not meet the preset conditions.
[0069] The light source identification method provided in this application embodiment allows an electronic device to acquire N frequency domain signals corresponding to a target light source in the environment in which the electronic device is located, and to determine a target value based on the N energy values corresponding to the N frequency domain signals. The target value is used to characterize the fluctuation of the N frequency domain signals. Thus, when the target value meets preset conditions, the electronic device can determine that the target light source is a first light source whose brightness does not change periodically, and when the target value meets preset conditions, the electronic device can determine that the target light source is a second light source whose brightness changes periodically. Because the electronic device can determine a target value characterizing the fluctuation of N frequency domain signals based on N energy values corresponding to those N signals, and then determine whether the brightness of the target light source exhibits periodic variation by checking if this target value meets preset conditions, rather than determining periodicity based on the brightness characteristics of the target light source, the electronic device can accurately determine that the brightness of the target light source does not exhibit periodic variation when the target value meets the preset conditions. This reduces the probability of determining that the brightness of the target light source exhibits periodic variation when the brightness of the target light source does not exhibit periodic variation but fluctuates. Conversely, if the target value does not meet the preset conditions, the electronic device can accurately determine that the brightness of the target light source exhibits periodic variation, reducing the probability of determining that the brightness of the target light source does not exhibit periodic variation when the brightness of the target light source exhibits periodic variation and the amplitude of the brightness variation is small. Therefore, the accuracy of the determination results obtained by the electronic device can be improved.
[0070] Of course, after the electronic device determines the target light source as the first light source or the second light source, the electronic device can also adjust the exposure time of the electronic device, as illustrated below.
[0071] Optionally, in the embodiments of this application, after step 103 above, the light source identification method provided in the embodiments of this application may further include the following steps 201 and 202.
[0072] Step 201: The electronic device determines the second exposure time.
[0073] Furthermore, the electronic device can determine the preset exposure time as the second exposure time.
[0074] Step 202: The electronic device adjusts its exposure time according to the second exposure time.
[0075] Furthermore, the electronic device can adjust its exposure time to a second exposure time.
[0076] In this embodiment of the application, if the target value meets the preset conditions, it can be considered that the characteristics of the spectrum of the target light source match the characteristics of the spectrum of the first light source, that is, the brightness of the target light source does not change periodically. Therefore, the electronic device can adjust the exposure time of the electronic device according to the second exposure time.
[0077] Optionally, in the embodiments of this application, after step 104 above, the light source identification method provided in the embodiments of this application may further include the following steps 301 and 302.
[0078] Step 301: The electronic device determines the first exposure time based on the frequency of the target light source.
[0079] Furthermore, the electronic device can detect the frequency of the target light source using a flicker sensor, and then determine the first exposure time based on an integer multiple of the frequency of the target light source.
[0080] Step 302: The electronic device adjusts its exposure time according to the first exposure time.
[0081] Furthermore, the electronic device can adjust its exposure time to the first exposure time.
[0082] In this embodiment of the application, if the target value does not meet the preset conditions, it can be assumed that the characteristics of the spectrum of the target light source match the characteristics of the spectrum of the second light source, that is, the brightness of the target light source changes periodically. Therefore, the electronic device can adjust the exposure time of the electronic device according to the first exposure time.
[0083] The following example illustrates how electronic devices acquire the frequency domain signal corresponding to the target light source.
[0084] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 2 As shown, step 101 can be implemented through steps 101a and 101b below.
[0085] Step 101a: The electronic device acquires L time-domain signals corresponding to the target light source.
[0086] In the embodiments of this application, L is a positive integer.
[0087] Optionally, in this embodiment of the application, the electronic device may first acquire the light intensity signal of the target light source and store the light intensity signal in the buffer of the electronic device, and then determine L time-domain signals from the light intensity signal in the buffer.
[0088] Specifically, in combination Figure 2 ,like Figure 3As shown, step 101a can be implemented through steps 101a1 and 101a2 as described below.
[0089] Step 101a1: The electronic device acquires the light intensity signal of the target light source through the flicker sensor of the electronic device.
[0090] Optionally, in this embodiment of the application, the electronic device can use a flicker sensor to convert the external light source signal of the target light source into a digital signal to obtain the light source intensity signal.
[0091] Optionally, in this embodiment of the application, after the electronic device acquires the light source intensity signal, the electronic device can store the light source intensity signal in the buffer of the electronic device.
[0092] Step 101a2: The electronic device uses a preset sliding window to determine L time-domain signals from the light source intensity signal.
[0093] Optionally, in this embodiment of the application, the electronic device can control a preset sliding window to slide according to a preset step size in order to determine L time-domain signals from the light source intensity signal.
[0094] Optionally, in this embodiment, L can be 256.
[0095] Thus, since electronic devices can acquire the light intensity signal of the target light source through a flicker sensor, they can directly use a preset sliding window to determine L time-domain signals. Therefore, electronic devices can accurately acquire N frequency-domain signals corresponding to the target light source, thereby enabling them to accurately determine the target value.
[0096] Step 101b: The electronic device uses the Fast Fourier Transform (FFT) algorithm to calculate N frequency domain signals based on L time domain signals.
[0097] Optionally, in the embodiments of this application, L can be equal to N.
[0098] Optionally, in this embodiment of the application, after acquiring L time-domain signals, the electronic device can transmit the L time-domain signals to memory so as to use the Fast Fourier Transform (FFT) algorithm to calculate N frequency-domain signals based on the L time-domain signals.
[0099] It should be noted that for an explanation of the FFT algorithm, please refer to the specific descriptions in related technologies; the embodiments in this application will not be repeated here.
[0100] Thus, it can be seen that electronic devices can use the FFT algorithm to accurately calculate N frequency domain signals based on the acquired L time domain signals, thereby enabling electronic devices to accurately determine the target value.
[0101] The light source identification method provided in this application can be executed by a light source identification device. This application uses a light source identification device executing the light source identification method as an example to illustrate the light source identification device provided in this application.
[0102] Figure 4 A schematic diagram of a possible structure of the light source recognition device involved in an embodiment of this application is shown. For example... Figure 4 As shown, the light source recognition device 50 may include an acquisition module 51 and a determination module 52.
[0103] The acquisition module 51 is used to acquire N frequency domain signals corresponding to the target light source, where the target light source is the light source in the environment where the light source identification device 50 is located, and N is a positive integer. The determination module 52 is used to determine a target value based on the N energy values corresponding to the N frequency domain signals acquired by the acquisition module 51. The target value is used to characterize the fluctuation of the N frequency domain signals. If the target value meets a preset condition, the target light source is determined to be a first light source, the brightness of which does not change periodically. If the target value does not meet the preset condition, the target light source is determined to be a second light source, the brightness of which changes periodically.
[0104] In one possible implementation, the target value is any one of the following: the average of N energy values, the median of N energy values, or M maxima; where the M maxima are the maximum values among the N energy values, and M is a positive integer.
[0105] In one possible implementation, the target value is any one of the following: the average of N energy values, the median of N energy values; the preset condition includes: the target value is greater than a first threshold; wherein the first threshold is determined based on a first coefficient and a first maximum value; the first coefficient is greater than 0; the first maximum value is the largest maximum value among M maximum values.
[0106] In one possible implementation, the target value is: M maxima; the preset conditions include: the number M of the M maxima is greater than or equal to a second threshold; the first maxima is less than a third threshold; the second maxima is greater than a fourth threshold; wherein, the first maxima is: the largest maxima among the M maxima; the second maxima is: any maxima other than the first maxima among the largest Q maxima among the M maxima, where Q is a positive integer less than or equal to M; the fourth threshold is: determined based on a second coefficient and the first maxima; the second coefficient is greater than 0.
[0107] In one possible implementation, the determining module 52 is further configured to determine the first exposure time based on the frequency of the target light source. Combined with... Figure 4 ,like Figure 5 As shown, the light source recognition device 50 provided in this embodiment may further include an adjustment module 53. The adjustment module 53 is used to adjust the exposure time of the light source recognition device 50 according to the first exposure time determined by the determining module 52.
[0108] The light source identification device provided in this application can determine a target value characterizing the fluctuation of N frequency domain signals based on N energy values corresponding to N frequency domain signals. It then determines whether the brightness of the target light source exhibits periodic changes based on whether this target value meets preset conditions, rather than determining periodicity based on the brightness characteristics of the target light source. Therefore, when the target value meets the preset conditions, the light source identification device can accurately determine that the brightness of the target light source does not exhibit periodic changes, reducing the probability that the brightness of the target light source is periodically changing even when it does not, but the brightness fluctuates. Alternatively, when the target value does not meet the preset conditions, the light source identification device can accurately determine that the brightness of the target light source exhibits periodic changes, reducing the probability that the brightness of the target light source is not periodically changing even when the brightness fluctuation is small. This improves the accuracy of the determination results obtained by the light source identification device.
[0109] The light source recognition device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0110] The light source recognition device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0111] The light source recognition device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0112] Optionally, in the embodiments of this application, such as Figure 6 As shown, this application embodiment also provides an electronic device 60, including a processor 61 and a memory 62. The memory 62 stores a program or instructions that can run on the processor 61. When the program or instructions are executed by the processor 61, they implement the various process steps of the above-described light source recognition method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0113] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0114] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0115] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.
[0116] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0117] The processor 110 is configured to acquire N frequency domain signals corresponding to a target light source, where the target light source is the light source in the environment where the electronic device is located, and N is a positive integer; and determine a target value based on the N energy values corresponding to the N frequency domain signals, where the target value is used to characterize the fluctuation of the N frequency domain signals; if the target value meets a preset condition, the target light source is determined to be a first light source, the brightness of which does not change periodically; if the target value does not meet the preset condition, the target light source is determined to be a second light source, the brightness of which changes periodically.
[0118] The electronic device provided in this application can determine a target value characterizing the fluctuation of N frequency domain signals based on N energy values corresponding to N frequency domain signals. It then determines whether the brightness of the target light source exhibits periodic variation based on whether this target value meets preset conditions, rather than determining periodicity based on the brightness characteristics of the target light source. Therefore, when the target value meets the preset conditions, the electronic device can accurately determine that the brightness of the target light source does not exhibit periodic variation, reducing the probability that the brightness of the target light source is periodically changing even when it does not, but the brightness fluctuates. Alternatively, when the target value does not meet the preset conditions, the electronic device can accurately determine that the brightness of the target light source exhibits periodic variation, reducing the probability that the brightness of the target light source is not periodically changing even when the brightness fluctuation is small. This improves the accuracy of the determination results obtained by the electronic device.
[0119] Optionally, in this embodiment of the application, the processor 110 is further configured to determine a first exposure time based on the frequency of the target light source; and adjust the exposure time of the electronic device based on the first exposure time.
[0120] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0121] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0122] The processor 110 may include one or more processing units; optionally, in this embodiment, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into the processor 110.
[0123] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described light source recognition method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0124] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0125] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described light source recognition method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0126] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0127] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described light source recognition method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0128] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0129] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0130] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A light source identification method, characterized in that, The method includes: Obtain N frequency domain signals corresponding to the target light source, where the target light source is the light source in the environment where the electronic device is located, and N is a positive integer; Based on the N energy values corresponding to the N frequency domain signals, a target value is determined, which is used to characterize the fluctuation of the N frequency domain signals. If the target value meets the preset conditions, the target light source is determined to be the first light source, and the brightness of the first light source does not change periodically. If the target value does not meet the preset conditions, the target light source is determined to be a second light source, and the brightness of the second light source changes periodically. The target value is any one of the following: the average of the N energy values, the median of the N energy values, or the M maxima; the M maxima are the maximum values among the N energy values, where M is a positive integer.
2. The method according to claim 1, characterized in that, The target value is any one of the following: the average value of the N energy values, or the median value of the N energy values; The preset condition includes: the target value is greater than a first threshold; Wherein, the first threshold is determined based on a first coefficient and a first maximum value; the first coefficient is greater than 0; the first maximum value is the largest maximum value among the M maximum values.
3. The method according to claim 1, characterized in that, The target value is: the M maximum values; The preset conditions include: The number M of the M maxima is greater than or equal to the second threshold; The first maximum value is less than the third threshold; The second maximum value is greater than the fourth threshold; Wherein, the first maximum value is: the largest maximum value among the M maximum values; the second maximum value is: any maximum value other than the first maximum value among the top Q largest maximum values among the M maximum values, where Q is a positive integer less than or equal to M; the fourth threshold is: determined based on the second coefficient and the first maximum value; the second coefficient is greater than 0.
4. The method according to claim 1, characterized in that, If the target value does not meet the preset condition, after determining that the target light source is the second light source, the method further includes: The first exposure time is determined based on the frequency of the target light source; The exposure time of the electronic device is adjusted according to the first exposure time.
5. A light source recognition device, characterized in that, The light source identification device includes: an acquisition module and a determination module; The acquisition module is used to acquire N frequency domain signals corresponding to the target light source, where the target light source is the light source in the environment where the light source identification device is located, and N is a positive integer; The determining module is configured to determine a target value based on the N energy values corresponding to the N frequency domain signals acquired by the acquiring module, wherein the target value is used to characterize the fluctuation of the N frequency domain signals; and if the target value meets a preset condition, determine the target light source as a first light source, wherein the brightness of the first light source does not change periodically; and if the target value does not meet the preset condition, determine the target light source as a second light source, wherein the brightness of the second light source changes periodically. The target value is any one of the following: the average of the N energy values, the median of the N energy values, or the M maxima; the M maxima are the maximum values among the N energy values, where M is a positive integer.
6. The light source recognition device according to claim 5, characterized in that, The target value is any one of the following: the average value of the N energy values, or the median value of the N energy values; The preset condition includes: the target value is greater than a first threshold; Wherein, the first threshold is determined based on a first coefficient and a first maximum value; the first coefficient is greater than 0; the first maximum value is the largest maximum value among the M maximum values.
7. The light source recognition device according to claim 5, characterized in that, The target value is: the M maximum values; The preset conditions include: The number M of the M maxima is greater than or equal to the second threshold; The first maximum value is less than the third threshold; The second maximum value is greater than the fourth threshold; Wherein, the first maximum value is: the largest maximum value among the M maximum values; the second maximum value is: any maximum value other than the first maximum value among the top Q largest maximum values among the M maximum values, where Q is a positive integer less than or equal to M; the fourth threshold is: determined based on the second coefficient and the first maximum value; the second coefficient is greater than 0.
8. The light source recognition device according to claim 5, characterized in that, The determining module is further configured to determine the first exposure time based on the frequency of the target light source; The light source recognition device further includes: an adjustment module; The adjustment module is used to adjust the exposure time of the light source recognition device according to the first exposure time determined by the determining module.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the light source recognition method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Frequency detection method and device, electronic equipment and storage medium
CN112887629A
Method for eliminating light source flicker, device for eliminating light source flicker and storage medium
CN114500860A