A brightness-based focus control method, device, storage medium and equipment

By dividing the image area in the camera and adjusting the trigger threshold of the scene switching detection algorithm according to the brightness attribute, the problem of frequent focusing of the camera in high contrast environment is solved, and flexible focus control in different environments is realized, thus improving shooting stability.

CN123055983APending Publication Date: 2026-11-06XIAN WINGTECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510543248.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

When the camera is stationary, brightness-based scene switching detection methods tend to frequently trigger focusing in high-contrast scenes with dense point light sources, such as at night, leading to focus issues.

Method used

By dividing the current frame image into multiple image regions, determining the brightness attribute of each region, and adjusting the trigger threshold of the scene switching detection algorithm according to the number of regions with the specified brightness attribute, the sensitivity of the detection algorithm can be flexibly adjusted to adapt to the contrast intensity of different shooting environments.

Benefits of technology

It improves the camera's adaptability to different shooting environments, reduces the occurrence of frequent focusing, avoids focus jamming, and enhances the camera's shooting stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123055983A_ABST
    Figure CN123055983A_ABST
Patent Text Reader

Abstract

This specification discloses a brightness-based focus control method. This method, for a current frame image, determines the brightness of each image region, determines the brightness attribute of each image region based on its brightness, adjusts the trigger threshold of a scene transition detection algorithm based on the number of image regions with the specified brightness attribute, and controls whether to refocus the current frame image based on the adjusted scene transition detection algorithm. This method allows for flexible adjustment of the trigger threshold of the scene transition detection algorithm according to the current shooting environment, thereby adjusting the sensitivity of the scene transition detection algorithm in triggering refocus. This enables the camera to determine whether frequent refocusing is needed based on the current shooting environment, improving the camera's adaptability to different shooting environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a brightness-based focus control method, apparatus, storage medium, and device. Background Technology

[0002] Currently, cameras are widely used in electronic devices in various fields, such as professional photography equipment, mobile phones, tablets, and traffic security monitoring cameras.

[0003] Typically, cameras have an autofocus (AF) function. AF mainly includes scene transition detection. When the current scene is not in focus, the algorithm will trigger a search to find the best focus position. However, the AF function of cameras on mobile devices such as mobile phones and tablets mainly uses brightness-based detection methods and gyroscope-based detection methods for scene transition detection.

[0004] Brightness-based scene transition detection algorithms primarily compare the brightness of the current frame with the brightness of the previous frame or the frame that was last focused. If the difference in brightness is significant, it indicates a scene transition, triggering refocusing. Gyroscope-based scene transition detection algorithms primarily detect the displacement of the camera (or an electronic device with a camera) to determine if a scene transition has occurred. If a scene transition has occurred, refocusing is triggered.

[0005] However, when the camera is stationary, only brightness-based detection methods can be relied upon. But if the shooting environment is a high-contrast scene with dense point light sources, such as at night, the existing brightness-based detection methods will frequently trigger focusing, which can easily lead to focus jamming. Summary of the Invention

[0006] This specification provides a brightness-based focus control method, apparatus, storage medium, and electronic device to partially solve the problems existing in the prior art.

[0007] The embodiments in this specification adopt the following technical solutions:

[0008] This specification provides a brightness-based focus control method, the method comprising:

[0009] Get the current frame image;

[0010] Determine each image region in the current frame image;

[0011] Determine the brightness of each image region;

[0012] For each image region, determine its brightness attribute based on the region's brightness.

[0013] Adjust the trigger threshold of the brightness-based scene transition detection algorithm based on the number of image regions with the specified brightness attribute;

[0014] A brightness-based scene switching detection algorithm with an adjusted trigger threshold is used to detect whether the current frame image needs to be refocused.

[0015] This specification provides a brightness-based focus control device, the device comprising:

[0016] The acquisition module is used to acquire the image of the current frame;

[0017] A segmentation module is used to determine each image region in the current frame image;

[0018] A brightness determination module is used to determine the brightness of each image region;

[0019] The brightness attribute determination module is used to determine the brightness attribute of each image region based on the brightness of that image region.

[0020] The adjustment module is used to adjust the trigger threshold of the brightness-based scene switching detection algorithm according to the number of image regions with a specified brightness attribute.

[0021] The control module is used to detect whether the current frame image needs to be refocused by employing a brightness-based scene switching detection algorithm after adjusting the trigger threshold.

[0022] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described brightness-based focus control method.

[0023] This specification provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the above-described brightness-based focus control method.

[0024] The above-described at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects:

