Image glare detection method and device

By dividing the image into blocks and obtaining the brightness and gradient information of each block, determining the type of marking start point, the problem of only detecting the entire column area in the prior art is solved, and detection and efficient detection of glare areas of any shape are realized.

CN119399090APending Publication Date: 2025-02-07SANECHIPS TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310915347.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-24
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, glare detection methods can only detect the entire column area, but cannot detect glare areas of any shape.

Method used

By dividing the image into blocks of set size, traversing and obtaining the average brightness, average brightness change amount and color gradient difference of each block, determining the type of marking starting point based on these parameters, and determining the glare area after detection is completed boundary.

Benefits of technology

The detection of glare areas of any shape is realized, and the problem of only detecting the entire column area in the prior art is solved, and the detection efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399090A_ABST
    Figure CN119399090A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image glare detection method and device. The method comprises the following steps: acquiring the average brightness of a current image block, the variation of the average brightness of the current image block and the average brightness of a previous adjacent image block, and the color gradient difference of the current image block; when the average brightness of the current image block meets a preset brightness threshold value and a marked starting point of which the type is not determined exists, determining the type of the marked starting point according to the variation between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; the type of the marked starting point is reserved as the starting point of the glare starting point, and after all the image blocks of the image are traversed, the boundary of the glare area of the image is determined according to the reserved glare starting point. Therefore, the detection of the glare area in any shape is realized, and the problem that the minimum area detected by the glare detection method in the related technology can only be a whole column and the glare area in any shape cannot be detected is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and in particular, to an image glare detection method and device. Background Art

[0002] The current glare detection method mainly calculates the local cumulative gradient of each pixel of the video image, takes the local cumulative gradient value of each pixel position of the video image as the pixel value, constructs a local cumulative gradient image, calculates the grayscale average of each column of pixels in the local cumulative gradient image and the grayscale average of all pixels, and calculates the ratio of the grayscale average of each column of pixels in the local cumulative gradient image to the grayscale average of all pixels, and determines the glare column according to the ratio.

[0003] However, the minimum area that can be detected by this method is only the entire column, and it is impossible to detect glare areas of arbitrary shapes. Summary of the invention

[0004] The embodiments of the present invention provide an image glare detection method and device, so as to at least solve the problem that the minimum area detected by the glare detection method in the related art can only be a whole column, and glare areas of arbitrary shapes cannot be detected.

[0005] According to an embodiment of the present invention, there is provided an image glare detection method, comprising:

[0006] Traverse the image row by row from left to right in blocks of a set size, and obtain the average brightness of the current image block, the change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process;

[0007] When the average brightness of the current image block meets a preset brightness threshold and there is a marked starting point of an undetermined type, the type of the marked starting point is determined according to the change between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; the marked starting point types include non-glare starting points and glare starting points;

[0008] The type of the starting point of the reserved mark is a starting point of the glare starting point, and after traversing all the image blocks of the image, the boundary of the glare area of ​​the image is determined according to the reserved glare starting point.

[0009] According to another embodiment of the present invention, there is provided an image glare detection device, the device comprising:

[0010] A first acquisition module is used to traverse the image row by row from left to right according to blocks of a set size, and obtain the average brightness of the current image block, the change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process;

[0011] A first determination module is used to determine the type of the marked starting point according to the change amount between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block when the average brightness of the current image block meets the preset brightness threshold and there is a marked starting point of an undetermined type; the marked starting point types include non-glare starting points and glare starting points;

[0012] The second determination module is used for retaining the starting point of the marked starting point of the type of glare starting point, and after traversing all image blocks of the image, determining the boundary of the glare area of ​​the image according to the retained glare starting point.

[0013] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0014] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0015] The embodiment of the present invention traverses an image row by row from left to right according to blocks of a set size, and in the traversal process, by obtaining the average brightness of the current image block, the change amount between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block, and when the average brightness of the current image block meets the preset brightness threshold and there is a starting point of a mark of an undetermined type, the type of the starting point of the mark is determined according to the change amount between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block, and the starting point type of the mark includes a non-glare starting point and a glare starting point, thereby realizing traversal of glare areas of arbitrary shapes, solving the problem that the minimum area detected by the glare detection method in the related art can only be a whole column, and the glare area of ​​arbitrary shapes cannot be detected; moreover, by retaining the starting point type of the mark as the starting point of the glare starting point, and after detecting all image blocks of the image, the boundary of the glare area of ​​the image can be determined according to the retained glare starting point, only one complete detection of the image needs to be completed, thereby improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a hardware structure block diagram of a mobile terminal for image glare detection according to an embodiment of the present invention;

[0017] Figure 2 is a flow chart of an image glare detection method according to an embodiment of the present invention;

[0018] Figure 3 is a flowchart (I) of performing image glare detection according to an embodiment of the present invention;

[0019] Figure 4 is a flowchart (II) of performing image glare detection according to an embodiment of the present invention;

[0020] Figure 5 is a flowchart of performing image glare detection according to an embodiment of the present invention (III);

