A focusing adjustment method, device and equipment

By acquiring the focusing parameter images of the infrared camera and combining edge detection and frequency domain filtering algorithms, the optimal focusing parameters are automatically selected, solving the problem of image clarity and quality of the infrared camera and achieving efficient and accurate focusing adjustment.

CN123145488APending Publication Date: 2026-11-20ZHEJIANG PIXFRA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611460179.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-18
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Traditional visible light autofocus algorithms struggle to achieve ideal focusing results in infrared cameras, resulting in poor clarity and quality of infrared images.

Method used

By acquiring infrared images based on each focusing parameter, and using a preset evaluation algorithm and image content to determine the evaluation operator, the optimal focusing parameters are automatically selected for focusing adjustment. This includes a combination of edge detection and frequency domain filtering algorithms to adapt to the characteristics of different infrared images.

Benefits of technology

It enables automatic focus adjustment of infrared cameras, improves image clarity and quality, ensures clear imaging under optimal focus parameters, and reduces the impact of human intervention and subjective estimation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123145488A_ABST
    Figure CN123145488A_ABST
Patent Text Reader

Abstract

The application relates to the field of infrared imaging technology, in particular to a focusing adjustment method, device and equipment. In the embodiment of the application, the imaging differences under different focusing parameters are obtained by acquiring infrared images collected based on each focusing parameter; and based on a preset evaluation algorithm and the content carried in each infrared image, an evaluation operator corresponding to each infrared image is determined, so that the image quality of each infrared image can be objectively and quantitatively reflected, the evaluation result is more accurate and reliable; and the optimal focusing parameter in each focusing parameter is determined based on the evaluation operator corresponding to each infrared image, the infrared camera is focused by using the optimal focusing parameter, so that the whole focusing adjustment process can be automatically completed without manual participation and subjective estimation, the accuracy and reliability of the focusing adjustment of the infrared camera are improved, and it is ensured that the infrared camera can clearly image under the optimal focusing parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of infrared imaging technology, and in particular to a focusing adjustment method, apparatus and device. Background Technology

[0002] Infrared cameras, as imaging devices capable of operating under complex lighting conditions and harsh environments, play an irreplaceable role in fields such as night vision reconnaissance, industrial inspection, medical diagnosis, and security monitoring. In the field of infrared imaging, autofocus technology is the core element ensuring the acquisition of high-quality, high-resolution images.

[0003] Since infrared cameras receive the thermal radiation emitted by the object itself, their imaging principle is significantly different from that of visible light cameras. This makes it difficult for traditional visible light autofocus algorithms to achieve ideal focusing results when directly applied to infrared cameras.

[0004] Therefore, there is an urgent need for a focus adjustment method that can be used to adjust the focus of an infrared camera, thereby improving the clarity and image quality of the infrared images captured by the infrared camera. Summary of the Invention

[0005] This application provides a focus adjustment method, apparatus, and device for focusing an infrared camera, thereby improving the clarity and image quality of infrared images captured by the infrared camera.

[0006] In a first aspect, embodiments of this application provide a focus adjustment method, the method comprising: Acquire infrared images based on each focus parameter; Based on a preset evaluation algorithm and the content carried in each infrared image, an evaluation operator corresponding to each infrared image is determined, and the evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused based on the optimal focusing parameter.

[0007] In one possible implementation, the evaluation algorithms corresponding to different infrared images may be the same or different; The process of determining the evaluation algorithm for any given infrared image includes: Identify the number of corner points contained in the infrared image, and determine the target size relationship between the number of corner points and a set corner point number threshold; Based on the pre-saved correspondence between size relationships and evaluation algorithms, the evaluation algorithm corresponding to the target size relationship is determined.

[0008] In one possible implementation, if the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the edge detection algorithm, edge detection is performed on the infrared image to obtain an edge image; based on the pixel value of each pixel in the edge image, the mean pixel value corresponding to the edge image is determined; based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the high-frequency component corresponding to the infrared image; the sum of the high-frequency component and the mean pixel value is determined as the evaluation operator corresponding to the infrared image.

[0009] In one possible implementation, the step of performing edge detection on the infrared image based on the edge detection algorithm to obtain an edge image includes: Obtain the Sobel operator corresponding to each filtering direction; Based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered in each filtering direction to obtain the sub-edge image corresponding to each filtering direction; Based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

[0010] In one possible implementation, the filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

[0011] In one possible implementation, if the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the low-frequency component corresponding to the infrared image; the low-frequency component is determined as the evaluation operator corresponding to the infrared image.

[0012] In one possible implementation, before identifying the number of corner points contained in the infrared image, the method further includes: Based on the guided filtering algorithm, the infrared image is filtered to remove the impulse noise contained in the infrared image; The identification of the number of corner points contained in the infrared image includes: Based on the established corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image.

[0013] In one possible implementation, identifying the number of corner points contained in the infrared image includes: Based on the corner recognition algorithm, each pixel in the infrared image is traversed to determine the target pixel that is a corner in the infrared image; If the number of target pixels identified reaches the set number, the number of corner points contained in the infrared image is determined to be the set number, and corner point identification of the infrared image is stopped. If the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corner points; Wherein, the set number is greater than the set corner point number threshold.

[0014] Secondly, embodiments of this application also provide a focus adjustment device, the device comprising: The acquisition module is used to acquire infrared images based on each focus parameter; The evaluation module is used to determine the evaluation operator corresponding to each infrared image based on a preset evaluation algorithm and the content carried in each infrared image. The evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focus parameter among the focus parameters is determined. A focusing module is used to focus the infrared camera based on the optimal focusing parameters.

[0015] Thirdly, embodiments of this application also provide an electronic device, the electronic device including a processor, the processor being configured to execute a computer program stored in a memory to implement the steps of the focus adjustment method as described in any of the preceding claims.