[0025] This specification discloses a brightness-based focus control method. This method, for a current frame image, determines the brightness of each image region, determines the brightness attribute of each image region based on its brightness, adjusts the trigger threshold of a scene transition detection algorithm based on the number of image regions with the specified brightness attribute, and controls whether to refocus the current frame image based on the adjusted scene transition detection algorithm. This method allows for flexible adjustment of the trigger threshold of the scene transition detection algorithm according to the current shooting environment, thereby adjusting the sensitivity of the scene transition detection algorithm in triggering refocus. This enables the camera to determine whether frequent refocusing is needed based on the current shooting environment, improving the camera's adaptability to different shooting environments. Attached Figure Description

[0026] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:

[0027] Figure 1 A flowchart of a brightness-based focus control method provided in the embodiments of this specification;

[0028] Figure 2A A brightness histogram for a high-contrast shooting environment provided in the embodiments of this specification;

[0029] Figure 2B A brightness histogram for a low-contrast shooting environment provided in the embodiments of this specification;

[0030] Figure 3 A schematic diagram of a brightness-based focus control device provided for an embodiment of this specification;

[0031] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this specification. Detailed Implementation

[0032] Generally, brightness-based scene transition detection algorithms mainly include the Sum of Absolute Differences with Rectangular Sub-Regions (SADR) algorithm and the Sum of Absolute Differences for Panning Motion (SAD_Panning) algorithm.

[0033] The SADR algorithm determines the difference between the brightness of the current frame and the brightness of the last focused frame. It compares this difference with a trigger threshold to determine whether a scene switch has occurred. If the difference is greater than the trigger threshold, a scene switch is determined to have occurred, and focusing on the current frame is triggered. Otherwise, no scene switch is determined to have occurred, and focusing on the current frame is not performed.

[0034] The SAD_Panning algorithm determines the difference in brightness between the current frame and the previous frame. It compares this difference with a trigger threshold to determine whether a scene switch has occurred. If the difference is greater than the trigger threshold, a scene switch is determined to have occurred, and focusing on the current frame is triggered. Otherwise, no scene switch is determined to have occurred, and focusing on the current frame is not performed.

[0035] In order to adapt the camera to high-contrast shooting environments with dense point light sources, such as at night, the embodiments of this specification adaptively adjust the trigger threshold in the brightness-based scene switching detection algorithm by the contrast intensity of the current frame image, so as to adjust the sensitivity of the brightness-based scene switching detection algorithm to trigger refocusing according to different shooting environments.

[0036] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0037] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0038] Figure 1 The flowchart of the brightness-based focus control method provided in the embodiments of this specification includes the following steps:

[0039] S100: Get the current frame image.

[0040] In the embodiments described in this specification, the following are employed: Figure 1 The method shown can be used to control the focus of a camera in any electronic device that includes a camera, such as a mobile phone, tablet, or camera. The following explanation uses a mobile terminal, such as a mobile phone, as an example.

[0041] The mobile terminal invokes and activates the camera to capture images. During image capture, it needs to determine in real time whether the scene being captured changes in order to decide whether refocusing is necessary. Therefore, the mobile terminal uses the currently captured frame as the current frame image.

[0042] S102: Determine each image region in the current frame image.

[0043] In the embodiments of this specification, the mobile terminal can use a preset partitioning method to divide the current frame image into several image regions of a specified size, with each image region being the same size. Specifically, the current frame image can be divided into several rectangular image regions of the same size, such as dividing the current frame image into 16×16 rectangular image regions, meaning that the length and width of each rectangular image region are 1 / 16 of the length and width of the original current frame image. The specific partitioning method is not limited in the embodiments of this specification. The more image regions divided, the more accurate the subsequent adjustment of the trigger threshold of the brightness-based scene transition detection algorithm will be; the fewer image regions divided, the more efficient the subsequent adjustment of the trigger threshold of the brightness-based scene transition detection algorithm will be, and the less computational resources the mobile terminal needs to execute this method. The method can be set as needed.

[0044] S104: Determine the brightness of each image region.

[0045] After dividing the current frame image into several image regions in step S102, the mobile terminal can determine the brightness of each image region. In this embodiment, the brightness value can range from 0 to 255. The mobile terminal can determine the brightness of each pixel in each image region within the above-mentioned value range, and then determine the brightness of the image region based on the brightness of each pixel in the image region. For example, the average brightness of all pixels in the image region can be determined as the brightness of the image region.

[0046] S106: For each image region, determine the brightness attribute of the image region based on the brightness of the image region.

