Light source detection method and device and storage medium

By calculating the average brightness value of the pixel point area in the image, combining the brightness value of the pixel point, and determining the light source information, the problem of difficulty in detecting light sources in a specific scene is solved in the prior art, and efficient detection and recognition of light source information is achieved.

CN119509914APending Publication Date: 2025-02-25BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311069113.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-23
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Existing light source detection technology is difficult to effectively detect light sources in specific scenarios, such as night view street lights and other scenes.

Method used

By obtaining the brightness value in the image, calculating the average brightness value of the area where any pixel point is located, and determining the light source information based on the brightness value of the pixel point and the average brightness value, thereby achieving efficient detection of the light source.

Benefits of technology

It realizes efficient detection of light source information in the image, can accurately identify the coordinates, intensity and environmental scenes of the light source, and is suitable for various light source scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119509914A_ABST
    Figure CN119509914A_ABST
Patent Text Reader

Abstract

The invention relates to a light source detection method and device and a storage medium. The light source detection method comprises: acquiring a first image; based on the brightness value of each pixel point in the first image, the average brightness value of an area where a first pixel point is located is determined, and the first pixel point is any pixel point in the first image; and based on the brightness value of the first pixel point and / or the average brightness value, light source information in the first image is determined, and the light source information is used for indicating a light source. The specific light source information of the image can be determined, and efficient detection of the light source information is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of light source detection, and in particular to a light source detection method, device and storage medium. Background Art

[0002] At present, light source detection is a relatively mature field. For example, for adjusting automatic exposure, common light source detection mainly focuses on regional brightness estimation of exposure statistics to perform light compensation correction for automatic exposure. However, it is impossible to detect the light source of specific scenes, such as night scene street lights. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides a light source detection method, device and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a light source detection method is provided, including: acquiring a first image; determining an average brightness value of an area where a first pixel is located based on a brightness value of each pixel in the first image, the first pixel being any pixel in the first image; and determining light source information in the first image based on the brightness value of the first pixel and / or the average brightness value, the light source information being used to indicate a light source.

[0005] In some implementations, after acquiring the first image, the method further includes: segmenting the first image to obtain a plurality of second images;

[0006] The area where the first pixel is located includes an area corresponding to the first image and an area corresponding to the second image where the first pixel is located, the average brightness value includes a first average brightness value and a second average brightness value, the first average brightness value is the average brightness value of the first image, and the second average brightness value is the average brightness value of the second image where the first pixel is located; the light source information includes first-category light source information and second-category light source information, the first-category light source information is used to indicate a first-category light source, the second-category light source information is used to indicate a second-category light source, and the light source area of ​​the first-category light source is larger than the light source area of ​​the second-category light source; determining the light source in the first image based on the brightness value of the first pixel and / or the average brightness value includes at least one of the following: determining the first-category light source information in the first image based on the second average brightness value and the first average brightness value; determining the second-category light source information in the first image based on the brightness value of the first pixel and the first average brightness value; determining the second-category light source information in the first image based on the brightness value of the first pixel and the second average brightness value.

[0007] In some embodiments, determining the second type of light source information in the first image based on the brightness value of the first pixel and the first average brightness value includes: in response to the difference between the brightness value of the first pixel and the first average brightness value, and the ratio of the brightness value of the first pixel being greater than or equal to a first threshold, determining the second type of light source information in the first image.

[0008] In some embodiments, determining the second type of light source information in the first image based on the brightness value of the first pixel and the second average brightness value includes: in response to the difference between the brightness value of the first pixel and the second average brightness value, the ratio of the brightness value of the first pixel is greater than or equal to a second threshold, determining the second type of light source information in the first image.

[0009] In some embodiments, determining the first type of light source in the first image based on the first average brightness value and the second average brightness value includes: in response to the difference between the second average brightness value and the first average brightness value, and the ratio of the second average brightness value is greater than or equal to a third threshold, determining the first type of light source information in the first image.

[0010] In some embodiments, it is characterized in that the method also includes: if the first average brightness value is greater than or equal to a fourth threshold, determining the first type of light source information in the first image based on the first average brightness value and the second average brightness value; if the first average brightness value is less than the fourth threshold, determining the second type of light source information in the first image based on the brightness value of the first pixel and the average brightness value.

[0011] In some embodiments, the method also includes: in response to determining that the first type of light source information does not exist in the first image based on the first average brightness value and the second average brightness value, determining the second type of light source information in the first image based on the brightness value of the first pixel and the average brightness value.

[0012] In some embodiments, before determining the average brightness value of the area where the first pixel is located based on the brightness value of each pixel in the first image, the method also includes: resetting the brightness values ​​of pixels in the first image whose brightness values ​​are lower than a fifth threshold to zero.

[0013] In some embodiments, the light source information includes at least one of the following: light source coordinates; light source intensity; and environmental scene.

[0014] According to a second aspect of an embodiment of the present disclosure, a light source detection device is provided, the device comprising: an acquisition module, used to acquire a first image; a determination module, used to determine an average brightness value of an area where a first pixel is located based on the brightness value of each pixel in the first image, the first pixel being any pixel in the first image; based on the brightness value of the first pixel and / or the average brightness value, determine light source information in the first image, the light source information being used to indicate a light source.

[0015] In some embodiments, the device also includes: a processing module, which is used to segment the first image to obtain multiple second images; the area where the first pixel point is located includes an area corresponding to the first image and an area corresponding to the second image where the first pixel point is located, the average brightness value includes a first average brightness value and a second average brightness value, the first average brightness value is the average brightness value of the first image, and the second average brightness value is the average brightness value of the second image where the first pixel point is located; the light source information includes first-category light source information and second-category light source information, the first-category light source information is used to indicate a first-category light source, the second-category light source information is used to indicate a second-category light source, and the light source area of ​​the first-category light source is larger than the light source area of ​​the second-category light source; the determination module determines the light source in the first image in at least one of the following ways: determining the first-category light source information in the first image based on the second average brightness value and the first average brightness value; determining the second-category light source information in the first image based on the brightness value of the first pixel point and the first average brightness value; determining the second-category light source information in the first image based on the brightness value of the first pixel point and the second average brightness value.

[0016] In some embodiments, the determination module determines the second type of light source information in the first image in the following manner: in response to the difference between the brightness value of the first pixel point and the first average brightness value, and the ratio of the brightness value of the first pixel point is greater than or equal to a first threshold, the second type of light source information in the first image is determined.

