Image FV confidence determination method, device, equipment and storage medium

By adaptively quantifying the focus value (FV) confidence of each area of ​​the image, the problem of non-texture area interference caused by fixed weight distribution in the existing technology is solved, and more accurate and reliable image sharpness calculation is achieved.

CN117974464BActive Publication Date: 2025-01-21上海为旌科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410220196.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-28
Publication Date
2025-01-21
Estimated Expiration
2044-02-28

AI Technical Summary

Technical Problem

The existing image definition calculation method cannot effectively eliminate interference caused by non-texture areas due to the fixed weight allocation method.

Method used

By adaptively quantifying the focus value (FV) confidence of each area of ​​the image, using the content of the image itself to obtain the gradient of each pixel in different directions, and calculating the histogram of the gradient image to determine the mean and variance, the FV confidence is obtained.

Benefits of technology

It reduces the problem of scene inapplicability caused by fixed weight configuration and improves the accuracy and reliability of image definition calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117974464B_ABST
    Figure CN117974464B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, apparatus, device and storage medium for determining the FV confidence of an image, including: determining a first image area, obtaining the gradient of each pixel in different directions in the first image area, and performing absolute value operations on the gradients in different directions to obtain a first result, the first result is used to determine a gradient image; obtaining a histogram of the gradient image, the histogram is used to determine the mean and variance; according to the mean and the variance, obtaining the FV confidence of the first image area. According to the method shown in the embodiments of the present application, it is only necessary to adaptively quantize the FV confidence of each area of ​​the image based on the image content itself, which can reduce the problem of scene inapplicability caused by fixed weight configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of image processing technology, and in particular, to a method, apparatus, device, and storage medium for determining image FV confidence. Background Art

[0002] With the continuous development of image technology, the requirements for image clarity are getting higher and higher. At present, when calculating the focus value FV (focus value) of an image, it is often counted in different areas, and the FV values ​​counted in each area are weighted together as the overall clarity value of the image.

[0003] like Figure 1 As shown in the figure, these are common weight distribution methods: the first is the all-1 type, where all areas have equal weights; the second is the high center and low surrounding type, which concentrates greater weights in the middle of the image; the third is the surrounding 0 type, that is, the areas around the image do not participate in the final clarity evaluation.

[0004] It can be seen that the above image weighted clarity calculation method cannot effectively eliminate the interference caused by non-texture areas due to the fixed weight distribution method. Summary of the invention

[0005] An embodiment of the present application provides a method for determining the FV confidence of an image, which only needs to adaptively quantify the FV confidence of each area of ​​the image based on the image content itself, thereby reducing the scene inapplicability problem caused by fixed weight configuration.

[0006] In a first aspect, an embodiment of the present application provides a method for determining an image FV confidence, comprising:

[0007] Determine a first image region, obtain the gradient of each pixel in different directions in the first image region, and perform absolute value operations on the gradients in different directions to obtain a first result, where the first result is used to determine a gradient image;

[0008] Obtaining a histogram of the gradient image, wherein the histogram is used to determine a mean and a variance;

[0009] The FV confidence of the first image region is obtained according to the mean and the variance.

[0010] It can be seen that according to the method shown in the embodiment of the present application, it is only necessary to adaptively quantize the FV confidence of each area of ​​the image based on the image content itself, which can reduce the scene inapplicability problem caused by fixed weight configuration.

[0011] In a possible implementation manner, the first result is used to determine a gradient image, including:

[0012] An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

[0013] In a possible implementation, the histogram is used to determine the mean and the variance, including: performing post-processing calculation on the histogram, and using the histogram obtained through the post-processing calculation to determine the mean and the variance.

[0014] It can be seen that post-processing the histogram of the gradient image enhances the value of the texture area in the histogram and improves the confidence index of the texture area. Using the mean and variance of the weighted histogram of the gradient image to characterize the FV confidence is reasonable and reliable.

[0015] In a possible implementation manner, the first image area includes at least one pixel.

[0016] In a second aspect, an embodiment of the present application provides an image FV confidence determination device, comprising:

[0017] A determination module, used to determine a first image area, obtain the gradient of each pixel in different directions in the first image area, and perform absolute value operations on the gradients in different directions to obtain a first result, wherein the first result is used to determine a gradient image;

[0018] An acquisition module, used for acquiring a histogram of the gradient image, wherein the histogram is used for determining a mean and a variance;

[0019] A calculation module is used to obtain the FV confidence of the first image area according to the mean and the variance.

[0020] In a possible implementation manner, the determining module is used to:

[0021] An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

[0022] In a possible implementation, the acquisition module is used to perform post-processing calculations on the histogram, and the histogram obtained through post-processing calculations is used to determine the mean and the variance.

[0023] In a possible implementation manner, the first image area includes at least one pixel.

[0024] In a third aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising:

[0025] at least one processor;

[0026] and a memory communicatively coupled to the at least one processor;

[0027] Among them, the memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the electronic device to execute a method corresponding to any embodiment in the first aspect of the embodiments of the present application.

[0028] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-readable storage medium is stored computer execution instructions, which, when executed by a processor, are used to implement any method of the first aspect of the embodiment of the present application.

[0029] In a fifth aspect, the present disclosure further provides a computer program product, which includes computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the method of any embodiment corresponding to the first aspect of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0032] Figure 1 The commonly used FV area weight allocation type provided in the embodiment of the present application;

[0033] Figure 2 A schematic diagram of a method for determining image FV confidence provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of a gradient calculation region division method provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of calculating pixel differences in different directions provided in an embodiment of the present application;

[0036] Figure 5 A schematic diagram of a gradient image calculated in an embodiment of the present application;

[0037] Figure 6 The histogram after the gradient image is calculated in the embodiment of the present application;

[0038] Figure 7 A histogram calculated after post-processing provided in an embodiment of the present application;

[0039] Figure 8Refer to the parameter configuration diagram provided for the embodiments of this application;

[0040] Fig. 9 A schematic diagram of an image FV confidence determination device provided in an embodiment of the present application;

[0041] Fig.10 A schematic diagram of an electronic device for determining image FV confidence provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0043] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The following will describe the embodiments of the present application in conjunction with the accompanying drawings.

[0044] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0045] The professional terms involved in the embodiments of the present application are exemplarily described as follows.

[0046] FV: Focus Value, used to measure the clarity of the image autofocus AF.

[0047] With the continuous development of image technology, the requirements for image clarity are getting higher and higher. At present, when calculating the focus value FV (focus value) of an image, it is often counted in different areas, and the FV values ​​counted in each area are weighted together as the overall clarity value of the image.

[0048] like Figure 1As shown in the figure, these are common weight distribution methods: the first is the all-1 type, where all areas have equal weights; the second is the high center and low surrounding type, which concentrates greater weights in the middle of the image; the third is the surrounding 0 type, that is, the areas around the image do not participate in the final clarity evaluation.

[0049] It can be seen that the above image weighted clarity calculation method cannot effectively eliminate the interference caused by non-texture areas due to the fixed weight distribution method.

[0050] Therefore, an embodiment of the present application provides a method for determining the FV confidence of an image, which only needs to adaptively quantify the FV confidence of each area of ​​the image based on the image content itself, thereby reducing the scene inapplicability problem caused by a fixed weight configuration.

[0051] like Figure 2 As shown, an embodiment of the present application provides a method for determining image FV confidence, including steps S201 to S203. Each step is described in detail below.

[0052] S201. Determine a first image region, obtain the gradient of each pixel in different directions in the first image region, and perform absolute value operations on the gradients in different directions to obtain a first result, where the first result is used to determine a gradient image.

[0053] In a possible implementation manner, the first image area includes at least one pixel.

[0054] In a possible implementation manner, the first result is used to determine a gradient image, including:

[0055] An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

[0056] like Figure 3 As shown, in a possible implementation, when calculating the gradient image, the gradient difference of the 3×3 neighborhood is calculated for each pixel of the first image area srcImg. It can be understood that in the embodiment of the present application, 3×3 is only an example. In actual application, it can also be configured as a 4×4 neighborhood, a 5×5 neighborhood, etc. as needed, and the embodiment of the present application does not limit this.

