A lens auto-focusing processing method and device based on a configuration weight list

By configuring a weight list to divide the non-target focus area into blocks, the problem of inaccurate focusing in complex scenes by traditional autofocus methods is solved, and high-quality autofocus effect is achieved.

CN122227072APending Publication Date: 2026-06-16INGENIC SEMICON CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INGENIC SEMICON CO LTD
Filing Date
2024-12-16
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

Traditional autofocus methods struggle to distinguish the importance of different depth-of-field areas in complex scenes, leading to inaccurate focusing or poor image sharpness, failing to meet the demands for high-quality imaging.

Method used

By configuring a weight list, the non-target focus area is divided into blocks, the weight list value of each pixel is calculated, and the weight list value is incorporated into the autofocus algorithm to adjust the autofocus data to adapt to the influence of different depth-of-field lenses.

Benefits of technology

It improves the accuracy and efficiency of autofocus, enabling precise focusing in complex scenes, enhancing image quality and depth, and adapting to different shooting needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122227072A_ABST
    Figure CN122227072A_ABST
Patent Text Reader

Abstract

The application provides a lens automatic focusing processing method and device based on a configuration weight list, which comprises the following steps: (a) acquiring image data, determining a target focusing area and a non-target focusing area; (b) configuring the weight list, performing block processing on the non-target focusing area, and obtaining each block image data; (c) taking each block image as a unit, calculating a weight list value corresponding to each pixel point in each block image; (d) adding the weight list value corresponding to each block image into an automatic focusing algorithm, outputting automatic focusing data, and adjusting the automatic focusing data. Through the block processing on the non-target focusing area, the weight configuration value of each pixel point is calculated, the weight configuration value is integrated into the automatic focusing algorithm, the automatic focusing value is outputted, the influence of different depth-of-field lenses on the automatic focusing algorithm is improved, and the focusing accuracy and efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent video processing, and specifically relates to a lens autofocus processing method and device based on a configuration weight list. Background Technology

[0002] Focusing is the process of adjusting the position of an optical lens to obtain a sharp image. Its history predates the invention of the camera; early painters already possessed the concept of focusing. Cameras developed rapidly after the Daguerre era, evolving from wet plate collodion to film, from black and white to color, and camera design also underwent changes, with functions evolving from manual metering to automatic. Autofocus technology emerged subsequently, undergoing a process from theory to practice, with passive focus detection becoming mainstream, relying on the lens to collect light information to determine focus. Today, algorithms can achieve autofocus, but the diversity of lenses makes focusing difficult on some lenses with poor depth of field. Focusing technology has evolved from manual to automatic, from simple to complex, and from analog to digital, and will continue to develop towards higher precision, speed, and intelligence. Autofocus algorithms have wide applications and ever-growing demand, and can be used for things like scanning QR codes and taking photos with mobile phones. Existing technologies to improve the impact of depth-of-field focusing algorithms include rotating the focus ring to observe the viewfinder, measuring the distance to rotate the focus ring, and using depth-of-field information to guide the algorithm. However, rotating the focus ring is time-consuming and laborious and relies on the experience of technicians; measuring the distance relies on estimation and error, requires focusing experience, and may damage the lens. Summary of the Invention

[0003] To address the aforementioned issues, the purpose of this application is to provide a lens autofocus processing method and apparatus based on a configuration weight list.

[0004] This invention provides a lens autofocus processing method based on a configuration weight list, characterized by comprising:

[0005] (a) Acquire image data and determine the target focus area and non-target focus area;

[0006] (b) Configure the weight list to divide the non-target focus area into blocks to obtain image data for each block.

[0007] (c) Using each of the image blocks as a unit, calculate the weight list value corresponding to each pixel in each image block;

[0008] (d) Add the weight list values ​​corresponding to each image block to the autofocus algorithm and output the autofocus data;

[0009] (e) Repeat steps (b) to (d) to adjust the autofocus data.

[0010] Optionally, the target focus area value corresponding to the weight list is 0, and the non-target focus area value corresponding to the weight list is not 0.

[0011] Optionally, configuring the weight list to divide the non-target focus area into blocks to obtain image data for each block includes: configuring the weight list, wherein the weight list contains N×N integer data, where N is an integer greater than 0; and determining the size of the region corresponding to each image block and the pixel value within each image block region based on the data of the configured weight list.

