An image focusing evaluation method, device, equipment and readable storage medium

By acquiring the average brightness and gain of the image block, using the bright noise function to remove noise, and combining filtering processing, the accuracy of image focus evaluation is improved, the noise problems caused by environmental brightness and gain are solved, and the focus accuracy is improved.

CN114862718BActive Publication Date: 2025-08-05杭州普联系统技术有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210520366.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-08-05
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

In the prior art, the ambient brightness and image gain cause the images acquired by the electronic device to contain a lot of noise, which affects the accuracy of the image focus evaluation results and thus affects the focus accuracy.

Method used

By obtaining the average brightness and gain of the image block, the noise value is removed by using the bright noise function, and combining bilateral filtering and time domain filtering processing, the first focus evaluation value of the image block is determined, and finally the target focus evaluation value of the acquired image is obtained through weighted summing.

Benefits of technology

The accuracy of image focus evaluation results is improved and the focus accuracy of electronic devices is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114862718B_ABST
    Figure CN114862718B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing technology, and provides an image focusing evaluation method, device, equipment and readable storage medium. The method includes: obtaining a captured image, where the captured image includes M image blocks, and M≥1; for each image block, determining the average brightness and the initial focusing evaluation value of the image block, and performing denoising processing on the initial focusing evaluation value according to the average brightness and the gain corresponding to the captured image to obtain the first focusing evaluation value of the image block; determining the target focusing evaluation value of the captured image according to the first focusing evaluation value of each of the M image blocks. The method provided by the present application can improve the accuracy of the focusing evaluation result of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and particularly to an image focusing evaluation method, apparatus, device, and readable storage medium. Background Art

[0002] Automatic focusing technology has been widely used in electronic devices such as cameras and projectors, enabling the electronic devices to automatically achieve the focusing function and thus obtain clear videos or images. Generally, during the automatic focusing process of an electronic device, it is necessary to evaluate the sharpness of the real-time acquired image based on a focusing evaluation algorithm, and control the focusing device in the electronic device to move to the position with the maximum sharpness of the image according to the evaluation result, so as to achieve the effect of focusing. However, factors such as environmental brightness or the structure of the electronic device itself will cause the electronic device to acquire images containing more noise, resulting in a low accuracy of the image focusing evaluation result, thus affecting the focusing accuracy of the electronic device. Summary of the Invention

[0003] In view of this, this application provides an image focusing evaluation method, apparatus, device, and readable storage medium, which can improve the accuracy of the image focusing evaluation result to a certain extent.

[0004] In a first aspect, this application provides an image focusing evaluation method, which includes: obtaining a captured image, where the captured image includes M image blocks, M≥1; for each image block, determining the average brightness and the initial focusing evaluation value of the image block, and performing denoising processing on the initial focusing evaluation value according to the average brightness and the gain corresponding to the captured image to obtain the first focusing evaluation value of the image block; determining the target focusing evaluation value of the captured image according to the first focusing evaluation value of each image block among the M image blocks.

[0005] Optionally, performing denoising processing on the initial focusing evaluation value according to the average brightness and the gain corresponding to the captured image includes:

[0006] Inputting the average brightness and the gain corresponding to the captured image into a preset brightness-noise function for processing to determine the average noise value, where the brightness-noise function is used to represent the corresponding relationship between the average brightness, the gain, and the average noise value;

[0007] Removing the average noise value from the initial focusing evaluation value to obtain the second focusing evaluation value;

[0008] Performing filtering processing on the second focusing evaluation value to obtain the first focusing evaluation value.

[0009] Optionally, performing filtering processing on the second focusing evaluation value to obtain the first focusing evaluation value includes:

[0010] Filter the second focus evaluation value using a bilateral filter to obtain a third focus evaluation value;

[0011] Perform time-domain filtering on the third focus evaluation value to obtain a first focus evaluation value.

[0012] Optionally, the method of filtering the second focus evaluation value using a bilateral filter to obtain a third focus evaluation value includes:

[0013]

[0014] where FV 3_i represents the third focus evaluation value of the i-th image block among M image blocks, 1 ≤ i ≤ M, U(i) represents a preset range centered on the i-th image block, and FV 2_j represents the second focus evaluation value of the j-th image block within the preset range, and w i,j represents the first weight of the j-th image block relative to the i-th image block.