[0016] In this embodiment, by acquiring infrared images based on each focusing parameter, the imaging differences under different focusing parameters are obtained; and based on a preset evaluation algorithm and the content carried in each infrared image, the evaluation operator corresponding to each infrared image is determined, thereby objectively and quantitatively reflecting the image quality of each infrared image, making the evaluation results more accurate and reliable; and based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused using the optimal focusing parameter, so that the entire focusing adjustment process can be completed automatically without manual intervention and subjective estimation, which not only improves the accuracy and reliability of the infrared camera's focusing adjustment, but also ensures that the infrared camera can achieve clear imaging under the optimal focusing parameter. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of a focus adjustment process provided in an embodiment of this application; Figure 2 A schematic diagram illustrating the process of frequency domain filtering of infrared images based on IIR and FIR filters, provided in an embodiment of this application; Figure 3a A schematic diagram of the original infrared image provided in the embodiments of this application; Figure 3b This is a schematic diagram of an image obtained by edge extraction from a raw infrared image, as provided in an embodiment of this application. Figure 3c A schematic diagram of an image obtained by edge extraction of a guided-filtered infrared image, provided in an embodiment of this application; Figure 3d This is a schematic diagram of an image obtained by edge extraction from an infrared image after Gaussian filtering and guided filtering, as provided in an embodiment of this application. Figure 4 A flowchart illustrating the calculation of an evaluation operator for any infrared image provided in an embodiment of this application; Figure 5 This is a schematic diagram of a focus adjustment device provided in an embodiment of this application; Figure 6 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] In the fields of infrared detection and imaging, infrared radiation is an electromagnetic wave with wavelengths between visible light and microwaves, imperceptible to the human eye. Therefore, an infrared detector can convert the incident infrared radiation signal into an electrical signal output, which is then processed to form an infrared image reflecting the temperature distribution of the scene. Autofocus is an automatic adjustment process that enables the imaging system to achieve accurate and clear imaging. For infrared cameras, due to factors such as manufacturing tolerances of the optical lens, changes in ambient temperature, and mechanical vibrations, the actual imaging plane may deviate from the ideal focal plane, resulting in blurred images. Therefore, automatic focus adjustment of the infrared camera is necessary before or during infrared image acquisition.

[0021] Since infrared cameras receive the thermal radiation emitted by the object itself, their imaging principle is significantly different from that of visible light cameras. This makes it difficult for traditional visible light autofocus algorithms to achieve ideal focusing results when directly applied to infrared cameras.

[0022] Therefore, there is an urgent need for a focus adjustment method that can be used to adjust the focus of an infrared camera, thereby improving the clarity and image quality of the infrared images captured by the infrared camera.

[0023] Therefore, in order to achieve automatic focus adjustment of infrared cameras, improve the accuracy and reliability of infrared camera focus adjustment, ensure that infrared cameras achieve clear imaging under optimal focus parameters, and thus improve the imaging clarity of infrared cameras, this application provides a focus adjustment method, apparatus, and device. The focus adjustment method includes: acquiring infrared images based on each focus parameter; determining an evaluation operator corresponding to each infrared image based on a preset evaluation algorithm and the content carried in each infrared image, the evaluation operator being used to evaluate the image quality of the corresponding infrared image; determining the optimal focus parameter among each focus parameter based on the evaluation operator corresponding to each infrared image, and focusing the infrared camera based on the optimal focus parameter.

[0024] Example 1: Figure 1 This application provides a schematic diagram of a focus adjustment process, which includes: S101: Acquire infrared images based on each focus parameter.

[0025] The focus adjustment method provided in this application is applied to an electronic device, which may be a server, PC, terminal, infrared camera, or infrared camera controller, etc.

[0026] In order to achieve focusing of the infrared camera and thus improve the image quality of the infrared images acquired by the infrared camera, in this embodiment of the application, the electronic device can control the infrared camera to acquire infrared images based on different focusing parameters, and select the optimal focusing parameters based on the image quality of the infrared images corresponding to different focusing parameters, thereby achieving focusing of the infrared camera.

[0027] The focusing parameters of the infrared camera are parameters used to characterize the current focusing state of the infrared camera. For example, the focusing parameters can be different steps of the focusing motor or different physical focusing positions of the lens, etc., which can characterize the focusing state. This application does not specifically limit this.

[0028] For example, an electronic device can control the focusing motor of an infrared camera to move sequentially to the position corresponding to each focusing parameter according to a preset movement strategy. At each position corresponding to a focusing parameter, the electronic device controls the infrared camera to acquire an infrared image, thereby obtaining an infrared image based on each focusing parameter. This movement strategy can involve the electronic device controlling the focusing motor to move in preset step sizes, causing the infrared camera to acquire infrared images sequentially at different focusing positions. The resulting multiple infrared images cover the complete imaging state change process from blurry to clear and then from clear to blurry, thus enabling more accurate determination of the optimal focusing parameters.

[0029] S102: Based on a preset evaluation algorithm and the content carried in each infrared image, determine the evaluation operator corresponding to each infrared image, and the evaluation operator is used to evaluate the image quality of the corresponding infrared image.

[0030] In this embodiment, after acquiring infrared images corresponding to multiple focusing parameters, the electronic device can determine the evaluation operator corresponding to each infrared image based on a preset evaluation algorithm and the content carried in each infrared image. The evaluation operator is an indicator used to quantify the image quality of the infrared image; its magnitude reflects the sharpness of the corresponding infrared image. For example, a larger evaluation operator generally indicates a sharper image and higher image quality; a smaller evaluation operator indicates a blurrier image and lower image quality.

[0031] Since different infrared images may carry different content—for example, some images may have rich scene textures while others may have poor textures—the evaluation algorithms used to calculate the evaluation operators for different infrared images can be the same or different.

[0032] Optionally, the evaluation algorithm can be at least one of edge detection algorithms and frequency domain filtering algorithms. The following describes a method for determining the evaluation operator corresponding to an infrared image based on different evaluation algorithms: If the evaluation algorithm is an edge detection algorithm, then edge detection can be performed on the infrared image based on this algorithm, and the evaluation operator corresponding to the infrared image can be determined based on the pixel value of each pixel in the obtained edge image. For example, the maximum pixel value in the edge image can be used as the evaluation operator, the root mean square of the pixel value of each pixel in the edge image can be used as the evaluation operator, and the average value of the pixel value of each pixel in the edge image can be used as the evaluation operator, etc.

[0033] If the evaluation algorithm is a frequency domain filtering algorithm, then the infrared image can be frequency-domain filtered based on this algorithm, and the evaluation operator corresponding to the infrared image can be determined based on the high-frequency or low-frequency components obtained from the filtering. For example, the maximum value of the high-frequency or low-frequency components can be used as the evaluation operator, the root mean square of the high-frequency or low-frequency components can be used as the evaluation operator, and the average value of the high-frequency or low-frequency components can be used as the evaluation operator, etc.