[0047] In the embodiments of this specification, brightness attributes may include bright areas, dark areas, and midtone areas. For each image region, the mobile terminal can determine the brightness attribute of that image region based on the brightness of that image region and preset brightness thresholds corresponding to each brightness attribute.

[0048] Specifically, for an image region, if the brightness of the image region is higher than the brightness threshold corresponding to the preset bright area, the brightness attribute of the image region can be determined as a bright area; if the brightness of the image region is lower than the brightness threshold corresponding to the preset dark area, the brightness attribute of the image region can be determined as a dark area; if the brightness of the image region is neither higher than the brightness threshold corresponding to the bright area nor lower than the brightness threshold corresponding to the dark area, the brightness attribute of the image region can be determined as a mid-tone area.

[0049] Among them, the brightness threshold corresponding to the bright area is higher than the brightness threshold corresponding to the dark area.

[0050] S108: Adjust the trigger threshold of the brightness-based scene transition detection algorithm according to the number of image regions with the specified brightness attribute.

[0051] In the embodiments of this specification, the mobile terminal can determine the shooting environment of the camera when capturing the current frame image based on the brightness attributes of each image region. Specifically, it can determine the brightness histogram of the current frame image based on the brightness of each image region, and determine the shooting environment of the current frame image based on the brightness histogram, such as... Figures 2A-2B As shown.

[0052] Figure 2A This is a brightness histogram for a high-contrast shooting environment provided in the embodiments of this specification. Figure 2B This is a brightness histogram for a low-contrast shooting environment provided in the embodiments of this specification. For example... Figure 2A , 2B As shown, the horizontal axis of the brightness histogram represents the brightness of the image region, with a value range of 0 to 255. This brightness value range can be divided into several intervals, such as 0 to 15, 16 to 31, 32 to 47, etc. The vertical axis represents the number of image regions. Thus, the brightness histogram can be used to represent the number of image regions whose brightness falls into each divided brightness interval.

[0053] from Figure 2A It is evident that the image areas are mostly concentrated at the two ends of the brightness range, meaning there are more bright and dark areas and fewer mid-tone areas. This is a typical characteristic of images captured in high-contrast shooting environments, such as nighttime shooting environments with dense point light sources. Figure 2B In this image, the number of regions is relatively even across the entire brightness range, which is a characteristic of images captured in low-contrast shooting environments.

[0054] Therefore, the specified attributes described in the embodiments of this specification can be bright areas and dark areas. That is, the mobile terminal can determine the contrast intensity of the current frame image using the statistical brightness histogram method described above, based on the first number of bright areas and the second number of dark areas determined from the current frame image in step S106. The higher the contrast intensity, the higher the contrast of the current frame image, and vice versa. The contrast intensity is positively correlated with both the first and second numbers, and negatively correlated with the difference between the first and second numbers.

[0055] In other words, the more bright and dark areas there are in the current frame image, and the smaller the difference between the number of bright and dark areas, the more the current frame image conforms to the following... Figure 2AThe characteristics of images captured in a high-contrast shooting environment, as shown, indicate that the higher the contrast intensity of the current frame image, the better. Conversely, the fewer the number of bright and dark areas, or the greater the difference between the number of bright and dark areas, the more the current frame image conforms to the characteristics of... Figure 2B The characteristics of images captured in low-contrast shooting environments are shown; the lower the contrast intensity of the current frame image, the better.

[0056] Therefore, the mobile terminal can adjust the trigger threshold of the brightness-based scene switching detection algorithm, including the trigger threshold of the SADR algorithm and / or the trigger threshold of the SAD_Panning algorithm, according to the contrast intensity of the current frame image, so that the camera's focus control can adapt to shooting environments with different contrast.

[0057] S110: Use a brightness-based scene switching detection algorithm with an adjusted trigger threshold to detect whether the current frame image needs to be refocused.

[0058] After adjusting the trigger threshold of the brightness-based scene transition detection algorithm, the mobile terminal can detect whether the current frame image needs to be refocused based on the adjusted brightness-based scene transition detection algorithm.

[0059] The above method determines the brightness of each image region in the current frame image, and based on the brightness of each image region, determines the brightness attribute of each image region. Based on the number of image regions with the specified brightness attribute, the trigger threshold of the scene transition detection algorithm is adjusted. The adjusted scene transition detection algorithm then controls whether the current frame image needs to be refocused. This method allows for flexible adjustment of the trigger threshold of the scene transition detection algorithm according to the current shooting environment, thereby adjusting the sensitivity of the algorithm in triggering refocus. This enables the camera to decide whether frequent refocusing is needed based on the current shooting environment, improving the camera's adaptability to different shooting conditions.