[0017] In some embodiments, the determination module determines the second type of light source information in the first image in the following manner: in response to the difference between the brightness value of the first pixel and the second average brightness value, and the ratio of the brightness value of the first pixel being greater than or equal to a second threshold, the second type of light source information in the first image is determined.

[0018] In some embodiments, the determination module determines the first type of light source in the first image in the following manner: in response to the difference between the second average brightness value and the first average brightness value, the ratio of the second average brightness value is greater than or equal to a third threshold, determining the first type of light source information in the first image.

[0019] In some embodiments, the determination module is also used to: if the first average brightness value is greater than or equal to a fourth threshold, determine the first type of light source information in the first image based on the first average brightness value and the second average brightness value; if the first average brightness value is less than the fourth threshold, determine the second type of light source information in the first image based on the brightness value of the first pixel and the average brightness value.

[0020] In some embodiments, the determination module is also used to: in response to determining that the first type of light source information does not exist in the first image based on the first average brightness value and the second average brightness value, determine the second type of light source information in the first image based on the brightness value of the first pixel point and the average brightness value.

[0021] In some embodiments, the device further includes: a processing module, configured to reset the brightness values ​​of pixels in the first image whose brightness values ​​are lower than a fifth threshold to zero.

[0022] In some embodiments, the light source information includes at least one of the following: light source coordinates; light source intensity; and environmental scene.

[0023] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a memory for storing instructions; and a processor for calling the instructions stored in the memory to execute the light source detection method in the first aspect or any one implementation of the first aspect.

[0024] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided, in which instructions are stored. When the instructions are executed by a processor, the light source detection method in the first aspect or any one implementation of the first aspect is executed.

[0025] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: by calculating the average brightness value of a certain area where any pixel is located through the brightness value of each pixel in the image. According to the brightness value of the pixel and the average brightness value of the area where the pixel is located, the specific light source information of the image can be determined, thereby realizing efficient detection of the light source information.

[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0028] Figure 1The figure is a flow chart of a light source detection method according to an exemplary embodiment.

[0029] Figure 2 is a flowchart of a first image acquisition method according to an exemplary embodiment.

[0030] Figure 3 is a flow chart of another light source detection method according to an exemplary embodiment.

[0031] Figure 4 is a schematic diagram of a first image according to an exemplary embodiment.

[0032] Figure 5 is a schematic diagram of a second image according to an exemplary embodiment.

[0033] Figure 6 is a flowchart of a first image acquisition method according to an exemplary embodiment.

[0034] Figure 7 is a flowchart of a first image acquisition method according to an exemplary embodiment.

[0035] Figure 8 is a flowchart of a first image acquisition method according to an exemplary embodiment.

[0036] Fig. 9 is a flowchart of a first image acquisition method according to an exemplary embodiment.

[0037] Fig.10 is a block diagram of a light source detection device according to an exemplary embodiment.

[0038] Fig.11 is a block diagram of another light source detection device according to an exemplary embodiment. DETAILED DESCRIPTION

[0039] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure.

[0040] At present, light source detection is a relatively mature field. For example, in the field of exposure statistics, for adjusting automatic exposure, common light source detection mainly focuses on regional brightness estimation of exposure statistics to make light compensation correction for automatic exposure. Or it mainly focuses on locating specific light source targets and removing exposure points, such as removing overexposure halos of car lights.

[0041] In some embodiments, the brightness information of the region of interest (ROI) is calculated by the illumination information and brightness information of the image. The illumination information can also be called the light intensity, which is used to indicate the intensity of the light and the degree of illumination of the surface area of ​​the object, that is, the luminous flux of visible light received per unit area, and the unit is lux. For example, the brightness information and illumination information of the image are normalized and then weighted to obtain the brightness information of the region of interest. The calculation can be performed with reference to Formula 1:

[0042] log(SensorLuxIdx)*(1-w)+log(LightLuxIdx)*w

[0043] Formula 1

[0044] In Formula 1, log represents logarithm, SensorLuxIdx represents normalized brightness information, LightLuxIdx represents normalized illumination information, w represents the weight of normalized brightness information, and (1-w) represents the weight of normalized illumination information.

[0045] However, in this embodiment, only the overall or regional brightness is calculated, and specific light source information, such as the coordinates of the light source, the light source intensity, etc., cannot be detected.

[0046] In some embodiments, the current light source is matched by presetting a standard light source. For example, the color parameters of the corresponding image of the current light source are compared with the color parameters of the pre-set standard light source to obtain the standard light source that best matches the current light source. Furthermore, the color parameters of the matched standard light source and the color parameters of the current light source can be used for weighted calculation to obtain the correction parameters. However, in this embodiment, the specific coordinates and intensity of the light source cannot be calculated.

[0047] In some embodiments, by continuously shooting light source images, the area where the light source is located is determined based on the change in brightness between the pixel point of the current frame image and the pixel point at the same position in the previous frames of images. However, in this embodiment, multiple frames of images need to be shot, resulting in certain power consumption.

[0048] In some embodiments, multiple sensors are used to capture images, obtain the brightness of the images, obtain the identity information of the light source, and locate the light source information according to the identity information. However, in this embodiment, multiple sensors are required, resulting in cost consumption, and the process is complicated and inefficient.

[0049] Therefore, the present disclosure proposes a light source detection method, which calculates the average brightness value of a certain area where any pixel is located through the brightness value of each pixel in the image. According to the brightness value of the pixel and the average brightness value of the area where the pixel is located, the specific light source information of the image can be determined, thereby realizing efficient detection of the light source information.

[0050] It can be understood that the light source detection method disclosed in the present invention can be applied to the field of image processing, and can also be applied to the field of chips, semiconductors, etc., which are not listed one by one in the present disclosure.

[0051] Among them, the light source detection method can be applied to a terminal or a chip, etc. The terminal can also be called a terminal device, a mobile station (MS), a mobile terminal (MT), etc. It is a device that provides voice and / or data connectivity to users. For example, the terminal can be a handheld device with wireless connection function, a vehicle-mounted device, etc. At present, some examples of terminals are: smart phones (mobile phones), pocket personal computers (pocket personal computers, PPCs), handheld computers, personal digital assistants (personal digital assistants, PDAs), laptops, tablet computers, wearable devices, or vehicle-mounted devices, etc. In addition, when it is a vehicle to everything (V2X) communication system, the terminal device can also be a vehicle-mounted device. It should be understood that the embodiments of the present disclosure do not limit the specific technology and specific device form adopted by the terminal.

