An auto-focusing method, apparatus, electronic device, and storage medium
By identifying low-light and low-light point light source scenes at night or in dim environments, and focusing the image after brightness suppression, the problem of focus blurring under the influence of point light sources is solved, and higher focus accuracy is achieved.
Patent Information
- Application Number
- CN202110558827.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-30
- Filing Date
- 2021-05-21
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2041-05-21
AI Technical Summary
In nighttime or dimly lit environments, point light sources can cause image blurring in video surveillance scenarios. Existing autofocus methods cannot accurately identify and eliminate pseudo-peak interference, thus affecting the focusing effect.
After identifying the scene of the captured image as a low-light scene, it is further determined whether it is a low-light point light source scene. The image after brightness suppression in the low-light point light source scene is then automatically focused to eliminate the influence of the point light source.
It improves the accuracy of autofocus at night, solves the problem of focusing difficulties in low-light point light source scenarios, and achieves more accurate scene recognition and focusing effects.
Smart Images

Figure CN113163123B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video surveillance technology, and in particular to an automatic focusing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Autofocus algorithms in video surveillance rely on determining the Focus Value (FV) of the current image. The FV value is typically obtained through image frequency domain analysis. Based on different frequency band divisions, FV values for low-frequency and high-frequency components can be obtained. Moving the focus motor to achieve a sharper image results in a higher FV value for the current image. In typical scenarios, the FV value curve, composed of the focus motor position and the FV value, generally exhibits unbiasedness and a single peak. Therefore, during autofocus, moving the focus motor to find the maximum FV value is sufficient to achieve sharp focus.
[0003] However, with the acceleration of urbanization, most nighttime or dimly lit surveillance scenarios are illuminated, making the FV value of the captured image susceptible to the influence of point light sources. When focusing becomes blurry, the halo effect increases low-frequency components in the image, leading to a phenomenon where the image becomes blurry but the FV value actually increases. This disrupts the single-peak characteristic of the FV value curve, resulting in a double-peak phenomenon, manifested as pseudo-peak interference in the FV value curve. Therefore, focusing in point light source scenarios is difficult and is one of the main problems currently existing in autofocusing in nighttime or dimly lit environments.
[0004] Existing technologies involve deleting high-brightness points from the image and determining the focus position based on the FV values of all retained points. However, the same brightness value may appear as an ordinary point in a high-brightness light source scene or as a light source point in a low-light scene in different scenarios. If high-brightness points in a point light source image are set as deletion points, the FV value curve formed by the retained points will show a very poor trend and cannot be used for focusing, severely affecting the autofocus effect in nighttime scenes. Summary of the Invention
[0005] This disclosure provides an autofocus method, apparatus, electronic device, and storage medium that improve the accuracy of autofocusing of zoom lenses by recognizing different scenes.
[0006] In a first aspect, embodiments of the present invention provide an automatic focusing method, comprising:
[0007] Obtain image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information;
[0008] If it is a low-light scene, then determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image;
[0009] If it is a low-light point light source scene, then the image is automatically focused based on the image after brightness suppression of the captured image.
[0010] Secondly, embodiments of the present invention also provide an autofocusing device, comprising:
[0011] The low-light scene determination module is used to acquire image parameter information in the captured image and determine whether the scene of the captured image is a low-light scene based on the image parameter information.
[0012] The low-light point light source scene determination module is used to determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image if it is a low-light scene.
[0013] The low-light point light source scene focusing module is used to automatically focus on the image after brightness suppression of the captured image if the scene is a low-light point light source.
[0014] Thirdly, embodiments of the present invention also provide an electronic device, comprising:
[0015] One or more processors;
[0016] Storage device for storing one or more programs.
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the autofocus method as described in any embodiment of the present invention.
[0018] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the autofocus method as described in any embodiment of the present invention.
[0019] This invention determines the light source or lighting scene of a captured image based on image parameter information, and proposes different aggregation schemes for different scenes, thereby improving the accuracy of automatic nighttime shooting. In some exemplary embodiments, more accurate scene recognition schemes are further proposed for low-light point light source scenes and / or strong point light source scenes to further improve the accuracy of automatic nighttime shooting.
[0020] After reading and understanding the accompanying diagrams and detailed descriptions, the other aspects can be understood. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0022] Figure 1 This is a flowchart of the autofocusing method in Embodiment 1 of the present invention;
[0023] Figure 2 This is a schematic diagram illustrating the segmentation of a captured image into blocks;
[0024] Figure 3 This is a schematic diagram illustrating the division of influence weights for high-brightness indicators;
[0025] Figure 4 This is a schematic diagram of segmented brightness suppression of an image;
[0026] Figure 5 This is a flowchart of the autofocusing method in Embodiment 2 of the present invention;
[0027] Figure 6 This is a display of the brightness histogram of a scene image with a strong point light source and the brightness histogram of other scene images;
[0028] Figure 7 This is a flowchart of an autofocusing method according to Embodiment 3 of the present invention;
[0029] Figure 8 This is a flowchart of another autofocusing method in Embodiment 3 of the present invention;
[0030] Figure 9 This is a schematic diagram of the autofocus device in Embodiment 4 of the present invention;
[0031] Figure 10 This is a schematic diagram of the electronic device in Embodiment 5 of the present invention.
[0032] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0034] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0035] Furthermore, in this invention, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0036] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0037] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are feasible for those skilled in the art. If the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
[0038] Example 1
[0039] Figure 1 This is a flowchart of the autofocus method in Embodiment 1 of the present invention. This embodiment is applicable to situations where autofocus is performed on a captured image based on a scene-based judgment. The method can be executed by an autofocus device, which can be implemented in software and / or hardware and can be configured in an electronic device, such as a backend server or other device with communication and computing capabilities. Figure 1 As shown, the method specifically includes:
[0040] Step 101: Obtain the image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information.
[0041] Here, "captured image" refers to an initially unfocused image taken with a zoom lens, specifically one captured at night or in low-light conditions. The focus is then targeted by identifying nighttime scenes within the captured image. "Image parameter information" refers to parameters characterizing the imaging effect in the captured image, such as brightness and gain information. The specific content of these parameters is not limited here. Scene classification distinguishes between images based on brightness and the influence of light sources. A low-light scene refers to an image with low illumination.
[0042] In some exemplary embodiments, image parameter information that can characterize the image illuminance is obtained from the captured image, such as brightness statistics. Based on the image parameter information, it is determined whether the image illuminance in the current image is too low. For example, it is determined whether it is a low-illuminance scene based on the comparison result of the brightness statistics and a preset low-illuminance threshold. If the brightness statistics is greater than the preset low-illuminance threshold, it is determined that the scene of the captured image is not a low-illuminance scene; if the brightness statistics is less than or equal to the preset low-illuminance threshold, it is determined that the scene of the captured image is a low-illuminance scene.
[0043] In one feasible embodiment, the image parameter information includes the brightness statistics and image gain parameters in the automatic exposure statistics;
[0044] Accordingly, based on the image parameter information, it is determined whether the scene captured is a low-light scene, including:
[0045] If the brightness statistics result is less than the preset low light threshold and the image gain parameter is greater than the preset gain threshold, then the scene of the captured image is determined to be a low light scene.
[0046] The image parameter information includes automatic exposure statistics, which refers to the statistical information obtained when the image is captured under automatic exposure (Auto Exposure, AE), including the brightness statistics result Luma and the current image gain parameter.
[0047] When images are captured in automatic exposure mode, the true illumination of the scene can be better represented. Therefore, when determining whether a captured image is a low-light scene, the luminance statistics (Luma) and image gain parameter in the AE statistics are used for judgment. Analysis of low-light scene images shows that when the luminance statistics (Luma) is less than a preset low-light threshold and the image gain parameter (Gain) is greater than a preset gain threshold, the captured image can be identified as a low-light scene. The preset low-light threshold and preset gain threshold can be statistically determined based on pre-collected low-light scene image materials to ensure the accuracy of their determination.
[0048] Step 102: If it is a low-light scene, determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image.
[0049] Because image sharpness evaluation values are easily affected by point light sources, when focusing is blurred, the diffusion of the halo effect from the point light source increases the low-frequency components in the image, leading to a phenomenon where the image blurs and the sharpness evaluation value increases, i.e., there is false peak interference on the sharpness evaluation value curve. Therefore, the presence of point light sources in a scene will make focusing difficult. Thus, after identifying the scene of the captured image as a low-light scene, it is necessary to further identify the current scene to determine whether point light sources are present. If point light sources are present, the current scene is a low-light point light source scene within a low-light scene.
[0050] Images of low-light point light source scenes are characterized by low illumination, high gain, and limited detail, often containing scattered light sources. A common example of a low-light point light source scene is an outdoor scene with light sources. These scattered light sources appear as relatively bright but few in number. Therefore, the distribution of these bright spots in the image can determine whether the scene is a point light source scene. For instance, if the bright spots in the image are scattered and few in number, the scene can be identified as a low-light point light source scene. Otherwise, it is a typical low-light scene, meaning that focusing in a typical low-light scene will not be affected by point light sources.
[0051] In one feasible embodiment, determining whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image includes: dividing the captured image into blocks to obtain at least two block regions;
[0052] Determine the proportion of pixels with brightness values greater than a preset high brightness threshold in each block region to the total number of pixels in that block region, and obtain the high brightness ratio of each block region;
[0053] The high-brightness focus influence parameters of the captured image are determined based on the high-brightness ratio of each segmented region and the pre-determined high-brightness influence weight; wherein, the high-brightness influence weight is determined based on the focus weight;
[0054] If the focusing influence parameter of the high-brightness point is greater than the preset focusing influence parameter threshold, then the scene of the captured image is determined to be a low-light point light source scene.
[0055] To improve the accuracy of determining the distribution of high-brightness areas in the captured image, and thus the accuracy of determining the focusing influence parameters of high-brightness areas, in this embodiment of the invention, the captured image is divided into blocks to obtain M*N block regions, such as... Figure 2The diagram shows the process of dividing a captured image into blocks. The width (Width) is divided into N equal parts, and the height (Height) is divided into M equal parts, resulting in M*N block regions, where M and N are both integers greater than or equal to 1.
[0056] For each segmented region, the number of bright spots is counted according to a preset bright spot threshold, and the proportion of bright spots in each segmented region is also calculated. For example, the number of pixels Cnt with brightness values greater than the preset bright spot threshold in each segmented region is counted, and the ratio of the number of pixels Cnt with brightness values greater than the preset bright spot threshold to the total number of pixels in the current segmented region is calculated. This ratio is denoted as R(x, y), where 1 ≤ x ≤ M, 1 ≤ y ≤ N. The preset bright spot threshold can be statistically determined based on pre-collected low-light point light source scene image materials to ensure that the preset bright spot threshold accurately reflects the point light source situation in low-light scenes. For example, the preset bright spot threshold is obtained based on the brightness histogram information of pre-collected low-light point light source scene image materials.
[0057] During autofocus, the image sharpness evaluation value is segmented based on different scene focuses, and different focus weights are assigned to each segment. During focusing, the sharpness evaluation value of each segment is convolved with its respective focus weight to obtain the final sharpness evaluation value used for focusing. The focus weights are set according to shooting requirements and are considered image attribute information, so they are not limited here. For example, focus weights include, but are not limited to, center focus and edge focus. In center focus, the focus weight of the segment located at the center of the image is greater than that of the segment located at the edge; in edge focus, the focus weight of the segment located at the center of the image is less than that of the segment located at the edge. In this embodiment of the invention, the specific setting of the focus weights is not limited. The influence weight of high-brightness areas is determined based on the focus weights, that is, the influence weight of high-brightness areas in the captured image is determined based on the overall situation of the focus weights in the image.
[0058] Due to the focus weight settings during autofocus, in low-light point light source scenes, the influence of point light sources on the final sharpness evaluation value varies depending on the pre-set focus weights for different segmented regions. When using center focus, point light sources closer to the center have a greater impact on focus; conversely, when using edge focus, point light sources closer to the edge have a greater impact. Therefore, after determining the proportion of high-brightness areas in each segmented region, the focus influence parameters for high-brightness areas in the captured image are determined based on this proportion and the pre-determined influence weights. The influence weights are determined based on the autofocus weights and the segmentation results. For example, the autofocus weights of this zoom lens can be directly used, or the design can be based on the actual autofocus influence weight division method, with distribution characteristics identical to the actual autofocus weights and matching the distribution of the segmentation results. For instance, in center focus, the weight is higher at the center and lower at the edges. Figure 3 The diagram illustrates the division of the influence weight of high-brightness areas. Region C in the image represents the center, with a high-brightness influence weight of W1. Region A represents the edge of the image, with a high-brightness influence weight of W3. Region B represents the center of the image, with a high-brightness influence weight of W2. Taking center focus as an example, W1 is greater than W2, and W2 is greater than W1, based on the location. The expression for the influence weight of high-brightness areas can be represented as:
[0059]
[0060] Specifically, when the target segment is located in region A, the influence weight of the highlighted areas in that target segment is W1; when the target segment is located in region B, the influence weight of the highlighted areas is W2; and when the target segment is located in region C, the influence weight of the highlighted areas is W3. Determining which region the target segment is located in can be based on the actual coordinates, which is a common technique used by those skilled in the art and will not be elaborated upon here.
[0061] The high-brightness focusing influence parameter is the convolution result of R(x,y) and W(x,y), representing the degree of influence of high-brightness information on focusing in each block region under the focusing weight. A larger value indicates a higher proportion of high-brightness information affecting focusing; a smaller value indicates a smaller proportion. Taking center focusing as an example, a larger high-brightness focusing influence parameter indicates that high-brightness information is mostly distributed in the center of the image, while a smaller parameter indicates that high-brightness information is mostly distributed at the edges of the image. If the high-brightness focusing influence parameter is greater than the preset focusing influence parameter threshold, it indicates that point light sources in the image will affect autofocus, and the scene is determined to be a low-light point light source scene. If the high-brightness focusing influence parameter is less than or equal to the preset threshold, it indicates that even if point light sources exist in the image, they will not have a significant impact on autofocus, and the scene is determined to be a low-light normal scene. The preset focusing influence parameter threshold can be statistically determined based on pre-collected low-light point light source scene image materials to ensure that the preset threshold accurately reflects the degree of influence of point light sources on focusing in low-light scenes.
[0062] For example, the brightness image of the captured image is determined based on the Y component image in the YUV format of the captured image. The brightness image is then divided into blocks, and the pixel value of each pixel in the brightness image is the brightness value of that point. The proportion of pixels with pixel values greater than a preset high brightness threshold in each block region is directly counted to the total number of pixels in the block region.
[0063] Step 103: If it is a low-light point light source scene, then automatically focus on the image after suppressing the brightness of the captured image.
[0064] In low-light point light source scenes, the sharpness evaluation value includes both point light source information and scene effective focus information. Therefore, to focus based on the scene effective focus information, it is necessary to weaken the point light source information. In this embodiment of the invention, suppressing point light source information in the image effectively highlights the effective focus information, resulting in a sharpness evaluation value unaffected by the point light source. Suppressing point light source information in the image can be achieved by suppressing high-brightness areas, i.e., reducing the brightness value of high-brightness areas.
[0065] In one feasible embodiment, automatic focusing based on an image after brightness suppression of the captured image includes:
[0066] The brightness values of pixels in the captured image that have a brightness value greater than a preset brightness suppression threshold are determined according to a preset suppression ratio to obtain a brightness-suppressed image.
[0067] Automatic focusing is performed based on the sharpness evaluation value of low-frequency components in the image after brightness suppression.
[0068] The preset brightness suppression threshold distinguishes high-brightness areas in the image that need to be suppressed; the preset suppression ratio ensures the degree of suppression of these high-brightness areas. Since suppressing point light source information not only suppresses unfavorable point light source information but also affects other effective focus information, the preset brightness suppression threshold and preset suppression ratio are set to suppress the pseudo-peak effect of high-brightness areas on the sharpness evaluation value curve. The preset brightness suppression threshold can be statistically obtained from the brightness histogram information of pre-collected low-light point light source scene image materials. After determining the preset brightness suppression threshold, the preset suppression ratio that has the least impact on the focus of the sharpness evaluation value is determined through real-world testing.
[0069] like Figure 4 The diagram illustrates segmented brightness suppression of an image. Luma represents the brightness value of a pixel in the image, T8 represents the first preset brightness suppression threshold, T7 represents the second preset brightness suppression threshold, RR represents the suppression ratio, and T9 represents the preset suppression ratio. Pixel values greater than T8 and less than T7 are linearly suppressed according to a range from 1 to T9. Pixel values greater than T7 are directly multiplied by the preset suppression ratio T9, while pixel values less than T8 remain unchanged. This achieves the effect of segmented brightness suppression in the image. The specific form of segmented brightness suppression in this embodiment is not limited; it is merely an example.
[0070] The image after brightness suppression is Img(i,j)′=Img(i,j)*RR(i,j), where Img(i,j) represents the brightness value of the captured image at point (i,j), RR(i,j) represents the preset suppression ratio determined based on the brightness value at point (i,j), and Img(i,j)′ is the brightness value of the image at point (i,j) after brightness suppression. Autofocus is performed based on the sharpness evaluation value in Img(i,j)′. Focusing is successful when the position of the focusing motor is moved to maximize the sharpness evaluation value in Img(i,j)′.
[0071] In low-light point light source scenes, the illumination is low, and the high-frequency component sharpness evaluation value contains a large amount of noise information introduced by increasing image gain. Therefore, using the high-frequency component sharpness evaluation value in this scene will cause focusing failure. Using the low-frequency component sharpness evaluation value can avoid interference. Effective focusing information is also mostly found in the low-frequency components. Therefore, using the sharpness evaluation value of the low-frequency components in the brightness-suppressed image can avoid focusing interference caused by noise information and also avoid focusing interference caused by point light sources, thus improving the accuracy of autofocus. For example, autofocus is performed based on the sharpness evaluation value of the low-frequency components in Img(i,j)′. Focusing is successful when the position of the focusing motor is moved to maximize the sharpness evaluation value of the low-frequency components in Img(i,j)′.
[0072] This invention determines whether a captured image is a low-light scene based on image parameter information. If it is determined to be a low-light scene, it further determines whether it is a low-light point light source scene based on the distribution of high-brightness areas in the captured image. If it is determined to be a low-light point light source scene, high-brightness areas in the captured image are suppressed, and automatic focusing is performed based on the suppressed image. This achieves targeted focusing based on the scene recognition result, improving the accuracy of recognizing low-light point light source scenes, thereby improving the focusing accuracy of low-light point light source scenes and solving the focusing problem in low-light point light source scenes.
[0073] Example 2
[0074] Figure 5 This is a flowchart of the autofocus method in Embodiment 2 of the present invention. Embodiment 2 is a further optimization based on Embodiment 1. Figure 5 As shown, the method includes:
[0075] Step 501: Determine whether the scene in the captured image is a strong point light source scene based on the distribution of brightness values of each pixel in the captured image.
[0076] In this process, the brightness value of each pixel in the image is determined based on the Y component image in the YUV format. The Y component image represents the brightness image of the image, and the pixel value of each point in the brightness image is the brightness value of that point in the captured image. The distribution of brightness values is determined by the distribution of the number of pixel values in the brightness image. Specifically, since the value range of brightness is 0-255, the range of pixel values in the brightness image is also 0-255. The number of pixels with each brightness value in the brightness image is counted, and a brightness histogram is generated, where the horizontal axis represents the brightness value and the vertical axis represents the number of pixels with each brightness value in the captured image.
[0077] For example, after acquiring the current captured image, the brightness image of the captured image is filtered and preprocessed to eliminate the influence of jittery high bright spots on the statistical results. The filtered brightness image is then normalized, and a normalized brightness histogram is generated.
[0078] In addition to low-light point light source scenes, there are also strong point light source scenes in the captured images. In strong point light source scenes, the overall brightness of the image is high, the image is in a state similar to overexposure, the bright area is large, and the image information mainly comes from the edge of the halo of the point light source. Common strong point light source scenes include illuminated billboards and large searchlights on iron towers.
[0079] Because images of strong point light source scenes exhibit characteristics similar to overexposure, the determination is based on the distribution of brightness values. Specifically, after determining the normalized brightness histogram of the captured image, if the brightness data in the normalized brightness histogram is discretely distributed and concentrated in bright and dark areas, with a significant peak in the bright areas, then the captured image scene meets the characteristics of a strong point light source scene and is determined to be a strong point light source scene; if any condition is not met, it is not a strong point light source scene, and further scene determination is required. Figure 6 The image shown displays the brightness histogram of a scene with a strong point light source and the brightness histograms of other scene images. Figure 6 As can be seen from the image above, the brightness data distribution in the brightness histogram of the strong point light source scene is discrete, with more pixels in the bright and dark areas, and obvious peaks in the bright areas.
[0080] In one feasible embodiment, the standard deviation feature parameter, the highlight ratio feature parameter, and the non-highlight skewness feature parameter are determined based on the distribution of brightness values of each pixel in the captured image. Whether the captured image scene is a strong point light source scene is determined based on whether the standard deviation feature parameter, the highlight ratio feature parameter, and the non-highlight skewness feature parameter meet the strong point light source feature threshold.
[0081] The standard deviation feature parameter is used to characterize the dispersion of brightness values in a captured image. In scenes with strong point light sources, the brightness value distribution is discrete. The standard deviation in the brightness histogram is used to characterize the dispersion of the brightness data distribution. The standard deviation feature parameter σ can be determined using the following formula:
[0082]
[0083] in, n = 255, X i X represents the number of pixels with a brightness value of i in the captured image. i The value can be obtained from the brightness histogram. When the standard deviation parameter is greater than the preset standard deviation threshold (first standard deviation threshold), the scene of the captured image conforms to the characteristics of a strong point light source scene. The preset standard deviation threshold can be statistically determined based on pre-collected strong point light source scene image materials to ensure that the preset standard deviation threshold can accurately reflect the distribution of brightness values in the strong point light source scene.
[0084] The highlight ratio feature parameter is used to characterize whether there are peaks in the highlight areas of the captured image. Based on a preset strong point light source highlight threshold, the brightness values in the captured image are divided into highlight areas and non-highlight areas. For example, if the preset strong point light source highlight threshold is set to 250, then the highlight areas have brightness values of 250 to 255, and the non-highlight areas have brightness values of 0 to 249. The preset strong point light source highlight threshold can be statistically determined based on pre-collected strong point light source scene image materials to ensure that the preset strong point light source highlight threshold accurately reflects the brightness level in the strong point light source scene.
[0085] Specifically, a preset high-brightness threshold for a strong point light source is set to Δi (denoted as the first brightness threshold) in the brightness histogram. Then, based on Δi, the brightness data in the brightness histogram is divided into two parts: the histogram data of the high-brightness area X. H (X Δi ,..,X 255 Histogram data of non-highlighted areas X L (X0, ..., X) Δi-1 The highlight ratio characteristic parameter can be determined using the following formula:
[0086]
[0087] Among them, R (Δi,255) The highlight area represents the highlight ratio characteristic parameter from Δi to 255; X i X represents the number of pixels with a brightness value of i in the captured image; H (X Δi ,..,X 255 X(X0, X1, X2, ..., X) represents the number of pixels whose brightness values are located in the highlight area; 255 This represents the total number of pixels in the captured image. When the highlight ratio feature parameter is greater than the preset highlight ratio threshold (first ratio threshold), the scene of the captured image conforms to the characteristics of a strong point light source scene. The preset highlight ratio threshold can be statistically determined based on pre-collected strong point light source scene image materials to ensure that the preset highlight ratio threshold can accurately reflect the peak value of the highlight area in the strong point light source scene.
[0088] Non-highlight skewness feature parameters are used to characterize the degree of deviation of samples in non-highlight areas of a captured image. In images of scenes with strong point light sources, due to the discrete brightness distribution, overexposure occurs, resulting in a large number of pixels in both dark and bright areas. Therefore, the non-highlight area X... L (X0, ..., X) Δi-1 The histogram of the positively skewed graph is positively skewed. The non-highlight skewness feature parameter can characterize the degree of deviation from the positive skewness. The non-highlight skewness feature parameter (also known as skewness) can be determined by the following formula:
[0089]
[0090] Wherein, SK represents the non-highlight skewness characteristic parameter, also known as skewness. SK represents the average image brightness, m3 is the third central moment of the sample, and m2 is the second central moment of the sample. When SK is greater than 0, it indicates a non-highlight area X. L (X0, ..., X) Δi-1 The histogram of the image shows a positive skewness, and when SK is greater than a preset skewness threshold (also known as the first skewness threshold), the scene of the captured image conforms to the characteristics of a strong point light source scene. The preset skewness threshold can be statistically determined based on pre-collected strong point light source scene image materials to ensure that the preset skewness threshold can accurately reflect the offset of non-highlight areas in the strong point light source scene.
[0091] If the standard deviation feature parameter of the captured image is greater than a preset standard deviation threshold, the highlight ratio feature parameter is greater than a preset highlight ratio threshold, and the non-highlight skewness feature parameter is greater than a preset skewness threshold, then the scene captured in the image is determined to be a strong point light source scene. Otherwise, it is necessary to determine whether the scene is a low-light scene based on the image parameter information. If the scene captured in the image is neither a strong point light source scene nor a low-light scene, then it is a high-light scene.
[0092] Step 502: If it is a scene with a strong point light source, focus is successful when the image brightness value of the captured image is at its minimum.
[0093] Because images of strong point light sources are typically in an overexposed state, with highlights and shadows occupying a large portion of the image, and the shadows being too dark to provide effective focus information, the sharpness evaluation values across all frequency bands cannot be used for focusing. However, when an image of a strong point light source is blurred, the halo of the point light source expands, increasing the overall brightness; conversely, when the image is sharp, the halo shrinks, decreasing the overall brightness. Therefore, when a scene is identified as a strong point light source, the image brightness value is used for focusing based on the image characteristics of the strong point light source. The focus motor is moved to find the point with the lowest image brightness value, which is the sharp point in the strong point light source scene. The image brightness value refers to the sum of the brightness values of all pixels in the captured image. The focus motor is moved, and the image brightness value at each position is calculated. When the image brightness value is at its lowest, the image is successfully focused.
[0094] Step 503: If it is not a strong point light source scene, determine whether the scene of the captured image is a low-light scene based on the image parameter information.
[0095] If the scene in which the image is captured is not a scene with a strong point light source, it is necessary to determine whether it is a low-light scene. If it meets the characteristics of a low-light scene image, it is a low-light scene; otherwise, it is a high-light scene.
[0096] Specifically, when determining whether a captured image is a low-light scene, the judgment is based on the luminance statistics (Luma) and image gain parameter in the AE statistics information. Analysis of low-light scene images shows that when the luminance statistics (Luma) is less than a preset low-light threshold and the image gain parameter (Gain) is greater than a preset gain threshold, the captured image can be identified as a low-light scene.
[0097] Step 504: If it is not a low-light scene, then determine that the scene of the captured image is a normal high-brightness scene, and automatically focus based on the sharpness evaluation value of the high-frequency components in the captured image.
[0098] When the brightness statistics result Luma is greater than or equal to the preset low light threshold or the image gain parameter Gain is less than or equal to the preset gain threshold, the scene of the captured image can be determined to be a high-brightness scene.
[0099] High-brightness scenes include both high-brightness regular scenes and high-spot-light-source scenes. Both types of scenes share the characteristics of high image brightness and rich detail. The main difference is that high-spot-light-source scenes contain point light sources. Common examples include distant urban buildings and residential areas, while common high-brightness regular scenes include street scenes under city lights at night.
[0100] Since the halo effect of point light sources primarily affects low-frequency components, by setting a filter cutoff frequency for calculating image sharpness evaluation values, and using the sharpness evaluation values of high-frequency components obtained after filtering, we can obtain high-frequency sharpness evaluation value statistics that are less affected by point light sources. Meanwhile, in bright, conventional scenes, which are unaffected by light sources and have high brightness and rich detail, high-frequency sharpness evaluation values can also be used for focusing.
[0101] Specifically, for focusing on bright scenes, a preset high-frequency threshold is used to determine the sharpness evaluation value of the high-frequency components. When the sharpness evaluation value of the high-frequency components is the highest, the captured image is successfully focused. The preset high-frequency threshold can be statistically determined based on pre-collected bright scene image materials to ensure that the high-frequency components accurately reflect the effective focus information in the bright scene image.
[0102] Step 505: If it is a low-light scene, determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image.
[0103] Once it's determined that the scene captured in the image is a low-light scene, it's necessary to determine whether it's a low-light point light source scene or a regular low-light scene. The determination of a low-light point light source scene can be based on the distribution of highlights in the captured image. The captured image is divided into blocks, resulting in at least two blocks. The proportion of pixels with brightness values greater than a preset highlight threshold in each block is determined, yielding the highlight ratio for each block. Highlight focus influence parameters are determined based on the highlight ratio of each block and a pre-determined highlight influence weight. The highlight influence weight is determined according to the focus weight. If the highlight focus influence parameter is greater than the preset focus influence parameter threshold, the scene captured in the image is determined to be a low-light point light source scene.
[0104] Step 506: If it is a low-light point light source scene, then automatically focus on the image after suppressing the brightness of the captured image.
[0105] In the case of a low-light point light source scene, the brightness values of pixels in the captured image that are greater than the preset brightness suppression threshold are determined according to the preset suppression ratio to obtain the brightness-suppressed image; the image is then automatically focused based on the sharpness evaluation value of the low-frequency components in the brightness-suppressed image.
[0106] Step 507: If it is not a low-light point light source scene, then determine that the scene of the captured image is a low-light normal scene, and automatically focus according to the sharpness evaluation value of the low-frequency components in the captured image.
[0107] If the scene depicted in the captured image is a low-light scene, and the distribution of high-brightness areas in the image indicates that the scene is not a low-light point light source scene, then the scene is classified as a typical low-light scene. Typical low-light scenes are characterized by low illumination, high gain, few image details, and no light source. A common example is an outdoor scene with no light source. This scene's characteristics are similar to those of a low-light point light source scene. Since the high-frequency sharpness evaluation value is unusable due to noise, the low-frequency component sharpness evaluation value is used for autofocus.
[0108] The division of low-frequency components is determined by setting a reasonable preset low-frequency cutoff frequency. This preset cutoff frequency can be statistically determined based on pre-collected low-light typical scene footage to ensure that the low-frequency components accurately reflect the effective focus information in low-light typical scenes. Specifically, for focusing in low-light typical scenes, the preset low-frequency cutoff frequency is used to determine the sharpness evaluation value of the low-frequency components; when the sharpness evaluation value of the low-frequency components is the highest, the captured image is successfully focused.
[0109] This invention addresses the problem of zoom lenses easily losing focus in complex nighttime or dimly lit environments by classifying image scenes into strong point light source scenes, low-light point light source scenes, low-light normal scenes, and high-brightness scenes. Different focusing methods are implemented according to the characteristics of different scenes, thereby achieving scene-adaptive focusing and improving the success rate of zoom lenses in focusing in nighttime or dimly lit scenes.
[0110] Example 3
[0111] This disclosure also provides an automatic focusing method, such as... Figure 7 As shown, it includes:
[0112] Step 701: Obtain image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information;
[0113] Step 702: If it is determined that it is not a low-light scene, then determine whether the scene of the captured image is a strong point light source scene based on the distribution of the brightness values of each pixel in the captured image.
[0114] Step 703: If the scene is determined to be a strong point light source, then the focus is successful when the image brightness value of the captured image is at its minimum.
[0115] In some exemplary embodiments, step 702, determining whether the scene in the captured image is a strong point light source scene based on the distribution of brightness values of each pixel in the captured image, includes:
[0116] Based on the brightness value of each pixel in the captured image, a brightness value statistics table is determined; wherein, the brightness value statistics table reflects each brightness value and the number of pixels included in each brightness value;
[0117] Based on the brightness value statistics, if the conditions for a strong point light source are met, then the scene of the captured image is determined to be a strong point light source scene.
[0118] In some exemplary embodiments, step 702, determining brightness value statistics based on the brightness values of each pixel in the captured image, includes:
[0119] Before determining the brightness statistics, step 7011 is performed to preprocess the captured image, including: filtering the captured image and normalizing the brightness values of the filtered image.
[0120] Then, based on the brightness values of each pixel in the normalized image, the brightness value statistics are determined.
[0121] As can be seen, in the preprocessing step 7011, the captured image of the current scene is filtered to eliminate the influence of flickering bright spots on the statistical results; the filtered brightness image is then normalized to a preset brightness value range, for example, a brightness value normalization of 0-255. The brightness range for normalization is not limited to the example in this disclosure, and other numerical ranges can be selected.
[0122] In some exemplary embodiments, such as Figure 8 As shown, after step 702, the following steps are also included:
[0123] Step 704: If it is determined that the scene is not a strong point light source scene, then the scene of the captured image is determined to be a normal high-brightness scene, and automatic focusing is performed based on the sharpness evaluation value of the high-frequency components in the captured image.
[0124] In some exemplary embodiments, the brightness value statistics can be obtained using methods such as... Figure 6 This is illustrated using a histogram. For example... Figure 6 In the histogram shown, the horizontal axis represents the brightness value, and the vertical axis represents the number of pixels included (corresponding to) each brightness value.
[0125] In some exemplary embodiments, the determination that the strong point light source condition is met includes:
[0126] Based on the brightness value statistics, brightness value statistics with brightness values less than the first brightness threshold are selected to form non-high-brightness area statistics.
[0127] If the statistical data of the non-high-brightness area is determined to be positively skewed and the skewness is greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met.
[0128] As can be seen, based on the first brightness threshold (the brightness value corresponding to the boundary point Δi that defines the bright area), the brightness value statistics of the captured image are divided into bright area statistics and non-bright area statistics. In some exemplary embodiments, the statistics are represented by histogram data, which corresponds to the division into bright area histograms. Figure X H (x Δi ,..,x 255 Histogram of non-highlighted areas Figure X L (X0, ..., X) Δi-1 ).
[0129] In some exemplary embodiments, in the above-mentioned strong point light source condition: the statistical data of the non-high brightness area is positively skewed, and the skewness is greater than or equal to the first skewness threshold, which is denoted as condition one; that is, if the brightness value statistical data satisfies condition one, then the scene of the captured image is determined to be a strong point light source scene.
[0130] As can be seen, in images of scenes with strong point light sources, overexposure occurs due to the discrete brightness distribution. There are many pixels in both dark and bright areas, therefore, the non-highlight area X... L (X0, ..., X) Δi-1 The histogram of the non-highlighted region data is positively skewed, and the skewness of the non-highlighted region data can characterize the degree of deviation from the positive skewness. In some exemplary embodiments, for the non-highlighted region data X... L (X0, ..., X) Δi-1 The skewness of () can be determined by the following formula:
[0131]
[0132] Where SK represents skewness, SK represents the mean brightness of the sample, m3 is the third central moment of the sample, and m2 is the second central moment of the sample. When SK is greater than 0, it indicates a non-highlight region X. L (X0, ..., X) Δi-1 The histogram of the image shows a positive skewness, and when SK is greater than the preset first skewness threshold, the scene of the captured image conforms to the characteristics of a strong point light source scene. The preset first skewness threshold can be statistically determined based on pre-collected strong point light source scene image materials to ensure that the preset first skewness threshold can accurately reflect the offset of non-highlight areas in the strong point light source scene.
[0133] That is, the non-highlighted region X L (X0, ..., X) Δi-1 A scene is considered a strong point light source if its histogram is positively skewed and its skewness is greater than or equal to the first skewness threshold T3; otherwise, it is not a strong point light source scene. The T3 threshold can be obtained by statistically analyzing image materials of strong point light source scenes.
[0134] In some exemplary embodiments, the determination that the strong point light source condition is met further includes:
[0135] Calculate the standard deviation of the statistical data on the brightness values;
[0136] If the standard deviation is greater than or equal to the first standard deviation threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met.
[0137] In some exemplary embodiments, in the above-mentioned strong point light source conditions: the standard deviation is greater than or equal to the first standard deviation threshold, which is denoted as condition two; that is, if the brightness value statistics satisfy condition one and condition two, then the scene of the captured image is determined to be a strong point light source scene.
[0138] In scenarios with strong point light sources, the statistical data distribution of brightness values is discrete. The standard deviation σ of the statistical data of brightness values is used to characterize the degree of dispersion of the brightness data distribution. The larger σ is, the more dispersed the data distribution; the smaller σ is, the more concentrated the data distribution.
[0139] In some exemplary embodiments, the luminance value statistics are represented as luminance histogram data X(x0,x1,x2,...x 255 The standard deviation is calculated as follows:
[0140] in
[0141] When the standard deviation σ is greater than or equal to the first standard deviation threshold T1, the scene is considered to meet the characteristics of a strong point light source scene. T1 can be obtained from statistical strong point light source image materials.
[0142] In some exemplary embodiments, the determination that the strong point light source condition is met further includes:
[0143] Based on the brightness value statistics, calculate the proportion of pixels with brightness values greater than or equal to the first brightness threshold to the total number of pixels in the captured image.
[0144] If the ratio is greater than or equal to a first ratio threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to a first skewness threshold, then the strong point light source condition is determined to be met.
[0145] In some exemplary embodiments, in the above-mentioned strong point light source conditions: the ratio is greater than or equal to the first ratio threshold, denoted as condition three; that is, if the brightness value statistics satisfy condition one and condition three, then the scene of the captured image is determined to be a strong point light source scene.
[0146] In some exemplary embodiments, the determination that the strong point light source condition is met further includes:
[0147] Calculate the standard deviation of the statistical data on the brightness values;
[0148] Based on the brightness value statistics, calculate the proportion of pixels with brightness values greater than or equal to the first brightness threshold to the total number of pixels in the captured image.
[0149] If the standard deviation is greater than or equal to the first standard deviation threshold, the proportion is greater than or equal to the first proportion threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met.
[0150] That is, if the brightness value statistics satisfy conditions one, two, and three, then the scene of the captured image is determined to be a strong point light source scene.
[0151] As can be seen, defining the boundary point Δi (first brightness threshold) of the highlight area histogram divides the brightness histogram data into two parts: the highlight area histogram... Figure X H (x Δi ,..,x 255 Histogram of non-highlighted areas Figure X L (X0, ..., X) Δi-1 ), calculate the percentage of pixels in the highlighted area:
[0152]
[0153] That is, the proportion of the number of pixels in the highlight area to the total number of pixels in the captured image is calculated. When the proportion is greater than or equal to the first proportion threshold T2, the scene is considered to meet the characteristics of a strong point light source scene. The T2 threshold can be obtained by statistically analyzing strong point light source scene image materials.
[0154] As can be seen, after identifying the scene as a strong point light source scene based on the above conditions one, two, and three, the image brightness value can be used for focusing. Moving the focusing motor to find the point with the minimum image brightness value is the clear point of the strong point light source scene.
[0155] It should be noted that, in the embodiments of this disclosure, for scenes that are not low-light conditions, strong point light source scenes and ordinary high-brightness scenes are further divided. For strong point light source scenes, a focusing scheme is adopted when the image brightness value is the minimum. For ordinary high-brightness scenes, automatic focusing is performed based on the sharpness evaluation value of the high-frequency components in the captured image.
[0156] The technical steps provided in Examples 1, 2, and 3 can be combined and implemented by those skilled in the art to obtain new technical solutions, provided that there is no conflict.
[0157] Example 4
[0158] Figure 9 This is a schematic diagram of the autofocus device in Embodiment 4 of the present invention. This embodiment is applicable to situations where autofocus is performed on captured images based on scene judgment results. Figure 9 As shown, the device includes:
[0159] The low-light scene determination module 910 is used to acquire image parameter information in the captured image and determine whether the scene of the captured image is a low-light scene based on the image parameter information.
[0160] The low-light point light source scene determination module 920 is used to determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image if it is a low-light scene.
[0161] The low-light point light source scene focusing module 930 is used to automatically focus on the image after brightness suppression of the captured image if the scene is a low-light point light source.
[0162] This invention determines whether a captured image is a low-light scene based on image parameter information. If it is determined to be a low-light scene, it further determines whether it is a low-light point light source scene based on the distribution of high-brightness areas in the captured image. If it is determined to be a low-light point light source scene, high-brightness areas in the captured image are suppressed, and automatic focusing is performed based on the suppressed image. This achieves targeted focusing based on the scene recognition result, improving the accuracy of recognizing low-light point light source scenes, thereby improving the focusing accuracy of low-light point light source scenes and solving the focusing problem in low-light point light source scenes.
[0163] Optionally, the low-light point light source scene judgment module is specifically used to: perform block processing on the captured image to obtain at least two block regions;
[0164] Determine the proportion of pixels with brightness values greater than a preset high brightness threshold in each block region to the total number of pixels in that block region, and obtain the high brightness ratio of each block region;
[0165] The high-brightness focus influence parameters of the captured image are determined based on the high-brightness ratio of each segmented region and the pre-determined high-brightness influence weight; wherein, the high-brightness influence weight is determined based on the focus weight;
[0166] If the high-brightness focus influence parameter is greater than the preset focus influence parameter threshold, then the scene of the captured image is determined to be a low-light point light source scene.
[0167] Optional, a low-light point light source scene focusing module, specifically used for:
[0168] The brightness values of pixels in the captured image whose brightness values are greater than a preset brightness suppression threshold are determined according to a preset suppression ratio to obtain a brightness-suppressed image.
[0169] Automatic focusing is performed based on the sharpness evaluation value of the low-frequency components in the image after brightness suppression.
[0170] Optionally, the image parameter information includes the brightness statistics and image gain parameters in the automatic exposure statistics;
[0171] Correspondingly, the low-light scene detection module includes:
[0172] If the brightness statistics result is less than the preset low light threshold and the image gain parameter is greater than the preset gain threshold, then the scene of the captured image is determined to be a low light scene.
[0173] Optionally, the image parameter information includes the brightness value of each pixel:
[0174] Correspondingly, the device also includes a strong point light source scene judgment module, which is used to determine whether the scene of the captured image is a strong point light source scene based on the distribution of the brightness values of each pixel in the captured image before determining whether the scene of the captured image is a low-light scene based on the image parameter information.
[0175] If the scene is a strong point light source, then the focus is successful when the image brightness value of the captured image is at its minimum.
[0176] Optionally, the low-light scene detection module also includes a high-brightness scene focusing unit, specifically used for:
[0177] If it is not a low-light scene, then the scene of the captured image is determined to be a high-light scene, and automatic focusing is performed based on the sharpness evaluation value of the high-frequency components in the captured image.
[0178] Optionally, the low-light point light source scene judgment module also includes a low-light conventional scene focusing unit, specifically used for:
[0179] If it is not a low-light point light source scene, then the scene of the captured image is determined to be a low-light normal scene, and automatic focusing is performed based on the sharpness evaluation value of the low-frequency components in the captured image.
[0180] In some exemplary embodiments, the strong point light source scene determination module is further configured to determine whether the scene of the captured image is a strong point light source scene based on the distribution of the brightness values of each pixel in the captured image when it is determined that the scene is not a low-light scene.
[0181] In some exemplary embodiments, the apparatus further includes a strong point light source scene focusing module, used to determine that the image brightness value of the captured image is at its minimum when the scene is determined to be a strong point light source scene, and thus the focusing is successful.
[0182] In some exemplary embodiments, the apparatus further includes a normal high-brightness scene focusing module, used to determine that the scene of the captured image is a normal high-brightness scene when it is determined that it is not a strong point light source scene, and to automatically focus based on the sharpness evaluation value of the high-frequency components in the captured image.
[0183] In some exemplary embodiments, the strong point light source scene determination module is further configured to determine brightness value statistics based on the brightness values of each pixel in the captured image; and determine that the strong point light source condition is met based on the brightness value statistics, and then determine that the captured image scene is a strong point light source scene.
[0184] The brightness value statistics reflect each brightness value and the number of pixels included in each brightness value.
[0185] In some exemplary embodiments, the strong point light source conditions include condition one; or condition one and condition two; or condition one and condition three; or condition one, condition two, and condition three. Conditions one, two, and three are detailed in Embodiment Three.
[0186] In some exemplary embodiments, the strong point light source scene judgment module is further configured to filter the captured image, normalize the brightness value of the filtered image, and determine the brightness value statistics based on the brightness value of each pixel in the normalized image.
[0187] The autofocus device provided in the embodiments of the present invention can execute the autofocus method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the autofocus method.
[0188] Example 5
[0189] Figure 10 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Figure 10 A block diagram is shown of an exemplary electronic device 12 suitable for implementing embodiments of the present invention. Figure 10 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0190] like Figure 10 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system storage device 28, and bus 18 connecting different system components (including system storage device 28 and processing unit 16).
[0191] Bus 18 represents one or more of several bus architectures, including a memory device bus or memory device controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0192] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0193] System storage device 28 may include computer system readable media in the form of volatile storage devices, such as random access memory (RAM) 30 and / or cache storage device 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 10 Not shown; usually referred to as a "hard drive"). Although Figure 10 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Storage device 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0194] A program / utility 40 having a set (at least one) of program modules 42 may be stored in, for example, storage device 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0195] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with device 12, and / or with any device that enables device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. Figure 10 As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although... Figure 10 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0196] Processing unit 16 executes various functional applications and data processing by running programs stored in system storage device 28, such as implementing the autofocus method provided in the embodiments of the present invention, including:
[0197] Obtain image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information;
[0198] If it is a low-light scene, then determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image;
[0199] If it is a low-light point light source scene, then the image is automatically focused based on the image after brightness suppression of the captured image.
[0200] Example 6
[0201] Embodiment 5 of the present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the autofocus method provided in the embodiments of the present invention, including:
[0202] Obtain image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information;
[0203] If it is a low-light scene, then determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image;
[0204] If it is a low-light point light source scene, then the image is automatically focused based on the image after brightness suppression of the captured image.
[0205] As can be seen, the autofocus solution provided in this disclosure is based on accurate scene identification and proposes a corresponding autofocus solution, which solves the shortcomings of the autofocus solution in related video surveillance solutions in nighttime environments and improves the accuracy of autofocus of zoom lenses.
[0206] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0207] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made under the concept of the present invention using the contents of the present invention specification and drawings, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. An autofocusing method, characterized in that, include, Obtain image parameter information from the captured image, and determine whether the scene of the captured image is a low-light scene based on the image parameter information; If it is a low-light scene, then determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image; If it is a low-light point light source scene, then automatic focusing is performed based on the image after brightness suppression of the captured image; The step of determining whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image includes: The captured image is divided into blocks to obtain at least two block regions; Determine the proportion of pixels with brightness values greater than a preset high brightness threshold in each block region to the total number of pixels in that block region, and obtain the high brightness ratio of each block region; The high-brightness focus influence parameters of the captured image are determined based on the high-brightness ratio of each segmented region and the pre-determined high-brightness influence weight. If the high-brightness focus influence parameter is greater than the preset focus influence parameter threshold, then the scene of the captured image is determined to be a low-light point light source scene.
2. The method as described in claim 1, characterized in that, The influence weight of the high-brightness area is determined based on the focus weight, which includes, but is not limited to, center focus and edge focus. In center focus, the focus weight of the block area located at the center of the captured image is greater than the focus weight of the block area located at the edge. In edge focus, the focus weight of the block area located at the center of the captured image is less than the focus weight of the block area located at the edge, which is 0.
3. The method as described in claim 1, characterized in that, The step of automatically focusing on the image after brightness suppression of the captured image includes: The brightness values of pixels in the captured image whose brightness values are greater than a preset brightness suppression threshold are determined according to a preset suppression ratio to obtain a brightness-suppressed image. Automatic focusing is performed based on the sharpness evaluation value of the low-frequency components in the image after brightness suppression.
4. The method according to any one of claims 1 to 3, characterized in that, The image parameter information includes the brightness statistics and image gain parameters in the automatic exposure statistics; Determining whether the scene of the captured image is a low-light scene based on the image parameter information includes: If the brightness statistics result is less than the preset low light threshold and the image gain parameter is greater than the preset gain threshold, then the scene of the captured image is determined to be a low light scene.
5. The method as described in claim 1, characterized in that, The image parameter information includes the brightness value of each pixel; Before determining whether the scene of the captured image is a low-light scene based on the image parameter information, the method further includes: Determine whether the scene in the captured image is a strong point light source scene based on the distribution of the brightness values of each pixel in the captured image; If the scene is a strong point light source, then the focus is successful when the image brightness value of the captured image is at its minimum.
6. The method as described in claim 1, characterized in that, After determining whether the scene of the captured image is a low-light scene based on the image parameter information, the method further includes: If it is not a low-light scene, then the scene of the captured image is determined to be a high-light scene, and automatic focusing is performed based on the sharpness evaluation value of the high-frequency components in the captured image.
7. The method as described in claim 1, characterized in that, After determining whether the scene in the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image, the method further includes: If it is not a low-light point light source scene, then the scene of the captured image is determined to be a low-light normal scene, and automatic focusing is performed based on the sharpness evaluation value of the low-frequency components in the captured image.
8. The method as described in claim 1, characterized in that, The image parameter information includes the brightness value of each pixel; After determining whether the scene of the captured image is a low-light scene based on the image parameter information, the method further includes: If it is determined that it is not a low-light scene, then the distribution of the brightness values of each pixel in the captured image is used to determine whether the scene of the captured image is a strong point light source scene. If the scene is determined to be a strong point light source, then the focus is successful when the image brightness value of the captured image is at its minimum.
9. The method as described in claim 8, characterized in that, After determining whether the scene in the captured image is a strong point light source scene based on the distribution of brightness values of each pixel in the captured image, the method further includes: If the scene is determined not to be a strong point light source scene, then the scene of the captured image is determined to be a normal high-brightness scene, and automatic focusing is performed based on the sharpness evaluation value of the high-frequency components in the captured image.
10. The method as described in claim 5 or 8, characterized in that, Determining whether the scene in the captured image is a strong point light source scene based on the distribution of brightness values of each pixel in the captured image includes: Based on the brightness value of each pixel in the captured image, a brightness value statistics table is determined; wherein, the brightness value statistics table reflects each brightness value and the number of pixels included in each brightness value; Based on the brightness value statistics, if the conditions for a strong point light source are met, then the scene of the captured image is determined to be a strong point light source scene. The determination that the strong point light source condition is met includes: Based on the brightness value statistics, brightness value statistics with brightness values less than the first brightness threshold are selected to form non-high-brightness area statistics. If the statistical data of the non-high-brightness area is determined to be positively skewed and the skewness is greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met.
11. The method as described in claim 10, characterized in that, The determination that the strong point light source condition is satisfied also includes: Calculate the standard deviation of the statistical data on the brightness values; If the standard deviation is greater than or equal to the first standard deviation threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met. or, The determination that the strong point light source condition is satisfied also includes: Based on the brightness value statistics, calculate the proportion of pixels with brightness values greater than or equal to the first brightness threshold to the total number of pixels in the captured image. If the ratio is greater than or equal to the first ratio threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met. or, The determination that the strong point light source condition is satisfied also includes: Calculate the standard deviation of the statistical data on the brightness values; Based on the brightness value statistics, calculate the proportion of pixels with brightness values greater than or equal to the first brightness threshold to the total number of pixels in the captured image. If the standard deviation is greater than or equal to the first standard deviation threshold, the proportion is greater than or equal to the first proportion threshold, and the statistical data of the non-high-brightness area shows a positively skewed distribution with a skewness greater than or equal to the first skewness threshold, then the strong point light source condition is determined to be met.
12. The method as described in claim 10, characterized in that, The step of determining brightness value statistics based on the brightness values of each pixel in the captured image includes: The captured image is filtered, and the brightness value of the filtered image is normalized. The brightness value statistics are determined based on the brightness values of each pixel in the normalized image.
13. An automatic focusing device, characterized in that, include: The low-light scene determination module is used to acquire image parameter information in the captured image and determine whether the scene of the captured image is a low-light scene based on the image parameter information. A low-light point light source scene determination module is used to determine whether the scene of the captured image is a low-light point light source scene based on the distribution of high-brightness points in the captured image if it is a low-light scene. This includes: dividing the captured image into blocks to obtain at least two block regions; determining the proportion of pixels with brightness values greater than a preset high-brightness threshold in each block region to the total number of pixels in that block region, thus obtaining the high-brightness ratio of each block region; determining the high-brightness focus influence parameter of the captured image based on the high-brightness ratio of each block region and a pre-determined high-brightness influence weight; and determining that the high-brightness focus influence parameter is greater than a preset focus influence parameter threshold if the high-brightness focus influence parameter is greater than the preset focus influence parameter threshold. The low-light point light source scene focusing module is used to automatically focus on the image after brightness suppression of the captured image if the scene is a low-light point light source.
14. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the autofocus method as described in any one of claims 1-12.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the autofocus method as described in any one of claims 1-12.
Citation Information
Patent Citations
Contrast type focusing method, system and device in point light source scene, and storage medium
CN111212238A