[0034] S103: Based on the evaluation operator corresponding to each infrared image, determine the optimal focusing parameter among the focusing parameters, and focus the infrared camera based on the optimal focusing parameter.

[0035] After obtaining the evaluation operator corresponding to each infrared image, the electronic device can determine the optimal focus parameter among each focus parameter by comparing the evaluation operator corresponding to each infrared image.

[0036] For example, an electronic device can determine the infrared image with the largest evaluation operator as the image with the highest sharpness, and determine the focusing parameters corresponding to that infrared image as the optimal focusing parameters. Optionally, if two focusing parameters have the same evaluation operator, they can be processed according to preset rules, such as determining the smaller focusing parameter as the optimal focusing parameter, or determining the focusing parameter corresponding to the first acquired infrared image as the optimal focusing parameter, etc. This application embodiment does not specifically limit this.

[0037] After determining the optimal focusing parameters, the electronic device can adjust the focusing parameters of the infrared camera to those optimal focusing parameters, enabling the infrared camera to capture clear infrared images, thereby completing the focusing of the infrared camera.

[0038] In this embodiment, by acquiring infrared images based on each focusing parameter, the imaging differences under different focusing parameters are obtained; and based on a preset evaluation algorithm and the content carried in each infrared image, the evaluation operator corresponding to each infrared image is determined, thereby objectively and quantitatively reflecting the image quality of each infrared image, making the evaluation results more accurate and reliable; and based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused using the optimal focusing parameter, so that the entire focusing adjustment process can be completed automatically without manual intervention and subjective estimation, which not only improves the accuracy and reliability of the infrared camera's focusing adjustment, but also ensures that the infrared camera can achieve clear imaging under the optimal focusing parameter.

[0039] Example 2: In order to adaptively determine the evaluation algorithm that matches the infrared image based on the content carried in the infrared image, so that the infrared images acquired in different scenarios can be evaluated for image quality using appropriate evaluation algorithms, thereby improving the accuracy of the determined evaluation operator, based on the above embodiments, in the embodiments of this application, the evaluation algorithms corresponding to different infrared images are the same or different. The process of determining the evaluation algorithm for any given infrared image includes: Identify the number of corner points contained in the infrared image, and determine the target size relationship between the number of corner points and a set corner point number threshold; Based on the pre-saved correspondence between size relationships and evaluation algorithms, the evaluation algorithm corresponding to the target size relationship is determined.

[0040] In the embodiments of this application, since different infrared images are acquired based on different focusing parameters, the clarity of different infrared images is different. Therefore, when calculating the evaluation operator corresponding to each infrared image, the same evaluation algorithm can be used, or different evaluation algorithms can be used.

[0041] For example, when two infrared images carry similar content, such as the scenes corresponding to both infrared images having rich textures, the same evaluation algorithm can be used to calculate the evaluation operators corresponding to the two infrared images; when the content carried by two infrared images differs greatly, such as the scene corresponding to one infrared image having rich textures while the scene corresponding to the other infrared image has sparse textures, different evaluation algorithms can be used to calculate the evaluation operators corresponding to the two infrared images.

[0042] It should be noted that the content carried in an infrared image can be represented in various ways, such as the number of corner points, the richness of texture, and the grayscale distribution contained in the infrared image. This application embodiment takes the number of corner points contained in the infrared image as an example to illustrate the content carried in the infrared image.

[0043] In infrared images, corner points refer to pixel regions with dramatic grayscale changes and distinct directional characteristics. They typically appear at the intersection of target edges, locations of abrupt texture changes, etc. The number of corner points in an infrared image reflects the richness of texture in the corresponding scene and indirectly reflects the image's clarity. Generally, the clearer the infrared image and the richer the scene texture, the more corner points can be detected; conversely, the blurrier the infrared image and the less texture the scene, the fewer corner points can be detected.

[0044] Specifically, for any given infrared image, the process of determining the evaluation algorithm corresponding to that infrared image includes: identifying the number of corner points contained in the infrared image, determining the target size relationship between the number of corner points and a set corner point number threshold; and determining the evaluation algorithm corresponding to the target size relationship based on the pre-saved correspondence between the size relationship and the evaluation algorithm.

[0045] The target size relationship can include relationships where the number of corner points is greater than a set corner point number threshold, and relationships where the number of corner points is not greater than the set corner point number threshold. The set corner point number threshold can be set based on empirical values, or adjusted according to factors such as the imaging characteristics of the infrared camera, the application scenario, and the focus adjustment range. This application embodiment does not limit the specific value of the set corner point number threshold.

[0046] In this embodiment, the electronic device pre-stores the correspondence between the number of corner points and a set threshold number of corner points and the evaluation algorithm. This correspondence is used to characterize the evaluation algorithm applicable under various size relationships. This correspondence can be stored in the form of a lookup table, mapping table, etc. It can be written at the factory or updated according to actual usage; this embodiment does not limit this.

[0047] After determining the target size relationship between the number of corner points and the set corner point number threshold, the electronic device can use the pre-saved correspondence between the size relationship and the evaluation algorithm as an index to search for the evaluation algorithm corresponding to the target size relationship, and then determine the evaluation algorithm corresponding to the infrared image based on the found evaluation algorithm. Finally, it can perform the operation of determining the evaluation operator corresponding to the infrared image based on the determined evaluation algorithm.

[0048] For example, when the target size relationship is such that the number of corner points is greater than a set corner point threshold, it indicates that the current infrared image contains a large number of corner points, the corresponding scene has rich texture, and belongs to a conventional imaging scene. In this case, the evaluation algorithm for the infrared image can be an edge detection algorithm and a frequency domain filtering algorithm. When the target size relationship is such that the number of corner points is not greater than a set corner point threshold, it indicates that the current infrared image contains a small number of corner points, the corresponding scene is in a relatively blurry state, or in a state of lack of texture. In this case, the evaluation algorithm for the infrared image can be a frequency domain filtering algorithm.

[0049] To reduce the computational overhead of corner detection, improve the timeliness of determining the number of corners in an infrared image, and avoid excessive consumption of electronic device processing resources due to unlimited corner counting of pixels, based on the above embodiments, in this embodiment, the identification of the number of corners in the infrared image includes: Based on the corner recognition algorithm, each pixel in the infrared image is traversed to determine the target pixel that is a corner in the infrared image; If the number of target pixels identified reaches the set number, the number of corner points contained in the infrared image is determined to be the set number, and corner point identification of the infrared image is stopped. If the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corner points; Wherein, the set number is greater than the set corner point number threshold.