[0052] Figure 1 is a flow chart of a light source detection method according to an exemplary embodiment. Figure 1 As shown, the light source detection method includes the following steps.

[0053] In step S11, a first image is acquired.

[0054] In some embodiments, a camera may be used to shoot in a light source scene to obtain a first image, wherein the first image includes the brightness value of each actual pixel point.

[0055] In some embodiments, a camera can be used to shoot in a light source scene, and the first image can be obtained after the captured image is processed. For example, a threshold value is calculated for the brightness value of each actual pixel point of the captured image, and then the actual pixel points after the N threshold values ​​are calculated are statistically processed to obtain statistical pixel points. Each statistical pixel point constitutes the first image. When the first image obtained after processing is used for subsequent calculations of light source detection, calculations can be performed more quickly, saving power consumption.

[0056] In step S12, based on the brightness value of each pixel in the first image, the average brightness value of the area where the first pixel is located is determined.

[0057] In some embodiments, the pixel points of the first image may be actual pixel points contained in the first image, or may be statistical pixel points contained in the first image.

[0058] In some embodiments, the brightness values ​​of each pixel in the region where any pixel of the first image is located may be averaged to determine the average brightness value of the region where the pixel is located. In this disclosure, any pixel in the first image is referred to as a first pixel.

[0059] In step S13, based on the brightness value and / or average brightness value of the first pixel, light source information in the first image is determined, where the light source information is used to indicate the light source.

[0060] In some embodiments, based on the brightness value and average brightness value of the first pixel, it can be determined whether the first pixel is a light source in the first image, and the light source information in the first image can be determined. If the difference between the brightness value of the first pixel and the average brightness value is relatively obvious, for example, when the difference between the brightness value of the first pixel and the average brightness value accounts for a large proportion of the brightness value of the first pixel, it can be determined that the first pixel is a light source in the first image.

[0061] The light source information may include light source coordinates, for example, if the first pixel is determined to be a light source, the light source coordinates are the coordinates of the first pixel. The light source information may include light source intensity, for example, if the first pixel is determined to be a light source, the light source intensity may be the brightness value of the first pixel. The light source information may include an environmental scene, for example, if the average brightness value is small and a first pixel is determined to be a light source, the environmental scene is determined to be a small light source at night.

[0062] In some embodiments, based on the brightness value of the first pixel, it can be determined whether the first pixel is a light source in the first image, and the light source information in the first image can be determined. For example, if the brightness value of the first pixel is large, and the brightness values ​​of other first pixels in the first image except the first pixel are small, it can be determined that the first pixel is a light source in the first image.

[0063] In some embodiments, it is possible to determine whether the smaller area where the first pixel is located is the light source in the first image based on the average brightness value. For example, if the difference between the average brightness value of the smaller area where the first pixel is located and the average brightness value of the larger area where the first pixel is located is relatively obvious, it can be determined that the smaller area where the first pixel is located is the light source in the first image. In this case, the light source coordinates are the coordinates of the smaller area.

[0064] It can be understood that the light source in the first image may be a certain pixel point or a certain area in the first image.

[0065] The present disclosure determines the average brightness value of a certain area where any pixel is located through the brightness value of each pixel in the image. According to the brightness value of the pixel and the average brightness value of the area where the pixel is located, the specific light source information of the image can be determined, realizing efficient detection of light source information.

[0066] In some embodiments, a camera is used to shoot in a light source scene, and the first image is obtained after the shot image is processed. This can be implemented in the following manner: Figure 2 As shown, Figure 2 The left side of is the image captured by the camera under the light source scene. Figure 2 The signal processor in the image performs threshold calculation and statistical processing on the exposure information of the captured image to obtain a first image. The first image reference Figure 2 The rightmost square in the figure shows different colors of pixels representing different brightness values.

[0067] The exposure information may be, for example, Bayer grid stats (BGStats), histogram stats (HistStats), etc. BGStats is a division of red, green, blue (RGB) pixels in a captured image, for example, N RGB pixels are divided into a defined pixel, and the brightness value of the defined pixel is calculated according to the brightness values ​​of the N RGB pixels, i.e., BGState. HistStats is a two-dimensional statistical chart information, the horizontal and vertical coordinates of which respectively represent the brightness value of the pixel in the captured image and the number of pixels corresponding to the brightness value.

[0068] Exemplarily, the threshold value calculation and statistical processing of the exposure information of the captured image can refer to the following method: pre-set a threshold value, if the brightness value of the defined pixel point is greater than the threshold value, the brightness value of the defined pixel point is set to 1, if the brightness value of the defined pixel point is less than the threshold value, the brightness value of the defined pixel point is set to 0. Divide every M pixels of the captured image into statistical pixels, and calculate the proportion of the defined pixels with a brightness value of 0 and the defined pixels with a brightness value of 1 in the statistical pixels to all the defined pixels in the statistical pixels. Determine the brightness value of the statistical pixel point based on the proportion. Assuming that the statistical pixels include 1000 defined pixels, of which 800 have a brightness value of 1, the brightness value can be 800 / 1000, that is, 0.8.

[0069] Of course, the illustrative examples given above are only for explanation and are not limiting.

[0070] The present disclosure uses a camera to shoot in a light source scene, and obtains a first image after processing the shot image, so that the obtained first image can be calculated more quickly when performing subsequent light source detection calculations, thereby saving power consumption.

[0071] In some embodiments, the present disclosure provides a light source detection method, which includes: performing data cleaning on the brightness value of each pixel in the first image. For example, a fifth threshold is preset, and when the brightness value of a pixel in the first image is lower than the fifth threshold, it can be considered that the brightness value of the pixel belongs to impurities or noise, and all brightness values ​​lower than the fifth threshold are reset to zero.

[0072] The present disclosure performs data cleaning on the brightness value of each pixel in the first image, thereby being able to detect the light source more quickly and save power consumption.

[0073] In some embodiments, the present disclosure provides a light source detection method, such as Figure 3 As shown, the light source detection method includes the following steps:

[0074] In step S21, the first image is segmented to obtain a plurality of second images.