[0057] like Figure 4 As shown, in a possible implementation, the absolute values ​​of the pixel differences in four directions are calculated respectively.

[0058] It can be understood that the different directions included in the embodiment of the present application are only 4 directions as an example, and the 4 directions include direction 1, direction 2, direction 3 and direction 4. In actual application, direction 1 and direction 2 may be used, or a combination of direction 2 and direction 3 may be used, or a combination of direction 2, direction 3 and direction 4 may be used, and the embodiment of the present application does not limit this.

[0059] In the embodiment of the present application, the pixel grayscale value is represented by I(x, y), and the four directional gradient differences are represented by diff1, diff2, diff3, and diff4 as shown in the following formulas (4-1)-(4-4). After the gradients in the four directions are calculated, they are added to obtain the gradient difference diff of the current pixel (x, y), as shown in formula 4-5.

[0060] diff1=abs(I(x,y-1)-I(x,y+1)) (4-1)

[0061] diff2=abs(I(x-1,y)-I(x+1,y)) (4-2)

[0062] diff3=abs(I(x-1,y-1)-I(x+1,y+1y)) (4-3)

[0063] diff4=abs(I(x+1,y-1)-I(x-1,y+1)) (4-4)

[0064] diff=diff1+diff2+diff3+diff4 (4-5)

[0065] Each pixel is calculated according to the neighborhood formula to obtain the gradient difference image diffImg. Figure 5 Shown, illustratively, are the srcImg and the corresponding diffImg for each region.

[0066] S202: Obtain a histogram of the gradient image, where the histogram is used to determine a mean and a variance.

[0067] In the embodiment of the present application, the histogram information of diffImg is counted, and the histogram is recorded as Hist. Figure 6 As shown, Figure 5 The histogram information corresponding to diffImg.

[0068] In a possible implementation, the histogram is used to determine the mean and the variance, including: performing post-processing calculation on the histogram, and using the histogram obtained through the post-processing calculation to determine the mean and the variance.

[0069] For example, each bin of Hist is given a certain weight; binIdx represents the horizontal coordinate of the histogram, and histVal represents the vertical coordinate. The result of post-processing of HistVal is recorded as newHistVal:

[0070]

[0071] Among them, binMax represents the maximum value of binIdx.

[0072] After the above calculations, we get Figure 7 Results shown.

[0073] Use the post-processed histogram to calculate the mean Ex and variance sigma information of the weighted histogram.

[0074]

[0075]

[0076] It can be seen that post-processing the histogram of the gradient image enhances the value of the texture area in the histogram and improves the confidence index of the texture area. Using the mean and variance of the weighted histogram of the gradient image to characterize the FV confidence is reasonable and reliable.

[0077] S203, obtaining the FV confidence of the first image region according to the mean and the variance. In the embodiment of the present application, after obtaining the variance and the mean, the FV confidence of the region is calculated:

[0078] confidence=β*sigma

[0079] The calculation method of β is as follows:

[0080]

[0081] Among them, the configuration of α1 and α2 is as follows Figure 8 As shown, α1 generally takes a value near (1 / 3)*binMax; α2 generally takes a value near (2 / 3)*binMax.

[0082] It can be seen that according to the method shown in the embodiment of the present application, it is only necessary to adaptively quantize the FV confidence of each area of ​​the image based on the image content itself, which can reduce the scene inapplicability problem caused by fixed weight configuration.

[0083] It is understandable that in the embodiment of the present application, all the formulas given are only exemplary, and in another possible implementation, the coefficients and the constant A can be configured according to actual needs. For example, confidence = β*sigma + A can also implement the method of the embodiment of the present application, and the embodiment of the present application does not limit this.

[0084] Fig. 9 A schematic diagram 900 of an image FV confidence determination device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the device 900 includes:

[0085] A determination module 901 is used to determine a first image region, obtain the gradient of each pixel in different directions in the first image region, and perform absolute value operations on the gradients in different directions to obtain a first result, where the first result is used to determine a gradient image;