[0050] In this embodiment of the application, when the electronic device identifies the number of corner points contained in any infrared image, if the number of corner points already identified reaches a set number, it will no longer continue to identify corner points in the infrared image.

[0051] Specifically, the electronic device can traverse each pixel in the infrared image based on a corner detection algorithm. For any pixel in the infrared image, the electronic device can determine the grayscale changes within a neighborhood window centered on that pixel. When the grayscale changes within the neighborhood window meet the corner detection criteria, the pixel is identified as a corner, i.e., it is designated as a target pixel, and the number of identified target pixels is accumulated. When the grayscale changes within the neighborhood window do not meet the corner detection criteria, the pixel is determined not to be a corner, and the traversal continues to the next pixel.

[0052] Each time the number of identified target pixels is accumulated, the electronic device will determine whether the number of corner points identified has reached the set number. If so, corner point identification of the infrared image will stop; if not, corner point identification of the infrared image will continue until the number of identified corner points reaches the set number, or the traversal of all pixels in the infrared image is completed.

[0053] The set quantity can be understood as the upper limit of the corner point statistics. It can be stored in the electronic device in advance by those skilled in the art based on experience or actual needs. The specific value of the set quantity is not limited in the embodiments of this application. However, the set quantity is greater than the set corner point number threshold.

[0054] During the process of traversing the pixels in an infrared image, if the number of target pixels identified by the electronic device reaches a set number, the electronic device can immediately stop corner detection of the infrared image and directly determine that the number of corners contained in the infrared image is the set number. It should be noted that since the number of corners is the basis for determining the evaluation algorithm corresponding to the infrared image, when the number of identified target pixels reaches the set number, based on the fact that the set number is greater than the set corner number threshold, it can be directly determined that the number of corners in the infrared image is greater than the set corner number threshold. At this time, there is no need to continue traversing and counting the remaining pixels in the infrared image. This is because the number of identified target pixels reaching the set number is sufficient to indicate that the scene captured by the infrared image has relatively rich texture; continuing to traverse will only increase the computational load without changing the determination result of the target size relationship. Therefore, the embodiments of this application can significantly shorten the corner detection time in scenes with rich texture, save the computing resources of the electronic device, and help improve the real-time performance of the infrared camera's focus adjustment process. This method is also convenient for hardware implementation and pipeline acceleration.

[0055] For example, suppose the threshold for the number of corner points is set to 50, and the set number is 100. If the number of target pixels identified during the traversal reaches 100, the electronic device stops corner point identification, determines that the number of corner points contained in the infrared image is 100, and accordingly determines that the evaluation algorithm corresponding to the infrared image is an edge detection algorithm and a frequency domain filtering algorithm; if 30 target pixels are identified after the traversal, which does not reach the set number of 100, then 30 is taken as the number of corner points contained in the infrared image.

[0056] Example 3: In order to fully utilize the edge and high-frequency information in the textured infrared image for image quality evaluation, and to ensure that the determined evaluation operator can accurately reflect the sharpness of the infrared image, thereby improving the accuracy of determining the optimal focusing parameters, based on the above embodiments, in this embodiment of the application, if the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the edge detection algorithm, edge detection is performed on the infrared image to obtain an edge image; based on the pixel value of each pixel in the edge image, the mean pixel value corresponding to the edge image is determined; based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the high-frequency component corresponding to the infrared image; the sum of the high-frequency component and the mean pixel value is determined as the evaluation operator corresponding to the infrared image.

[0057] In this embodiment, when the target size relationship between the number of corner points in an infrared image and a set corner point number threshold is such that the number of corner points is greater than the set corner point number threshold, it indicates that the infrared image contains a large number of corner points, corresponding to rich scene texture. This infrared image contains relatively abundant edge and detail information, which can accurately characterize the image's clarity. Therefore, in this embodiment, when the number of corner points is greater than the set corner point number threshold, the evaluation algorithm corresponding to the infrared image is an edge detection algorithm and a frequency domain filtering algorithm; that is, the evaluation operator corresponding to the infrared image is jointly determined by the edge detection result and the frequency domain filtering result.

[0058] Specifically, electronic devices can perform edge detection on infrared images based on edge detection algorithms to obtain edge images. These edge images reflect the edge information contained in the infrared image. The pixel value of each pixel in the edge image reflects the edge intensity at the corresponding location. The more pronounced the edge at a certain location in the original image, the larger the pixel value of its corresponding pixel in the edge image.

[0059] After obtaining the edge image, the electronic device can determine the average pixel value of the edge image based on the pixel value of each pixel in the edge image. This average pixel value reflects the overall edge intensity of the infrared image. The clearer the image and the more obvious the edge, the larger the average pixel value of the corresponding edge image; conversely, the blurrier the image and the less obvious the edge, the smaller the average pixel value of the corresponding edge image.

[0060] Furthermore, since the pixel mean is a statistical feature of the entire image, it is more resistant to local noise than the pixel value of a single pixel, and can more stably reflect the overall edge strength of the image.

[0061] Electronic devices can also perform frequency domain filtering on the infrared image based on frequency domain filtering algorithms to obtain the corresponding high-frequency components. Specifically, the electronic device can perform frequency domain transformation on the infrared image, transforming it from the spatial domain to the frequency domain, and then use a high-pass filter to filter the transformed image. The high-frequency components output by the high-pass filter correspond to the detailed information in the infrared image, such as target edges and texture details. Generally, the clearer the image, the richer its high-frequency components; the blurrier the image, the more attenuated its high-frequency components.

[0062] For example, in the embodiments of this application, at least one of an Infinite Impulse Response (IIR) filter and a Finite Impulse Response (FIR) filter can be used to filter the frequency domain of the infrared image to separate the high-frequency and low-frequency components in the infrared image; alternatively, the infrared image can be divided into blocks, and each sub-block can be processed separately to obtain the high-frequency components in the infrared image.