[0075] In some embodiments, Figure 4 As shown, Figure 4 The length of the first image is M and the width is N. The first image is segmented to obtain multiple second images. The length of the second image is m and the width is n. The first image can be segmented in equal proportions, or it can be segmented freely according to actual conditions. Figure 4 The R in the image indicates that the first image contains R pixels, and R0 indicates that the second image contains R0 pixels. The second image can be referred to Figure 5 , Figure 5 , represents a pixel in the second image, and the brightness of each pixel in the image can represent the brightness value of each pixel.

[0076] In step S22, a first average brightness value and a second average brightness value are determined based on the brightness value of each pixel in the first image.

[0077] In some embodiments, the area where the first pixel is located may be an area corresponding to the first image. The average brightness value of the first image may be determined based on the brightness value of each pixel in the first image. The present disclosure refers to the average brightness value of the first image as the first average brightness value.

[0078] In some embodiments, the area where the first pixel is located may be the area corresponding to the second image, and the average brightness value of the second image may be determined based on the brightness value of each pixel in the second image. In the present disclosure, the average brightness value of the second image where the first pixel is located is referred to as the second average brightness value.

[0079] It can be understood that the area where the first pixel point in the present disclosure is located includes the first image and the second image, and the average brightness value in the present disclosure includes the first average brightness value and the second average brightness value.

[0080] In step S23, first-category light source information in the first image is determined based on the second average brightness value and the first average brightness value.

[0081] In some embodiments, the light source information may include first-class light source information and second-class light source information. The first-class light source information is used to indicate the first-class light source, the second-class light source information is used to indicate the second-class light source, and the light source area of ​​the first-class light source is larger than the light source area of ​​the second-class light source. The first-class light source in the present disclosure may be referred to as a larger light source, and the second-class light source may be referred to as a smaller light source. The first-class light source information in the first image may be determined based on the difference between the second average brightness value and the first average brightness value. That is, it is determined whether the second image is the light source in the first image. For example, if the difference between the second average brightness value and the first average brightness value is more obvious, it can be determined that the second image is the light source in the first image, and the light source information in the first image is determined based on the second image. That is, the brightness information is related to the second image. For example, the coordinates of the light source in the first image are determined based on the coordinates of the second image; the intensity of the light source in the first image is determined based on the second average brightness value, etc.

[0082] In some embodiments, when the second image is determined to be a light source in the first image, it may be determined that a larger light source is detected in the first image.

[0083] The present disclosure divides the first image and determines the light source information in the first image based on the difference between the average brightness value of the divided areas and the average brightness value of the first image, so that the light source information in the first image can be determined quickly and accurately, and the detection of a larger light source can be achieved. In some scenarios, since this method detects a larger light source, it can also avoid the situation where the reflection is mistaken for the light source.

[0084] In some embodiments, the present disclosure provides a light source detection method, such as Figure 6 As shown, the light source detection method includes the following steps:

[0085] In step S31, the first image is segmented to obtain a plurality of second images.

[0086] In step S32, a second average brightness value is determined based on the brightness value of each pixel in the first image.

[0087] In some embodiments, the first image includes the second image. The second average brightness value is determined based on the brightness value of each pixel in the first image, that is, the second average brightness value is determined based on the brightness value of each pixel in the second image.

[0088] Among them, the specific implementation of step S31 is similar to the implementation of the above-mentioned step S21, and the specific implementation of step S32 is similar to the above-mentioned step S22, which will not be repeated here in this disclosure.

[0089] In step S33, based on the brightness value of the first pixel and the second average brightness value, the second type of light source information in the first image is determined.

[0090] In some embodiments, based on the difference between the brightness value of the first pixel and the second average brightness value, the first pixel can be judged to be the light source in the first image, and the second type of light source information can be determined. For example, if the difference between the brightness value of the first pixel and the second average brightness value is obvious, the first pixel can be determined to be the light source in the first image, and the light source information in the first image can be determined based on the first pixel. For example, the light source information in the first image can be determined based on the coordinates of the first pixel; the light source intensity of the first image can be determined based on the brightness value of the first pixel, etc.

[0091] In some embodiments, when the first pixel is determined to be a light source in the first image, it can be determined that a smaller light source is detected in the first image.

[0092] The present disclosure determines the light source information in the first image based on the difference between the brightness value of the first pixel in the divided area and the average brightness value of the divided area by dividing the first image, and can quickly and accurately determine the light source information in the first image, thereby realizing the detection of smaller light sources. And for some scenes, the effect of detecting light sources is better. For example, in a small light source scene during the day, due to the high intensity of sunlight during the day, the smaller light source may not be detected. Therefore, by dividing the first image to obtain the second image, the brightness value of the first pixel is compared with the second average brightness value, so that the smaller light source in the bright light scene can be better detected.

[0093] In some embodiments, the present disclosure provides a light source detection method, such as Figure 7 As shown, the light source detection method includes the following steps:

[0094] In step S41, a first average brightness value is determined based on the brightness value of each pixel in the first image.

[0095] The specific implementation of step S41 is similar to the specific implementation of the above-mentioned step S22, and will not be repeated herein.

[0096] In step S42, the second type of light source information in the first image is determined based on the brightness value of the first pixel and the first average brightness value.

[0097] In some embodiments, based on the difference between the brightness value of the first pixel and the first average brightness value, the first pixel can be judged to be the light source in the first image, and the second type of light source information can be determined. For example, if the difference between the brightness value of the first pixel and the first average brightness value is obvious, the first pixel can be determined to be the light source in the first image, and the light source information in the first image can be determined based on the first pixel. That is, the brightness information is related to the first pixel. For example, the light source information in the first image is determined based on the coordinates of the first pixel; the light source intensity of the first image is determined based on the brightness value of the first pixel, etc.

[0098] In some embodiments, the above steps S23, S33 and S42 may all be performed.

[0099] For example, step S23 and step S33 may be performed simultaneously, or step S23 and step S42 may be performed simultaneously, so as to detect the larger light source and the smaller light source simultaneously.

[0100] For another example, step S33 and step S42 may be performed simultaneously to achieve that after a smaller light source is detected, it is possible to further determine whether the smaller light source belongs to the center of a larger light source, that is, a larger light source is detected. Exemplarily, if there is a larger light source located in the second image, the brightness value of the edge position of the larger light source is less than the brightness value of the center position of the larger light source. Then, through step S33, it can be detected that the first pixel point at the center position of the larger light source is the light source in the first image, and through step S42, it can be detected that the first pixel point at the edge position of the larger light source is the light source in the first image, and the larger light source is formed from all the first pixel points detected as light sources.