[0086] An acquisition module 902 is used to acquire a histogram of the gradient image, wherein the histogram is used to determine a mean and a variance;

[0087] The calculation module 903 is used to obtain the FV confidence of the first image area according to the mean and the variance.

[0088] In a possible implementation manner, the determining module is used to:

[0089] An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

[0090] In a possible implementation, the acquisition module is used to perform post-processing calculations on the histogram, and the histogram obtained through post-processing calculations is used to determine the mean and the variance.

[0091] In a possible implementation manner, the first image area includes at least one pixel.

[0092] It can be understood that the processing device is used to implement Figures 2 to 8 Corresponding to any embodiment method.

[0093] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the electronic device 1000 includes: a memory 1010 and a processor 1020 .

[0094] The memory 1010 stores a computer program that can be executed by at least one processor 1020. The computer program is executed by at least one processor 1020 to enable the electronic device to implement the method provided in any of the above embodiments.

[0095] The memory 1010 and the processor 1020 may be connected via a bus 1030 .

[0096] The relevant instructions can be understood by referring to the relevant descriptions and effects corresponding to the method embodiments, which will not be repeated here.

[0097] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the following Figures 2 to 8 Corresponding to any embodiment method.

[0098] Among them, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0099] An embodiment of the present application provides a computer program product, which includes computer-executable instructions, which are used to implement the following when the computer-executable instructions are executed by a processor: Figures 2 to 8 The method of any corresponding embodiment.

[0100] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0101] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope of the present application is indicated by the claims.

[0102] It will be appreciated that the present application is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.

Claims

1. A method for determining image FV confidence, characterized in that: include: Determine a first image area, obtain the gradient of each pixel in different directions in the first image area, perform absolute value operations on the gradients in different directions, add the absolute value operation results in at least two directions of the different directions to obtain a first result, and use the first result to determine a gradient image; Obtaining a histogram of the gradient image, wherein the histogram is used to determine a mean and a variance; Determine a coefficient based on the size of the mean, and multiply the coefficient by the variance to obtain the FV confidence of the first image area; The relationship between the mean and the coefficient is as follows: , is the coefficient, is the mean value, and 2 are two value points of the mean, and Less than 2, is the maximum value that the mean can reach.

2. The method according to claim 1, characterized in that The first result is used to determine a gradient image, including: An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

3. The method according to claim 1 or 2, characterized in that: The histogram is used to determine the mean and the variance, including: performing post-processing calculation on the histogram, and using the histogram obtained by the post-processing calculation to determine the mean and the variance.

4. The method according to claim 1, characterized in that: The first image area includes at least one pixel.

5. An image FV confidence determination device, characterized in that: include: a determination module, configured to determine a first image region, obtain the gradient of each pixel in different directions in the first image region, perform absolute value operations on the gradients in different directions, add the absolute value operation results in at least two directions of the different directions, and obtain a first result, wherein the first result is used to determine a gradient image; An acquisition module, used for acquiring a histogram of the gradient image, wherein the histogram is used for determining a mean and a variance; a calculation module, configured to determine a coefficient based on the size of the mean, and multiply the coefficient by the variance to obtain an FV confidence of the first image area; The relationship between the mean and the coefficient is as follows: , is the coefficient, is the mean value, and 2 are two value points of the mean, and Less than 2, is the maximum value that the mean can reach.

6. The device according to claim 5, characterized in that The determining module is used to: An absolute value operation is performed on the gradients in different directions, and the first results obtained after the operation are added together to obtain the gradient image.

7. The device according to claim 5 or 6, characterized in that The acquisition module is used to perform post-processing calculation on the histogram, and the histogram obtained through post-processing calculation is used to determine the mean and the variance.

8. The device according to claim 5, characterized in that The first image area includes at least one pixel.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 4 when executed by a processor.

10. A computer program product comprising computer executable instructions, characterized in that: The computer-executable instructions are used to implement the method according to any one of claims 1 to 4 when executed by a processor.

Citation Information

Patent Citations

  • Non-reference definition evaluating method and system for full-slice image

    CN107507173A

  • Automatic focusing system and method based on multi-depth plane microscope

    CN110646933A