[0012] Optionally, the value represented in the weight list corresponding to each pixel in each segmented image is equal to the product of the value in the weight list and the position value of each pixel in the corresponding weight list.

[0013] Optionally, before adding the weight list values ​​corresponding to each image block to the autofocus algorithm and outputting the autofocus data, the method further includes: calculating the mean and variance of the image data; and adding the calculated mean and variance to the autofocus algorithm.

[0014] The present invention also provides a lens autofocus processing device based on a configuration weight list, comprising:

[0015] The image acquisition module is used to acquire image data and determine the target focus area and non-target focus area;

[0016] The configuration module is used to configure the weight list and perform block processing on the non-target focus area to obtain image data of each block;

[0017] The calculation module is used to calculate the weight list value corresponding to each pixel in each of the image blocks, taking each image block as a unit;

[0018] The output module is used to add the weight list values ​​corresponding to each image block to the autofocus algorithm and output autofocus data.

[0019] An adjustment module is used to adjust the autofocus data.

[0020] Therefore, the advantage of this application is that: by dividing the non-target focus area into blocks, the present invention calculates the weight configuration value of each pixel, integrates the weight configuration value into the autofocus algorithm, and outputs autofocus values ​​adapted to different depth-of-field lenses. This method improves the impact of different depth-of-field lenses on the autofocus algorithm and improves the accuracy and efficiency of focusing. Attached Figure Description

[0021] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.

[0022] Figure 1 This is a flowchart illustrating a lens autofocus processing method based on a configuration weight list according to the present invention.

[0023] Figure 2 This is a schematic diagram of a lens autofocus processing device based on a configuration weight list according to the present invention. Detailed Implementation

[0024] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0025] In today's optical imaging field, with the widespread application of photography and videography technologies and the ever-increasing demands for image quality, the autofocus performance of lenses has become one of the key technical indicators. Traditional autofocus methods are usually based on a single focusing strategy, processing the entire image area uniformly. However, in complex shooting scenarios, because they cannot distinguish the importance of different depth-of-field areas, inaccurate or unsatisfactory focusing often occurs. Either background interference elements affect the focusing accuracy of the subject, making it less sharp; or, when attempting to balance focusing on different depth-of-field areas, the desired effect cannot be achieved, resulting in poor overall image sharpness and depth. As users' need for precise control over the focus area becomes increasingly urgent, whether professional photographers pursuing unique artistic creations or industrial inspection, machine vision, and other fields requiring precise focusing on specific targets, the limitations of traditional autofocus methods are becoming increasingly apparent. Therefore, there is an urgent need for an innovative technical solution that can effectively address the impact of depth of field on focusing algorithms to meet the growing demand for high-quality imaging and improve the autofocus performance and flexibility of lenses in various complex scenarios.

[0026] The following specific embodiments disclose a lens autofocus processing method of the present invention, such as... Figure 1 As shown, it includes the following steps:

[0027] S101 acquires image data and determines the target focus area and non-target focus area;

[0028] In this step, image information is first acquired through various lens devices, and initial autofocus data is calculated using an autofocus algorithm. Based on this initial autofocus data, the target focus area and non-target focus areas in the image are determined according to the user's needs. For example, the main subject or specific objects in the image are designated as target focus areas, where the image is relatively clear. The remaining areas are then identified as non-target focus areas. This step forms the basis for the differentiated autofocus processing in this solution.

[0029] In this invention, if the initial autofocus data calculated by the autofocus algorithm allows the user to perceive that each lens is perfectly focused on the shooting scene, it means that each lens will not affect the autofocus algorithm. If the user perceives that the focus is off, it means that each lens will affect the autofocus algorithm.

[0030] In this invention, multiple lenses are used and configured to capture images with different depths of field; however, the invention is not limited to this. Because each lens focuses on capturing sharp details within its specific depth of field, the captured images may show varying degrees of sharpness and blurriness when capturing the same scenery or people. Through weighted allocation, the focus can be precisely concentrated on the subject area of ​​interest to the user.

[0031] S102 Configures the weight list, performs block processing on the non-target focus area, and obtains image data for each block;

[0032] In this invention, the target focus area value corresponding to the weight list is 0, and the non-target focus area value corresponding to the weight list is not 0. The weight list is configured with N×N integer data, where N is an integer greater than 0; based on the data of the configured weight list, the area size corresponding to each image block and the pixel value within each image block area are determined.