[0063] Figure 2 This is a schematic diagram illustrating the process of frequency domain filtering of infrared images based on IIR and FIR filters, as provided in the embodiments of this application. Figure 2 As shown, the infrared image is converted into a discrete signal sequence X(n). An IIR filter is used to perform frequency domain filtering on the horizontal direction of the infrared image to obtain the low-frequency component IIR0 and the high-frequency component IIR1 in the horizontal direction. Similarly, an FIR filter is used to perform frequency domain filtering on the vertical direction of the infrared image to obtain the low-frequency component FIR0 and the high-frequency component FIR1 in the vertical direction. Then, based on the low-frequency component IIR0 in the horizontal direction and the low-frequency component FIR0 in the vertical direction, the low-frequency component of the infrared image is obtained; based on the high-frequency component IIR1 in the horizontal direction and the high-frequency component FIR1 in the vertical direction, the high-frequency component of the infrared image is obtained.

[0064] Optionally, a Coring curve can be configured to suppress components with amplitudes below a certain threshold as noise, thereby further shielding the noise introduced during the filtering process and ensuring that the high-frequency components involved in the evaluation operator calculation can truly reflect the clear details of the image, avoiding noise from disturbing the evaluation results.

[0065] In the embodiments of this application, high-frequency components can be characterized by the energy of high-frequency components, the sum of the amplitudes of high-frequency components, etc. The embodiments of this application do not specifically limit the specific characterization form of high-frequency components.

[0066] After determining the high-frequency components and the average pixel value of the infrared image, the electronic device can use the sum of the high-frequency components and the average pixel value as the evaluation operator for the infrared image. The average pixel value reflects the overall edge intensity of the infrared image, while the high-frequency components reflect the detail information of the image. Both can reflect the clarity of the image. After fusion, the evaluation operator integrates the edge features of the infrared image and the high-frequency features in the frequency domain, further improving the accuracy of the evaluation operator in characterizing image quality.

[0067] To accurately obtain edge information in various directions from an infrared image and improve the completeness of edge detection, based on the above embodiments, in this embodiment, the step of performing edge detection on the infrared image based on the edge detection algorithm to obtain an edge image includes: Obtain the Sobel operator corresponding to each filtering direction; Based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered in each filtering direction to obtain the sub-edge image corresponding to each filtering direction; Based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

[0068] In this embodiment of the application, the electronic device can perform edge detection on the infrared image based on the Sobel operator to obtain the edge image.

[0069] The Sobel operator is a discrete differential operator used to approximate the gradient of an image brightness function. It combines smoothing and differentiation, and has the advantages of simple structure, convenient operation, high computational efficiency, and easy hardware implementation.

[0070] In this embodiment, the electronic device can pre-configure a Sobel operator corresponding to each filtering direction. When performing edge detection on an infrared image, the electronic device can first acquire the Sobel operator corresponding to each filtering direction. The Sobel operators corresponding to different filtering directions can be the same or different. The Sobel operator for any filtering direction is used to extract the edge components of the infrared image in that filtering direction.

[0071] The electronic device can perform filtering on the infrared image in each filtering direction based on the Sobel operator corresponding to each filtering direction. Specifically, for any filtering direction, the electronic device can perform a convolution operation between the infrared image and the Sobel operator corresponding to that filtering direction to obtain the gradient calculation result of the infrared image in that filtering direction, and determine the sub-edge image corresponding to that filtering direction based on the gradient calculation result. Each sub-edge image is used to characterize the edge information of the infrared image in the corresponding filtering direction.

[0072] In the process of convolution operation, the boundary pixels of the image can be processed by zero padding, mirror filling, etc., and this application embodiment does not limit this.

[0073] Furthermore, after obtaining the sub-edge images corresponding to each filtering direction, the electronic device can merge the sub-edge images corresponding to each filtering direction based on a preset image merging algorithm to obtain the final edge image. Optionally, the image merging algorithm can adopt a pixel-by-pixel maximum value method, that is, for any pixel position, the pixel value of the pixel at that position in the edge image is the maximum value among the pixel values ​​of the pixels at that position in each sub-edge image; or, the image merging algorithm can also adopt merging methods such as square root of the sum of squares or weighted summation, etc., which are not specifically limited in this embodiment.

[0074] In order to fully cover edge information in all directions in the infrared image and further improve the completeness of edge detection results, based on the above embodiments, in this embodiment, the filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

[0075] In this embodiment, the filtering directions can be divided into two groups, with two filtering directions in each group being perpendicular to each other. Furthermore, one filtering direction in any group is the diagonal direction of the other group; that is, the angle difference between the filtering directions in the two groups is 45 degrees. For example, one group may include two perpendicular filtering directions, 0 degrees and 90 degrees, while the other group may include two perpendicular filtering directions, 45 degrees and 135 degrees. The 45-degree and 135-degree directions are precisely the diagonals of the 0-degree and 90-degree directions, respectively. Based on this, this embodiment extends the Sobel operator, which originally only included two directions, to four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees. The four filtering directions are evenly distributed with equal angular intervals, enabling edge detection to cover four filtering directions: horizontal, vertical, and two diagonals.

[0076] The values ​​of the Sobel operator differ for each filtering direction and can be set based on experience and actual filtering requirements; no restrictions are imposed here. The example shows the Sobel operator for the 0-degree direction. Sobel operator at 45 degrees Sobel operator in the 90-degree direction Sobel operator in the 135-degree direction .

[0077] Since infrared images are formed by the temperature difference between the target and the background, the edges of the imaged target have diverse orientations. Using only two directions for edge detection can easily lead to the loss of edge information in the diagonal direction. However, using four directions for edge detection and merging can more comprehensively capture the edges formed by the temperature difference of the infrared thermal radiation target, making the edge representation more comprehensive and unbiased, thereby improving the accuracy of edge representation and the reliability of sharpness evaluation.

[0078] It should be noted that, in this embodiment, the process of obtaining an edge image by performing edge detection on the infrared image based on the Sobel operator is described as an example. In practical applications, edge detection algorithms can also use other forms of operators such as the Laplacian operator and the Prout operator. As long as edge information in the infrared image can be extracted, they can be applied to this embodiment. This embodiment does not limit the specific form of the edge detection algorithm.

[0079] Example 4: In order to determine the evaluation operator for sparsely textured infrared images, based on the above embodiments, in this embodiment of the application, if the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the low-frequency component corresponding to the infrared image; the low-frequency component is determined as the evaluation operator corresponding to the infrared image.