[0015] Optionally, the method for determining the first weight of the j-th image block relative to the i-th image block includes:

[0016] Determine a distance weight according to the relative distance between the j-th image block and the i-th image block and a preset first distribution function, where the first distribution function is used to represent the corresponding relationship between the relative distance and the distance weight;

[0017] Determine a difference weight according to the first difference between the second focus evaluation value of the j-th image block and the second focus evaluation value of the i-th image block and a preset second distribution function, where the second distribution function is used to represent the corresponding relationship between the first difference and the difference weight;

[0018] Determine the first weight according to the distance weight and the difference weight.

[0019] Optionally, the method of performing time-domain filtering on the third focus evaluation value to obtain a first focus evaluation value includes:

[0020] For the i-th image block among M image blocks, determine the second difference between the first focus evaluation value of the image block corresponding to the i-th image block in the previous frame of the acquired image and the third focus evaluation value of the i-th image block, 1 ≤ i ≤ M;

[0021] Determine the second weight of the i-th image block according to a preset third distribution function and the second difference, where the third distribution function is used to represent the corresponding relationship between the second difference and the second weight;

[0022] Determine the first focus evaluation value of the \(i\)-th image block according to the second weight, the first focus evaluation value of the image block corresponding to the \(i\)-th image block in the previous frame image of the acquired image, and the third focus evaluation value of the \(i\)-th image block.

[0023] Optionally, determining the target focus evaluation value of the acquired image according to the first focus evaluation value of each of the \(M\) image blocks includes:

[0024] Perform a weighted sum of the first focus evaluation values of each image block according to the preset third weight corresponding to each of the \(M\) image blocks to obtain the target focus evaluation value of the acquired image.

[0025] In a second aspect, the present application provides an image focus evaluation device, which includes:

[0026] An acquisition unit, configured to acquire an acquired image, where the acquired image includes \(M\) image blocks, \(M\geq1\);

[0027] A denoising unit, configured to, for each image block, determine the average brightness and the initial focus evaluation value of the image block, and perform denoising processing on the initial focus evaluation value according to the average brightness and the gain corresponding to the acquired image to obtain the first focus evaluation value of the image block;

[0028] A determination unit, configured to determine the target focus evaluation value of the acquired image according to the first focus evaluation value of each of the \(M\) image blocks.

[0029] In a third aspect, the present application provides an electronic device, including: a memory and a processor, where the memory is used to store a computer program, and the processor is configured to execute the method described in any of the above first aspects when calling the computer program.

[0030] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method described in any of the above first aspects is implemented.

[0031] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a processor, causes the processor to execute the method described in any of the above first aspects.

[0032] Based on the image focusing evaluation method provided in this application, the average brightness of each image block in the captured image is determined, and the initial focusing evaluation value of each image block is determined through an existing focusing evaluation algorithm. The initial focusing evaluation value is denoised according to the average brightness of the image block and the gain corresponding to the captured image, so as to determine the target focusing evaluation value of the captured image according to the first focusing evaluation value obtained after denoising each image block. This application takes into account that the environmental brightness and the gain of the electronic device when acquiring an image will cause noise information in the image, thereby affecting the focusing evaluation result of the image. Therefore, this application removes the noise value in the initial focusing evaluation value based on the brightness and gain of the image, which improves the accuracy of the focusing evaluation value of the image to a certain extent. Description of the Drawings

[0033] Figure 1 It is a schematic flowchart of an image focusing evaluation method provided by an embodiment of this application;

[0034] Figure 2 It is a schematic diagram of the correspondence between a relative distance and a distance weight provided by an embodiment of this application;

[0035] Figure 3 It is a schematic diagram of the correspondence between a first difference and a difference weight provided by an embodiment of this application;

[0036] Figure 4 It is a schematic diagram of the correspondence between a second difference and a second weight provided by an embodiment of this application;

[0037] Figure 5 It is a schematic structural diagram of an image focusing evaluation device provided by an embodiment of this application;

[0038] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. Detailed Embodiments