[0033] This invention enables the assignment of weights to each element based on its importance in complex scenes containing multiple elements of varying depth of field, such as foreground, middle ground, and background in landscape photography. Appropriate weights can be assigned to key elements, allowing the autofocus algorithm to comprehensively consider the focusing needs of different depth-of-field areas, achieving balanced focusing across the entire image and improving overall image clarity and depth.

[0034] S103 Using each segmented image as a unit, calculate the weight list value corresponding to each pixel in each segmented image;

[0035] In this invention, the value represented by the weight list corresponding to each pixel in each segmented image is equal to the product of the value in the weight list and the position value of each pixel in the corresponding weight list.

[0036] S104 adds the weight list values ​​corresponding to each image block to the autofocus algorithm and outputs autofocus data;

[0037] In this invention, before adding the weight list values ​​corresponding to each image block to the autofocus algorithm and outputting the autofocus data, the method further includes: calculating the mean and variance of the image data; and adding the calculated mean and variance to the autofocus algorithm.

[0038] In this invention, the weight-based algorithm can reasonably process pixels in different regions according to their weight values, avoiding excessive blurring or defocusing in some areas due to uniform processing. For example, in some scenes with specific depth-of-field requirements, by appropriately adjusting the weights, non-critical areas can maintain a certain level of clarity while critical areas become clearer, reducing blurry areas caused by depth-of-field differences and improving the overall image quality.

[0039] S105 adjusts the autofocus data.

[0040] In dynamic scenarios such as video shooting, weighted processing methods can automatically adjust the focus in real time based on a pre-set weight list and changes in the scene content. For example, in continuous shots during filming or live streaming, when the position of the main subject changes or the scene switches, the autofocus algorithm can quickly refocus on the new key area according to the weight configuration, without frequent manual intervention, thus improving the automation and efficiency of shooting.

[0041] In step S101, the initial autofocus algorithm fails to focus due to differences in depth of field. This issue needs to be resolved by configuring the weight list in this step.

[0042] One embodiment of this invention configures a weight list, which contains N×N integer data points (where N is a positive integer). Based on the data in this weight list, the size of each image block and the pixel values ​​within each image block are determined. For non-target focus areas, they are divided into multiple blocks, the size and position of each block being determined according to the configuration of the weight list, thereby achieving fine-grained division and processing of non-target focus areas.

[0043] In this embodiment, a 16×16 weight list was created, with a total of 256 values, where each value corresponds to a specific region in the image.

[0044] If we assume the image size is 640×640, then the image region size represented by each value in the weight list, i.e., roi_w = 640 / 16 = 40, roi_h = 640 / 16 = 40, means that each value in the weight list corresponds to a 40×40 pixel region in the image, and these regions are arranged in an orderly manner in the image.

[0045] If the image size is 320×320, the region represented by each value in the weight list is: roi w =320 / 16=20, roi h =320 / 16=20, so each value in the weight list corresponds to an image region of 20×20 pixels, and these regions are arranged one by one. The range of values ​​in the list is set to 0-8, where 0 represents the region in the image. That is, each pixel in the 20×20 region is multiplied by one-eighth, 1 represents each pixel in the 20×20 region being multiplied by one-eighth, and so on. This rule is used to configure the areas of interest or focus areas for the user. Assume the image is divided into 8×8 blocks, and the size and pixel value of each block are determined. The calculation module uses each block as a unit to calculate the weight list value corresponding to each pixel. For example, for a pixel in a block, its position value in the weight list is (3, 5), and the value at that position is 2, then the weight list value corresponding to that pixel is 2×(3×8+5)=58. The weight list values ​​corresponding to each block are added to the autofocus algorithm, outputting autofocus data, and the lens performs preliminary focusing based on this data. The adjustment module repeats the above steps multiple times, for example, 5 times. Each time, it fine-tunes the configuration of the weight list and the block processing method based on the previous focus result, and finally obtains a clear and accurately focused portrait photo.