[0080] In this embodiment, when the target size relationship between the number of corner points in the infrared image and a set corner point number threshold is such that the number of corner points is not greater than the set corner point number threshold, it indicates that the infrared image contains a small number of corner points, which may be in a blurry state or a state lacking texture. The infrared image contains very little edge and high-frequency information; the high-frequency information is weak and easily drowned out by noise. If the evaluation operator is still determined based on edge detection algorithms and high-frequency components, the evaluation operator may not accurately reflect the image's clarity, and may even lead to repeated focus oscillations due to the inability to find effective features.

[0081] Based on this, in this embodiment of the application, when the number of corner points is not greater than a set corner point number threshold, the evaluation algorithm corresponding to the infrared image is a frequency domain filtering algorithm.

[0082] Specifically, electronic devices can perform frequency domain filtering on infrared images based on frequency domain filtering algorithms to obtain the corresponding low-frequency components. Specifically, electronic devices can perform frequency domain transformation on infrared images, transforming them from the spatial domain to the frequency domain, and then use a low-pass filter to filter the transformed image. The low-frequency components output by the low-pass filter reflect the overall grayscale distribution and overall energy of the image. When the infrared camera is out of focus, the overall energy distribution of the image changes with the degree of defocusing, and the low-frequency components also change accordingly. Therefore, in scenes with limited texture, the low-frequency components can still provide an effective evaluation basis for the focus adjustment process.

[0083] That is, for infrared images with sparse textures, the embodiments of this application incorporate the information of blurred edges into the evaluation system, so that effective evaluation can be maintained throughout the entire focusing process from blurry to clear, as well as when the scene itself lacks sharp textures. This avoids evaluation failure and repeated focus oscillations in special scenarios, and improves the robustness and practicality of the entire focus adjustment process.

[0084] In determining low-frequency components, electronic devices can first divide the infrared image into blocks, process each block individually to obtain the corresponding low-frequency sub-components, and then determine the low-frequency components of the infrared image based on these sub-components. During the process of obtaining low-frequency components, a Coring curve can also be configured to suppress components with amplitudes below a certain threshold as noise, thereby shielding against noise introduced during the filtering process and ensuring the stability of the evaluation operator.

[0085] Optionally, the low-frequency components can be characterized by the energy of the low-frequency components, the sum of the amplitudes of the low-frequency components, etc. The embodiments of this application do not specifically limit the specific characterization form of the low-frequency components.

[0086] Example 5: To remove the interference of impulse noise contained in the infrared image on corner detection, improve the accuracy of corner count identification, and thus ensure the rationality of the evaluation algorithm, based on the above embodiments, in this embodiment of the application, before identifying the number of corners contained in the infrared image, the method further includes: Based on the guided filtering algorithm, the infrared image is filtered to remove the impulse noise contained in the infrared image; The identification of the number of corner points contained in the infrared image includes: Based on the established corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image.

[0087] In practical applications, infrared images often contain impulse noise, such as salt-and-pepper noise, due to factors like infrared camera noise and environmental interference during acquisition and transmission. This impulse noise typically manifests as alternating bright and dark salt- and pepper-like noise points, originating from either the infrared camera's own thermal noise or interference in the signal transmission link. The grayscale value of impulse noise points differs significantly from that of surrounding pixels, appearing as obvious bright or dark spots in the image. If corner detection is performed directly on undenoised infrared images, these noise points may be misidentified as corners, causing the number of identified corners to deviate from the image's true texture, thus affecting the accuracy of subsequent target size relationships and evaluation algorithms.

[0088] Based on this, in the embodiments of this application, before identifying the number of corner points contained in the infrared image, the electronic device first performs filtering processing on the infrared image based on the guided filtering algorithm to remove the pulse noise contained in the infrared image and reduce the interference of background noise on subsequent calculations.

[0089] Among them, guided filtering is an edge-preserving smoothing filtering algorithm. Its filtering process is guided by a guide graph, which can effectively smooth noise while maintaining the edge structure of the image. In the guided filtering process, for any pixel, the filtering result of that pixel is determined based on the local linear model within the sliding window centered on that pixel in the guide graph, which makes guided filtering have good edge-preserving properties and noise smoothing capabilities.

[0090] In this embodiment, when performing guided filtering on an infrared image, the infrared image itself can be used as the guide image, or the image obtained after Gaussian filtering the infrared image can be used as the guide image. Optionally, parameters such as the filter window radius and regularization parameters in the guided filtering can be set as needed according to the noise level of the image; this embodiment does not limit this.

[0091] Example, Figure 3a This is a schematic diagram of the original infrared image provided in the embodiments of this application. Figure 3b This is a schematic diagram of an image obtained by edge extraction from the original infrared image, as provided in an embodiment of this application. Figure 3c This is a schematic diagram of an image obtained by edge extraction from a guided-filtered infrared image, as provided in an embodiment of this application. Figure 3d This is a schematic diagram of an image obtained by edge extraction from an infrared image after Gaussian filtering and guided filtering, as provided in an embodiment of this application. Figures 3a-3d The comparison visually demonstrates that using an infrared image with Gaussian filtering as a guide map can more effectively remove salt-and-pepper noise from the infrared image, reduce background noise interference with subsequent calculations, and achieve better edge extraction results than using the original infrared image directly as the guide map.

[0092] In this embodiment, after filtering the infrared image, the electronic device can perform corner detection on the filtered infrared image based on a set corner detection algorithm to obtain the number of corners contained in the infrared image. For example, the set corner detection algorithm can be the Shi-Tomasi corner detection algorithm, or other corner detection algorithms; this embodiment does not specifically limit the algorithm used.

[0093] Furthermore, since the number of corner points in this embodiment is only used as a reference for selecting the evaluation algorithm and does not need to exhaustively count all corner points in the image, the maximum number of corner points to be counted can be preset, i.e., the number of corner points is set. When the number of detected corner points reaches the set number of corner points, the detection stops, thereby reducing the computational overhead of corner point detection and enabling the number of identified corner points to accurately reflect the texture of the image while meeting the computational budget.

[0094] Figure 4 This is a flowchart illustrating the calculation of an evaluation operator for any infrared image provided in the embodiments of this application. Figure 4 As shown, the process includes: S401: Input the raw infrared image; S402: Perform guided filtering on the original infrared image; S403: Based on the Shi-Tomasi corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image; S404: Determine whether the number of corner points is greater than the set corner point number threshold. If yes, execute S405-S407; otherwise, execute S408-S409. S405: Based on the edge detection algorithm, perform edge detection on the filtered infrared image to obtain the average pixel value of the edge image; S406: Based on the frequency domain filtering algorithm, the filtered infrared image is subjected to frequency domain filtering to obtain high-frequency components; S407: The sum of the pixel mean and the high-frequency component is determined as the evaluation operator corresponding to the infrared image; S408: Based on the frequency domain filtering algorithm, the filtered infrared image is subjected to frequency domain filtering to obtain the low-frequency component; S409: Determine the low-frequency component as the evaluation operator corresponding to the infrared image.