[0021] Figure 6 is a structural block diagram of an image glare detection device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0024] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal for image glare detection according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0025] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the image glare detection method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0026] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0027] In this embodiment, a method for detecting image glare is provided. Figure 2 is a flow chart of an image glare detection method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0028] Step S201, traverse the image row by row from left to right according to blocks of a set size, and obtain the average brightness of the current image block, the change in the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process.

[0029] In the embodiment of the present invention, the image can be traversed row by row from left to right according to the blocks of the set size, and when the blocks of the set size traverse to a certain image area, the detection of the image area begins. As an example, during the traversal process, the average brightness of the current image block, the change in the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block can be obtained.

[0030] It should be noted that the block of set size in the embodiment of the present invention may be equivalent to a scanning window, and the image area currently scanned by the scanning window is the current image block. The process of scanning the image with the block of set size is the process of traversing the image.

[0031] As an example, scanning with a step size of 1 may be performed in units of blocks of a set size.

[0032] As an example, in the process of traversing row by row from left to right, the brightness change of the first image block of each row obtained may be 0 by default.

[0033] For example, a block of size w*h can be set to scan the image to be detected, where w can be the width of the image block and h can be the length of the image block. When the image block J is scanned, the average brightness M of the image block J can be obtained. j , the change D between the average brightness of image block J and the average brightness of the previous adjacent image block J-1, and the color gradient difference C of image block J:

[0034] 1) For an image block J of size w*h, calculate the brightness value J corresponding to each position coordinate in the image block J based on the RGB three channels y , the calculation formula is as follows:

[0035]

[0036] Wherein, ω1, ω2, and ω3 are weight factors, which are generally set to 1 / 3 respectively. Specifically, those skilled in the art may set them according to actual conditions, and the embodiment of the present invention does not limit them here. Respectively represent the R, G, and B channel values ​​of each (i, j) position in image block J.

[0037] 2) Calculate the mean brightness value of image block J, that is, the average brightness M of image block J j .

[0038] The calculation method of the average brightness is prior art and will not be described in detail in this embodiment.

[0039] 3) Calculate the change D between the average brightness of image block J and the average brightness of the previous adjacent image block J-1:

[0040] D=|M j -M j-1 |

[0041] Among them, M j is the average brightness of the current image block, M j-1 is the average brightness of the previous adjacent image block.

[0042] 4) Calculate the color gradient difference C of image block J:

[0043] Calculate the RGB three-channel value of each position (i, j) in the image block J, and calculate the difference between the maximum and minimum values ​​of the RGB three-channel at each position (i, j). Then, determine the maximum difference from the difference between the maximum and minimum values ​​of the RGB three-channel at each position (i, j). The maximum difference is the color gradient difference C of the image block J, and its calculation formula is:

[0044]

[0045] in, It is the RGB three-channel value of each position (i, j) in image block J.

[0046] Step S202, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of an undetermined type, the type of the starting point of the mark is determined according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; the starting point types of the mark include non-glare starting points and glare starting points.

[0047] In an embodiment of the present invention, there may be multiple preset brightness thresholds. For example, the preset brightness thresholds include a first brightness threshold, a second brightness threshold, a third brightness threshold, etc. In the process of traversing the image block, when the average brightness of the image block meets the first brightness threshold, the center position coordinates of the image block can be marked as the starting point.

[0048] In the embodiment of the present invention, the starting point of the mark may include a non-glare starting point and a glare starting point, and the starting point of the mark of undetermined type means that the starting point of the mark has not yet been determined to be a non-glare starting point or a glare starting point. As an example, the non-glare starting point may be discarded.

[0049] As an example, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of undetermined type, the type of the starting point of the mark can be determined based on the change in the average brightness of the current image block and the average brightness of the previous adjacent image block.

[0050] As an example, when the average brightness of the current image block meets a preset brightness threshold and there is a marked starting point of an undetermined type, the type of the marked starting point may be determined according to the color gradient difference of the current image block.

[0051] As an example, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of undetermined type, the type of the starting point of the mark can be determined based on the change in the average brightness of the current image block and the average brightness of the previous adjacent image block and the color gradient difference of the current image block.

[0052] The following are some examples of the process of determining the starting point of the mark:

[0053] Figure 3 FIG. 1 is a flowchart of performing image glare detection according to an embodiment of the present invention (I). After an image frame is input, the image can be scanned and detected line by line from left to right according to a block of a set size. The execution logic of the block of a set size is as follows:

[0054] 300) detecting the current image block;

[0055] 302) When the average brightness of the current image block is M>m1, the current image block is marked as the starting point, and the next image block is traversed for detection, and the number of blocks S that continuously meet the average brightness of the image block M>m1 is recorded;

[0056] 303) Determine whether S is greater than S1;

[0057] 304) If not, the marked starting point is discarded, and the traversal continues to the next image block, and the execution returns to step 300);

[0058] 305) If yes, determine whether the change D between the average brightness of the current image block moved to and the average brightness of the previous adjacent image block is greater than or equal to d1;

[0059] 306) If yes, discard the marked starting point, continue traversing to the next image block, and return to step 300);

[0060] 307) If not, determine whether D satisfies d2<D<d1;

[0061] 308) If not, continue traversing to the next image block and return to step 300);