[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the protection scope of this application.

[0040] In the prior art, during the focusing process of an electronic device with an autofocus function, the clarity of the real-time acquired image is generally evaluated based on a focus evaluation algorithm, and the focusing device in the electronic device is controlled to move according to the evaluation result to adjust the relative position between the lens and the image detector of the electronic device, so that the focal plane of the electronic device coincides with the image detector, thereby achieving the effect of focusing. Therefore, the focus evaluation value of the image plays an important role in the electronic device to achieve the focusing function. However, factors such as ambient brightness, exposure when the electronic device acquires an image, and image gain will cause the acquired image to contain more noise, and the focus evaluation value of the image is greatly affected by the noise, resulting in a low accuracy of the focus evaluation result, which in turn affects the focusing accuracy of the electronic device.

[0041] To improve the accuracy of the focus evaluation result of the image, this application provides an image focus evaluation method, device, equipment, and readable storage medium. Based on the existing focus evaluation algorithm, the initial focus evaluation value of each image block in the acquired image is determined, and the initial focus evaluation value is denoised according to the average brightness and image gain of the image block, so as to determine the target focus evaluation value of the acquired image according to the first focus evaluation value obtained after denoising each image block. This application takes into account the correspondence between ambient brightness and image gain and the noise signal in the acquired image, and removes the noise value in the initial focus evaluation value according to the brightness and gain of the acquired image, which improves the accuracy of the focus evaluation value of the image to a certain extent.

[0042] The technical solution of this application will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0043] Refer to Figure 1 The flowchart of the image focus evaluation method shown. In a possible implementation manner, the image focus evaluation method provided by this application includes the following steps:

[0044] S101, acquire an acquired image, where the acquired image includes M image blocks, M≥1.

[0045] In an example, the acquired image obtained by an electronic device with an autofocus function can be regarded as an image block, and then the acquired image is directly processed according to the methods provided in steps S102 - S103, so as to determine the target focus evaluation value of the acquired image.

[0046] In another example, considering that different regions in the acquired image have different brightness levels, resulting in different amounts of noise in different regions, the acquired image can be evenly divided into at least two image blocks according to its size, such that each image block contains the same number of pixel points. The first focus evaluation value of each image block and the target focus evaluation value of the acquired image are determined according to the methods provided in steps S102 - S103. For example, if the size of the acquired image is 256×256, the acquired image can be divided into 256 image blocks of 16×16, and each image block includes 16×16 pixel points.

[0047] S102. For each image block, determine the average brightness and the initial focus evaluation value of the image block, and perform denoising processing on the initial focus evaluation value according to the average brightness and the gain corresponding to the acquired image to obtain the first focus evaluation value of the image block.

[0048] In one example, the method for determining the average brightness of each image block includes: determining the brightness of each pixel point in the image block; dividing the sum of the brightnesses of all pixel points in the image block by the number of pixel points in the image block to obtain the average brightness of the image block. Among them, the brightness L of the pixel point located at (x, y) in the image block can be expressed by the formula:

[0049] L(x, y) = R(x, y) * 0.3 + G(x, y) * 0.59 + B(x, y) * 0.11. In the above formula, R(x, y) represents the brightness value of the pixel point located at (x, y) in the R channel, G(x, y) represents the brightness value of the pixel point located at (x, y) in the G channel, and B(x, y) represents the brightness value of the pixel point located at (x, y) in the B channel.

[0050] In one example, any one of the image focus evaluation algorithms can be used to determine the initial focus evaluation value of each image block. Exemplarily, for any image block, after determining the average brightness of the image block by the above method, the average brightness can be processed through a high - pass filter or a band - pass filter to obtain the initial focus evaluation value of the image block.

[0051] It can be understood that generally, the initial focus evaluation value of an image is calculated based on the brightness of the image. When the image contains noise signals and image feature signals, the brightness information of the image contains noise information and image feature information. Correspondingly, the initial focus evaluation value of the image also contains noise information and image feature information. By performing denoising processing on the initial focus evaluation value of the image, the focus evaluation value corresponding to the feature information of the image itself can be determined, and thus the clarity of the image can be accurately evaluated.

[0052] In an embodiment of the present application, for any image block in the acquired image, a specific method for denoising the initial focus evaluation value according to the average brightness of the image block and the gain corresponding to the acquired image to obtain the first focus evaluation value of the image block includes the following steps:

[0053] Step 1: Input the average brightness and the gain corresponding to the acquired image into a preset brightness-noise function for processing to determine the average noise value. The brightness-noise function is used to represent the corresponding relationship between the average brightness, the gain, and the average noise value.