[0046] This invention also provides a feasible method for configuring the weight list. For example, a 10×10 weight list data is created, and the non-target focus area is divided into blocks to obtain image data for each block. After calculating the weight list values ​​corresponding to the pixels in each block image, the output module adds them to the autofocus algorithm to output autofocus data, and the lens begins focusing. In subsequent repetitions, the adjustment module continuously adjusts the weight list and block division method based on factors such as depth of field and changes in lighting, so that the entire landscape image can achieve a good focus effect, ensuring the clarity and layering of the foreground, middle ground, and background, thereby capturing high-quality landscape photos.

[0047] As can be seen from the above embodiments, the lens autofocus processing method and device of the present invention can effectively achieve accurate focusing and improve image quality in different shooting scenarios, and has wide application value and good practical effect.

[0048] The present invention also provides a method for calculating the mean and variance of the entire image.

[0049] Mean Calculation Method: Taking a 320×320 image as an example, the mean of the image is calculated by iterating through each pixel and applying a mathematical mean calculation method. This step provides a basic data reference for subsequent weighted calculations and reflects the overall brightness level of the image. Assuming the image size is 320×320 or 640×640, it is necessary to iterate through every pixel in the image. Let the coordinates of a pixel be (x, y), and its pixel value be P(x, y). By summing the pixel values ​​of all pixels and then dividing by the total number of pixels in the image (320×320 or 640×640), the mean of the image can be obtained. The mean will serve as an important reference value for subsequent calculations, measuring the overall brightness level of the image and providing a basis for variance calculation.

[0050] Variance calculation method: Taking a 320×320 image as an example, subtract the mean from each pixel in the image, square the result, sum the squares, and then divide by the number of pixels (for a 320×320 image, the number of pixels is 102400). For example, for a pixel with image coordinates (10,20), assuming its pixel value P(10,20) = 150, and the previously calculated mean Mean = 20, then the variance contribution of this pixel is (150 - 120). 2 =900.

[0051] This invention provides a method for calculating the image region size corresponding to each value in a weight list. Given a weight list of 16×16 integers, for an image size of 320×320, the width roi of the image region corresponding to each weight value is calculated. w and height roi h Calculated separately as: roi w =M / n, roi h = N / n. Taking a 320×320 image and a 16×16 weight list as an example, roi w =320 / 16, roi h =320 / 20, meaning each weight value corresponds to a 20×20 pixel region. Defining the size of these regions is crucial for accurately assigning weights to each region and processing the data, as we need to determine the weight region to which each pixel belongs based on these regions, thus applying the corresponding weight value for calculation.

[0052] This invention provides a method for determining the value represented by each pixel in a weight list. First, the row index (Block) of the pixel in the weight list is calculated. h and column index Block w:

[0053] Block h =(i / / width) / / roi h

[0054] Block w =(i / / width) / / roi w

[0055] Where y is the ordinate of a pixel, N is the height of the image, and roi h This represents the image region height corresponding to each weight value calculated previously; x is the x-coordinate of the pixel, M is the image width, and roi is the height of the region. w It is the width of the image region corresponding to each weight value calculated previously.