[0062] 309) If yes, determine whether the color gradient difference C of the current image block is less than c1;

[0063] 310) If yes, determine that the starting point of the mark is a non-glare starting point, discard the starting point of the mark, continue to traverse to the next image block, and return to execute step 300);

[0064] 311) If not, then determine that the starting point of the mark is the colored glare starting point.

[0065] As an example, the glare starting point may include a colored glare starting point and a white glare starting point.

[0066] The following are some optional embodiments. Figure 3 The execution flow is further described:

[0067] In an optional embodiment, when the average brightness of the current image block satisfies a preset brightness threshold and there is a starting point of a mark of undetermined type, before determining the type of the starting point of the mark based on the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block, the method further includes: when the average brightness of the current image block is greater than a first average brightness threshold, marking the starting point and traversing to the next image block position.

[0068] As an example, during the image detection process, when it is detected that the average brightness M of the current image block is greater than the first average brightness threshold m1, the center position coordinates of the current image block can be marked as the starting point and traverse to the next image block position.

[0069] In an optional embodiment, it also includes: recording the number of blocks whose average brightness of the current image block is continuously greater than the first average brightness threshold during the traversal process; when the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is less than a preset block number threshold, discarding the starting point of the mark; when the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is greater than or equal to the preset block number threshold, determining that there is a starting point of a mark of an undetermined type.

[0070] As an example, during the traversal process, the number of blocks S whose average brightness M continuously satisfies M>m1 can be recorded. If S<preset block number threshold s1, the starting point of the current mark can be directly discarded; if S≥s1, the traversal can continue to the next image block.

[0071] As an example, in the case of S≥s1, the detection and recording may continue to the next image block, and the recording may be stopped when the average brightness of the next image block is less than or equal to the first average brightness threshold m1.

[0072] In an optional embodiment, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of an undetermined type, determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of a previous adjacent image block or a color gradient difference of the current image block includes:

[0073] When the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a starting point of a mark of undetermined type, the type of the starting point of the mark is determined according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; wherein the second average brightness threshold is less than the first average brightness threshold.

[0074] As an example, when the average brightness M of the current image block is less than or equal to the first average brightness threshold m1 and greater than the second average brightness threshold m2, and there is a starting point of a mark of undetermined type, the type of the starting point of the mark can be determined based on the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; wherein, m2<m1.

[0075] In an optional embodiment, when the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a starting point of a mark of an undetermined type, determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of a previous adjacent image block or a color gradient difference of the current image block includes:

[0076] Determine whether a change between the average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to a first brightness change threshold;

[0077] When the change in average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to a first brightness change threshold, the type of the marked starting point is determined to be the non-glare starting point, and the marked starting point is discarded.

[0078] As an example, when m2<M≤m1 and there is a starting point of a mark of undetermined type, it can be determined whether the change D between the average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to the first brightness change threshold d1, and when D≥d1, the type of the starting point of the mark is determined to be a non-glare starting point, and the starting point of the mark is discarded.

[0079] In an optional embodiment, when the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a starting point of a mark of an undetermined type, determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of a previous adjacent image block or a color gradient difference of the current image block includes:

[0080] Determine whether a change between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold;

[0081] When the change in the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold, the type of the marked starting point is determined according to the color gradient difference of the current image block.

[0082] As an example, it is possible to determine whether the change D between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold d1 and greater than a second brightness change threshold d2, and when d2<D<d1 is satisfied, determine the type of the starting point of the mark based on the color gradient difference C of the current image block.

[0083] In an optional embodiment, when the amount of change between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold, determining the type of the marked starting point according to the color gradient difference of the current image block includes:

[0084] Determine whether the color gradient difference of the current image block is less than a color gradient difference threshold;

[0085] In a case where the color gradient difference of the current image block is less than a color gradient difference threshold, determining the type of the marked starting point to be the non-glare starting point, and discarding the marked starting point;

[0086] In a case where the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold, the type of the marked starting point is determined to be the colored glare starting point.

[0087] As an example, when d2<D<d1 is satisfied, it can be determined whether the color gradient difference C of the current image block is less than the color gradient difference threshold c1.

[0088] If C<c1, the type of the marked starting point can be determined to be a non-glare starting point, and the marked starting point is discarded; if C≥c1, the type of the marked starting point can be determined to be a colored glare starting point.

[0089] Figure 4 is a flowchart (II) of performing image glare detection according to an embodiment of the present invention. Figure 3 After the process shown, if the image has not been completely detected, the block of the set size can continue to traverse to the next image block position for detection, and the execution logic is as follows:

[0090] 400) Detect the current image block;

[0091] 401) determining whether the average brightness M of the current image block is less than m2, where m2<m1;

[0092] 402) If not, traverse to the next image block and return to step 400);

[0093] 403) If yes, determine whether there is a starting point of a mark of an undetermined type;

[0094] 404) If there is no starting point of a mark of an undetermined type, traverse to the next image block and return to step 400);

[0095] 405) If there is a starting point of a mark of an undetermined type, determine whether the color gradient difference C of the current image block is less than c1;