[0060] Furthermore, both the SADR and SAD_Panning algorithms detect scene changes by comparing the brightness of the current frame with that of the previous frame or the frame that was previously focused. They determine if a scene change has occurred based on whether this difference exceeds a trigger threshold. Once a scene change is confirmed, refocusing on the current frame is triggered. Therefore, to prevent the camera from frequently refocusing and causing focus jamming in high-contrast shooting environments, the embodiments in this specification... Figure 1 In step S108, the mobile terminal can adjust the trigger threshold of the brightness-based scene switching detection algorithm according to the principle that a stronger contrast intensity corresponds to a higher trigger threshold. This is because a stronger contrast intensity indicates a more suitable shooting environment. Figure 2AThe high-contrast shooting environment shown indicates that increasing the trigger threshold prevents the SADR and / or SAD_Panning algorithms from easily recognizing a scene change and thus avoids frequent refocusing of the current frame. This achieves the goal of preventing frequent refocusing in high-contrast shooting environments. Conversely, a lower contrast threshold indicates a more suitable shooting environment. Figure 2B In the low-contrast shooting environment shown, if the brightness of the current frame image differs significantly from the brightness of the previous frame or the frame after the last focus was completed, it indicates that a scene switch has indeed occurred. Therefore, the trigger threshold is lowered to achieve the purpose of normally detecting whether a scene switch has occurred in the low-contrast shooting environment.

[0061] Specifically, in the embodiments of this specification, a correspondence between contrast intensity and trigger threshold can be preset. The higher the contrast intensity, the higher the corresponding trigger threshold. When adjusting the trigger threshold of the brightness-based scene transition detection algorithm based on the contrast intensity, the adjustment can be made according to the aforementioned correspondence. That is, after determining the contrast intensity of the current frame image in step S108, the trigger threshold corresponding to the contrast intensity of the current frame image can be determined based on the contrast intensity of the current frame image and the aforementioned correspondence, and used as the target trigger threshold. If the current trigger threshold of the brightness-based scene transition detection algorithm is inconsistent with the target trigger threshold, the trigger threshold of the brightness-based scene transition detection algorithm is adjusted to the target trigger threshold; otherwise, the current trigger threshold of the brightness-based scene transition detection algorithm does not need to be adjusted.

[0062] In addition, the mobile terminal can use each frame captured by the camera as the current frame image to perform the above-mentioned operations. Figure 1 The method shown adjusts the trigger threshold of the brightness-based scene transition detection algorithm, or it can wait until a specified number of frames have been acquired before using the next captured image as the current frame image and executing the above steps. Figure 1 The method shown adjusts the trigger threshold of the brightness-based scene switching detection algorithm only once every specified number of frames, in order to reduce the algorithm execution pressure on the mobile terminal.

[0063] The above is an example of a brightness-based focus control method provided in this specification. Based on the same idea, this specification also provides corresponding devices, storage media, and electronic devices.

[0064] Figure 3 This is a schematic diagram of a brightness-based focus control device provided in an embodiment of this specification. The device includes:

[0065] The acquisition module 301 is used to acquire the current frame image;

[0066] The segmentation module 302 is used to determine each image region in the current frame image;

[0067] Brightness determination module 303 is used to determine the brightness of each image region;

[0068] The brightness attribute determination module 304 is used to determine the brightness attribute of each image region based on the brightness of that image region.

[0069] The adjustment module 305 is used to adjust the trigger threshold of the brightness-based scene switching detection algorithm according to the number of image regions with a specified brightness attribute.

[0070] The control module 306 is used to detect whether the current frame image needs to be refocused by employing a brightness-based scene switching detection algorithm after adjusting the trigger threshold.

[0071] Optionally, the partitioning module 302 is specifically used to partition the current frame image into several image regions of a specified size.

[0072] Optionally, the brightness attribute determination module 304 is specifically used to determine the brightness attribute of the image region based on the brightness of the image region and the preset brightness threshold corresponding to each brightness attribute.

[0073] Optionally, the brightness attribute includes bright areas and dark areas;

[0074] The brightness attribute determination module 304 is specifically used to determine the brightness attribute of the image region as a bright region if the brightness of the image region is higher than the preset brightness threshold corresponding to the bright region.

[0075] If the brightness of the image region is lower than the preset brightness threshold corresponding to the dark area, the brightness attribute of the image region is determined to be a dark area.