[0101] For another example, after executing step S23 , when it is detected that the number of larger light sources is zero, step S33 or step S42 may be executed to detect smaller light sources.

[0102] Of course, the combination of steps S23, S33 and S42 can be arbitrary, and the examples in this disclosure are only exemplary and not limiting.

[0103] In some embodiments, the difference between the brightness value of the first pixel and the first average brightness value can be calculated. If the difference is large, it can be determined that the difference between the first pixel and the first average value is more obvious. Alternatively, the ratio of the brightness value of the first pixel to the first average brightness value is calculated. If the ratio is large, it can be determined that the difference between the first pixel and the first average value is more obvious. However, there are some cases where the judgment is wrong, that is, there is a situation where the first pixel is not a light source but is determined to be a light source, or the first pixel is a light source but is not detected.

[0104] Therefore, the present disclosure provides a light source detection method. The light source detection method includes: in response to a difference between a brightness value of a first pixel and a first average brightness value, and a ratio of the brightness value of the first pixel being greater than or equal to a first threshold, determining light source information in a first image, the light source information being related to the first pixel.

[0105] In some embodiments, the difference between the brightness value of the first pixel and the first average brightness value may be calculated. The ratio of the difference to the brightness value of the first pixel may be calculated. The ratio may be compared with a preset first threshold. If the ratio is greater than or equal to the first threshold, the first pixel may be determined to be a light source in the first image, and the light source information may be determined.

[0106] The light source information is related to the first pixel. For example, refer to Formula 2.

[0107]

[0108] In formula 2, SAT[i] represents the brightness value of the first pixel. represents the first average brightness value, where ∑ represents the summation symbol, represents the sum of all first pixels in the first image, that is, the sum of the brightness values ​​of R first pixels, M represents the length of the first image, N represents the width of the first image, and MxN represents the area of ​​the first image. THR0 represents the first threshold.

[0109] It can be understood that the greater than in the formula can also mean greater than or equal to, and the present disclosure does not limit this.

[0110] The present disclosure determines the light source information in the first image by determining that the ratio of the difference between the brightness value of the first pixel point and the first average brightness value to the brightness value of the first pixel point is greater than or equal to the first threshold, and can more accurately determine the light source information in the first image.

[0111] In some embodiments, the present disclosure provides a light source detection method, which includes: in response to a difference between a brightness value of a first pixel point and a second average brightness value, and a ratio of the brightness value of the first pixel point being greater than or equal to a second threshold, determining light source information in a first image, wherein the light source information is related to the first pixel point.

[0112] In some embodiments, the difference between the brightness value of the first pixel and the second average brightness value can be calculated, and then the ratio of the difference to the brightness value of the first pixel can be calculated. The ratio is compared with a preset second threshold, and if the ratio is greater than or equal to the second threshold, the first pixel can be determined to be a light source in the first image, and the light source information is determined.

[0113] The light source information is related to the first pixel. For example, refer to Formula 3.

[0114]

[0115] In formula 3, SAT[i] represents the brightness value of the first pixel. represents the second average brightness value. represents the sum of the brightness values ​​of all first pixels in the second image, that is, the sum of R0 first pixels, m represents the length of the second image, n represents the width of the second image, and mxn represents the area of ​​the second image. THR1 represents the second threshold.

[0116] The present disclosure determines the light source information in the first image by determining that the ratio of the difference between the brightness value of the first pixel point and the second average brightness value is greater than or equal to the second threshold, so that the light source information in the first image can be determined more accurately.

[0117] In some embodiments, the present disclosure provides a light source detection method, which includes: in response to a difference between a second average brightness value and a first average brightness value, and a ratio of a brightness value of a first pixel point being greater than or equal to a third threshold, determining light source information in a first image, wherein the light source information is related to a second image.

[0118] In some embodiments, the difference between the first average brightness value and the second average brightness value can be calculated, and then the ratio of the difference to the second average brightness value can be calculated. The ratio is compared with a pre-set third threshold value. If the ratio is greater than or equal to the third threshold value, it can be determined that the first pixel is a light source in the first image, and the light source information is determined. The light source information is related to the first pixel. For example, refer to Formula 4.

[0119]

[0120] In formula 4, represents the first average brightness value, represents the second average brightness value, and THR2 represents the third threshold value.

[0121] The present disclosure determines the light source information in the first image by determining that the ratio of the difference between the first average brightness value and the second average brightness value is greater than or equal to the third threshold, so that the light source information in the first image can be determined more accurately.

[0122] It can be understood that the sizes of the above-mentioned first threshold, second threshold and third threshold can be set according to actual conditions, and the present disclosure does not limit them. The sizes of the first threshold, second threshold and third threshold can be the same or different.

[0123] In some embodiments, the present disclosure provides a light source detection method, such as Figure 8 As shown, the light source detection method includes the following steps.

[0124] In step S51 , if the first average brightness value is greater than or equal to a fourth threshold, first-category light source information in the first image is determined based on the first average brightness value and the second average brightness value.

[0125] In step S52, if the first average brightness value is less than the fourth threshold, the second type of light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value.

[0126] In some embodiments, if the first average brightness value is greater than a certain value, it can be considered that the first image is brighter, and it can be considered that there may be a larger light source in the first image, and the larger light source in the first image is detected. A fourth threshold can be pre-set, and if the first average brightness value is greater than or equal to the fourth threshold, the light source information in the first image is determined based on the first average brightness value and the second average brightness value to detect the larger light source in the first image; if the first average brightness value is less than the fourth threshold, the light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value to detect the smaller light source in the first image. The average brightness value can be the first average brightness value or the second average brightness value.

[0127] Among them, when the first brightness average value is equal to the fourth threshold, the light source information in the first image can be determined based on the first average brightness value and the second average brightness value, or based on the brightness value of the first pixel point and the average brightness value, and the present disclosure does not limit this.

[0128] It can be understood that the above examples are exemplary methods. When the first average brightness value is greater than or equal to the fourth threshold value, the brightness value of the first pixel and the average brightness value can also be used to determine the light source information in the first image to detect the smaller light source in the first image. Alternatively, the larger light source and the smaller light source can also be detected simultaneously based on two methods, which is not limited in the present disclosure.