[0054] It should be noted that generally, when an electronic device acquires an image, it can adjust the gain to improve the brightness, contrast, and dynamic range of the image. The greater the brightness and gain of the image, the higher the sensitivity of the electronic device to the noise signal, and the more noise signals the image contains.

[0055] In an embodiment of the present application, the corresponding relationship between the average brightness, the gain, and the average noise value of the image can be represented by a pre-fitted brightness-noise function. The brightness-noise function can be expressed as: where FV 噪声 represents the average noise value, K represents the gain, u represents the average brightness, and a and b are both fitting parameters. Different electronic devices correspond to different brightness-noise functions. The gain includes the analog or digital gain of the image detector in the electronic device and the isp (image signal process) gain. <able>

[0056] In one example, the fitting method of the brightness-noise function includes: obtaining a data set, where the data set includes the initial focus evaluation value, the average brightness, and the gain corresponding to different images. Specifically, a flat scene is constructed. A flat scene means that the brightness distribution in the scene is uniform and contains less contrast information. Images with different ambient brightnesses and / or different gains are acquired through an electronic device, and the initial focus evaluation value and the average brightness of each image are determined; the brightness-noise function is fitted according to multiple data sets to determine the values of the fitting parameters a and b.

[0057] In Step 1, for any image block in the acquired image, input the average brightness and the gain corresponding to the image block into the fitted brightness-noise function for processing, and the average noise value of the image block can be determined.

[0058] Step 2: Remove the average noise value from the initial focus evaluation value to obtain the second focus evaluation value. Specifically, it can be expressed by the following formula:

[0059] FV2 = FV 初始 - FV 噪声

[0060] In the above formula, FV2 represents the second focus evaluation value, FV初始 represents the initial focus evaluation value, FV 噪声 represents the average noise value.

[0061] It should be noted that the average noise value in the image block determined based on the light-noise function is an estimated value. However, the actual noise value in the image block may be greater than or less than the estimated value. If the actual noise value in the image block is less than the estimated value, the first focus evaluation value may be negative. At this time, the first focus evaluation value of this image block can be set to 0. After removing the average noise value from the initial focus evaluation value, most of the noise can be eliminated, and the signal-to-noise ratio is greatly improved. However, there is still some noise, that is, the fluctuation of the noise has not been eliminated.

[0062] Step 3: Perform filtering on the second focus evaluation value to obtain the first focus evaluation value.

[0063] In one embodiment, the present application uses a filter to perform filtering on the second focus evaluation value to eliminate the fluctuation of the noise. Exemplarily, a bilateral filter can be used to perform filtering on the second focus evaluation value of the image block to obtain the third focus evaluation value; then perform time-domain filtering on the third focus evaluation value to obtain the first focus evaluation value of the image block.

[0064] Among them, using a bilateral filter to perform filtering on the second focus evaluation value of the image block to obtain the third focus evaluation value can be expressed by the following formula:

[0065]

[0066] In the above formula, FV 3_i represents the third focus evaluation value of the i-th image block among the M image blocks of the acquired image, 1 ≤ i ≤ M; U(i) represents a preset range centered on the i-th image block, and there are N image blocks within the preset range, 2 ≤ N ≤ M; FV 2_j represents the second focus evaluation value of the j-th image block within the preset range centered on the i-th image block; w i,j represents the first weight of the j-th image block relative to the i-th image block, 1 ≤ j ≤ N. The first weight of the j-th image block relative to the i-th image block is the product of the distance weight of the j-th image block relative to the i-th image block and the difference weight of the j-th image block relative to the i-th image block. Assume that there are N image blocks within the preset range.

[0067] Exemplarily, if the acquired image is evenly divided into image blocks of 16×16, the preset range can be set to 5×5. In practical applications, when the number of image blocks increases, the preset range can be appropriately increased.

[0068] In one example, as Figure 2 shown, the distance weight rspacer The correspondence relationship between the relative distance d of two image patches satisfies a first distribution function, and the first distribution function can be expressed as a formula: In the acquired image, for the j-th image patch located at (x j , y j ) and the i-th image patch located at (x i , y i ), the relative distance d i,j can be expressed as a formula:

[0069] As Figure 3 shown, the difference weight r diff of the j-th image patch relative to the i-th image patch and the first difference FV 2_diff between the second focus evaluation values of these two image patches satisfy a second distribution function. The first difference is the absolute value of the difference between the second focus evaluation value of the j-th image patch and the second focus evaluation value of the i-th image patch, and the second distribution function can be expressed as a formula:

[0070]

[0071] In one example, the third focus evaluation value is subjected to time-domain filtering to obtain the first focus evaluation value, which can be expressed as a formula:

[0072] FV 1_i (t) = α i *FV 1_i (t - 1) + (1 - α i )*FV 3_i (t)

[0073] where FV 1_i (t) represents the first focus evaluation value of the i-th image patch in the acquired image, FV 1_i (t - 1) represents the first focus evaluation value of the image patch corresponding to the i-th image patch in the previous frame of the acquired image obtained by the electronic device (i.e., the position of this image patch in the previous frame of the image is the same as the position of the i-th image patch in the acquired image), FV 3_i (t) represents the third focus evaluation value of the i-th image patch in the acquired image, and α i represents a preset second weight corresponding to the i-th image patch.

[0074] In the embodiments of the present application, according to a preset third distribution function, the second weight corresponding to the i-th image patch can be determined, and the third distribution function can be expressed as a formula:

[0075]

[0076] where, diffFV 1_i = |FV 1_i (t) - FV 1_i (t - 1)|, diffFV 1_i represents the second difference between the first focus evaluation value of the i-th image block in the captured image and the first focus evaluation value of the image block corresponding to the i-th image block in the previous frame of the captured image. Specifically, reference can be made to Figure 4 the schematic diagram of the corresponding relationship between the second difference and the second weight shown.

[0077] S103. Determine the target focus evaluation value of the captured image according to the first focus evaluation value of each image block among the M image blocks.

[0078] In one example, if the captured image is not segmented, that is, the entire captured image is regarded as one image block and M = 1, the average brightness and the initial focus evaluation value of the captured image can be determined according to the method provided in step S102. Remove the noise in the initial focus evaluation value of the captured image according to the average brightness and gain of the captured image, so as to obtain the first focus evaluation value of the captured image, and the first focus evaluation value of the captured image is the target focus evaluation value of the captured image.

[0079] In another example, if the captured image is divided into at least two image blocks, that is, M ≥ 2, the first focus evaluation value of each image block in the captured image can be determined according to the method provided in step S102, and then the target focus evaluation value of the captured image can be determined according to the first focus evaluation value of each image block. Specifically, the first focus evaluation value corresponding to each image block can be weighted and summed according to the preset third weight corresponding to each image block in the captured image to obtain the target focus evaluation value of the captured image, which can be expressed by the formula:

[0080]

[0081] where, v i represents the preset second weight corresponding to the i-th image block among the M image blocks of the captured image, FV 1_i represents the first focus evaluation value of the i-th image block among the M image blocks of the captured image, and F represents the target focus evaluation value of the captured image. The third weight of the image block is related to the position of the image block in the captured image, that is, the closer the image block is to the center of the captured image, the greater the corresponding third weight.

[0082] Based on the image focusing evaluation method provided in this application, by acquiring a captured image with an electronic device, determining the initial focusing evaluation value of each image block in the captured image according to the existing focusing evaluation algorithm, inputting the average brightness and gain of each image block into a pre-fitted brightness-noise function to determine the average noise of each image block, removing the average noise from the initial focusing evaluation value can improve the signal-to-noise ratio to a certain extent, but the fluctuation of the noise still remains uneliminated. Therefore, this application uses bilateral filtering and time-domain filtering to filter the second focusing evaluation value after denoising each image block to further denoise and obtain the first focusing evaluation value of each image block. Finally, based on a preset second weight, the first focusing evaluation values of all image blocks in the captured image are weighted and summed to determine the target focusing evaluation value of the captured image. The image focusing evaluation method provided in this application can effectively remove the influence of noise in the captured image on the focusing evaluation value, thereby more accurately evaluating the focusing degree of the captured image.

[0083] It should be noted that the image focusing evaluation method provided in this application can be applied not only to the autofocus task of an electronic device, but also to any image processing task that requires evaluating the clarity of an image.

[0084] Based on the same inventive concept, as an implementation of the above method, an embodiment of this application provides an image focusing evaluation device. This device embodiment corresponds to the foregoing method embodiment. For the convenience of reading, the details in the foregoing method embodiment will not be repeated one by one in this device embodiment, but it should be clear that the device in this embodiment can correspondingly implement all the content in the foregoing method embodiment.