[0095] Example 6: Based on the above embodiments, this application also provides a focus adjustment device. Figure 5 This application provides a schematic diagram of a focus adjustment device, which includes: The acquisition module 501 is used to acquire infrared images based on each focus parameter; Evaluation module 502 is used to determine the evaluation operator corresponding to each infrared image based on a preset evaluation algorithm and the content carried in each infrared image. The evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focus parameter among the focus parameters is determined. The focusing module 503 is used to focus the infrared camera based on the optimal focusing parameters.

[0096] In one possible implementation, the evaluation algorithms corresponding to different infrared images may be the same or different; The evaluation module 502 is also used to determine the evaluation algorithm corresponding to any infrared image; The evaluation module 502 is specifically used to identify the number of corner points contained in the infrared image, determine the target size relationship between the number of corner points and a set corner point number threshold, and determine the evaluation algorithm corresponding to the target size relationship based on the pre-saved correspondence between the size relationship and the evaluation algorithm.

[0097] In one possible implementation, if the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm. The evaluation module 502 is specifically used to perform edge detection on the infrared image based on the edge detection algorithm to obtain an edge image; determine the mean pixel value corresponding to the edge image based on the pixel value of each pixel in the edge image; perform frequency domain filtering on the infrared image based on the frequency domain filtering algorithm to obtain the high-frequency component corresponding to the infrared image; and determine the sum of the high-frequency component and the mean pixel value as the evaluation operator corresponding to the infrared image.

[0098] In one possible implementation, the evaluation module 502 is specifically used to obtain the Sobel operator corresponding to each filtering direction; based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered for each filtering direction to obtain the sub-edge image corresponding to each filtering direction; based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

[0099] In one possible implementation, the filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

[0100] In one possible implementation, if the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm. The evaluation module 502 is specifically used to perform frequency domain filtering on the infrared image based on the frequency domain filtering algorithm to obtain the low-frequency component corresponding to the infrared image; and to determine the low-frequency component as the evaluation operator corresponding to the infrared image.

[0101] In one possible implementation, the device further includes: The preprocessing module 504 is used to filter the infrared image based on the guided filtering algorithm to remove the impulse noise contained in the infrared image. The evaluation module 502 is specifically used to perform corner detection on the filtered infrared image based on a set corner detection algorithm, and to obtain the number of corners contained in the infrared image.

[0102] In one possible implementation, the evaluation module 502 is specifically used to traverse each pixel in the infrared image based on a corner recognition algorithm to determine the target pixels that are corners in the infrared image; if the number of identified target pixels reaches a set number, then the number of corners contained in the infrared image is determined to be the set number, and corner recognition of the infrared image is stopped; if the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corners; wherein, the set number is greater than the set corner number threshold.

[0103] Example 7: Based on the above embodiments, this application also provides an electronic device. Figure 6 This application provides a schematic diagram of an electronic device structure, such as... Figure 6 As shown, it includes: processor 601, communication interface 602, memory 603 and communication bus 604, wherein processor 601, communication interface 602 and memory 603 communicate with each other through communication bus 604. The memory 603 stores a computer program, which, when executed by the processor 601, causes the processor 601 to perform the following steps: Acquire infrared images based on each focus parameter; Based on a preset evaluation algorithm and the content carried in each infrared image, an evaluation operator corresponding to each infrared image is determined, and the evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused based on the optimal focusing parameter.

[0104] In one possible implementation, the evaluation algorithms corresponding to different infrared images may be the same or different; The process of determining the evaluation algorithm for any given infrared image includes: Identify the number of corner points contained in the infrared image, and determine the target size relationship between the number of corner points and a set corner point number threshold; Based on the pre-saved correspondence between size relationships and evaluation algorithms, the evaluation algorithm corresponding to the target size relationship is determined.

[0105] In one possible implementation, if the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the edge detection algorithm, edge detection is performed on the infrared image to obtain an edge image; based on the pixel value of each pixel in the edge image, the mean pixel value corresponding to the edge image is determined; based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the high-frequency component corresponding to the infrared image; the sum of the high-frequency component and the mean pixel value is determined as the evaluation operator corresponding to the infrared image.

[0106] In one possible implementation, the step of performing edge detection on the infrared image based on the edge detection algorithm to obtain an edge image includes: Obtain the Sobel operator corresponding to each filtering direction; Based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered in each filtering direction to obtain the sub-edge image corresponding to each filtering direction; Based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

[0107] In one possible implementation, the filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

[0108] In one possible implementation, if the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the low-frequency component corresponding to the infrared image; the low-frequency component is determined as the evaluation operator corresponding to the infrared image.

[0109] In one possible implementation, before identifying the number of corner points contained in the infrared image, the method further includes: Based on the guided filtering algorithm, the infrared image is filtered to remove the impulse noise contained in the infrared image; The identification of the number of corner points contained in the infrared image includes: Based on the established corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image.

[0110] In one possible implementation, identifying the number of corner points contained in the infrared image includes: Based on the corner recognition algorithm, each pixel in the infrared image is traversed to determine the target pixel that is a corner in the infrared image; If the number of target pixels identified reaches the set number, the number of corner points contained in the infrared image is determined to be the set number, and corner point identification of the infrared image is stopped. If the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corner points; Wherein, the set number is greater than the set corner point number threshold.

[0111] Since the principle of the above-mentioned electronic device in solving the problem is similar to that of the focus adjustment method, the implementation of the above-mentioned electronic device can be found in the embodiments of the method, and repeated parts will not be described again.

[0112] The communication bus mentioned in the aforementioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus. Communication interface 602 is used for communication between the aforementioned electronic device and other devices. The memory can include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.

[0113] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0114] Example 8: Based on the above embodiments, this application also provides a computer-readable storage medium storing a computer program executable by a processor. When the program runs on the processor, it causes the processor to perform the following steps: Acquire infrared images based on each focus parameter; Based on a preset evaluation algorithm and the content carried in each infrared image, an evaluation operator corresponding to each infrared image is determined, and the evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused based on the optimal focusing parameter.

