An adaptive fast focusing method and system
By automatically selecting the focus area based on high-frequency feature distribution maps and adjusting the lens position using a deep learning model in the autofocus scheme, the problems of cumbersome user interaction and waste of computing resources in existing technologies are solved, achieving fast and reliable focusing results.
Patent Information
- Application Number
- CN202611267638.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-20
- Publication Date
- 2026-11-17
AI Technical Summary
Existing autofocus solutions require cumbersome and inaccurate user interaction, while deep learning solutions are costly, consume redundant computing resources, and have inconsistent evaluations of focusing performance.
By determining the high-frequency feature distribution map of the image based on the initial position of the lens, the focus area is automatically selected, and the focus position of the lens is predicted using a deep learning model. The focus position is then adjusted by combining high-frequency feature verification to ensure the focus effect.
It reduces user interaction costs, lowers the burden of training data collection and annotation, improves focusing speed and reliability, and ensures the consistency and accuracy of focusing results.
Smart Images

Figure CN123123720A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of image processing and autofocus technology in everyday photography scenarios, and specifically relate to an adaptive fast focusing method and system. Background Technology
[0002] With the widespread application of image acquisition equipment and smart terminals, autofocus technology has been widely used in fields such as photography, video surveillance, unmanned equipment, and mobile terminals.
[0003] Existing autofocus solutions are mainly divided into user-operated solutions and deep learning-based salient region detection solutions. The user-operated solution requires additional user interaction, which is not only cumbersome but may also lead to inaccurate selection of the focus area. The deep learning solution achieves automatic selection of the focus area through image salient region detection, which not only incurs high costs in the collection and labeling of training data but may also limit its application due to the reliance of model inference on the computing power of embedded devices.
[0004] In addition, existing autofocus solutions involve calculating image sharpness evaluation values frame by frame to judge the focusing effect. This not only easily leads to the repeated consumption of computing resources, but may also result in logically inconsistent evaluations. Summary of the Invention
[0005] The embodiments of this disclosure propose an adaptive fast focusing method and system that can adaptively determine the focus area and quickly complete focusing based on image information while reducing explicit user operations. It also supports focus sharpness monitoring, thereby supporting rapid reversal when the focus effect is poor, improving the response speed of autofocus and the overall user experience.
[0006] In a first aspect of this disclosure, an adaptive fast focusing method is provided. The method includes determining a first image based on an initial lens position corresponding to a focusing module, and determining a high-frequency feature distribution map of the first image. The method further includes determining the region with the largest high-frequency feature quantization value as a focusing region based on the high-frequency feature distribution map, and determining a target image corresponding to the focusing region from the first image. The method also includes obtaining a lens focusing position based on the target image and a deep learning model, and determining a second image based on the lens focusing position. Furthermore, the method includes determining whether to adjust the lens focusing position to the initial lens position based on a first feature value corresponding to the focusing region in the first image and a second feature value corresponding to the focusing region in the second image.
[0007] In a second aspect of this disclosure, an adaptive fast focusing system is provided. The system includes a feature distribution map determination module configured to determine a first image based on an initial lens position corresponding to a focusing module, and to determine a high-frequency feature distribution map of the first image. The system also includes a target image selection module configured to determine the region with the largest high-frequency feature quantization value as the focusing region based on the high-frequency feature distribution map, and to determine a target image corresponding to the focusing region from the first image. The system further includes a focus image determination module configured to obtain the lens focus position based on the target image and a deep learning model, and to determine a second image based on the lens focus position. Furthermore, the system includes a focus adjustment module configured to determine whether to adjust the lens focus position to the initial lens position based on a first feature value in the first image corresponding to the focusing region and a second feature value in the second image corresponding to the focusing region.
[0008] In a third aspect of this disclosure, a computer program product is provided, comprising a computer program that is executed by a processor to implement the method according to the first aspect.
[0009] In a fourth aspect of this disclosure, a machine-readable storage medium is provided. The machine-readable storage medium stores machine-executable instructions, which are executed by a processor to implement the method provided according to a first aspect of this disclosure.
[0010] It should be understood that the description in the Summary of the Invention section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0011] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0012] Figure 1 A schematic diagram of an adaptive fast focusing method according to some embodiments of the present disclosure is shown;
[0013] Figure 2 A schematic diagram of a high-frequency feature distribution map of some embodiments of this disclosure is shown:
[0014] Figure 3 A schematic diagram of a target image is shown, illustrating some embodiments of the present disclosure;
[0015] Figure 4 A schematic diagram illustrating a process for adjusting the focusing position of a lens according to some embodiments of the present disclosure is shown;
[0016] Figure 5 A block diagram of an adaptive fast focusing system according to some embodiments of the present disclosure is shown; and
[0017] Figure 6 A block diagram of an electronic device that can implement several embodiments of the present disclosure is shown. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0019] The terms “comprising” and “having”, and any variations thereof, in this specification, claims, and the foregoing drawings are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. Depending on the context, the word “if” as it applies herein may be interpreted as “when”, “when”, “in response to determination”, or “in response to detection”.
[0020] As mentioned above, existing autofocus solutions are mainly divided into user-operated solutions and deep learning-based salient region detection solutions. The user-operated solution usually relies on pre-set or explicit user operation commands to determine the focus area, such as specifying the focus area by clicking on the touch screen, selecting a region, or selecting from the menu, and then the device performs the autofocus process within the selected area. This method requires additional user interaction, which not only increases the number of operation steps, but also the position selected by the user may not be accurate enough. For example, when selecting the focus area on the boundary of the target, it may lead to incorrect selection of the foreground or background, resulting in unsatisfactory focusing effect.
[0021] Deep learning-based salient region detection schemes mainly achieve automatic selection of the focus area by detecting salient regions in an image. This not only requires the collection of a large amount of training data, resulting in high costs for data collection and annotation, but may also limit its application due to the reliance of model inference on the computing power of embedded devices. In addition, the saliency score output by this scheme only reflects the detection confidence and cannot be directly used to evaluate the change in sharpness before and after focusing.
[0022] Furthermore, existing autofocus solutions (such as the application with patent number CN107395993B) involve using a method of independently calculating image sharpness evaluation values frame by frame during the focusing process to judge the focusing effect. This method makes the selection of the focus area and the evaluation of the focusing effect two independent steps, that is, using different features or independent sharpness calculation processes. This not only easily leads to the repeated consumption of computing resources, but also, since the selection criteria for the focus area and the evaluation of the focusing effect are not from the same source, the two may have logical inconsistencies in the evaluation criteria that deviate from the original intention of selection during the focusing process.
[0023] To address this, embodiments of this disclosure propose an adaptive fast focusing method. The method includes determining a first image based on the initial position of the lens corresponding to the focusing module, and determining a high-frequency feature distribution map of the first image. The method further includes determining the region with the largest high-frequency feature quantization value as the focusing region based on the high-frequency feature distribution map, and determining a target image corresponding to the focusing region from the first image. The method also includes obtaining the lens focusing position based on the target image and a deep learning model, and determining a second image based on the lens focusing position. Furthermore, the method includes determining whether to adjust the lens focusing position to the initial lens position based on a first feature value corresponding to the focusing region in the first image and a second feature value corresponding to the focusing region in the second image.
[0024] In the embodiments of this disclosure, the core idea is to adaptively locate the most suitable area for focusing in the image before focusing, by calculating the spatial distribution of high-frequency features in the current image, in everyday photography focusing scenarios. Then, the local image of this area is used as input to a neural network, which predicts the focus position in one step. After the focusing module is driven to move into position, the high-frequency feature quantization values of the focusing area and the area before focusing are reused as a verification benchmark. The high-frequency feature quantization values of the same area after focusing are calculated and compared. If the focusing effect does not meet the standard, the focusing module is returned to the initial position to ensure that the focusing action does not make the image worse than before focusing.
[0025] This approach offers several beneficial effects:
[0026] (1) Compared with the method of user actively specifying the focus area by clicking on the touch screen or selecting the area, it can save the cost of manual interaction and automatically calculate the most suitable area for focus in the image. It is not only faster, but also avoids the problem of inaccurate manual selection. In addition, the method of automatically calculating the focus area can make focusing more flexible and not limited to a certain focus area, thereby avoiding the interaction time of potential focus area switching.
[0027] (2) Compared with the salient target region detection method based on deep learning, there is no need to collect and label training data separately for the focus region selection stage. Instead, the focus region is determined by using the high-frequency feature distribution of the first image, thereby reducing the training and inference burden of the focus region selection stage. The deep learning model used to predict the lens focus position can be trained based on the pre-built training data. In addition, adaptive prediction based on the high-frequency features in the image is more in line with the biological characteristics of human vision being more sensitive to high-frequency information, and the region prediction is more in line with the human eye focusing principle. It should be noted that the saliency score corresponding to the salient region calculated by saliency detection only represents the confidence of the detection result. The change in the saliency score before and after focusing is meaningless and cannot be used to compare the effect before and after focusing. However, the high-frequency feature quantization value is used as a unified index for focus region selection and focus effect verification (that is, avoiding the introduction of an independent sharpness evaluation function, and achieving the two purposes of finding the region and judging the effect under the same calculation framework). The high-frequency feature quantization value is directly positively correlated with the image sharpness, so that the direction and magnitude of the change before and after focusing can be directly used for effect judgment.
[0028] (3) Compared with the existing focusing scheme based on pure neural network prediction (such as the application with patent number WO2020104521A2), after obtaining the lens focusing position, high-frequency feature verification and back-off logic are introduced to automatically identify and recover in the scenario of focusing failure, ensuring that the focusing action is "potentially beneficial and absolutely harmless", thereby improving the reliability of focusing and the actual user experience.
[0029] (4) Compared with the patent application CN107395993B mentioned above, it does not require the entire motor to reciprocate the search. In most scenarios, focusing can be completed in one step by prediction, which significantly improves the speed. At the same time, the reliability advantage of the existing hill climbing method is effectively retained through high-frequency feature verification and graded backoff strategy, while also taking into account speed and accuracy.
[0030] Please see Figure 1 , Figure 1 A flowchart of an adaptive fast focusing method according to some embodiments of this disclosure is shown. Method 100 can be executed, for example, by a processing terminal having at least a shooting module and a focusing module; wherein, the shooting module, for example, consists of a lens group, an image sensor, and a focusing lens, for acquiring an image based on a shooting command; the focusing module, for example, consists of a focusing motor and a transmission assembly between the focusing motor and the focusing lens, for controlling the movement of the focusing lens along the optical axis direction based on a focusing command, thereby adjusting the lens position (i.e., distance) between the focusing lens and the image sensor, thereby achieving focusing on objects at different distances. It is understood that the structure and working principle of the shooting module and the focusing module are well-known techniques in the art, and will not be described in detail here.
[0031] like Figure 1 As shown in block 102, method 100 can determine a first image based on the initial position of the lens corresponding to the focusing module, and determine the high-frequency feature distribution map of the first image. Here, when the focusing action is triggered, the processing terminal can control the shooting module to expose and acquire a frame image (i.e., the first image, with a resolution of, for example, 1920×1080) based on the current dwell position of the focusing module between the focusing lens and the image sensor (i.e., the initial position of the lens), and determine the high-frequency feature distribution map of the image based on the high-frequency features reflecting the edges, textures, and detailed structures of the image. Understandably, high-frequency features of an image typically refer to the feature information corresponding to rapid changes in grayscale or color values within the spatial domain. They are more sensitive to the structural contours, detail changes, and sharpness of objects. The feature types include, for example, edge features reflecting image edge (or contour) regions, texture statistical features reflecting image texture and detail regions, or spectral features reflecting high-frequency energy regions of the image. Of course, they can also be image depth feature maps or image embedding vectors extracted based on neural networks (such as the ResNet series, EfficientNet series, MobileNet series, or Vision Transformer structure well-known in the field), and are not limited to these. It should be noted that, within the same focusing process, a pre-selected feature extraction algorithm and its corresponding normalization rule can be used to calculate the first feature value, the second feature value, and each candidate feature value. The first feature value, the second feature value, and each candidate feature value are calculated using the same algorithm parameters and the same normalization rule, and can all be converted into numerical form to ensure the comparability of subsequent feature values. Among them, edge features, texture statistical features, and spectral features correspond to different feature extraction implementation methods and normalization rules. Within the same focusing process, the original values of different feature types are not compared.
[0032] Specifically, edge features can be gradient magnitude maps, gradient direction maps, or edge intensity maps determined by first-order gradient operators (Sobel, Prewitt, Scharr, Roberts operators), second-order differential operators (Laplacian, LoG operators), or edge detection algorithms (Canny edge detection, multi-scale edge detection algorithms); texture statistical features can be contrast, energy, or entropy determined by local binary mode (LBP), improved local binary mode, Gabor filter, Log-Gabor filter, or gray-level co-occurrence matrix (GLCM); spectral features can be spectral energy after Fourier transform, mid-to-high frequency coefficient statistics after discrete cosine transform, or high frequency block energy distribution, high frequency subband (such as LH, HL, and HH) energy after discrete wavelet transform, or multi-scale high frequency components.
[0033] In the embodiments of this disclosure, when determining the high-frequency feature distribution map of the first image, the corresponding high-frequency feature type can be flexibly determined based on the content characteristics of the first image (or application scenario, hardware computing power conditions). The essence of the high-frequency feature distribution map can be understood as dividing the image space into several sub-regions, calculating the high-frequency features corresponding to each sub-region, and forming a two-dimensional distribution map based on the spatial relationship between all sub-regions. Here, when flexibly determining the corresponding high-frequency feature type based on the content characteristics of the first image, for example, when the content characteristics of the first image involve low-light night scene shooting, the high-frequency feature type can be texture statistical features reflecting image texture and detail areas; when the content characteristics of the first image involve document scanning and text copying, the high-frequency feature type can be edge features reflecting image edge (or contour) areas; when the content characteristics of the first image involve product surface defects, the high-frequency feature type can be spectral features reflecting high-frequency energy areas of the image; when the content characteristics of the first image involve animal or human photography, if the device computing power allows, the high-frequency feature type can be an image depth feature map extracted based on a neural network or an image embedding vector.
[0034] In the embodiments of this disclosure, candidate sub-image regions and their corresponding high-frequency feature quantization values can be obtained using different processing sequences. In one implementation, high-frequency features can be extracted from the entire first image to obtain the high-frequency feature response results of the first image. Then, based on the position and range of each candidate sub-image region, the high-frequency feature response results within the corresponding region are quantized to obtain the high-frequency feature quantization values corresponding to each candidate sub-image region. In another implementation, multiple candidate sub-image regions can be determined first, and then high-frequency feature extraction and quantization can be performed on each candidate sub-image region separately to obtain the high-frequency feature quantization values corresponding to each candidate sub-image region. Both of the above processing sequences can be used to obtain candidate sub-image regions and their corresponding high-frequency feature quantization values, and this disclosure does not limit them.
[0035] In some implementations, when determining the high-frequency feature distribution map of the first image, the processing terminal specifically acquires multiple candidate sub-image regions in the first image and the high-frequency feature quantization value corresponding to each candidate sub-image region. Here, when acquiring multiple candidate sub-image regions in the first image, the first image can be divided into multiple candidate sub-image regions of the same size based on a preset single window size. For example, the first image can be traversed by sliding according to a preset single window size and a preset step size (e.g., when the resolution of the first image is 1920×1080, the preset single window size can be 640×540, and the preset step size can be 1 / 4 or 1 / 2 of the preset single window side length). Each time the window slides to a position, the image area covered by the corresponding window is the candidate sub-image region.
[0036] Subsequently, based on the spatial relationships of all candidate sub-image regions and the quantized values of all high-frequency features, the high-frequency feature distribution map of the first image is determined. Here, the high-frequency feature distribution map of the first image can be constructed based on the spatial relationships between the position coordinates of all candidate sub-image regions (such as the position coordinates of the region center in the first image) and all high-frequency feature quantized values corresponding to all candidate sub-image regions (that is, the high-frequency feature distribution map has the same size as the first image and has all high-frequency feature quantized values arranged according to spatial relationships, or it may also have candidate sub-image region bounding boxes corresponding to each high-frequency feature quantized value).
[0037] In one example, the high-frequency feature quantization value is determined based on the edge features of the sub-image region. This edge feature can be calculated by convolving each pixel and its neighboring pixels in the sub-image region with a Laplacian operator (such as a 3×3 discrete convolution kernel) to obtain the Laplacian response value corresponding to each pixel in the sub-image region. For example, when determining the high-frequency feature distribution map of the first image, multiple first sub-image regions in the first image are specifically obtained, and the first high-frequency feature quantization value corresponding to each first sub-image region is obtained. Each first high-frequency feature quantization value is determined based on the edge features of the corresponding first sub-image region. Here, for example, the first image can be divided into multiple first sub-image regions of the same size based on a preset single window size. The absolute values of the Laplacian response values of all pixels within each first sub-image region are then summed to determine the average value of the summed results as the high-frequency feature quantization value (i.e., the first high-frequency feature quantization value) of the corresponding first sub-image region. Alternatively, the first image can be divided into multiple regularly shaped or irregularly shaped first sub-image regions according to image block division. The absolute values of the Laplacian response values of all pixels within each sub-image region are then summed to determine the average value of the summed results as the high-frequency feature quantization value (i.e., the first high-frequency feature quantization value) of the corresponding sub-image region. It is understood that a larger first high-frequency feature quantization value indicates richer edge texture in the corresponding first sub-image region, making it more suitable for focusing.
[0038] Subsequently, based on the spatial positional relationships of all first sub-image regions and all first high-frequency feature quantization values, a high-frequency feature distribution map of the first image is determined. Here, after determining the first high-frequency feature quantization values corresponding to each first sub-image region, the high-frequency feature distribution map of the first image can be constructed based on the spatial positional relationships between the position coordinates of all first sub-image regions (such as the position coordinates of the region center in the first image) and all first high-frequency feature quantization values corresponding to all first sub-image regions (that is, the high-frequency feature distribution map has the same size as the first image and has all first high-frequency feature quantization values arranged according to spatial positional relationships, or it may also have first sub-image region bounding boxes corresponding to each first high-frequency feature quantization value).
[0039] In the embodiments of this disclosure, when there are potential focus targets with huge differences in scale in the scene being photographed (such as a face in the foreground and a signboard in the distance), a single window size is difficult to accommodate them all: because a small window may not be able to completely frame the overall structural information of the face, while a large window may frame the signboard but also mix in a large amount of low-frequency background, diluting the detail density. Based on this, in order to more robustly adapt to images of different sizes and to solve the limitations of the single fixed window size mentioned above, the first image can be divided into multiple candidate sub-image regions corresponding to each window size based on multiple preset window sizes. For example, the first image can be traversed by sliding according to each window size and a corresponding preset step size (e.g., when the resolution of the first image is 1920×1080, the windows of each scale can be 640×540, 320×270 and 160×135 respectively, and the preset step size corresponding to each scale window can be 1 / 4 or 1 / 2 of the side length of the corresponding window). Each time the sliding reaches a position, the image area covered by the corresponding window is the candidate sub-image region corresponding to the corresponding window size.
[0040] In another example, the high-frequency feature quantization value is determined based on the edge features of the sub-image region. This edge feature can be calculated by convolving each pixel and its neighboring pixels in the sub-image region with a Laplacian operator (such as a 3×3 discrete convolution kernel) to obtain the Laplacian response value corresponding to each pixel in the sub-image region. For example, when determining the high-frequency feature distribution map of the first image, multiple second sub-image regions corresponding to each window size in the first image are specifically obtained, and the second high-frequency feature quantization value corresponding to each second sub-image region is obtained. Each second high-frequency feature quantization value is determined based on the edge features of the corresponding second sub-image region.
[0041] Here, based on all pixels contained in each second sub-image region, the absolute values of the Laplacian response values of all corresponding pixels can be accumulated to obtain the corresponding accumulated calculation result. Then, since the physical areas corresponding to different window sizes are different, for example, a larger window size covers more image pixels, while a smaller window size covers only a few image pixels, in order to achieve fair comparison across scales, the accumulated calculation results corresponding to each second sub-image region can also be normalized by area (such as calculating the ratio of the mean of the accumulated calculation result to the area of the corresponding window size), or the accumulated calculation results corresponding to each second sub-image region can also be normalized by response density (such as calculating the ratio of the mean of the accumulated calculation result to the total number of pixels of the corresponding window size). Of course, scale normalization or significance statistical normalization can also be performed (and not limited to these), and the final normalization result is determined as the high-frequency feature quantization value (i.e., the second high-frequency feature quantization value) of the corresponding second sub-image region.
[0042] Subsequently, based on the spatial positional relationships of all second sub-image regions corresponding to each window size and all second high-frequency feature quantization values, a sub-high-frequency feature distribution map is determined, and multi-size fusion is performed on all sub-high-frequency feature distribution maps to obtain the high-frequency feature distribution map of the first image. Here, the sub-high-frequency feature distribution map can be constructed based on the spatial positional relationships between the position coordinates of all second sub-image regions corresponding to each window size and all second high-frequency feature quantization values corresponding to the corresponding second sub-image regions (that is, each sub-high-frequency feature distribution map has the same size as the first image and has all second high-frequency feature quantization values arranged according to spatial positional relationships, or it may also have second sub-image region bounding boxes corresponding to each second high-frequency feature quantization value).
[0043] After determining the sub-high-frequency feature distribution map corresponding to each window size, based on all the second high-frequency feature quantization values contained in each sub-high-frequency feature distribution map and the second sub-image region bounding boxes corresponding to each second high-frequency feature quantization value, all pixels in the corresponding sub-high-frequency feature distribution map are assigned the corresponding second high-frequency feature quantization value (that is, all pixels within each second sub-image region are assigned the second high-frequency feature quantization value corresponding to the corresponding second sub-image region). Then, all sub-high-frequency feature distribution maps after pixel assignment are fused, that is, each pixel is assigned the largest second high-frequency feature quantization value among all the corresponding second high-frequency feature quantization values, thereby obtaining the high-frequency feature distribution map of the first image (that is, having all the second high-frequency feature quantization values corresponding to all pixels in the first image). Of course, embodiments of this disclosure may also use weighted averaging or scale selection to perform multi-size fusion of all sub-high-frequency feature distribution maps to obtain the high-frequency feature distribution map of the first image, and are not limited to this.
[0044] It is understandable that the larger the quantization value of the second high-frequency feature, the richer the edge texture of the corresponding pixel in the second sub-image region, which means it is more suitable for focusing.
[0045] Furthermore, after determining the high-frequency feature distribution map of the first image based on the multi-scale window, the pixel with the largest high-frequency feature response intensity (that is, the maximum value among all second high-frequency feature quantization values corresponding to all pixels) can be identified in the high-frequency feature distribution map, and the second sub-image region where the second high-frequency feature quantization value corresponding to the pixel is located is determined as the focus region.
[0046] In another example, the high-frequency feature vector is used to determine the texture statistical features of the sub-image region. The texture statistical features can be calculated based on the gray values of all pixels contained in the sub-image region, and the local binary value corresponding to each pixel is calculated (that is, the binary value is determined based on the size between the gray values of the eight neighboring pixels and the corresponding pixel gray value, and the binary value is converted into a decimal value). Taking the normalized histogram determined based on all the local binary values corresponding to each sub-image region as an example, when determining the high-frequency feature distribution map of the first image, multiple third sub-image regions in the first image are specifically obtained, and the third high-frequency feature quantization value corresponding to each third sub-image region is obtained. Each third high-frequency feature quantization value is determined based on the texture statistical features of the corresponding third sub-image region. Here, for example, the first image can be divided into multiple third sub-image regions of the same size based on a preset single window size. Based on the gray values of all pixels contained in each third sub-image region, a local binary value corresponding to each pixel is calculated (that is, based on the size between the gray values of the eight neighboring pixels and the corresponding pixel gray value, the binary value is determined and converted into a decimal value). Then, based on all the local binary values corresponding to each third sub-image region, a normalized histogram is determined (that is, the frequency corresponding to each local binary value is counted in all local binary values), and the normalized histogram is used as the texture statistical feature of the corresponding third sub-image region.
[0047] Next, based on the texture statistical features corresponding to each third sub-image region, the entropy of the corresponding texture statistical feature can be calculated (e.g., E = -Σ(H_k * log2(H_k)), where E is the entropy and H_k is the frequency corresponding to each local binary value in the normalized histogram). This entropy can then be used as the quantization value of the corresponding third high-frequency feature. It can be understood that the larger the quantization value of the third high-frequency feature, the richer the texture details of the corresponding third sub-image region, and thus the more suitable it is for focusing.
[0048] Subsequently, based on the spatial relationships of all third sub-image regions and the quantization values of all third high-frequency features, the high-frequency feature distribution map of the first image is determined. Here, after determining the quantization values of the third high-frequency features corresponding to each third sub-image region, the high-frequency feature distribution map of the first image can be constructed based on the spatial relationships between the positional coordinates of all third sub-image regions (such as the positional coordinates of the region center in the first image) and the quantization values of the third high-frequency features corresponding to all third sub-image regions (that is, the high-frequency feature distribution map has the same size as the first image and has all the quantization values of the third high-frequency features arranged according to the spatial relationships, or it may also have the bounding boxes of the third sub-image regions corresponding to each third high-frequency feature quantization value).
[0049] In another example, the high-frequency feature quantization value is determined based on the spectral characteristics of the sub-image region. This spectral characteristic can be obtained by performing a Fast Fourier Transform on each sub-image region to obtain the corresponding region spectrum. For instance, when determining the high-frequency feature distribution map of the first image, multiple fourth sub-image regions in the first image are specifically obtained, along with the fourth high-frequency feature quantization value corresponding to each fourth sub-image region. Each fourth high-frequency feature quantization value is determined based on the spectral characteristics of its corresponding fourth sub-image region. Here, for example, the first image can be divided into multiple fourth sub-image regions of the same size based on a preset single window size, and a Fast Fourier Transform can be performed on each fourth sub-image region to obtain the corresponding region spectrum.
[0050] After determining the regional spectrum corresponding to each fourth sub-image region, the zero-frequency component of each region's spectrum can be moved to the center. Using the center of the corresponding region's spectrum as the origin, a circular region with a preset radius is designated as the high-frequency region. The sum of the energy of all spectral coefficients within this high-frequency region is then calculated, and the sum is used as the fourth high-frequency feature quantization value for the corresponding fourth sub-image region. It can be understood that a larger fourth high-frequency feature quantization value indicates greater high-frequency energy in the corresponding fourth sub-image region, meaning it is more suitable for focusing.
[0051] Subsequently, based on the spatial relationships of all fourth sub-image regions and the quantization values of all fourth high-frequency features, the high-frequency feature distribution map of the first image is determined. Here, after determining the quantization values of the fourth high-frequency features corresponding to each fourth sub-image region, the high-frequency feature distribution map of the first image can be constructed based on the spatial relationships between the position coordinates of all fourth sub-image regions (such as the position coordinates of the region center in the first image) and the quantization values of the fourth high-frequency features corresponding to all fourth sub-image regions (that is, the high-frequency feature distribution map has the same size as the first image and has all the quantization values of the fourth high-frequency features arranged according to the spatial relationships, or it may also have the fourth sub-image region bounding boxes corresponding to each fourth high-frequency feature quantization value).
[0052] Please see Figure 2A schematic diagram of a high-frequency feature distribution map according to some embodiments of the present disclosure is shown. For example... Figure 2 As shown, the high-frequency feature distribution map 200 shows six window regions of the same size divided by a sliding window traversal method. Each window region has a corresponding high-frequency feature quantization value. The maximum value of all high-frequency feature quantization values is 0.8, that is, the window region corresponding to 0.8 can be used as the focus area.
[0053] In the embodiments of this disclosure, in addition to using the sliding window traversal, image segmentation, or multi-scale window methods mentioned above to determine the high-frequency feature distribution map, the high-frequency feature distribution map can also be determined by direct full-image calculation or convolutional response map calculation. Direct full-image calculation can be understood as extracting high-frequency features from the entire first image to obtain the full-image high-frequency feature response, and calculating statistical quantities such as the full-image high-frequency energy, mean, variance, or spectral energy distribution based on the full-image high-frequency feature response, thereby obtaining the high-frequency feature distribution map. Convolutional response map calculation can be understood as using a preset convolution kernel to convolve the first image to obtain a high-frequency response map, and using this high-frequency response map as the high-frequency feature distribution map; neither of these will be elaborated upon further.
[0054] In box 104, method 100 can determine the region with the largest high-frequency feature quantization value as the focus region based on the high-frequency feature distribution map, and determine the target image corresponding to the focus region from the first image. Here, after determining the high-frequency feature distribution map, the processing terminal can determine the region with the largest high-frequency feature quantization value (i.e., the region with the largest high-frequency feature response intensity) as the focus region, and crop the corresponding target image from the first image based on a preset cropping size (e.g., 640×640, which can be fixed after selection through actual debugging and does not require adaptive adjustment) and the center position of the focus region. It is understood that the target image can completely cover the focus region, and the size of the target image can be consistent with the input image size of the subsequent deep learning model to facilitate embedded deployment.
[0055] It should be noted that, in the embodiments of this disclosure, the maximum value of the high-frequency feature quantization value in the high-frequency feature distribution map can also be retained as the first feature value corresponding to the focus area in the first image, so as to be reused in the subsequent focus effect evaluation stage. This not only reduces the repeated technical overhead, but also avoids independent sharpness evaluation calculations, and ensures strict consistency between the focus target and the effect evaluation object.
[0056] Please see Figure 3 A schematic diagram of a target image according to some embodiments of the present disclosure is shown. For example... Figure 3As shown, in a high-frequency feature distribution map with 6 window regions of the same size and high-frequency feature quantization values corresponding to each window region, the target image 300 can be an image covering the window region corresponding to the maximum value (0.8) of all high-frequency feature quantization values. Its image width can be the same as the width of the corresponding window region, and its image height is greater than the height of the corresponding window region.
[0057] In box 106, method 100 can obtain the lens focus position based on the target image and the deep learning model, and determine the second image based on the lens focus position. Here, the processing terminal can input the target image into the pre-trained deep learning model to obtain the lens focus position through model prediction, that is, the lens position between the focusing lens and the image sensor that the focusing module needs to adjust; then, the focusing module can control the focusing lens to move along the optical axis to the lens focus position based on the focusing command corresponding to the lens focus position, so as to achieve lens focusing, and after the lens focuses, control the shooting module again to expose and capture a frame image (that is, the second image, which has the same exposure parameters and gain as when capturing the first image to ensure the comparability of high-frequency feature values before and after).
[0058] Understandably, the structure of deep learning models can preferably adopt lightweight convolutional neural networks, such as the MobileNet series, ShuffleNet series, GhostNet series, or small Vision Transformer structures, to take advantage of the small number of parameters and fast inference speed to adapt to the computing power limitations of mobile and embedded devices, and to meet real-time requirements while ensuring the accuracy of focus position prediction. In the training process of deep learning models, the training set may include multiple image samples collected under different scenes and lighting conditions, and lens position labels corresponding to each image sample. The loss function may be to calculate the mean square error between the predicted lens position and the lens position label, and backpropagation using optimizers such as Adam is used to update the network parameters until the deep learning model converges.
[0059] In embodiments of this disclosure, the processing terminal may also determine multiple target images corresponding to the focus area from the first image, each target image being able to cover the focus area (as determined by referring to the sliding window traversal method), and input all target images together into the deep learning model to obtain the lens focus position, but is not limited to this.
[0060] To ensure the comparability of the first feature value, the second feature value, and the alternative feature value, unless otherwise stated, each feature value is calculated using the pixel coordinates and region size of the focus area determined in the first image as a benchmark, and employing the same high-frequency feature extraction algorithm, algorithm parameters, and quantization / normalization rules. Furthermore, the same exposure, gain, and image preprocessing configurations are used when acquiring the corresponding images, or preset compensation is applied to compensate for configuration differences. Subsequent paragraphs involving the second feature value and the alternative feature value can be calculated with reference to the above-mentioned unified comparison rules, without the need for repeated descriptions.
[0061] In box 108, method 100 can determine whether to adjust the lens focus position to the lens initial position based on a first feature value corresponding to the focus area in the first image and a second feature value corresponding to the focus area in the second image. Here, the first feature value can be understood as the maximum value of the high-frequency feature quantization value in the high-frequency feature distribution map of the first image mentioned above; the second feature value can be understood as the high-frequency feature quantization value corresponding to the region corresponding to the focus area in the high-frequency feature distribution map of the second image. The process of determining the high-frequency feature distribution map of the second image is completely consistent with the process of determining the high-frequency feature distribution map of the first image mentioned above. The position coordinates (such as the position coordinates of the region center in the second image) and the region size of the region corresponding to the focus area are completely consistent with the position coordinates (such as the position coordinates of the region center in the first image) and the region size of the focus area in the first image. In this way, the constraints of the same location and the same method can be used to ensure that the first feature value and the second feature value are comparable at the pixel level. That is, the comparison is of the high-frequency feature changes of the same spatial region before and after focusing, rather than the feature comparison of the whole image or different regions. In addition, the comparison between the first feature value and the second feature value can also have a clear physical meaning, avoiding unreliable evaluation results due to coordinate offset or method differences.
[0062] In some implementations, when the processing terminal determines whether to adjust the lens focus position to the initial lens position based on a first feature value corresponding to the focus area in the first image and a second feature value corresponding to the focus area in the second image, it specifically determines whether the first feature value exceeds the second feature value. It is understood that when the first feature value exceeds the second feature value, it indicates that the sharpness effect after lens focusing is not as good as the sharpness effect before lens focusing (i.e., it becomes blurry), and it may be necessary to return to the initial lens position or further fine-tune the lens focus position; when the first feature value does not exceed the second feature value, it indicates that the sharpness effect after lens focusing is clearer than the sharpness effect before lens focusing (or remains unchanged), that is, the focusing action is considered effective.
[0063] Subsequently, in response to determining that the first characteristic value does not exceed the second characteristic value, it is determined not to adjust the lens focusing position to the lens's initial position. Here, after determining that the first characteristic value does not exceed the second characteristic value, the focusing module can be controlled to remain at the current dwell position (i.e., the lens focusing position) between the focusing lens and the image sensor, and the focusing process ends.
[0064] In some implementations, when determining whether to adjust the lens focusing position to the lens's initial position, the processing terminal further responds by determining that a first feature value exceeds a second feature value, calculating the descent amplitude based on the first and second feature values, and determining whether the descent amplitude exceeds a preset amplitude threshold. The calculation process for the descent amplitude can be seen, for example, in the expression shown below:
[0065] Δf = (f1−f2) / f1
[0066] In the above formula, Δf is the magnitude of the decrease, f1 is the first eigenvalue, and f2 is the second eigenvalue.
[0067] Understandably, when the decrease exceeds a preset threshold (e.g., 10%), it indicates a severe deterioration in the sharpness of the lens after focusing. This means the predicted lens focus position is completely off-target, and continuing to search near the incorrect position is not only ineffective but also a waste of time. The lens focus position needs to be directly adjusted back to its initial position. When the decrease does not exceed the preset threshold, it indicates a slight deterioration in the sharpness of the lens after focusing. Further fine-tuning of the lens focus position can then be used to determine the final lens position. By using the decrease as a criterion, the preset threshold can be maintained as a consistent standard across different image content, lighting conditions, and high-frequency feature dimensions.
[0068] Subsequently, in response to determining that the descent amplitude exceeds a preset amplitude threshold, the focusing module adjusts the lens's focus position to the lens's initial position. Here, after determining that the descent amplitude exceeds the preset amplitude threshold, the focusing module can control the focusing lens to move along the optical axis to the lens's initial position based on the focusing command corresponding to the lens's initial position, thereby achieving rapid lens retraction. In this way, the goal is to minimize the focusing time, so that a secondary search is not initiated when focusing fails, allowing the imaging state of the shooting module to recover to the state before the focusing action was executed in the shortest possible time, thus reducing the risk that the predicted result will degrade the imaging effect of the focused area.
[0069] In some implementations, when determining whether to adjust the lens focus position to the initial lens position, the processing terminal further determines multiple candidate lens positions and corresponding candidate images based on a fine-tuning focus algorithm and the lens focus position, in response to determining that the descent amplitude does not exceed a preset amplitude threshold. Here, taking the hill-climbing method, a well-known fine-tuning focus algorithm (though other algorithms are also possible), as an example, the lens focus position can be used as a starting point. Based on a preset step size and a preset range, the lens focus position is scanned in two small directions to obtain multiple candidate lens positions within the preset range. Furthermore, while determining each candidate lens position, the focusing module adjusts the lens position between the focusing lens and the image sensor to the corresponding candidate lens position, and the shooting module exposes and captures the corresponding candidate image.
[0070] Next, candidate feature values corresponding to the focus area in each candidate image are determined. Based on all candidate feature values, the candidate lens position corresponding to the largest candidate feature value is determined as the target lens position. Here, the candidate feature value corresponding to the focus area in each candidate image can be understood as the quantized value of the high-frequency feature corresponding to the area of the focus area in the high-frequency feature distribution map of the corresponding candidate image. The process of determining the high-frequency feature distribution map of the candidate image is completely consistent with the process of determining the high-frequency feature distribution map of the first image mentioned above, to ensure that the evaluation criteria are completely consistent. The position coordinates (such as the position coordinates of the center of the area in the candidate image) and the size of the area corresponding to the focus area are completely consistent with the position coordinates (such as the position coordinates of the center of the area in the first image) and the size of the area of the focus area in the first image.
[0071] It is understandable that the maximum value among all candidate feature values indicates that the corresponding lens candidate position has the best focusing effect, and thus the lens candidate position corresponding to the maximum candidate feature value can be determined as the lens target position.
[0072] Next, the focusing module adjusts the lens's focus position to the target position. Here, the focusing module can control the focusing lens to move along the optical axis to the target position based on the focusing command corresponding to the target position, thus achieving fine-tuning of the focus. In this way, compared to a method that searches from the initial position of the lens throughout the entire process, the search range can be narrowed using prediction results, the motor travel and the number of search steps can be reduced, thereby improving focusing efficiency.
[0073] In the embodiments of this disclosure, a graded response strategy is adopted according to the degree of deterioration of the focusing effect: when the deterioration is slight, a local climbing method for fine adjustment is initiated; when the deterioration is severe, the lens is directly reverted to its initial position; and when the focusing improves, the predicted position is maintained. This gradient response mechanism can achieve fast focusing in one step in most scenarios, while automatically backing up in a few failure scenarios, thus balancing focusing speed and focusing reliability.
[0074] Please see Figure 4 The diagram illustrates a process for adjusting the focusing position of a lens according to some embodiments of the present disclosure. Figure 4 As shown, the lens focusing position adjustment process 400 can determine whether the second feature value is weaker than the first feature value. If so, it further determines whether the reduction range between the second feature value and the first feature value (i.e., the reduction range mentioned above) exceeds the threshold (i.e., the preset range threshold mentioned above). Otherwise, the focusing ends. When it is determined that the reduction range exceeds the threshold, the position of the rewind focusing motor (i.e., the initial position of the lens mentioned above) is controlled. If the threshold is not exceeded, the fine-tuning focusing algorithm is started until the lens is at the target position, and the focusing ends.
[0075] Figure 5 A block diagram of an adaptive fast focusing system according to some embodiments of the present disclosure is shown. The various embodiments in this specification are described in a progressive manner, with reference to each other for similar or identical parts. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple, and relevant parts can be referred to in the description of the method embodiments. Figure 5 As shown, the adaptive fast focusing system 500 may include at least a feature distribution map determination module 502, configured to determine a first image based on the initial position of the lens corresponding to the focusing module, and determine the high-frequency feature distribution map of the first image. The adaptive fast focusing system 500 also includes a target image selection module 504, configured to determine the region with the largest high-frequency feature quantization value as the focusing region based on the high-frequency feature distribution map, and determine the target image corresponding to the focusing region from the first image. The adaptive fast focusing system 500 also includes a focus image determination module 506, configured to obtain the lens focus position based on the target image and a deep learning model, and determine a second image based on the lens focus position. Furthermore, the adaptive fast focusing system 500 also includes a focus adjustment module 508, configured to determine whether to adjust the lens focus position to the initial lens position based on a first feature value corresponding to the focusing region in the first image and a second feature value corresponding to the focusing region in the second image.
[0076] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0077] Figure 6 Block diagrams of electronic devices that can implement various embodiments of the present disclosure are shown. For example... Figure 6 As shown, the electronic device 600 includes a processor 601, which can perform various appropriate actions and processes based on computer program instructions loaded into random access memory (RAM) 603 according to computer program instructions stored in read-only memory (ROM) 602. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0078] The various processes and procedures described above, such as method 100, can be executed by processor 601. For example, in some embodiments, method 100 may be implemented as a software program tangibly contained in a machine-readable medium. In some embodiments, part or all of the software program may be loaded into and / or installed onto electronic device 600 via ROM 602. When the software program is loaded into RAM 603 and executed by processor 601, one or more actions of method 100 described above may be performed.
[0079] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload programmable logic devices (CPLDs), and so on.
[0080] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0081] This disclosure can be a method, apparatus, system, and / or program product. The program product may include a machine-readable storage medium on which machine-readable program instructions for performing various aspects of this disclosure are loaded. The machine-readable program instructions described herein can be downloaded from the machine-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the machine-readable program instructions from the network and forwards them to the machine-readable storage medium in the respective computing / processing device.
[0082] Machine program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. Machine-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as a standalone software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the machine-readable program instructions to implement various aspects of this disclosure.
[0083] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. Furthermore, although operations are depicted in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.
[0084] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. An adaptive fast focusing method, characterized in that, include: The first image is determined based on the initial position of the lens corresponding to the focusing module, and the high-frequency feature distribution map of the first image is determined. Based on the high-frequency feature distribution map, the region with the largest high-frequency feature quantization value is determined as the focus region, and the target image corresponding to the focus region is determined from the first image. Based on the target image and the deep learning model, the lens focus position is obtained, and the second image is determined based on the lens focus position. as well as Based on the first feature value in the first image corresponding to the focus area and the second feature value in the second image corresponding to the focus area, it is determined whether to adjust the focus position of the lens to the initial position of the lens.
2. The method according to claim 1, characterized in that, Determining the high-frequency feature distribution map of the first image includes: Obtain multiple candidate sub-image regions in the first image, and the high-frequency feature quantization value corresponding to each candidate sub-image region; and Based on the spatial positional relationship of all the candidate sub-image regions and the quantization values of all the high-frequency features, the high-frequency feature distribution map of the first image is determined.
3. The method according to claim 2, characterized in that, The step of obtaining multiple candidate sub-image regions in the first image includes: Based on a preset single window size, the first image is divided into multiple candidate sub-image regions; or Based on multiple preset window sizes, the first image is divided into multiple candidate sub-image regions corresponding to each window size; the proportions between each window size are the same.
4. The method according to claim 2, characterized in that, Determining the high-frequency feature distribution map of the first image includes: Obtain multiple first sub-image regions in the first image, and a first high-frequency feature quantization value corresponding to each first sub-image region; each first high-frequency feature quantization value is determined based on the edge features of the corresponding first sub-image region; and Based on the spatial positional relationships of all the first sub-image regions and the quantization values of all the first high-frequency features, the high-frequency feature distribution map of the first image is determined.
5. The method according to claim 3, characterized in that, Determining the high-frequency feature distribution map of the first image includes: Obtain multiple second sub-image regions in the first image corresponding to each of the stated window sizes, and second high-frequency feature quantization values corresponding to each of the second sub-image regions; and Based on the spatial positional relationship of all the second sub-image regions corresponding to each of the window sizes and all the second high-frequency feature quantization values, a sub-high-frequency feature distribution map is determined, and multi-size fusion is performed on all the sub-high-frequency feature distribution maps to obtain the high-frequency feature distribution map of the first image.
6. The method according to claim 2, characterized in that, Determining the high-frequency feature distribution map of the first image includes: Obtain multiple third sub-image regions in the first image, and a third high-frequency feature quantization value corresponding to each third sub-image region; each third high-frequency feature quantization value is determined based on the texture statistical features of the corresponding third sub-image region; and Based on the spatial positional relationships of all the third sub-image regions and the quantization values of all the third high-frequency features, the high-frequency feature distribution map of the first image is determined.
7. The method according to claim 2, characterized in that, Determining the high-frequency feature distribution map of the first image includes: Obtain multiple fourth sub-image regions in the first image, and a fourth high-frequency feature quantization value corresponding to each fourth sub-image region; each fourth high-frequency feature quantization value is determined based on the spectral characteristics of the corresponding fourth sub-image region; and Based on the spatial positional relationships of all the fourth sub-image regions and the quantization values of all the fourth high-frequency features, the high-frequency feature distribution map of the first image is determined.
8. The method according to any one of claims 1-7, characterized in that, The step of determining whether to adjust the lens focus position to the initial position based on the first feature value corresponding to the focus area in the first image and the second feature value corresponding to the focus area in the second image includes: Based on a first feature value in the first image corresponding to the focus area and a second feature value in the second image corresponding to the focus area, determine whether the first feature value exceeds the second feature value; and In response to determining that the first feature value does not exceed the second feature value, it is determined not to adjust the lens focusing position to the initial position of the lens.
9. The method according to claim 8, characterized in that, The method further includes: In response to determining that the first feature value exceeds the second feature value, the decrease amplitude is calculated based on the first feature value and the second feature value, and it is determined whether the decrease amplitude exceeds a preset amplitude threshold; and In response to determining that the decrease exceeds the preset amplitude threshold, the focusing module adjusts the lens focusing position to the initial position of the lens.
10. The method according to claim 9, characterized in that, The method further includes: In response to determining that the decrease amplitude does not exceed the preset amplitude threshold, based on the fine-tuning focus algorithm and the lens focus position, multiple lens candidate positions and candidate images corresponding to each lens candidate position are determined; Determine candidate feature values corresponding to the focus area in each of the candidate images, and based on all the candidate feature values, determine the lens candidate position corresponding to the largest candidate feature value as the lens target position; and The focusing module adjusts the lens's focusing position to the lens's target position.
11. An adaptive fast focusing system, characterized in that, include: The feature distribution map determination module is configured to determine a first image based on the initial position of the lens corresponding to the focusing module, and to determine the high-frequency feature distribution map of the first image; The target image selection module is configured to determine the region with the largest high-frequency feature quantization value as the focus region based on the high-frequency feature distribution map, and to determine the target image corresponding to the focus region from the first image; The focus image determination module is configured to obtain the lens focus position based on the target image and the deep learning model, and determine the second image based on the lens focus position; as well as The focus adjustment module is configured to determine whether to adjust the lens focus position to the lens initial position based on a first feature value in the first image corresponding to the focus area and a second feature value in the second image corresponding to the focus area.
12. A computer-readable storage medium having a computer program stored thereon, the computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform the steps of the method as claimed in any one of claims 1-10.
13. An electronic device, characterized in that, include: One or more processors, and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method as described in any one of claims 1-10.
Citation Information
Patent Citations
Fully automatic focusing method and system
CN107395993B
Learning autofocus
WO2020104521A2