[0085] Figure 5 is a schematic diagram of the image focusing evaluation device provided in an embodiment of this application. As Figure 5 shown, the image focusing evaluation device 5 provided in this embodiment includes:

[0086] An acquisition unit 501, configured to acquire a captured image, where the captured image includes M image blocks, and M≥1;

[0087] A denoising unit 502, configured to, for each image block, determine the average brightness and the initial focusing evaluation value of the image block, and perform denoising processing on the initial focusing evaluation value according to the average brightness and the gain corresponding to the captured image to obtain the first focusing evaluation value of the image block;

[0088] A determination unit 503, configured to determine the target focusing evaluation value of the captured image according to the first focusing evaluation value of each of the M image blocks.

[0089] The image focusing evaluation device 5 provided by the embodiments of the present application can execute the steps in the embodiments of the above image focusing evaluation method. The implementation principle and technical effect are similar to those of the above method embodiments, and will not be elaborated here.

[0090] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments and will not be elaborated here.

[0091] Based on the same inventive concept, the embodiments of the present application also provide an electronic device. The electronic device can be a device with an autofocus function, such as a camera, a mobile electronic device, a projection device, etc. During the process of autofocusing, such an electronic device can determine the clarity of an image based on the image focusing evaluation method provided by the present application, and then determine the moving direction and moving step of the focusing motor in the electronic device. The electronic device can also be any device with an image processing function.

[0092] As Figure 6 shown, the electronic device 6 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. The computer program 603 can be run by the processor 601 to generate instructions, and the processor 601 can implement the steps in the above embodiments of each image focusing evaluation method according to the instructions. Or, when the processor 601 executes the computer program 603, it implements the functions of each module / unit in the above device embodiments, for example Figure 5 the functions of the units 501 to 503 shown.

[0093] Exemplarily, the computer program 603 can be divided into one or more modules / units. One or more modules / units are stored in the memory 602 and executed by the processor 601 to complete the present application. One or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program 603 in the electronic device 6.

[0094] Those skilled in the art can understand that Figure 6 These are merely examples of the electronic device 6 and do not constitute a limitation on the electronic device 6. It may include more or fewer components than those shown in the figure, or combine certain components, or have different components. For example, the electronic device 6 may also include input / output devices, network access devices, buses, etc.

[0095] The processor 601 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0096] The memory 602 may be an internal storage unit of the electronic device 6, such as the hard disk or memory of the electronic device 6. The memory 602 may also be an external storage device of the electronic device 6, such as a plug-in hard disk equipped on the electronic device 6, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 602 may also include both the internal storage unit and the external storage device of the electronic device 6. The memory 602 is used to store computer programs and other programs and data required by the electronic device 6. The memory 602 may also be used to temporarily store data that has been output or will be output.

[0097] The electronic device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be elaborated here.

[0098] This application embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the autofocus method provided in the above method embodiment.

[0099] This application embodiment also provides a computer program product. When the computer program product runs on an electronic device, it enables the electronic device to execute the autofocus method provided in the above method embodiment.

[0100] When the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above method embodiments of this application, a computer program can be used to instruct the relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium can at least include: any entity or device that can carry the computer program code to the photographing device / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, USB flash drive, mobile hard disk, magnetic disk or optical disc, etc. In some jurisdictions, according to legislation and patent practice, computer-readable media may not be electrical carrier signals and telecommunication signals.

[0101] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0102] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0103] In the embodiments provided in this application, it should be understood that the disclosed device / equipment and method can be implemented in other ways. For example, the device / equipment embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0104] It should be understood that, as used in the specification of this application and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their combinations.

[0105] It should also be understood that the term "and / or" as used in the specification of this application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0106] As used in the specification of this application and the appended claims, the term "if" may be construed, depending on the context, as "when" or "once" or "in response to determining" or "in response to detecting". Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be construed, depending on the context, as meaning "once determined" or "in response to determining" or "once detected [the described condition or event]" or "in response to detecting [the described condition or event]".

[0107] In addition, in the description of the specification of this application and the appended claims, the terms "first", "second", "third", etc. are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0108] The reference to "one embodiment" or "some embodiments" or the like described in the specification of this application means that a specific feature, structure or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized.