[0096] 406) If yes, then determine the starting point of the mark as the white glare starting point;

[0097] 407) If not, the starting point of the mark is determined to be the colored glare starting point.

[0098] The following are some optional embodiments. Figure 4 The execution flow is further described:

[0099] In an optional embodiment, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of an undetermined type, determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block further includes:

[0100] When the average brightness of the current image block is less than the second average brightness threshold and there is a starting point of a mark of undetermined type, the type of the starting point of the mark is determined according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block.

[0101] As an example, when the average brightness M of the current image block satisfies M<m2 and there is a starting point of a mark of undetermined type, the type of the starting point of the mark can be determined based on the change D between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference C of the current image block.

[0102] In an optional embodiment, when the average brightness of the current image block is less than the second average brightness threshold and there is a starting point of a mark of an undetermined type, determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of a previous adjacent image block or a color gradient difference of the current image block includes:

[0103] Determine whether the color gradient difference of the current image block is less than a color gradient difference threshold;

[0104] In a case where the color gradient difference of the current image block is less than a color gradient difference threshold, determining that the type of the marked starting point is a white glare starting point;

[0105] In a case where the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold, it is determined that the type of the marked starting point is a colored glare starting point.

[0106] As an example, when the average brightness M of the current image block satisfies M<m2 and there is a starting point of an undetermined type of mark, it can be determined whether the color gradient difference of the current image block is less than the color gradient difference threshold, that is, C<c1.

[0107] If C<c1, it can be determined that the type of the marked starting point is a white glare starting point;

[0108] If C≥c1, it can be determined that the type of the marked starting point is a colored glare starting point.

[0109] Step S203, retaining the type of the marked starting point as a starting point of the glare starting point; and after detecting all image blocks of the image, determining the boundary of the glare area of ​​the image according to the retained glare starting point.

[0110] As an example, it is possible to determine whether the marked starting point is a glare starting point or a non-glare starting point according to the above method, and discard the non-glare starting point, retaining the starting point of the marked starting point as a glare starting point, thereby obtaining the boundary of the glare area formed by the glare starting point after detecting all image blocks of the image.

[0111] Figure 5 is a flowchart (III) of performing image glare detection according to an embodiment of the present invention. After retaining the type of the marked starting point as the starting point of the glare starting point, the glare starting point can be further screened. Figure 5 The screening process execution logic is as follows:

[0112] 500) Detect the current image block;

[0113] 501) when the average brightness M of the current image block is greater than m3, obtaining the glare starting point P1 closest to the current image block, where m3<m2;

[0114] 502) calculating the Euclidean distance o2 between the current image block and the nearest glare starting point P1;

[0115] 503) determining whether the Euclidean distance o2 is less than a second preset distance L2 and the current image block is on the left side of the nearest glare starting point P1;

[0116] 504) If not, continue traversing to the next image block and return to step 500);

[0117] 505) If yes, determine whether the change D between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position satisfies D>d1;

[0118] 506) If D>d1 is satisfied, then delete the glare starting point P1 closest to the current image block, continue traversing to the next image block, and return to execute step 500);

[0119] 507) If D>d1 is not satisfied, then determine whether D satisfies d2<D≤d1 and the color gradient difference C of the current image block is less than c1;

[0120] 508) If satisfied, delete the glare starting point P1 closest to the current image block, continue traversing to the next image block, and return to execute step 500);

[0121] 509) If not satisfied, continue traversing to the next image block and return to execute step 500).

[0122] The following are some optional embodiments. Figure 5 The execution flow is further described:

[0123] In an optional embodiment, after the starting point of the reserved marked starting point is a glare starting point, the method further includes:

[0124] Traversing to the next image block, and when the average brightness of the current image block is greater than a third brightness threshold, obtaining the glare starting point closest to the center position coordinates of the current image block, and obtaining a second Euclidean distance between the center position coordinates of the current image block and the nearest glare starting point; wherein the third brightness threshold is less than the second brightness threshold;

[0125] When the second Euclidean distance is less than the second preset distance and the center position coordinates of the current image block are to the left of the nearest glare starting point, the nearest glare starting point is deleted according to the change in the average brightness of the current image block and the average brightness of the image block at the previous adjacent position or the color gradient difference of the current image block.

[0126] As an example, after retaining the starting point of the marked starting point of the type of glare starting point, traverse to the next image block position.

[0127] When the average brightness of the current image block is greater than the third brightness threshold, that is, when M>m3, the glare starting point P1 closest to the center position coordinates of the current image block can be obtained, and the second Euclidean distance o2 between the center position coordinates of the current image block and the nearest glare starting point P1 can be calculated.

[0128] As an example, when the second Euclidean distance o2 is less than the second preset distance L2, and the current image block is on the left of the nearest glare starting point, the nearest glare starting point P1 can be deleted according to the change D between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position or the color gradient difference C of the current image block, so as to retain the glare starting point on the left side of the image.

[0129] In an optional embodiment, deleting the most recent glare starting point based on the amount of change between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position, and the color gradient difference of the current image block, includes: deleting the most recent glare starting point when the amount of change between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position is greater than the first brightness change threshold.