[0129] In some embodiments, other feasible methods may be used to determine whether the scene of the first image is a brighter scene, for example, by determining whether the scene of the first image is a brighter scene through a histogram of the first image. If the scene of the first image is determined to be a brighter scene, the light source information in the first image may be determined based on the first average brightness value and the second average brightness value. If the scene of the first image is determined to be a darker scene, the light source information in the first image may be determined based on the brightness value of the first pixel and the average brightness value.

[0130] The present disclosure can detect the light source more efficiently by pre-judging the scene of the first image and detecting the light source in a targeted manner.

[0131] In some embodiments, the present disclosure provides a light source detection method, which includes: in response to determining that the number of light source information in a first image is zero based on a first average brightness value and a second average brightness value, determining the light source information in the first image based on the brightness value of a first pixel and the average brightness value.

[0132] In some embodiments, the light source information in the first image can be determined based on the first average brightness value and the second average brightness value. If the number of light source information detected in the first image is zero, it can be considered that there is no larger light source in the first image. Then, it can be detected whether there is a smaller light source in the first image. The light source information in the first image can be determined based on the brightness value of the first pixel and the average brightness value.

[0133] The present disclosure determines the light source information in the first image based on the brightness value and the average brightness value of the first pixel if the number of light source information detected in the first image is zero, thereby avoiding the situation where only larger light sources are detected and smaller light sources are ignored, and the light source in the first image is detected more accurately.

[0134] In some embodiments, in the light source detection method provided by the present disclosure, the light source information may include at least one of the following:

[0135] Light source coordinates;

[0136] Light source intensity;

[0137] Environmental scenes.

[0138] In some embodiments, the light source coordinates may indicate the specific position of the light source. The first image may be processed according to the specific position of the light source. For example, the brightness value of the light source in the first image may be adjusted or the light source in the first image may be eliminated to optimize the first image.

[0139] In some embodiments, the light source intensity may indicate a specific intensity of the light source. For example, a light source with a larger intensity in the first image may be processed, or light sources with different intensities may be processed differently to optimize the first image.

[0140] In some embodiments, the environmental scene may include a sunlight scene, a dense small light source scene, and the like.

[0141] Exemplarily, the environment scene can be determined in the following manner:

[0142] For example, when the second image is determined to be the light source of the first image based on the first average brightness value and the second average brightness value, and the number of light source information in the first image is determined to be 0 based on the first pixel point and the average brightness value, that is, there is no first pixel point that is the light source in the first image, then it can be determined that the environmental scene is a sun scene or a large light source scene at night.

[0143] For another example, when the second image is determined to be the light source of the first image based on the first average brightness value and the second average brightness value, and the first pixel is determined to be the light source in the first image based on the first pixel and the average brightness value, and the number of second images determined to be light sources is large, and the number of first pixels determined to be light sources is small, then the environment scene can be determined to be a sun scene or a large light source scene at night.

[0144] For another example, when the second image is determined to be the light source of the first image based on the first average brightness value and the second average brightness value, and the first pixel is determined to be the light source in the first image based on the first pixel and the average brightness value, and the number of second images determined to be light sources and the number of first pixels determined to be light sources are both large, then the environment scene can be determined to be a dense and small light source.

[0145] It can be understood that determining the environmental scene of the first image based on the brightness value and / or average brightness value of the first pixel may also include other situations, which are not listed one by one in the present disclosure, but are not limited to the above illustrative examples.

[0146] In some embodiments, this announcement provides a light source detection method, such as Fig. 9 As shown, the light source detection method includes the following steps.

[0147] In step S61, a first image is acquired.

[0148] In step S62, data cleaning is performed on the brightness value of each pixel in the first image.

[0149] In step S63, the first image is segmented to obtain a second image.

[0150] In step S64, it is determined whether the ratio of the difference between the second average brightness value and the first average brightness value to the second average brightness value is greater than or equal to a third threshold.

[0151] In step S65, in response to the difference between the second average brightness value and the first average brightness value, the ratio of the second average brightness value is greater than or equal to the third threshold, the first type of light source information in the first image is determined.

[0152] In step S66, in response to the difference between the second average brightness value and the first average brightness value, and the ratio of the difference between the second average brightness value and the second average brightness value being less than the third threshold, it is determined whether the difference between the brightness value of the first pixel point and the first average brightness value, and the ratio of the brightness value of the first pixel point is greater than or equal to the first threshold.

[0153] In step S67, in response to the difference between the brightness value of the first pixel and the first average brightness value, the ratio of the difference between the brightness value of the first pixel and the first average brightness value to the brightness value of the first pixel is greater than or equal to the first threshold, it is determined whether the difference between the brightness value of the first pixel and the second average brightness value, and the ratio of the brightness value of the first pixel is greater than or equal to the second threshold.

[0154] In step S68, in response to the difference between the brightness value of the first pixel and the second average brightness value, the ratio of the brightness value of the first pixel being greater than or equal to the second threshold, the second type of light source information in the first image is determined.

[0155] In some embodiments, a first image may be acquired, data cleaning may be performed on the first image, and segmentation may be performed to obtain a second image. The specific implementation methods may refer to other embodiments before this example and will not be described in detail here.

[0156] In some embodiments, it is possible to first detect whether there is a large light source in the first image. For example, it is determined whether the ratio of the difference between the second average brightness value and the first average brightness value to the second average brightness value is greater than or equal to a third threshold. If the judgment result is greater than or equal to the third threshold, it can be determined that there is a large light source in the first image, and the light source information is determined. If the judgment result is less than the third threshold, it can be determined that there is no large light source in the first image.

[0157] In some embodiments, if there is no larger light source in the first image, it is possible to detect whether there is a smaller light source in the first image. For example, it is determined whether the ratio of the difference between the brightness value of the first pixel and the first average brightness value to the brightness value of the first pixel is greater than or equal to a first threshold. If the judgment result is greater than or equal to the first threshold, it is possible to determine whether the ratio of the difference between the brightness value of the first pixel and the second average brightness value to the brightness value of the first pixel is greater than or equal to a second threshold. If the judgment result is greater than or equal to the second threshold, it is possible to determine that there is a smaller light source in the first image. If the judgment result is less than the first threshold, or the judgment result is less than the second threshold, it is possible to detect whether there is a smaller light source in the first image based on other first pixels in the first image.

[0158] In some embodiments, the first pixel is any pixel in the first image, and it can be determined in turn whether each first pixel in the first image is a smaller light source in the first image.

