Focusing method, device, equipment, chip and chip module
By performing color space conversion and encoding compression on images acquired at the lens position, and using the amount of encoded image data to reflect sharpness, the problem of inaccurate focus values in point light sources and high-contrast scenes in traditional methods is solved, achieving more stable and efficient autofocus.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
- Filing Date
- 2026-03-19
- Publication Date
- 2026-05-15
AI Technical Summary
In point light source and high-contrast scenes, traditional autofocus methods based on spatial gradient features are easily misled by halos and overexposed areas, resulting in inaccurate focus values and poor autofocus success rate.
After acquiring images at each lens position, color space conversion and encoding compression are performed. The amount of data in the encoded image is used as the focus value, avoiding reliance on spatial gradient features and directly reflecting the trend of image sharpness changes with the amount of data in the encoded image.
It improves the stability and success rate of autofocus, avoids the misleading effect of halos and overexposed areas on focus values in point light sources and high-contrast scenes, and significantly improves the accuracy and reliability of focusing.
Smart Images

Figure CN122053968A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a focusing method, apparatus, computer equipment, chip, and chip module. Background Technology
[0002] In a shooting scenario, the shooting device can measure the image sharpness of the area of interest in the preview screen, obtain the focus value of the current preview screen, and guide the lens to move to the position that maximizes the focus value through the autofocus function to ensure that the preview screen is clear.
[0003] In traditional contrast-detection autofocus methods, the lens can be driven to acquire original images at different positions, and the image sharpness can be measured based on the spatial gradient features of the original images to determine the focus value corresponding to each position. Then, by combining search strategies such as hill climbing algorithms, the lens can be positioned to the position corresponding to the peak point of the focus value by tracking the changing trend of the focus value, thereby completing autofocus.
[0004] However, in scenarios with point light sources and high contrast, the spatial gradient features are easily misled by halos and overexposed areas, resulting in an abnormal phenomenon where the focus value is higher when the image is out of focus. Therefore, the obtained focus value cannot accurately reflect the true image sharpness, leading to a poor success rate of the autofocus function. Summary of the Invention
[0005] Therefore, it is necessary to provide a focusing method, device, computer equipment, chip, and chip module to address the aforementioned technical problems, so that the focus value accurately reflects the true image sharpness and improves the success rate and stability of focusing.
[0006] In a first aspect, this application provides a focusing method, including:
[0007] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0008] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0009] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0010] In one embodiment, the step of acquiring images of the target scene at each camera position to obtain a first image at each camera position includes:
[0011] Acquire sensor data of the target scene at each camera position;
[0012] The sensor data is subjected to pixel interpolation to obtain a first image of each lens position.
[0013] In one embodiment, the step of performing pixel interpolation processing on the sensor data to obtain a first image for each of the lens positions includes:
[0014] The sensor data is subjected to pixel interpolation to obtain the original image of each lens position;
[0015] The original image is subjected to noise suppression, color normalization, and image quality enhancement to obtain the first image.
[0016] In one embodiment, the step of encoding and compressing each of the second images to obtain the corresponding encoded image includes:
[0017] For each of the second images, each color channel of the second image is divided into blocks to obtain multiple image blocks;
[0018] For each of the image blocks, a discrete cosine transform is performed on the image block to obtain the frequency domain coefficient matrix of the image block, and the frequency domain coefficient matrix is quantized to obtain the quantization coefficient matrix;
[0019] Entropy coding is performed based on each of the quantization coefficient matrices to obtain the encoded image corresponding to each of the second images.
[0020] In one embodiment, the step of performing color space conversion on the first image to obtain the second image includes:
[0021] Perform facial recognition on the first image;
[0022] In response to the identification of a face region in the first image, face alignment is performed based on the face region in the reference image and the face region in the first image to determine the target region; the reference image is the previous frame of the first image, and the reference image corresponds to the target scene;
[0023] The target area is subjected to color space conversion to obtain a second image.
[0024] In one embodiment, the color channel includes a luminance channel; the method further includes:
[0025] In response to the absence of a face region in the first image, the first image is subjected to region of interest identification, and the identified region of interest is segmented to obtain multiple segmented regions;
[0026] Determine the luminance characteristics of the luminance channels in each of the segmented regions;
[0027] In response to the brightness feature satisfying the validity condition, the region of interest is subjected to brightness smoothing processing based on the reference image to obtain the target region.
[0028] Secondly, this application also provides a focusing device, comprising:
[0029] The acquisition module is used to acquire images of the target scene at each lens position to obtain a first image at each lens position;
[0030] The encoding module is used to perform color space conversion on each of the first images to obtain a second image, and to encode and compress the second images to obtain an encoded image; the data volume of the encoded image is used as the focus value.
[0031] The focusing module is used to determine the target focus value that meets the focusing conditions, and to take the lens position corresponding to the target focus value as the focus position of the target scene.
[0032] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0033] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0034] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0035] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0036] Fourthly, this application also provides a chip, including a processor and a communication interface, wherein the processor is configured to cause the chip to perform:
[0037] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0038] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0039] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0040] Fifthly, this application also provides a chip module, including a communication module, a power module, a storage module, and a chip, wherein:
[0041] The power module is used to provide power to the chip module;
[0042] The storage module is used to store data and instructions;
[0043] The communication module is used for internal communication within the chip module, or for communication between the chip module and external devices.
[0044] The chip is used to perform the steps of the method provided in the first aspect above.
[0045] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0046] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0047] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0048] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0049] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0050] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0051] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0052] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0053] The aforementioned focusing method, device, computer equipment, chip, and chip module, after acquiring a first image of the target scene at each lens position, performs color space conversion on the first image to a color space more suitable for encoding and compression processing, obtaining a second image. Then, the second image is encoded and compressed, and the data volume of the compressed encoded image is directly used as the focus value. It can be understood that since the encoding and compression process is more sensitive to the compactness of the global information contained in the second image, the richer the details contained in a clearer second image, the higher the data volume of the encoded image. Therefore, the focus value can more stably and accurately reflect the overall sharpness change trend of the second image. Compared with the traditional contrast focusing method based on spatial gradient features to measure sharpness, it can avoid the misleading effect of halos and overexposed areas on the focus value in scenes such as point light sources. Furthermore, the lens position that meets the target focus value that meets the focusing conditions is used as the focus position of the target scene, thereby significantly improving the stability and success rate of autofocus in scenes such as point light sources and high contrast. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1 Here is a flowchart of a focusing method in one embodiment;
[0056] Figure 2 This is a flowchart illustrating the process of determining the focus value in one embodiment;
[0057] Figure 3 This is a schematic diagram of the first image, corresponding DCT spectrum, and spatial gradient feature map obtained by capturing the target scene from different lens positions in a specific embodiment.
[0058] Figure 4 This is a comparison chart of the focus numerical curve determined based on spatial gradient features and the focus numerical curve determined based on JPEG compression in a specific embodiment.
[0059] Figure 5 This is a hardware architecture diagram of a focusing method in one embodiment;
[0060] Figure 6 This is a schematic diagram of the face-based preprocessing flow in the focusing method of one embodiment;
[0061] Figure 7 This is a structural block diagram of the focusing device in one embodiment;
[0062] Figure 8 This is an internal structural diagram of a computer device in one embodiment;
[0063] Figure 9 This is a structural block diagram of a chip module in one embodiment. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0065] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0066] In traditional contrast-detection autofocus methods, the lens can be driven to acquire original images at different positions, and the image sharpness can be measured based on the spatial gradient features of the original images to determine the focus value corresponding to each position. Then, by combining search strategies such as hill climbing algorithms, the lens can be positioned to the position corresponding to the peak point of the focus value by tracking the changing trend of the focus value, thereby completing autofocus.
[0067] However, in scenarios with point light sources and high contrast, the spatial gradient features are easily misled by halos and overexposed areas, resulting in an abnormal phenomenon where the focus value is higher when the image is out of focus. Therefore, the obtained focus value cannot accurately reflect the true image sharpness, leading to a poor success rate of the autofocus function.
[0068] It is understandable that a point light source refers to an idealized point source, an abstract physical concept that does not exist in reality. It is only used to facilitate the analysis and representation of light sources, referring to a light source that emits uniform light from a single point in all directions. In the embodiments of this application, most scenarios are not intended to actually focus on a point light source, but rather to unintentionally or intentionally autofocus on part or the entire point light source in night scenes or night portrait scenes.
[0069] In this case, due to overexposure at the center of the point light source and halo at the edge, the spatial gradient features of the point light source area are basically lost. Only the halo part has spatial gradient features due to brightness differences. Moreover, as the degree of defocusing gradually increases, the brightness difference in the halo part decreases, and the spatial gradient features also gradually weaken. Therefore, autofocus based on spatial gradient features will lead to focus errors.
[0070] Based on this, in an exemplary embodiment, this application provides a focusing method that can be applied to a computer device with autofocus shooting function, the computer device being a terminal or a server.
[0071] For example, it can include, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. A client application for the target application can be installed and run on the terminal device. This target application can be an application for focusing or an application that provides focusing functionality; this application does not limit the specific form of the target application. Furthermore, this application does not limit the form of the target application, including but not limited to apps, mini-programs, etc., installed on the terminal device, and it can also be in web page form.
[0072] A server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. A server can be a backend server for the aforementioned target application, used to provide backend services to the client of the target application.
[0073] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Based on the cloud computing business model, cloud technology encompasses network technology, information technology, integration technology, management platform technology, and application technology. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0074] Specifically, such as Figure 1 As shown, this method includes the following steps:
[0075] Step 101: Capture images of the target scene at each camera position to obtain the first image at each camera position.
[0076] After the computer device's autofocus process is initiated, the lens can be driven to sequentially stop at multiple lens positions within an adjustable range, thereby capturing an image of the target scene at each lens position and obtaining a first image corresponding to each lens position. In one implementation, during the acquisition of the first image, the shooting settings parameters such as exposure parameters and white balance can be kept consistent to ensure the comparability of the first images acquired at different lens positions.
[0077] It can be understood that the first image is a preview image captured during the shooting process to achieve automatic focusing, while the final image recorded and stored after the shutter is triggered. After the shooting function is activated for the target scene, the lens can briefly pause at each lens position driven by the VCM (Voice Coil Motor). During this time, the image sensor can expose in preview mode, generating an image frame used to calculate focus values, which is the first image. The focusing process may continuously capture multiple frames of the first image to support subsequent analysis of focus value change trends based on sharpness, guiding the lens to position itself at the focus position of the target scene, which is the position where the target scene forms the sharpest image on the image sensor. Afterward, the first image is not stored or output until the shutter is triggered, controlling the image sensor to expose and read out, thus forming the final image for storage or output.
[0078] Step 102: For each first image, perform color space conversion on the first image to obtain a second image, and encode and compress the second image to obtain an encoded image; the data volume of the encoded image is used as the focus value.
[0079] For each first image, its corresponding focus value needs to be calculated. Specifically, each first image can first be converted to a different color space to obtain a second image. Typically, the original first image is in the RGB (Red, Green, Blue) color space, while the encoding and compression algorithm is more adaptable to color spaces that separate luminance and chrominance. Therefore, converting the first image to a second image through color space conversion can achieve the separation of luminance and chrominance, thus supporting the efficient execution of subsequent encoding and compression.
[0080] Then, a preset encoding and compression algorithm can be used to encode and compress the second image to obtain an encoded image. The preset encoding and compression algorithm may include, but is not limited to, image compression algorithms such as JPEG (Joint Photographic Experts Group), HEIF (High Efficiency Image File Format), or HEIC (High Efficiency Image Coding). This application embodiment does not specifically limit the specific algorithm used.
[0081] It is understandable that during the encoding and compression process, the higher the clarity of the second image, the richer the detailed information it contains, and therefore the larger the amount of data required for the generated encoded image. Based on this characteristic, the amount of data in the encoded image can be directly used as the focus value for the lens position corresponding to the current first image. In this way, the focus value does not need to rely on the analysis of the spatial gradient features of the first image, thus avoiding the influence of related interference factors.
[0082] Step 103: Determine the target focus value that meets the focus conditions, and take the lens position corresponding to the target focus value as the focus position of the target scene.
[0083] After acquiring the focus values corresponding to each lens position, the computer device can analyze and filter these focus values to determine the target focus value that meets the focusing conditions. The focusing conditions can be set based on the core requirements of autofocus. For example, it could be maximizing the focus value, i.e., using the lens position corresponding to the first image with the largest amount of encoded image data as the focus position, because the first / second image corresponding to this focus value has the richest detail and the highest sharpness. Alternatively, it can be set according to the actual application scenario, i.e., when the focus value corresponding to any lens position reaches or exceeds the preset sharpness threshold, it is determined that the focusing conditions are met, the search can be terminated, and that lens position can be used as the focus position, thereby improving the efficiency of autofocus. Additionally, it can be set that the difference between the focus value and the default reference value is greater than a preset difference value, i.e., when the positive difference between any focus value and the default reference value is greater than a preset difference threshold, it is determined that the sharpness has been significantly improved, meeting the focusing conditions, thus achieving fast focusing without pursuing absolute peak values.
[0084] After selecting the target focus value, the lens position corresponding to the target focus value can be located by querying the correspondence between the focus value and the lens position. This lens position is then determined as the focus position of the target scene. This means that the image of the target scene captured at this focus position has sufficient clarity to meet the shooting requirements. Furthermore, the lens can be moved to this focus position by using VCM to complete the autofocus operation and ensure that the target scene can be clearly imaged.
[0085] As can be seen from the above, in the solution provided in this application, after acquiring the first image of the target scene at each lens position, the first image is converted to a color space more suitable for encoding and compression processing to obtain the second image. Then, the second image is encoded and compressed, and the data volume of the encoded image generated after compression is directly used as the focus value. It can be understood that since the encoding and compression process is more sensitive to the compactness of the global information included in the second image, the richer details contained in a clearer second image will lead to a higher data volume in the encoded image. Therefore, the focus value can more stably and accurately reflect the overall sharpness change trend of the second image. Compared with the traditional contrast focusing method based on spatial gradient features to measure sharpness, it can avoid the misleading effect of halos and overexposed areas on the focus value in scenes such as point light sources. Furthermore, the lens position that meets the target focus value that meets the focusing conditions is used as the focus position of the target scene, thereby significantly improving the stability and success rate of autofocus in scenes such as point light sources and high contrast.
[0086] In an exemplary embodiment, step 101, acquiring images of the target scene at each camera position to obtain a first image at each camera position, includes:
[0087] Step 1011: Acquire sensor data of the target scene at each lens position.
[0088] Step 1012: Perform pixel interpolation on the sensor data to obtain the first image of each lens position.
[0089] In this exemplary embodiment, step 101 includes two specific operations for acquiring and generating the first image. First, sensor data of the target scene acquired at each lens position can be obtained. This step relies on the VCM driving the lens to move the lens to each designated lens position. Then, at the current lens position, the image sensor senses the light signal of the target scene, converts the light signal into an electrical signal, and generates the original sensor data. The sensor data directly reflects the optical information of the target scene at the current lens position and is the basis for subsequent image generation. Its acquisition process follows preset shooting parameters such as exposure time and sensitivity to ensure the accuracy and consistency of the generated first images.
[0090] The image sensor can be a sensor with a CFA (Color Filter Array). Each pixel on the surface of this type of image sensor is covered with a tiny red, green, or blue filter, allowing only specific wavelengths of light to be captured by the photosensitive unit below. Therefore, each pixel can only record specific color information (red, green, or blue) and output raw sensor data. The photosensitive unit can use a CCD (Charge-Coupled Device), CMOS (Complementary Metal-Oxide-Semiconductor), or any other semiconductor technology capable of photoelectric conversion to capture light and generate sensor data. This application does not specifically limit the specific technology used.
[0091] It's understandable that sensor data is a mosaic pattern composed of regularly arranged red, green, and blue pixels, which cannot accurately reflect the true colors and details of a scene. Therefore, pixel interpolation processing is needed to demosaic the sensor data, resulting in an RGB image that is perceptible to the human eye, i.e., the first image.
[0092] Among them, pixel interpolation processing can use algorithms such as bilinear interpolation and bicubic interpolation. By utilizing the other color information recorded by the neighboring pixels around each pixel, the missing two other color values of the pixel can be estimated and filled. For example, for a pixel that only records red information, the green and blue information corresponding to the pixel can be calculated based on the color information of its green and blue neighboring pixels above, below, left, and right. After processing, each pixel will have complete red, green, and blue three-channel data, thereby generating a first image with complete image quality that meets the requirements of subsequent processing.
[0093] In one implementation, step 1012 involves performing pixel interpolation on the sensor data to obtain a first image of each lens position, including:
[0094] Pixel interpolation is performed on the sensor data to obtain the original images of each lens position;
[0095] The original image is subjected to noise suppression, color normalization, and image quality enhancement to obtain the first image.
[0096] In this implementation, pixel interpolation of sensor data can be performed using an ISP Pipeline (ImageSignal Processor Pipeline) to generate a first image that meets the requirements.
[0097] Specifically, the original sensor data is first processed using a preset pixel interpolation algorithm to fill in the missing pixel data, thereby obtaining the original image corresponding to each lens position. This original image already has basic image outline and color information, but may have problems such as noise and color deviation.
[0098] Based on this, further optimization processing can be performed on the original image, including but not limited to noise suppression, color normalization, and image quality enhancement.
[0099] Among them, noise reduction algorithms such as Gaussian filtering and median filtering can be used to suppress noise in the original image, remove random noise and salt-and-pepper noise caused by the image sensor itself or environmental interference, and improve the image purity.
[0100] Color standardization includes white balance and color gamut conversion. White balance corrects the overall color cast caused by different light source color temperatures, ensuring that white objects can be reproduced as neutral white under various lighting conditions. This is the foundation for achieving color accuracy and consistency. Color gamut conversion transforms the original image, after white balance processing, from the RGB color space associated with the image sensor to the standard CIE XYZ (Commission Internationale de l'Éclairage XYZ, International Commission on Illumination XYZ) color space, providing an objective and unified benchmark for subsequent color processing.
[0101] Image enhancement includes color adjustment and color gamut mapping. Color adjustment refers to adjusting parameters such as contrast, saturation, and hue of the original image based on color standardization, thereby improving the visual effect and color performance of the original image. Color gamut mapping refers to mapping the color-adjusted original image to the sRGB (Standard Red Green Blue) color space to ensure the consistency and compatibility of the resulting image's colors across different display devices.
[0102] In this way, by processing the raw sensor data through the ISP Pipeline, a first image with clear image quality, accurate color, and low noise can be obtained, providing reliable data support for subsequent operations such as color space conversion and encoding compression.
[0103] In an exemplary embodiment, step 102, encoding and compressing each second image to obtain a corresponding encoded image, includes:
[0104] Step 1021: For each second image, perform block processing on each color channel of the second image to obtain multiple image blocks.
[0105] Step 1022: For each image block, perform discrete cosine transform on the image block to obtain the frequency domain coefficient matrix of the image block, and quantize the frequency domain coefficient matrix to obtain the quantization coefficient matrix.
[0106] Step 1023: Perform entropy coding based on each quantization coefficient matrix to obtain the coded image corresponding to each second image.
[0107] In this exemplary embodiment, the second image is located in a target color space that includes color channels. The JPEG compression algorithm can be used to encode and compress the second image through steps 1021 to 1023 to generate an encoded image.
[0108] Specifically, for each second image, its various color channels can be independently divided into blocks. This means dividing the image data corresponding to each color channel into multiple uniformly sized image blocks, ensuring that subsequent transformation and encoding operations can be performed efficiently on a block-by-block basis, laying the foundation for frequency domain processing. For example, each image block can be 8 pixels × 8 pixels in size.
[0109] Understandably, during the conversion of the first image to the second image, different downsampling strategies may be employed for each color channel. Consequently, the resolutions of different color channels will vary, and therefore, the number of image blocks obtained for each color channel after block processing will also differ. For example, if the second image is in the YCbCr (Luma, Chrominance Blue, Chrominance Red) color space, then the luminance channel may retain full resolution, while the two chrominance channels may be downsampled using a format such as 4:2:0, meaning that the resolution of the chrominance channels is halved in both the horizontal and vertical directions.
[0110] Then, for each segmented image patch, the pixel values included in the patch are calculated using DCT (Discrete Cosine Transform). This converts the pixel values describing the brightness variations of the image patch in the two-dimensional plane into a set of cosine wave components of different frequencies, resulting in the frequency domain coefficient matrix corresponding to the image patch. Each frequency domain coefficient in the matrix corresponds to a specific spatial frequency, and the magnitude of this coefficient represents the intensity of the cosine wave component at that spatial frequency, thus achieving the conversion from the spatial domain to the frequency domain. Subsequently, the frequency domain coefficient matrix is quantized using a preset quantization table. Division and rounding operations are used to compress the data volume of the frequency domain coefficient matrix, reducing many small-valued frequency domain coefficients corresponding to high-frequency details to zero, resulting in a quantized coefficient matrix mainly composed of integers.
[0111] Furthermore, entropy encoding can be performed on each quantization coefficient matrix. The two-dimensional quantization coefficient matrix can be converted into a one-dimensional sequence by zigzag scanning. Run-length encoding is performed on the continuous zero values. The one-dimensional sequence is compressed using lossless compression methods such as Huffman coding to further remove data redundancy. The discrete quantization coefficient matrix is converted into a continuous binary code stream. The file composed of this binary code stream is the encoded image corresponding to the second image.
[0112] In this way, the encoding and compression process can fully separate and process the color and detail information of the second image, making the data volume of the encoded image extremely sensitive to changes in the true sharpness of the second image. Thus, in high-contrast scenes such as point light sources, it can avoid misjudgments caused by halos and overexposure due to traditional spatial gradient features, significantly improving the accuracy and reliability of focus values and laying a solid foundation for subsequent focus decisions.
[0113] In an exemplary embodiment, step 102, which involves color space conversion of the first image to obtain a second image, includes:
[0114] Step 201: Perform face recognition on the first image;
[0115] Step 202a: In response to the recognition of a face region in the first image, face alignment is performed based on the face region in the reference image and the face region in the first image to determine the target region; the reference image is the previous frame of the first image and corresponds to the target scene;
[0116] Step 203: Perform color space conversion on the target area to obtain the second image.
[0117] In this implementation, before the first image undergoes color space conversion, face recognition technology can be used to preprocess the first image, thereby improving the efficiency and accuracy of subsequent encoding and compression.
[0118] Specifically, the first step is to perform face recognition on the first image to be processed, using a preset face recognition algorithm to detect whether a face region exists in the first image. If a face region is detected in the first image, the previous frame of the first image is used as a reference image. The recognized face region in the reference image is extracted and matched with the recognized face region in the first image. A preset face alignment algorithm is then used to match and align the two face regions, eliminating positional deviations caused by slight movements, pose adjustments, or changes in shooting angle between the two frames. The aligned face-related region is then determined as the target region, which is the core range for subsequent block processing.
[0119] After completing face alignment and determining the target region, the target region can be divided into independent blocks for each color channel. The target region image data corresponding to each color channel is divided into multiple image blocks of uniform size and distribution. Finally, multiple image blocks are obtained for subsequent operations such as discrete cosine transform and quantization, so as to achieve accurate adaptation between block processing and face region in the target scene.
[0120] It is important to note that the reference image also corresponds to the current target scene, ensuring the continuity and consistency of the scene. Based on this, in one implementation, before performing face recognition on the first image, inter-frame relationship detection can be performed between the first image and its previous frame. If the similarity of the two frames in global or local features satisfies the correlation condition, it can be determined that the first image and its previous frame captured the same target scene, and therefore the previous frame can be used as the reference image. Conversely, if the similarity of the two frames in global or local features does not satisfy the correlation condition, it can be determined that the first image and its previous frame captured different target objects. In this case, the previous frame will not be used as the reference image, and due to the change in the captured scene, the current autofocus process will terminate, and a new round of autofocus will be restarted.
[0121] The correlation conditions may include feature matching degree conditions, i.e., the number of key point features successfully matched between two frames of images exceeds a preset threshold, and the spatial distribution consistency of these matched points is lower than a preset error threshold; or, structural similarity conditions, i.e., the comprehensive similarity index of two frames of images in terms of brightness, contrast and structure is higher than a preset similarity threshold; in addition, motion continuity conditions may be included, i.e., the image content of the corresponding region of the current first image is predicted based on the previous frame image, and if the difference between the image content of the first image and the predicted image content is less than the fault tolerance threshold, then the correlation conditions are satisfied.
[0122] In this way, by introducing an inter-frame alignment mechanism on the basis of face recognition, it is ensured that the core object of subsequent encoding and compression can continuously and stably lock onto the face subject. This effectively overcomes the problem of focus area drift caused by the movement of the person, changes in posture, or hand shake. It ensures that the sharpness measurement is always centered around the visual focus of the user, greatly improving the pertinence and stability of the focus value calculation. As a result, it significantly enhances the tracking ability of the autofocus system and the focus accuracy of the final image in dynamic scenes such as portrait shooting.
[0123] In one implementation, the color channel includes a luminance channel; this method also includes:
[0124] Step 202b: In response to the absence of a face region in the first image, region of interest (ROI) identification is performed on the first image, and the identified ROI is segmented to obtain multiple segmented regions; the brightness features of the brightness channel of each segmented region are determined; in response to the brightness features satisfying the validity condition, brightness smoothing processing is performed on the ROI based on the reference image to obtain the target region.
[0125] In this implementation, the color channel includes a luminance channel. Therefore, in the case where no face region is identified in step 201, the target region in the first image can be determined through processes such as region of interest identification, luminance feature judgment, and luminance smoothing, so as to ensure that the block processing can still focus on the effective region and guarantee the quality of subsequent encoding.
[0126] Specifically, after performing face recognition on the first image, if no face region is detected, ROI (Region of Interest) identification can be performed on the first image to select regions in the first image that have clear information value and whose details need to be preserved as ROIs. For example, ROIs can be core objects in the target scene, non-redundant key scene content, etc.
[0127] Subsequently, the identified region of interest (ROI) can be segmented into multiple regions to facilitate accurate analysis of subsequent brightness features. Since the color channel includes a brightness channel, the brightness features of the brightness channel in each segmented region will be extracted. These brightness features can be specifically represented by parameters such as the average brightness value, brightness variance, and brightness gradient within the segmented region, which are used to characterize the overall pattern and detailed features of brightness variations within the region.
[0128] Afterwards, the extracted brightness features can be evaluated for validity. If the brightness features of a segmented region meet the preset validity conditions, it indicates that the brightness features of the segmented region conform to the normal representation of the target scene and there are no feature anomalies caused by overexposure, severe dark area loss, or noise interference. It is valuable for subsequent processing. Then, using the reference image of the first image as a benchmark, brightness smoothing processing is performed on the region of interest where the segmented region is located to correct brightness abrupt changes in the region of interest and weaken brightness fluctuations caused by noise, so that the brightness distribution of the region of interest is more uniform and the features are more stable, thereby obtaining the target region.
[0129] This avoids focusing on invalid areas such as solid colors, overexposed areas, or underexposed areas, fundamentally eliminating misjudgments and focus failures caused by improper area selection. Simultaneously, brightness smoothing effectively suppresses the interference of inter-frame illumination fluctuations on the amount of encoded compressed data, allowing subsequent focus values to more purely reflect changes in sharpness caused by lens movement. This significantly improves the accuracy, robustness, and success rate of autofocus in non-portrait scenes.
[0130] like Figure 2 The diagram shown is a flowchart illustrating a method for determining focus values according to this application, which specifically includes the following steps:
[0131] First, sensor data collected from the target scene at each lens position is acquired. Pixel interpolation is performed on the sensor data to obtain the original image at each lens position. Then, white balance, color gamut conversion, color adjustment, and color gamut mapping are performed on the original image to obtain a first image in the sRGB color space. Next, for each first image, color space conversion is performed to obtain a second image, and the second image is JPEG encoded and compressed to obtain an encoded image. The data volume of the encoded image can be used as the focus value. This method determines the focus value based on JPEG compression; therefore, it can be called the JAFM (Joint Photographic Experts Group Auto Focus Monitor) method.
[0132] like Figure 3 As shown, these are four first images obtained from shots taken at camera positions 76, 176, 276, and 376, capturing the target scene of the ceiling light. Figure 3 (a1, a2, a3, a4) and the corresponding region of interest in the target scene (e.g. Figure 3 DCT spectrum of (a1) Figure 3 (b1, b2, b3, b4), spatial gradient feature map ( Figure 3 As can be seen from c1, c2, c3, and c4, the first image corresponding to lens position 176 is the clearest of the four first images. Correspondingly, the DCT spectrum information corresponding to lens position 176 is also richer, especially the high-frequency information is more significant, which can better represent the clarity of the first image. However, the gradient information in the spatial gradient feature map corresponding to lens position 176 is less. It is conceivable that if the focus value is calculated based on the spatial gradient feature map, it may cause a defocusing problem.
[0133] like Figure 4 As shown, this is for Figure 3 After capturing the first images of the target scene—the ceiling light—from multiple camera positions, the focus numerical curve (peak on the right) determined using traditional spatial gradient features and... Figure 2 The chart shown compares the focus value curves (peak on the left) determined based on JPEG compression, where the horizontal axis represents lens position and the vertical axis represents focus value. It can be seen that the peak of the focus value curve determined based on JPEG compression is closer to lens position 176, which is precisely the optimal focus position determined during actual measurement.
[0134] Therefore, in scenes containing point light sources, due to the objectively high dynamic range characteristics, automatic exposure control prioritizes the brightness of non-point light source areas. This leads to severe overexposure in point light source areas, resulting in the loss of central details, while non-point light source areas lack significant gradient changes due to insufficient brightness. This brightness distribution makes it difficult for traditional focusing methods based on spatial gradients to extract effective sharpness features. However, in frequency domain analysis, the rich spectral information contained in point light sources can be fully captured. The sharper the first image, the more significant the frequency domain components corresponding to the point light source, and the more complete the spectral structure. The JPEG compression-based focusing method proposed in this application performs exceptionally well in point light source scenes precisely because the discrete cosine transform upon which JPEG compression relies naturally possesses a compact representation capability for signal energy. It can efficiently convert the frequency domain information contained in the point light source into a measurable amount of compressed data, thereby achieving an accurate assessment of image sharpness.
[0135] Figure 5 Here is a hardware architecture diagram of a focusing method in one embodiment, wherein:
[0136] First, the lens acquires sensor data through the image sensor. After processing such as front-end preprocessing, white balance, bad pixel correction, depixelation, noise suppression, and edge enhancement, the resulting first image is input to the data distribution module.
[0137] Furthermore, in the hardware structure provided in this embodiment, after performing bad pixel correction on the sensor data, it can be initially cropped, and the cropped sensor data can be input to the autofocus monitor. The autofocus monitor can process the cropped sensor data using a focusing algorithm based on spatial gradient features, and transmit the calculated focus value to the data distribution module. Then, through the kernel layer, hardware abstraction layer, camera service component, and AF Ctrl component, it drives the VCM to position the lens at the focus position. In this way, an alternative autofocus chain can be provided to improve hardware robustness.
[0138] The data distribution module transmits the first image to the AF Algo component through the kernel layer, hardware abstraction layer, camera service component, and AF Ctrl component. The JAFM thread built into the AF Algo component performs preprocessing operations such as face recognition on the first image, and then transmits the recognized target area back to the data distribution module along the original link.
[0139] Then, the data distribution module transmits the target area of the first image to the JPEG encoder. The JPEG encoder performs color space conversion on the target area of the first image to obtain the second image, and performs JPEG encoding compression on the second image to obtain the encoded image. The data volume of the encoded image is used as the focus value, which is then transmitted back to the AF Algo component through the data distribution module. The JAFM thread built into the AF Algo component determines the target focus value that meets the focus conditions from the focus values corresponding to each lens position, and uses the lens position corresponding to the target focus value as the focus position of the target scene, which is then transmitted to the AF Ctrl component.
[0140] Furthermore, the JAFM thread built into the AF Ctrl component drives the VCM to position the lens at the received focus position, thereby interacting with the user on the front-end interface and achieving the effect of autofocus.
[0141] Figure 6 This is a schematic diagram of a face-based preprocessing flow in a focusing method according to one embodiment, including:
[0142] The data distribution module transmits the first image to the AF Ctrl component through the hardware abstraction layer. The AF Ctrl component passes through the first image and transmits it to the AF Algo component. The JAFM thread built into the AF Algo component performs inter-frame relationship detection between the first image and the previous frame image.
[0143] If the similarity of two images in global or local features satisfies the correlation condition, it can be determined that the first image and its preceding image captured the same target scene, and therefore the preceding image can be used as a reference image. Conversely, if the similarity of two images in global or local features does not satisfy the correlation condition, it can be determined that the first image and its preceding image captured different target objects. In this case, the preceding image will not be used as a reference image, and due to the change in the captured scene, the current autofocus process will be terminated, and a new round of autofocus will be restarted.
[0144] In response to the identification of a face region in the first image, face alignment is performed based on the face region in the reference image and the face region in the first image to determine and crop the target region.
[0145] In response to the absence of a face region in the first image, the region of interest (ROI) is identified in the first image, and the identified ROI is segmented to obtain multiple segmented regions. The brightness features of the brightness channel of each segmented region are determined. In response to the brightness features satisfying the validity condition, the ROI is smoothed based on the reference image to obtain the target region.
[0146] Furthermore, the identified target area can be transmitted back to the data distribution module along the original link. Then, the data distribution module transmits the target area of the first image to the JPEG encoder to realize the subsequent encoding compression and autofocus process.
[0147] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0148] Based on the same inventive concept, this application also provides a focusing device for implementing the focusing method described above. This device can be applied to or integrated into a chip or chip module, for example. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more focusing device embodiments provided below can be found in the limitations of the focusing method described above, and will not be repeated here.
[0149] In one exemplary embodiment, such as Figure 7 As shown, a focusing device is provided, which includes:
[0150] The acquisition module 701 is used to acquire images of the target scene at each lens position to obtain a first image at each lens position;
[0151] The encoding module 702 is used to perform color space conversion on each of the first images to obtain a second image, and to encode and compress the second image to obtain an encoded image; the data volume of the encoded image is used as the focus value.
[0152] The focusing module 703 is used to determine the target focus value that meets the focusing conditions, and to use the lens position corresponding to the target focus value as the focus position of the target scene.
[0153] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all of their modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all of their modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0154] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores measurement data and / or positioning information. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a focusing method.
[0155] Those skilled in the art will understand that Figure 8The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0156] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0157] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0158] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0159] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0160] Based on the same inventive concept, this application also provides a chip, including a processor and a communication interface; the communication interface is used to receive or send data; the processor is configured to cause the chip to perform the following steps:
[0161] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0162] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0163] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0164] It is understood that the chip involved in the embodiments of this application may be a field-programmable gate array (FPGA), may be an application-specific integrated circuit (ASIC), may be a system on chip (SoC), may be a central processor unit (CPU), may be a network processor (NP), may be a digital signal processor (DSP), may be a microcontroller unit (MCU), may be a programmable logic device (PLD), or other integrated chips, etc.
[0165] Based on the same inventive concept, this application also provides a chip module, such as... Figure 9 As shown, the chip module includes a communication module, a power module, a storage module, and a chip. Among them:
[0166] The power module is used to provide power to the chip module; the storage module is used to store data and instructions; the communication module is used for internal communication within the chip module, or for communication between the chip module and external devices; this chip corresponds to the chip in the above chip embodiment.
[0167] The implementation method of this chip module can be found in the relevant content of the above chip embodiment, and will not be repeated here.
[0168] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0169] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0170] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0171] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0172] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0173] Images of the target scene are captured at each camera position to obtain a first image at each camera position;
[0174] For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value;
[0175] Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
[0176] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all of their modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into a chip module, all of their modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., a chip circuit module) or different components of the chip module, or at least some modules / units... It can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0177] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0178] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0179] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0180] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A focusing method, characterized in that, The method includes: Images of the target scene are captured at each camera position to obtain a first image at each camera position; For each of the first images, the color space of the first image is converted to obtain a second image, and the second image is encoded and compressed to obtain an encoded image; the data volume of the encoded image is used as the focus value; Determine the target focus value that meets the focus conditions, and use the lens position corresponding to the target focus value as the focus position of the target scene.
2. The method according to claim 1, characterized in that, The step of acquiring images of the target scene at each camera position to obtain a first image at each camera position includes: Acquire sensor data of the target scene at each camera position; The sensor data is subjected to pixel interpolation to obtain a first image of each lens position.
3. The method according to claim 2, characterized in that, The step of performing pixel interpolation processing on the sensor data to obtain a first image for each of the lens positions includes: The sensor data is subjected to pixel interpolation to obtain the original image of each lens position; The original image is subjected to noise suppression, color normalization, and image quality enhancement to obtain the first image.
4. The method according to claim 1, characterized in that, The step of encoding and compressing each of the second images to obtain the corresponding encoded images includes: For each of the second images, each color channel of the second image is divided into blocks to obtain multiple image blocks; For each of the image blocks, a discrete cosine transform is performed on the image block to obtain the frequency domain coefficient matrix of the image block, and the frequency domain coefficient matrix is quantized to obtain the quantization coefficient matrix; Entropy coding is performed based on each of the quantization coefficient matrices to obtain the encoded image corresponding to each of the second images.
5. The method according to claim 1, characterized in that, The step of performing color space conversion on the first image to obtain the second image includes: Perform facial recognition on the first image; In response to the identification of a face region in the first image, face alignment is performed based on the face region in the reference image and the face region in the first image to determine the target region; the reference image is the previous frame of the first image, and the reference image corresponds to the target scene; The target area is subjected to color space conversion to obtain a second image.
6. The method according to claim 5, characterized in that, The color channel includes a luminance channel; the method further includes: In response to the absence of a face region in the first image, the first image is subjected to region of interest identification, and the identified region of interest is segmented to obtain multiple segmented regions; Determine the luminance characteristics of the luminance channels in each of the segmented regions; In response to the brightness feature satisfying the validity condition, the region of interest is subjected to brightness smoothing processing based on the reference image to obtain the target region.
7. A focusing device, characterized in that, The device includes: The acquisition module is used to acquire images of the target scene at each lens position to obtain a first image at each lens position; The encoding module is used to perform color space conversion on each of the first images to obtain a second image, and to encode and compress the second images to obtain an encoded image; the data volume of the encoded image is used as the focus value. The focusing module is used to determine the target focus value that meets the focusing conditions, and to take the lens position corresponding to the target focus value as the focus position of the target scene.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A chip, characterized in that, The device includes a processor and a communication interface, wherein the processor is configured to cause the chip to perform the steps of the method described in any one of claims 1 to 6.
10. A chip module, characterized in that, The device includes a communication module, a power module, a storage module, and a chip, wherein: the power module provides power to the chip module; the storage module stores data and instructions; the communication module performs internal communication within the chip module or communication between the chip module and external devices; and the chip performs the steps of the method described in any one of claims 1 to 6.