[0130] As an example, when the change D between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position is greater than the first brightness change threshold d1, the most recent glare starting point P1 may be deleted.

[0131] In an optional embodiment, deleting the most recent glare starting point based on the amount of change between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position, and the color gradient difference of the current image block, includes: deleting the most recent glare starting point when the amount of change between the average brightness of the image block and the average brightness of the image block at the previous adjacent position is less than or equal to the first brightness change threshold and greater than the second brightness change threshold, and the color gradient difference of the image block is less than the preset color gradient difference threshold.

[0132] As an example, the most recent glare starting point P1 may be deleted when the change D between the average brightness of the current image block and the average brightness of the previous adjacent image block satisfies d2<D≤d1 and the color gradient difference C of the current image block is<c1.

[0133] In an optional embodiment, after deleting the most recent glare starting point, the method further includes:

[0134] Obtaining a first Euclidean distance between the current glare starting point and all glare starting points recorded before the current glare starting point;

[0135] From all glare starting points recorded before the current glare starting point, determining whether there is a target glare starting point whose first Euclidean distance from the current glare starting point is less than a first preset distance;

[0136] If the target glare starting point exists, marking the current glare starting point and the target glare starting point as the same glare source cluster;

[0137] If the target glare starting point does not exist, the current glare starting point is marked as a new glare source cluster.

[0138] As an example, all glare starting points recorded before the current glare starting point may be obtained, and the first Euclidean distance between the current glare starting point and all glare starting points recorded before the current glare starting point may be calculated.

[0139] As an example, a glare starting point P2 recorded before the current glare starting point that satisfies the first Euclidean distance less than the first preset distance can be determined, and the glare starting point P2 can be used as the target glare starting point, and the current glare starting point and the target glare starting point P2 can be marked as the same glare source cluster.

[0140] As an example, if the target glare starting point does not exist, the current glare starting point may be marked as a new glare source cluster.

[0141] In an optional embodiment, after traversing all image blocks of the image, the method further includes:

[0142] Determining whether the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster;

[0143] If the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster, then determining that the glare source cluster is a colored glare source cluster;

[0144] If the number of colored glare points in the glare source cluster is less than the number of white glare starting points in the glare source cluster, then determining that the glare source cluster is a white glare source cluster;

[0145] An area formed by the colored glare source cluster and / or the white glare source cluster is determined as a left boundary of the glare area of ​​the image.

[0146] In this embodiment, the number of colored glare starting points and the number of white glare starting points recorded by different light source clusters can be used to distinguish whether the light source cluster is colored glare or white glare. If the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster, the glare source cluster can be determined to be a colored glare source cluster; if the number of colored glare points in the glare source cluster is less than the number of white glare starting points in the glare source cluster, the glare source cluster can be determined to be a white glare source cluster.

[0147] As an example, the area formed by the colored glare source clusters and / or the white glare source clusters may be determined as the left boundary of the glare area of ​​the image.

[0148] In an optional embodiment, determining the area formed by the colored glare source cluster and / or the white glare source cluster as the left boundary of the glare area of ​​the image includes:

[0149] respectively determining the total number of glare starting points in the colored glare source cluster and the white glare source cluster;

[0150] If the total number of glare starting points in the colored glare source cluster is greater than a first glare total number threshold, determining the colored glare cluster as a valid colored light source cluster;

[0151] If the total number of glare starting points in the colored glare source cluster is less than or equal to a first glare total number threshold, deleting the colored glare cluster;

[0152] If the total number of glare starting points in the white glare light source cluster is greater than a second glare total number threshold, determining that the white glare light source cluster is a valid white light source cluster;

[0153] If the total number of glare points in the colored glare source cluster is less than or equal to a second total glare threshold, deleting the colored glare cluster;

[0154] An area formed by the effective colored glare source cluster and / or the effective white glare source cluster is determined as a left boundary of the glare area of ​​the image.

[0155] In this embodiment, the determined type of glare source clusters may be further screened to determine effective glare source clusters, and the area formed by the effective glare source clusters may be determined as the left boundary of the glare area of ​​the image.

[0156] According to the embodiment of the present invention, when performing row-by-row detection from left to right on an image equally divided into a plurality of image blocks, the average brightness of the current image block, the amount of change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block are obtained. When the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of an undetermined type, the type of the starting point of the mark is determined according to the amount of change between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block. The starting point type of the mark includes a non-glare starting point and a glare starting point, thereby realizing detection of glare areas of arbitrary shapes, solving the problem that the minimum area detected by the glare detection method in the related art can only be a whole column, and glare areas of arbitrary shapes cannot be detected. Moreover, by retaining the starting point of the marked starting point type as the glare starting point, and after detecting all image blocks of the image, the boundary of the glare area of ​​the image can be determined according to the retained glare starting point, only one complete detection of the image needs to be completed, thereby improving the detection efficiency.

[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0158] In this embodiment, an image glare detection device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0159] Figure 6 is a structural block diagram of an image glare detection device according to an embodiment of the present invention. Figure 6 As shown, the device comprises:

[0160] The first acquisition module 601 is used to traverse the image row by row from left to right according to the blocks of a set size, and obtain the average brightness of the current image block, the change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process;

[0161] A first determination module 602 is configured to determine the type of the marked starting point according to a change in the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block when the average brightness of the current image block meets a preset brightness threshold and there is a marked starting point of an undetermined type; the marked starting point types include a non-glare starting point and a glare starting point;

[0162] The second determination module 603 is configured to retain the starting point of the marked starting point of the type of glare starting point, and determine the boundary of the glare area of ​​the image according to the retained glare starting point after detecting all image blocks of the image.

[0163] In an optional embodiment, it also includes:

[0164] A marking module is used to, when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of the mark of an undetermined type, mark the starting point and traverse to the next image block when the average brightness of the current image block is greater than a first average brightness threshold before determining the type of the starting point of the mark based on the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block.

[0165] In an optional embodiment, it also includes:

[0166] A recording module, used for recording the number of blocks whose average brightness of the current image block is continuously greater than a first average brightness threshold value during the traversal process;

[0167] A discarding module, configured to discard the marked starting point when the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is less than a preset block number threshold;

[0168] The third determination module is used to determine the starting point of the mark of undetermined type when the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is greater than or equal to a preset block number threshold.

[0169] In an optional embodiment, the first determining module 602 includes:

[0170] A first determination submodule is used to determine the type of the starting point of the mark according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block, when the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a starting point of the mark of an undetermined type; wherein the second average brightness threshold is less than the first average brightness threshold.

[0171] In an optional embodiment, the first determining submodule includes:

[0172] A first judging unit, configured to judge whether a change between an average brightness of the current image block and an average brightness of a previous adjacent image block is greater than or equal to a first brightness change threshold;

[0173] The first discarding unit is used to determine the type of the marked starting point as the non-glare starting point and discard the marked starting point when the change in the average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to a first brightness change threshold.

[0174] In an optional embodiment, the first determining submodule includes:

[0175] A second judgment unit is used to judge whether the change between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold;

[0176] The first determination unit is used to determine the type of the starting point of the mark according to the color gradient difference of the current image block when the change in the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold.

[0177] In an optional embodiment, the first determining unit includes:

[0178] A first judging subunit, configured to judge whether the color gradient difference of the current image block is less than a color gradient difference threshold;

[0179] A first discarding subunit is used to determine that the type of the marked starting point is the non-glare starting point and discard the marked starting point when the color gradient difference of the current image block is less than a color gradient difference threshold;

[0180] The first determining subunit is configured to determine that the type of the marked starting point is the colored glare starting point when the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold.

[0181] In an optional embodiment, the first determining submodule further includes:

[0182] A second determination unit is used to determine the type of the starting point of the mark according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block when the average brightness of the current image block is less than the second average brightness threshold and there is a starting point of the mark of undetermined type.

[0183] In an optional embodiment, the second determining unit includes:

[0184] A second judging subunit, configured to judge whether the color gradient difference of the current image block is less than a color gradient difference threshold;

[0185] A second determining subunit is configured to determine that the type of the marked starting point is a white glare starting point when the color gradient difference of the current image block is less than a color gradient difference threshold;

[0186] The third determining subunit is configured to determine that the type of the marked starting point is a colored glare starting point when the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold.

[0187] In an optional embodiment, it also includes:

[0188] a second acquisition module, configured to, after retaining the starting point of the type of the marked starting point as the glare starting point, traverse to the next image block, and, if the average brightness of the current image block is greater than a third brightness threshold, acquire the glare starting point closest to the center position coordinates of the current image block, and acquire a second Euclidean distance between the center position coordinates of the current image block and the nearest glare starting point; wherein the third brightness threshold is less than the second brightness threshold;

[0189] a deleting module, configured to delete the nearest glare starting point according to a change in the average brightness of the current image block and the average brightness of an image block at a previous adjacent position or a color gradient difference of the current image block, when the second Euclidean distance is less than a second preset distance and the center position coordinates of the current image block are to the left of the nearest glare starting point.

[0190] In an optional embodiment, the deletion module includes:

[0191] The first deletion submodule is configured to delete the most recent glare starting point when the difference between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position is greater than the first brightness difference threshold.

[0192] In an optional embodiment, the deletion module includes:

[0193] A second deletion submodule is used to delete the most recent glare starting point when the change in the average brightness of the image block and the average brightness of the image block at the previous adjacent position is less than or equal to the first brightness change threshold and greater than the second brightness change threshold, and the color gradient difference of the image block is less than the preset color gradient difference threshold.

[0194] In an optional embodiment, it also includes:

[0195] an acquisition submodule, configured to acquire, after deleting the most recent glare starting point, a first Euclidean distance between the current glare starting point and all glare starting points recorded before the current glare starting point;

[0196] a judgment submodule, configured to judge whether there is a target glare starting point whose first Euclidean distance from the current glare starting point is less than a first preset distance from the current glare starting point from among all glare starting points recorded before the current glare starting point;

[0197] A first marking submodule, configured to mark the current glare starting point and the target glare starting point as the same glare source cluster if the target glare starting point exists;