[0159] The present disclosure can detect a larger light source through the above embodiments. If a large light source does not exist, a smaller light source can be detected to achieve a better light source detection effect.

[0160] It should be noted that those skilled in the art can understand that the various implementation methods / embodiments involved in the embodiments of the present disclosure can be used in conjunction with the aforementioned embodiments or can be used independently. Whether used alone or in conjunction with the aforementioned embodiments, the implementation principle is similar. In the implementation of the present disclosure, some embodiments are described in terms of implementation methods used together. Of course, those skilled in the art can understand that such examples are not limitations of the embodiments of the present disclosure.

[0161] Based on the same concept, an embodiment of the present disclosure also provides a light source detection device.

[0162] It is understandable that the light source detection device provided in the embodiment of the present disclosure includes hardware structures and / or software modules corresponding to the execution of each function in order to realize the above functions. In combination with the units and algorithm steps of each example disclosed in the embodiment of the present disclosure, the embodiment of the present disclosure 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. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present disclosure.

[0163] Fig.10 is a block diagram of a light source detection device 100 according to an exemplary embodiment. Fig.10The device 100 includes: an acquisition module 101, a determination module 102 and a processing module 103.

[0164] The acquisition module 101 is used to acquire a first image. The determination module 102 is used to determine the average brightness value of the area where the first pixel is located based on the brightness value of each pixel in the first image, where the first pixel is any pixel in the first image. Based on the brightness value and / or the average brightness value of the first pixel, the light source information in the first image is determined, where the light source information is used to indicate the light source.

[0165] In some embodiments, the processing module 103 is used to segment the first image to obtain multiple second images. The area where the first pixel is located includes the area corresponding to the first image and the area corresponding to the second image where the first pixel is located, and the average brightness value includes a first average brightness value and a second average brightness value. The first average brightness value is the average brightness value of the first image, and the second average brightness value is the average brightness value of the second image where the first pixel is located. The light source information includes first-class light source information and second-class light source information. The first-class light source information is used to indicate the first-class light source, and the second-class light source information is used to indicate the second-class light source. The light source area of ​​the first-class light source is greater than the light source area of ​​the second-class light source. The determination module 102 determines the light source in the first image in at least one of the following ways: based on the second average brightness value and the first average brightness value, determine the first-class light source information in the first image. Based on the brightness value of the first pixel and the first average brightness value, determine the second-class light source information in the first image. Based on the brightness value of the first pixel and the second average brightness value, determine the second-class light source information in the first image.

[0166] In some embodiments, the determination module 102 determines the second type of light source information in the first image in the following manner: in response to the difference between the brightness value of the first pixel point and the first average brightness value, the ratio of the brightness value of the first pixel point is greater than or equal to the first threshold, and the second type of light source information in the first image is determined.

[0167] In some embodiments, the determination module 102 determines the second type of light source information in the first image in the following manner: in response to the difference between the brightness value of the first pixel point and the second average brightness value, the ratio of the brightness value of the first pixel point is greater than or equal to the second threshold, and the second type of light source information in the first image is determined.

[0168] In some embodiments, the determination module 102 determines the second type of light source information in the first image in the following manner: in response to the difference between the second average brightness value and the first average brightness value, the ratio of the second average brightness value is greater than or equal to a third threshold, and the second type of light source information in the first image is determined.

[0169] In some embodiments, the determination module 102 is further configured to: determine the first type of light source information in the first image based on the first average brightness value and the second average brightness value if the first average brightness value is greater than or equal to a fourth threshold value. If the first average brightness value is less than the fourth threshold value, determine the second type of light source information in the first image based on the brightness value of the first pixel and the average brightness value.

[0170] In some embodiments, the determination module 102 is further used to: in response to determining that the first type of light source information does not exist in the first image based on the first average brightness value and the second average brightness value, determine the second type of light source information in the first image based on the brightness value and the average brightness value of the first pixel.

[0171] In some implementations, the processing module is configured to reset the brightness values ​​of pixels in the first image whose brightness values ​​are lower than a fifth threshold to zero.

[0172] In some embodiments, the light source information includes at least one of the following: light source coordinates; light source intensity; and environmental scene.

[0173] Fig.11 is a block diagram of a light source detection device 200 according to an exemplary embodiment.

[0174] like Fig.11 As shown, apparatus 200 may include one or more of the following components: a processing component 202 , a memory 204 , a power component 206 , a multimedia component 208 , an audio component 210 , an input / output (I / O) interface 212 , a sensor component 214 , and a communication component 216 .

[0175] The processing component 202 generally controls the overall operation of the device 200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 202 may include one or more modules to facilitate interaction between the processing component 202 and other components. For example, the processing component 202 may include a multimedia module to facilitate interaction between the multimedia component 208 and the processing component 202.

[0176] The memory 204 is configured to store various types of data to support operations on the device 200. Examples of such data include instructions for any application or method operating on the device 200, contact data, phone book data, messages, pictures, videos, etc. The memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0177] The power component 206 provides power to the various components of the device 200. The power component 206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 200.

[0178] The multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 208 includes a front camera and / or a rear camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0179] The audio component 210 is configured to output and / or input audio signals. For example, the audio component 210 includes a microphone (MIC), and when the device 200 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 204 or sent via the communication component 216. In some embodiments, the audio component 210 also includes a speaker for outputting audio signals.

[0180] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0181] The sensor assembly 214 includes one or more sensors for providing various aspects of the status assessment of the device 200. For example, the sensor assembly 214 can detect the open / closed state of the device 200, the relative positioning of components, such as the display and keypad of the device 200, the sensor assembly 214 can also detect the position change of the device 200 or a component of the device 200, the presence or absence of user contact with the device 200, the orientation or acceleration / deceleration of the device 200 and the temperature change of the device 200. The sensor assembly 214 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 214 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 214 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

[0182] The communication component 216 is configured to facilitate wired or wireless communication between the device 200 and other devices. The device 200 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0183] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0184] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, and the instructions can be executed by the processor 220 of the device 200 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0185] The present disclosure calculates the average brightness value of a certain area where any pixel is located through the brightness value of each pixel in the image. According to the brightness value of the pixel and the average brightness value of the area where the pixel is located, the specific light source information of the image can be determined, and efficient detection of light source information can be achieved.

[0186] It is to be understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar thereto. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.

[0187] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or degree of importance. In fact, the expressions "first", "second", etc. can be used interchangeably. For example, without departing from the scope of the present disclosure, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information.