[0056] Through the weight list Block w Get the weight value corresponding to the pixel using an array of eight (e.g., a 16x16 two-dimensional array). Alphe = block w weight[Block h ][Block w For example, for a pixel with image coordinates (50, 80), assuming the Block is obtained through the above calculation... h =2, Block w =3, then from the weight list Alphe=block w weight[2][3].

[0057] At this stage, we use the mean, variance, and weight value of each pixel obtained earlier to calculate the final weighted structure.

[0058] For example, for each pixel (x, y) in the image, its variance is first adjusted by weighting its value Alphe. Then, the weighted variances of all pixels are summed to obtain a total. This sum is divided by the total number of pixels in the image, M×N, to obtain the final weighted output integer data Result. For example, for a 320×320 image, after the above series of calculations, assuming Result = 75, this structure will serve as the output of the optimized autofocus algorithm. This result will be passed to the developers to guide the lens's focusing operation, enabling the lens to focus more accurately on the region of interest based on the image's depth-of-field characteristics and the configured weights, thereby improving the overall focusing effect and image quality.

[0059] In this invention, the method can be used in a wide range of application scenarios.

[0060] For example, in portrait photography, when shooting close-ups, it's usually desirable for facial details (such as eyes and lips) to be in absolute sharp focus. By using a lens autofocus processing method based on a weighted list, the weight can be allocated to the facial area. For instance, for a region containing a person's face (let's say 300×300 pixels), the value in the weighted list corresponding to that region can be set to a higher value (e.g., 6-8), so that the pixel data in this region has a greater impact on the final result when calculating autofocus data. This ensures precise focus on the face even in complex depth-of-field variations (such as background blur), resulting in portraits with a prominent subject and a soft background.

[0061] For example, in landscape photography, the image may contain multiple layers: foreground, middle ground, and background. When photographing mountains and rivers, it might be desirable for both distant peaks and the foreground river to be sharp, even though they are at different depths of field. In this case, weighted algorithms can optimize the calculation by assigning appropriate weights to the foreground and background. For important elements (such as mountains and rivers), relatively higher weights (e.g., 4-6) are assigned, while less important background areas (such as parts of the sky) are assigned lower weights (e.g., 0-3). In this way, in complex depth-of-field environments, the autofocus algorithm can balance the sharpness of different depth-of-field areas, ensuring good focus across the entire landscape and presenting a rich sense of depth.

[0062] For example, in macro photography, the focus on the details of the subject (such as flowers, insects, etc.) is extremely critical. Taking the photograph of a flower as an example, the stamen is the key area of ​​focus. The weight list value corresponding to the smaller area containing the stamen (let's say 100×100 pixels) can be set to the maximum value (e.g., 8), while the edges of the petals and the background are given lower weights. This way, when calculating autofocus data, the algorithm will prioritize the pixel information of the stamen, ensuring that every detail of the stamen is clearly focused, thus capturing a high-quality macro image.

[0063] The present invention also provides a lens autofocus processing device based on a configuration weight list, such as... Figure 2 As shown: The device includes:

[0064] The 201 image acquisition module is used to acquire image data and determine the target focus area and non-target focus area;

[0065] 202 Configuration module, used to configure the weight list, divide the non-target focus area into blocks, and obtain image data for each block;

[0066] 203 Calculation module is used to calculate the weight list value corresponding to each pixel in each segmented image, taking each segmented image as a unit;

[0067] 204 output module is used to add the weight list values ​​corresponding to each block image to the autofocus algorithm and output autofocus data;

[0068] 205 Adjustment module, used to adjust the autofocus data.

[0069] It should be noted that the various embodiments in this application specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0070] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0071] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the aforementioned element.

[0072] The above provides a detailed description of the lens autofocus processing method and apparatus based on a configuration weight list. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A lens autofocus processing method based on a configuration weight list, characterized in that, include: (a) Acquire image data and determine the target focus area and non-target focus area; (b) Configure the weight list to divide the non-target focus area into blocks to obtain image data for each block. (c) Using each of the image blocks as a unit, calculate the weight list value corresponding to each pixel in each image block; (d) Add the weight list values ​​corresponding to each image block to the autofocus algorithm and output the autofocus data; (e) Repeat steps (b) to (d) to adjust the autofocus data.

2. The method according to claim 1, characterized in that, The target focus area value corresponding to the weight list is 0, and the non-target focus area value corresponding to the weight list is not 0.

3. The method according to claim 1, characterized in that, The weight list is configured to divide the non-target focus area into blocks, obtaining image data for each block, including: Configure the weight list, wherein the weight list contains N×N integer data, where N is an integer greater than 0; Based on the data in the configuration weight list, the size of the region corresponding to each image block and the pixel value within each image block region are determined.

4. The method according to claim 1, characterized in that, The value represented by the weight list corresponding to each pixel in each segmented image is equal to the product of the value in the weight list and the position value of each pixel in the corresponding weight list.

5. The method according to claim 1, characterized in that, Before adding the weight list values ​​corresponding to each image block to the autofocus algorithm and outputting the autofocus data, the method further includes: Calculate the mean and variance of the image data; The calculated mean and variance are added to the autofocus algorithm.

6. A lens autofocus processing device based on a configuration weight list, comprising: The image acquisition module is used to acquire image data and determine the target focus area and non-target focus area; The configuration module is used to configure the weight list and perform block processing on the non-target focus area to obtain image data of each block; The calculation module is used to calculate the weight list value corresponding to each pixel in each of the image blocks, taking each image block as a unit; The output module is used to add the weight list values ​​corresponding to each image block to the autofocus algorithm and output autofocus data. An adjustment module is used to adjust the autofocus data.