[0198] The second marking submodule is configured to mark the current glare starting point as a new glare source cluster if the target glare starting point does not exist.

[0199] In an optional embodiment, after traversing all image blocks of the image, the method further includes:

[0200] A judging module, used for judging whether the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster;

[0201] a fourth determination module, configured to determine that the glare source cluster is a colored glare source cluster if the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster;

[0202] a fifth determining module, configured to determine that the glare source cluster is a white glare source cluster if the number of colored glare points in the glare source cluster is less than the number of white glare starting points in the glare source cluster;

[0203] A sixth determination module is configured to determine an area formed by the colored glare source cluster and / or the white glare source cluster as a left boundary of the glare area of ​​the image.

[0204] In an optional embodiment, the sixth determining module includes:

[0205] A second determination submodule is used to determine the total number of glare starting points in the colored glare source cluster and the white glare source cluster respectively;

[0206] A third determination submodule, configured to determine that the colored glare cluster is a valid colored light source cluster if the total number of glare starting points in the colored glare source cluster is greater than a first glare total number threshold;

[0207] a third deletion submodule, configured to delete the colored glare cluster if the total number of glare starting points in the colored glare source cluster is less than or equal to a first glare total number threshold;

[0208] a fourth determination submodule, configured to determine that the white glare cluster is a valid white light source cluster if the total number of glare starting points in the white glare light source cluster is greater than a second glare total number threshold;

[0209] a fourth deletion submodule, configured to delete the colored glare cluster if the total number of glare points in the colored glare source cluster is less than or equal to a second total glare threshold;

[0210] The fifth determining submodule is configured to determine the area formed by the effective colored glare source cluster and / or the effective white glare source cluster as the left boundary of the glare area of ​​the image.

[0211] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0212] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0213] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0214] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0215] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0216] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0217] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0218] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for detecting image glare, characterized in that: include: Traverse the image row by row from left to right in blocks of a set size, and obtain the average brightness of the current image block, the change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process; When the average brightness of the current image block meets a preset brightness threshold and there is a marked starting point of an undetermined type, determining the type of the marked starting point according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block; The starting point types of the mark include non-glare starting point and glare starting point; The type of the starting point of the reserved mark is a starting point of the glare starting point, and after traversing all the image blocks of the image, the boundary of the glare area of ​​the image is determined according to the reserved glare starting point.

2. The method according to claim 1, characterized in that In a case where the average brightness of the current image block meets a preset brightness threshold and there is a starting point of a mark of an undetermined type, before determining the type of the starting point of the mark according to a change in the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block, the method further includes: When the average brightness of the current image block is greater than a first average brightness threshold, the starting point is marked and the next image block is traversed.

3. The method according to claim 2, characterized in that Also includes: Recording the number of blocks whose average brightness of the current image block is continuously greater than a first average brightness threshold during the traversal process; When the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is less than a preset block number threshold, discarding the marked starting point; When the number of blocks whose average brightness of the current image block is continuously greater than the first brightness threshold is greater than or equal to a preset block number threshold, it is determined that there is a starting point of a mark of an undetermined type.

4. The method according to claim 2, characterized in that: The method further comprises: determining the type of the marked starting point according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block when the average brightness of the current image block meets a preset brightness threshold and there is a marked starting point of an undetermined type. When the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a starting point of a mark of undetermined type, the type of the starting point of the mark is determined according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block; wherein the second average brightness threshold is less than the first average brightness threshold.

5. The method according to claim 4, characterized in that The method further comprises: determining the type of the marked starting point according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block, when the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a marked starting point of an undetermined type. Determine whether a change between the average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to a first brightness change threshold; When the change in average brightness of the current image block and the average brightness of the previous adjacent image block is greater than or equal to a first brightness change threshold, the type of the marked starting point is determined to be the non-glare starting point, and the marked starting point is discarded.

6. The method according to claim 4, characterized in that The method further comprises: determining the type of the marked starting point according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block, when the average brightness of the current image block is less than or equal to the first average brightness threshold and greater than the second average brightness threshold, and there is a marked starting point of an undetermined type. Determine whether a change between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold; When the change in the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold, the type of the marked starting point is determined according to the color gradient difference of the current image block.

7. The method according to claim 6, characterized in that The method of determining the type of the marked starting point according to the color gradient difference of the current image block when the amount of change between the average brightness of the current image block and the average brightness of the previous adjacent image block is less than a first brightness change threshold and greater than a second brightness change threshold comprises: Determine whether the color gradient difference of the current image block is less than a color gradient difference threshold; In a case where the color gradient difference of the current image block is less than a color gradient difference threshold, determining the type of the marked starting point to be the non-glare starting point, and discarding the marked starting point; In a case where the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold, the type of the marked starting point is determined to be the colored glare starting point.

8. The method according to claim 4, characterized in that The method further comprises: determining the type of the starting point of the mark according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block when the average brightness of the current image block meets a preset brightness threshold and there is a starting point of the mark of an undetermined type. When the average brightness of the current image block is less than the second average brightness threshold and there is a starting point of a mark of undetermined type, the type of the starting point of the mark is determined according to the change in the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block.