[0115] In one possible implementation, the evaluation algorithms corresponding to different infrared images may be the same or different; The process of determining the evaluation algorithm for any given infrared image includes: Identify the number of corner points contained in the infrared image, and determine the target size relationship between the number of corner points and a set corner point number threshold; Based on the pre-saved correspondence between size relationships and evaluation algorithms, the evaluation algorithm corresponding to the target size relationship is determined.

[0116] In one possible implementation, if the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the edge detection algorithm, edge detection is performed on the infrared image to obtain an edge image; based on the pixel value of each pixel in the edge image, the mean pixel value corresponding to the edge image is determined; based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the high-frequency component corresponding to the infrared image; the sum of the high-frequency component and the mean pixel value is determined as the evaluation operator corresponding to the infrared image.

[0117] In one possible implementation, the step of performing edge detection on the infrared image based on the edge detection algorithm to obtain an edge image includes: Obtain the Sobel operator corresponding to each filtering direction; Based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered in each filtering direction to obtain the sub-edge image corresponding to each filtering direction; Based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

[0118] In one possible implementation, the filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

[0119] In one possible implementation, if the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm. The evaluation operators corresponding to the infrared image include: Based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the low-frequency component corresponding to the infrared image; the low-frequency component is determined as the evaluation operator corresponding to the infrared image.

[0120] In one possible implementation, before identifying the number of corner points contained in the infrared image, the method further includes: Based on the guided filtering algorithm, the infrared image is filtered to remove the impulse noise contained in the infrared image; The identification of the number of corner points contained in the infrared image includes: Based on the established corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image.

[0121] In one possible implementation, identifying the number of corner points contained in the infrared image includes: Based on the corner recognition algorithm, each pixel in the infrared image is traversed to determine the target pixel that is a corner in the infrared image; If the number of target pixels identified reaches the set number, the number of corner points contained in the infrared image is determined to be the set number, and corner point identification of the infrared image is stopped. If the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corner points; Wherein, the set number is greater than the set corner point number threshold.

[0122] Since the principle of the computer-readable storage medium in solving the problem is similar to that of the focus adjustment method, the implementation of the computer-readable storage medium can be found in the embodiments of the method, and repeated details will not be described again.

[0123] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0125] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0126] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0127] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A focus adjustment method, characterized in that, The method includes: Acquire infrared images based on each focus parameter; Based on a preset evaluation algorithm and the content carried in each infrared image, an evaluation operator corresponding to each infrared image is determined, and the evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focusing parameter among each focusing parameter is determined, and the infrared camera is focused based on the optimal focusing parameter.

2. The method according to claim 1, characterized in that, Different infrared images may use the same or different evaluation algorithms. The process of determining the evaluation algorithm for any given infrared image includes: Identify the number of corner points contained in the infrared image, and determine the target size relationship between the number of corner points and a set corner point number threshold; Based on the pre-saved correspondence between size relationships and evaluation algorithms, the evaluation algorithm corresponding to the target size relationship is determined.

3. The method according to claim 2, characterized in that, If the target size relationship is such that the number of corner points is greater than the set corner point number threshold, then the evaluation algorithm is an edge detection algorithm and a frequency domain filtering algorithm; The evaluation operators corresponding to the infrared image include: Based on the edge detection algorithm, edge detection is performed on the infrared image to obtain an edge image; based on the pixel value of each pixel in the edge image, the mean pixel value corresponding to the edge image is determined; based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the high-frequency component corresponding to the infrared image; the sum of the high-frequency component and the mean pixel value is determined as the evaluation operator corresponding to the infrared image.

4. The method according to claim 3, characterized in that, The process of performing edge detection on the infrared image based on the edge detection algorithm to obtain an edge image includes: Obtain the Sobel operator corresponding to each filtering direction; Based on the Sobel operator corresponding to each filtering direction, the infrared image is filtered in each filtering direction to obtain the sub-edge image corresponding to each filtering direction; Based on a preset image merging algorithm, the sub-edge images corresponding to each filtering direction are merged to obtain the edge image.

5. The method according to claim 4, characterized in that, The filtering direction includes two sets of mutually perpendicular filtering directions, and one of the filtering directions in any set is the direction of the diagonal of the other set.

6. The method according to claim 2, characterized in that, If the target size relationship is such that the number of corner points is not greater than the set corner point number threshold, then the evaluation algorithm is a frequency domain filtering algorithm; The evaluation operators corresponding to the infrared image include: Based on the frequency domain filtering algorithm, the infrared image is filtered in the frequency domain to obtain the low-frequency component corresponding to the infrared image. The low-frequency component is determined as the evaluation operator corresponding to the infrared image.

7. The method according to claim 2, characterized in that, Before identifying the number of corner points contained in the infrared image, the method further includes: Based on the guided filtering algorithm, the infrared image is filtered to remove the impulse noise contained in the infrared image; The identification of the number of corner points contained in the infrared image includes: Based on the established corner detection algorithm, corner detection is performed on the filtered infrared image to obtain the number of corners contained in the infrared image.

8. The method according to claim 2, characterized in that, The identification of the number of corner points contained in the infrared image includes: Based on the corner recognition algorithm, each pixel in the infrared image is traversed to determine the target pixel that is a corner in the infrared image; If the number of target pixels identified reaches the set number, the number of corner points contained in the infrared image is determined to be the set number, and corner point identification of the infrared image is stopped. If the number of identified target pixels does not reach the set number, then the number of target pixels is taken as the number of corner points; Wherein, the set number is greater than the set corner point number threshold.

9. A focus adjustment device, characterized in that, The device includes: The acquisition module is used to acquire infrared images based on each focus parameter; The evaluation module is used to determine the evaluation operator corresponding to each infrared image based on a preset evaluation algorithm and the content carried in each infrared image. The evaluation operator is used to evaluate the image quality of the corresponding infrared image. Based on the evaluation operator corresponding to each infrared image, the optimal focus parameter among the focus parameters is determined. A focusing module is used to focus the infrared camera based on the optimal focusing parameters.

10. An electronic device, characterized in that, The electronic device includes a processor that executes a computer program stored in a memory to implement the steps of the focus adjustment method as described in any one of claims 1-8.