[0076] Optionally, the adjustment module 305 is specifically used to determine the contrast intensity of the current frame image based on a first number of image regions with a brightness attribute of bright areas and a second number of image regions with a brightness attribute of dark areas; wherein the contrast intensity is positively correlated with the first number and the second number, and the contrast intensity is negatively correlated with the difference between the first number and the second number;

[0077] The trigger threshold of the brightness-based scene transition detection algorithm is adjusted according to the contrast intensity.

[0078] Optionally, the brightness-based scene switching detection algorithm is used to: based on the brightness difference between the current frame image and the specified frame image, trigger focusing on the current frame image when the brightness difference is higher than a trigger threshold;

[0079] The adjustment module 305 is specifically used to adjust the trigger threshold in a manner that the stronger the contrast intensity, the higher the trigger threshold.

[0080] Optionally, the scene transition detection algorithm based on brightness includes the rectangular region absolute difference and SADR algorithm and / or the translational motion absolute difference and SAD_Panning algorithm.

[0081] This specification also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can be used to perform the above-described actions. Figure 1 A brightness-based focus control method is provided.

[0082] based on Figure 1 The brightness-based focus control method shown in this specification also provides embodiments that... Figure 4 The diagram shows the structure of the electronic device. Figure 4 At the hardware level, this electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then executes it to achieve the above. Figure 1 The brightness-based focus control method described above.

[0083] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A focus control method based on brightness, characterized in that, The method includes: Get the current frame image; Determine each image region in the current frame image; Determine the brightness of each image region; For each image region, determine its brightness attribute based on the region's brightness. Adjust the trigger threshold of the brightness-based scene transition detection algorithm based on the number of image regions with the specified brightness attribute; A brightness-based scene switching detection algorithm with an adjusted trigger threshold is used to detect whether the current frame image needs to be refocused.

2. The method as described in claim 1, characterized in that, Determining each image region in the current frame image specifically includes: The current frame image is divided into several image regions of a specified size.

3. The method as described in claim 1, characterized in that, Based on the brightness of the image region, determine the brightness attribute of the image region, specifically including: The brightness attribute of the image region is determined based on the brightness of the image region and the preset brightness threshold corresponding to each brightness attribute.

4. The method as described in claim 3, characterized in that, The brightness attribute includes bright areas and dark areas; Based on the brightness of the image region and the preset brightness thresholds corresponding to each brightness attribute, the brightness attributes of the image region are determined, specifically including: If the brightness of the image region is higher than the preset brightness threshold corresponding to the bright region, the brightness attribute of the image region is determined to be a bright region; If the brightness of the image region is lower than the preset brightness threshold corresponding to the dark area, the brightness attribute of the image region is determined to be a dark area.

5. The method as described in claim 4, characterized in that, The trigger threshold of the brightness-based scene transition detection algorithm is adjusted based on the number of image regions with a specified brightness attribute. Specifically, this includes: The contrast intensity of the current frame image is determined based on a first number of image regions with bright brightness attributes and a second number of image regions with dark brightness attributes; wherein the contrast intensity is positively correlated with the first number and the second number, and the contrast intensity is negatively correlated with the difference between the first number and the second number; The trigger threshold of the brightness-based scene transition detection algorithm is adjusted according to the contrast intensity.

6. The method as described in claim 5, characterized in that, The brightness-based scene switching detection algorithm is used to: based on the brightness difference between the current frame image and the specified frame image, trigger refocusing on the current frame image when the brightness difference is higher than a trigger threshold; Based on the contrast intensity, the trigger threshold of the brightness-based scene transition detection algorithm is adjusted, specifically including: The trigger threshold is adjusted in such a way that the stronger the contrast intensity, the higher the trigger threshold.

7. The method according to any one of claims 1 to 6, characterized in that, Brightness-based scene transition detection algorithms include rectangular region absolute difference and SADR algorithm and / or translational motion absolute difference and SAD_Panning algorithm.

8. A focus control device based on brightness, characterized in that, The device includes: The acquisition module is used to acquire the image of the current frame; A segmentation module is used to determine each image region in the current frame image; A brightness determination module is used to determine the brightness of each image region; The brightness attribute determination module is used to determine the brightness attribute of each image region based on the brightness of that image region. The adjustment module is used to adjust the trigger threshold of the brightness-based scene switching detection algorithm according to the number of image regions with a specified brightness attribute. The control module is used to detect whether the current frame image needs to be refocused by employing a brightness-based scene switching detection algorithm after adjusting the trigger threshold.

9. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method described in any one of claims 1-7.