9. The method according to claim 8, characterized in that; The method further comprises: determining the type of the marked starting point according to a change between the average brightness of the current image block and the average brightness of the previous adjacent image block or a color gradient difference of the current image block when the average brightness of the current image block is less than the second average brightness threshold and there is a marked starting point of an undetermined type. Determine whether the color gradient difference of the current image block is less than a color gradient difference threshold; In a case where the color gradient difference of the current image block is less than a color gradient difference threshold, determining that the type of the marked starting point is a white glare starting point; In a case where the color gradient difference of the current image block is greater than or equal to a color gradient difference threshold, it is determined that the type of the marked starting point is a colored glare starting point.

10. The method according to claim 4, characterized in that After the start point of the reserved marked start point of type glare start point, also include: Traversing to the next image block, and when the average brightness of the current image block is greater than a third brightness threshold, obtaining the glare starting point closest to the center position coordinates of the current image block, and obtaining a second Euclidean distance between the center position coordinates of the current image block and the nearest glare starting point; wherein the third brightness threshold is less than the second brightness threshold; When the second Euclidean distance is less than the second preset distance and the center position coordinates of the current image block are to the left of the nearest glare starting point, the nearest glare starting point is deleted according to the change in the average brightness of the current image block and the average brightness of the image block at the previous adjacent position or the color gradient difference of the current image block.

11. The method according to claim 10, characterized in that The deleting the most recent glare starting point according to the change in the average brightness of the current image block and the average brightness of the image block at the previous adjacent position, and the color gradient difference of the current image block, comprises: When the difference between the average brightness of the current image block and the average brightness of the image block at the previous adjacent position is greater than the first brightness difference threshold, the most recent glare starting point is deleted.

12. The method according to claim 10, characterized in that The deleting the most recent glare starting point according to the change in the average brightness of the current image block and the average brightness of the image block at the previous adjacent position, and the color gradient difference of the current image block, comprises: When the change in the average brightness of the image block and the average brightness of the image block at the previous adjacent position is less than or equal to the first brightness change threshold and greater than the second brightness change threshold, and the color gradient difference of the image block is less than the preset color gradient difference threshold, the most recent glare starting point is deleted.

13. The method according to claim 10, characterized in that After deleting the most recent glare starting point, the method further includes: Obtaining a first Euclidean distance between the current glare starting point and all glare starting points recorded before the current glare starting point; From all glare starting points recorded before the current glare starting point, determining whether there is a target glare starting point whose first Euclidean distance from the current glare starting point is less than a first preset distance; If the target glare starting point exists, marking the current glare starting point and the target glare starting point as the same glare source cluster; If the target glare starting point does not exist, the current glare starting point is marked as a new glare source cluster.

14. The method according to claim 13, characterized in that After traversing all the image blocks of the image, the method further includes: Determining whether the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster; If the number of colored glare starting points in the glare source cluster is greater than or equal to the number of white glare starting points in the glare source cluster, then determining that the glare source cluster is a colored glare source cluster; If the number of colored glare points in the glare source cluster is less than the number of white glare starting points in the glare source cluster, then determining that the glare source cluster is a white glare source cluster; An area formed by the colored glare source cluster and / or the white glare source cluster is determined as a left boundary of the glare area of ​​the image.

15. The method according to claim 14, characterized in that The step of determining the area formed by the colored glare source cluster and / or the white glare source cluster as the left boundary of the glare area of ​​the image includes: respectively determining the total number of glare starting points in the colored glare source cluster and the white glare source cluster; If the total number of glare starting points in the colored glare source cluster is greater than a first glare total number threshold, determining the colored glare cluster as a valid colored light source cluster; If the total number of glare starting points in the colored glare source cluster is less than or equal to a first glare total number threshold, deleting the colored glare cluster; If the total number of glare starting points in the white glare light source cluster is greater than a second glare total number threshold, determining that the white glare light source cluster is a valid white light source cluster; If the total number of glare points in the colored glare source cluster is less than or equal to a second total glare threshold, deleting the colored glare cluster; An area formed by the effective colored glare source cluster and / or the effective white glare source cluster is determined as a left boundary of the glare area of ​​the image.

16. An image glare detection device, characterized in that: The device comprises: A first acquisition module is used to traverse the image row by row from left to right according to blocks of a set size, and obtain the average brightness of the current image block, the change between the average brightness of the current image block and the average brightness of the previous adjacent image block, and the color gradient difference of the current image block during the traversal process; A first determination module is used to determine the type of the marked starting point according to the change amount between the average brightness of the current image block and the average brightness of the previous adjacent image block or the color gradient difference of the current image block when the average brightness of the current image block meets the preset brightness threshold and there is a marked starting point of an undetermined type; the marked starting point types include non-glare starting points and glare starting points; The second determination module is used for retaining the starting point of the marked starting point of the type of glare starting point, and after traversing all image blocks of the image, determining the boundary of the glare area of ​​the image according to the retained glare starting point.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 15 when executed by a processor.

18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 15 are implemented.

Citation Information

Cited By

  • An infrared image fusion method for multi-feature glare detection and zoning processing

    CN122694678A