[0109] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. An image focus evaluation method, characterized in that: The method comprises: Acquire an acquired image, where the acquired image includes M image blocks, where M≥1; For each image block, the average brightness and initial focus evaluation value of the image block are determined, the average brightness and the gain corresponding to the acquired image are input into a preset brightness-noise function for processing to determine an average noise value, the brightness-noise function being used to represent the correspondence between the average brightness, the gain, and the average noise value, the average noise value is removed from the initial focus evaluation value to obtain a second focus evaluation value, and the second focus evaluation value is filtered to obtain a first focus evaluation value for the image block; wherein the brightness-noise function is: FV 噪声 represents the average noise value, K represents the gain, u represents the average brightness, and a and b are fitting parameters; A target focus evaluation value of the acquired image is determined according to the first focus evaluation value of each image block in the M image blocks.

2. The method according to claim 1, characterized in that The filtering the second focus evaluation value to obtain the first focus evaluation value includes: filtering the second focus evaluation value using a bilateral filter to obtain a third focus evaluation value; Performing time domain filtering processing on the third focus evaluation value to obtain the first focus evaluation value.

3. The method according to claim 2, characterized in that The method of filtering the second focus evaluation value by using a bilateral filter to obtain a third focus evaluation value includes: Among them, FV 3_i represents the third focus evaluation value of the i-th image block among the M image blocks, 1≤i≤M, U(i) represents the preset range centered on the i-th image block, FV 2_j represents the second focus evaluation value of the j-th image block within the preset range, w i,j represents a first weight of the j-th image block relative to the i-th image block.

4. The method according to claim 3, characterized in that The method for determining the first weight of the j-th image block relative to the i-th image block includes: determining a distance weight according to a relative distance between the j-th image block and the i-th image block and a preset first distribution function, wherein the first distribution function is used to represent a corresponding relationship between the relative distance and the distance weight; determining a difference weight according to a first difference between the second focus evaluation value of the j-th image block and the second focus evaluation value of the i-th image block and a preset second distribution function, wherein the second distribution function is used to represent a corresponding relationship between the first difference and the difference weight; The first weight is determined according to the distance weight and the difference weight.

5. The method according to claim 2, characterized in that The method of performing time domain filtering on the third focus evaluation value to obtain the first focus evaluation value includes: For an i-th image block among the M image blocks, determining a second difference between a first focus evaluation value of an image block corresponding to the i-th image block and a third focus evaluation value of the i-th image block in a previous frame of the acquired image, where 1≤i≤M; determining a second weight of the i-th image block according to a preset third distribution function and the second difference, wherein the third distribution function is used to represent a corresponding relationship between the second difference and the second weight; The first focus evaluation value of the i-th image block is determined according to the second weight, the first focus evaluation value of the image block corresponding to the i-th image block in the previous frame image, and the third focus evaluation value of the i-th image block.

6. The method according to any one of claims 1 to 5, characterized in that Determining the target focus evaluation value of the acquired image according to the first focus evaluation value of each image block in the M image blocks includes: According to a preset third weight corresponding to each of the M image blocks, a weighted sum is performed on the first focus evaluation value of each of the image blocks to obtain a target focus evaluation value of the captured image.

7. An image focus evaluation device, characterized in that: include: An acquisition unit, configured to acquire an acquired image, wherein the acquired image includes M image blocks, where M≥1; a denoising unit, configured to determine, for each image block, an average brightness and an initial focus evaluation value of the image block, input the average brightness and a gain corresponding to the acquired image into a preset brightness-noise function for processing to determine an average noise value, wherein the brightness-noise function is used to represent a correspondence between the average brightness, the gain, and the average noise value; remove the average noise value from the initial focus evaluation value to obtain a second focus evaluation value; and perform filtering processing on the second focus evaluation value to obtain a first focus evaluation value of the image block; wherein the brightness-noise function is: FV 噪声 represents the average noise value, K represents the gain, u represents the average brightness, and a and b are fitting parameters; A determining unit is configured to determine a target focus evaluation value of the acquired image according to the first focus evaluation value of each image block in the M image blocks.

8. An electronic device, characterized in that: include: A memory and a processor, the memory being used to store a computer program, the processor being used to execute the method according to any one of claims 1 to 7 when the computer program is called.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Auto focus device

    JP1995143390A