[0188] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring the operations to be performed in the specific order shown or in a serial order, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.

[0189] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.

[0190] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

Claims

1. A light source detection method, characterized in that: The method comprises: acquiring a first image; Determine, based on the brightness value of each pixel in the first image, an average brightness value of an area where a first pixel is located, where the first pixel is any pixel in the first image; Based on the brightness value of the first pixel and / or the average brightness value, light source information in the first image is determined, where the light source information is used to indicate a light source.

2. The method according to claim 1, characterized in that After acquiring the first image, the method further includes: Segmenting the first image to obtain a plurality of second images; The area where the first pixel point is located includes an area corresponding to the first image and an area corresponding to the second image where the first pixel point is located, and the average brightness value includes a first average brightness value and a second average brightness value, the first average brightness value is an average brightness value of the first image, and the second average brightness value is an average brightness value of the second image where the first pixel point is located; The light source information includes first-category light source information and second-category light source information, the first-category light source information is used to indicate a first-category light source, the second-category light source information is used to indicate a second-category light source, and the light source area of ​​the first-category light source is greater than the light source area of ​​the second-category light source; The determining, based on the brightness value of the first pixel and / or the average brightness value, the light source information in the first image includes at least one of the following: Determining first-category light source information in a first image based on the first average brightness value and the second average brightness value; Determining second-category light source information in the first image based on the brightness value of the first pixel and the first average brightness value; Based on the brightness value of the first pixel and the second average brightness value, second type of light source information in the first image is determined.

3. The method according to claim 2, characterized in that The determining, based on the brightness value of the first pixel and the first average brightness value, the second type of light source information in the first image includes: In response to a ratio of a difference between the brightness value of the first pixel and the first average brightness value to the brightness value of the first pixel being greater than or equal to a first threshold, second type of light source information in the first image is determined.

4. The method according to claim 2, characterized in that: The determining, based on the brightness value of the first pixel and the second average brightness value, the second type of light source information in the first image includes: In response to a ratio of a difference between the brightness value of the first pixel and the second average brightness value to the brightness value of the first pixel being greater than or equal to a second threshold, second type of light source information in the first image is determined.

5. The method according to claim 2, characterized in that: The determining, based on the first average brightness value and the second average brightness value, first-category light source information in the first image includes: In response to a difference between the second average brightness value and the first average brightness value, and a ratio thereof to the second average brightness value being greater than or equal to a third threshold, first-category light source information in the first image is determined.

6. The method according to claim 2, characterized in that The method further comprises: If the first average brightness value is greater than or equal to a fourth threshold, determining first-category light source information in the first image based on the first average brightness value and the second average brightness value; If the first average brightness value is less than a fourth threshold, second-category light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value.

7. The method according to claim 6, characterized in that The method further comprises: In response to determining that no first-category light source information exists in the first image based on the first average brightness value and the second average brightness value, second-category light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value.

8. The method according to claim 1, characterized in that Before determining the average brightness value of the area where the first pixel is located based on the brightness value of each pixel in the first image, the method further includes: The brightness values ​​of pixels in the first image whose brightness values ​​are lower than the fifth threshold are reset to zero.

9. The method according to any one of claims 1 to 8, characterized in that: The light source information includes at least one of the following: Light source coordinates; Light source intensity; Environmental scenes.

10. A light source detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a first image; A determination module is used to determine the average brightness value of the area where the first pixel is located based on the brightness value of each pixel in the first image, where the first pixel is any pixel in the first image; based on the brightness value of the first pixel and / or the average brightness value, determine the light source information in the first image, where the light source information is used to indicate the light source.

11. The device according to claim 10, characterized in that The device also includes: A processing module, used for segmenting the first image to obtain a plurality of second images; The area where the first pixel point is located includes an area corresponding to the first image and an area corresponding to the second image where the first pixel point is located, and the average brightness value includes a first average brightness value and a second average brightness value, the first average brightness value is an average brightness value of the first image, and the second average brightness value is an average brightness value of the second image where the first pixel point is located; The light source information includes first-category light source information and second-category light source information, the first-category light source information is used to indicate a first-category light source, the second-category light source information is used to indicate a second-category light source, and the light source area of ​​the first-category light source is greater than the light source area of ​​the second-category light source; The determining module determines the light source information in the first image in at least one of the following ways: Determining first-category light source information in the first image based on the second average brightness value and the first average brightness value; Determining second-category light source information in the first image based on the brightness value of the first pixel and the first average brightness value; Based on the brightness value of the first pixel and the second average brightness value, second type of light source information in the first image is determined.

12. The device according to claim 11, characterized in that The determination module determines the second type of light source information in the first image in the following manner: In response to a ratio of a difference between the brightness value of the first pixel and the first average brightness value to the brightness value of the first pixel being greater than or equal to a first threshold, second type of light source information in the first image is determined.

13. The device according to claim 11, characterized in that The determination module determines the second type of light source information in the first image in the following manner: In response to a ratio of a difference between the brightness value of the first pixel and the second average brightness value to the brightness value of the first pixel being greater than or equal to a second threshold, second type of light source information in the first image is determined.

14. The device according to claim 11, characterized in that The determining module determines the first type of light source information in the first image in the following manner: In response to a difference between the second average brightness value and the first average brightness value, and a ratio thereof to the second average brightness value being greater than or equal to a third threshold, first-category light source information in the first image is determined.

15. The device according to claim 11, characterized in that The determining module is also used for: If the first average brightness value is greater than or equal to a fourth threshold, determining first-category light source information in the first image based on the first average brightness value and the second average brightness value; If the first average brightness value is less than a fourth threshold, second-category light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value.

16. The device according to claim 15, characterized in that The determining module is also used for: In response to determining that no first-category light source information exists in the first image based on the first average brightness value and the second average brightness value, second-category light source information in the first image is determined based on the brightness value of the first pixel and the average brightness value.

17. The device according to claim 10, characterized in that The device also includes: The processing module is used to reset the brightness values ​​of pixels in the first image whose brightness values ​​are lower than a fifth threshold to zero.

18. The device according to any one of claims 10 to 17, characterized in that The light source information includes at least one of the following: Light source coordinates; Light source intensity; Environmental scenes.

19. An electronic device, characterized in that: include: A memory for storing instructions; as well as A processor, configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 9.

20. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions are executed by the processor, the method according to any one of claims 1 to 9 is executed.