Image clarity evaluation method, device, equipment and medium

By using a method of enhancing grayscale gradient based on image dark channel in image clarity evaluation, the problem of unsatisfactory clarity evaluation in the traditional method in small grayscale gradient areas is solved, and more accurate focus positioning is achieved.

CN115760757BActive Publication Date: 2025-04-25XINJIANG TECH INST OF PHYSICS & CHEM CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211438468.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-16
Publication Date
2025-04-25
Estimated Expiration
2042-11-16

AI Technical Summary

Technical Problem

The traditional image clarity evaluation function cannot accurately evaluate the clarity of the object in areas with small gray gradients and inconspicuous changes in the focus area, resulting in the inability to accurately find the focus position.

Method used

By continuously changing the flange distance of the measurement lens and using the sensor to acquire images, the image clarity evaluation function based on the image dark channel enhancement grayscale gradient is used to calculate the sharpness value of the images acquired by different flange distances. The specific steps include converting the RGB image into a grayscale image, traversing the grayscale image to determine the maximum and minimum pixel grayscale values, and calculating the sharpness value from these values.

Benefits of technology

This method can better adapt to areas with small gray gradients and less obvious changes, improve the signal-to-noise ratio, stability and unimodality of image clarity calculation, so as to find the focus position more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760757B_ABST
    Figure CN115760757B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image clarity evaluation method, device, electronic device and medium, the method comprising: continuously changing the flange focal length of the measuring lens, and using a sensor to collect images to obtain images corresponding to each flange focal length; using an image clarity evaluation function based on image dark channel enhanced grayscale gradient to calculate the clarity values ​​of images collected at different flange focal lengths, and determining the image with the highest clarity value. The image clarity evaluation method is applicable to image clarity calculation in a variety of scenarios, and has the characteristics of strong unimodality and good robustness in scenarios where the image grayscale changes are not obvious.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of image clarity evaluation, and in particular to an image clarity evaluation method, device, equipment and medium. Background Art

[0002] The evaluation of image clarity can be achieved without reference to image quality. Through the calculation of the clarity evaluation function, the image blur degree result corresponding to the subjective feeling of the human eye can be obtained. For image clarity evaluation functions, there are currently many methods, such as Brenner gradient function, Tenengrad gradient function, Laplacian gradient function, variance function, energy gradient function and entropy function. These image clarity evaluation functions can be applied to the calculation of image clarity values. In specific scenarios, using these functions for calculation can obtain a relatively accurate result. However, the traditional image clarity evaluation function does not produce ideal evaluation results for the image clarity of objects in the area with small grayscale gradient and unclear changes in the focus area, which ultimately leads to the inability to accurately find the focus position. Summary of the invention

[0003] In view of this, the present disclosure provides an image clarity evaluation method, device, equipment and medium, which are used to at least partially solve the problem in the prior art that the clarity evaluation results of objects in the focus area with small grayscale gradient and unclear changes are not ideal.

[0004] A first aspect of the present disclosure provides an image clarity evaluation method, comprising: continuously changing the flange focal length of a measuring lens, and acquiring images using a sensor to obtain images corresponding to each flange focal length; and calculating clarity values ​​of images acquired at different flange focal lengths using an image clarity evaluation function based on image dark channel enhanced grayscale gradient.

[0005] According to an embodiment of the present disclosure, an image clarity evaluation function based on image dark channel enhanced grayscale gradient is used to calculate the clarity values ​​of images captured at different flange distances, specifically including: for each image corresponding to the flange distance, converting the image corresponding to the flange distance from an RGB image to a grayscale image; traversing the grayscale image with a preset search window, and determining the maximum pixel grayscale value and the minimum pixel grayscale value corresponding to each search in the traversal process; traversing the RGB image, splitting the values ​​of the R, G, and B channels of each pixel point, and obtaining the minimum pixel value in the R, G, and B channels; and calculating the clarity value of the image corresponding to the flange distance according to the maximum pixel grayscale value, the minimum pixel grayscale value, and the minimum pixel grayscale value in the R, G, and B channels.

[0006] According to an embodiment of the present disclosure, the clarity value of the image corresponding to the flange distance is calculated based on the maximum pixel grayscale value, the minimum pixel grayscale value and the minimum pixel value in the R, G, and B channels, specifically including: accumulating the maximum pixel grayscale value based on the maximum pixel grayscale value and the minimum pixel grayscale value; and calculating the clarity value of the image corresponding to the flange distance based on the accumulation result and the minimum pixel value.

[0007] According to an embodiment of the present disclosure, the maximum pixel grayscale value is accumulated according to the maximum pixel grayscale value and the minimum pixel grayscale value, specifically including:

[0008]

[0009] All maximum pixel grayscale values ​​are accumulated, where (x, y) is the coordinate position of the pixel point, maxG i (x, y) is the maximum pixel grayscale value corresponding to the i-th search, minG i (x, y) is the minimum pixel gray value corresponding to the i-th search, m is the total number of searches during the traversal process, k is the image number corresponding to the current flange distance position, and F(k) is the cumulative result of all maximum pixel gray values ​​in the k-th image.

[0010] According to an embodiment of the present disclosure, the definition value of the image corresponding to the flange distance is calculated according to the accumulation result and the minimum pixel value, specifically including:

[0011]

[0012] Calculate the image clarity value corresponding to the current flange distance position, where D k is the clarity value of the kth image, Ω(y) is the square area centered on the pixel with coordinate position y, and I c (y) is the pixel value in a color channel of the square area.

[0013] According to an embodiment of the present disclosure, converting the image corresponding to the flange distance from an RGB image to a grayscale image specifically includes: obtaining a resolution size of the RGB image; and converting the RGB image into a grayscale image according to the obtained resolution size.

[0014] A second aspect of the present disclosure provides an image clarity evaluation device, including: an image acquisition module, used to continuously change the flange distance of a measuring lens, and use a sensor to acquire images to obtain images corresponding to each flange distance; a calculation module, used to calculate the clarity values ​​of images acquired at different flange distances using an image clarity evaluation function based on image dark channel enhanced grayscale gradient.

[0015] According to an embodiment of the present disclosure, a calculation module includes: a conversion unit, which is used to convert the image corresponding to each flange distance from an RGB image to a grayscale image; a first traversal unit, which is used to traverse the grayscale image with a preset search window, and determine the maximum pixel grayscale value and the minimum pixel grayscale value corresponding to each search in the traversal process; a second traversal unit, which traverses the RGB image, splits the R, G, and B channel values ​​of each pixel point, and obtains the minimum pixel value in the R, G, and B channels; a calculation unit, which is used to calculate the clarity value of the image corresponding to the flange distance based on the maximum pixel grayscale value, the minimum pixel grayscale value and the minimum pixel grayscale value in the R, G, and B channels.

[0016] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above method.

[0017] A fourth aspect of the present disclosure provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method described in the claim.

[0018] The image clarity evaluation method, device, equipment and medium provided by the embodiments of the present disclosure have at least the following beneficial effects:

[0019] This method is based on enhancing the grayscale gradient of the dark channel of the image. The image clarity is calculated according to the minimum pixel value of the three channels of the RGB image and the maximum pixel grayscale value of the corresponding grayscale image. It can adapt to the image clarity calculation of objects in areas with small grayscale gradients and unobvious changes, and has better signal-to-noise ratio, stability and unimodality. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0021] Figure 1 The flowchart of the image clarity evaluation method according to the embodiment of the present disclosure is schematically shown.

[0022] Figure 2 The flowchart of the method for calculating image clarity according to an embodiment of the present disclosure is schematically shown.

[0023] Figure 3 The figure schematically shows a curve of actual definition values ​​calculated according to an embodiment of the present disclosure.

[0024] Figure 4 A block diagram of an image clarity evaluation device according to an embodiment of the present disclosure is schematically shown.

[0025] Figure 5 The block diagram of a computing module according to an embodiment of the present disclosure is schematically shown.

[0026] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.

[0028] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0029] In the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or can communicate with each other; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0030] In the description of the present disclosure, it is necessary to understand that the terms "longitudinal", "length", "circumferential", "front", "rear", "left", "right", "top", "bottom", "inside", "outside", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the present disclosure and simplifying the description, and do not indicate or imply that the subsystem or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present disclosure.

[0031] Throughout the drawings, the same elements are represented by the same or similar reference numerals. Conventional structures or configurations will be omitted when they may cause confusion in the understanding of the present disclosure. The shapes, sizes, and positional relationships of the components in the drawings do not reflect the actual size, proportion, and actual positional relationship. In addition, in the present disclosure, any reference symbol between brackets should not be constructed as a limitation to the present disclosure.

[0032] Similarly, in order to simplify the present disclosure and help understand one or more of the various disclosed aspects, in the above description of the exemplary embodiments of the present disclosure, the various features of the present disclosure are sometimes grouped together into a single embodiment, figure, or description thereof. The description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0033] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0034] Figure 1 The flowchart of the image clarity evaluation method according to the embodiment of the present disclosure is schematically shown.

[0035] like Figure 1 As shown, the image clarity evaluation method may include, for example, operations S101 to S102.

[0036] In operation S101 , the flange focal length of the measuring lens is continuously changed, and an image is collected by using a sensor to obtain an image corresponding to each flange focal length.

[0037] In operation S102, the clarity values ​​of images acquired at different flange distances are calculated using an image clarity evaluation function based on enhanced grayscale gradient of an image dark channel.

[0038] Figure 2 The flowchart of the method for calculating image clarity according to an embodiment of the present disclosure is schematically shown.

[0039] like Figure 2 As shown, the image definition calculation method may include, for example, operations S201 to S205.

[0040] In operation S201 , for each image corresponding to the flange distance, the image corresponding to the flange distance is converted from an RGB image to a grayscale image.

[0041] For example, the sensor for collecting images may be a complementary metal oxide semiconductor (CMOS) sensor, which may be selected according to actual needs and is not limited by the present disclosure. The multiple images collected with different blur levels may be 1920*1080 RGB images, and the specific size may be determined according to actual needs and is not limited by the present disclosure. The RGB image may be converted into a grayscale image by the resolution size.

[0042] In operation S202, the grayscale image is traversed with a preset search window, and the maximum pixel grayscale value and the minimum pixel grayscale value corresponding to each search in the traversal process are determined.

[0043] For example, a 9*9 search window can be used to traverse the grayscale image obtained in operation S201. The pixel values ​​in each search window are sorted to obtain the maximum pixel grayscale value. During the traversal of the grayscale image, a maximum pixel grayscale value can be obtained for each search window. For example, if the total number of searches during the traversal is m, m maximum pixel grayscale values ​​can be obtained.

[0044] In operation S203, the RGB image is traversed, the values ​​of the R, G, and B channels of each pixel are separated, and the minimum value of the pixel in the R, G, and B channels is obtained.

[0045] In operation S204, the definition value of the image corresponding to the flange focal length is calculated according to the maximum pixel gray value, the minimum pixel gray value, and the minimum pixel value in the R, G, and B channels.

[0046] In the embodiment of the present disclosure, the maximum pixel grayscale value may be first accumulated according to the maximum pixel grayscale value and the minimum pixel grayscale value, and then the clarity value of the image corresponding to the flange distance may be calculated according to the accumulated result and the minimum pixel value.

[0047] Further, in operation S204,

[0048]

[0049] All maximum pixel grayscale values ​​are accumulated, where (x, y) is the coordinate position of the pixel point, maxG i (x, y) is the maximum pixel grayscale value corresponding to the i-th search, minG i (x, y) is the minimum pixel gray value corresponding to the i-th search, m is the total number of searches during the traversal process, k is the image number corresponding to the current flange distance position, and F(k) is the cumulative result of all maximum pixel gray values ​​in the k-th image.

[0050] In other words, establish a search window of a specified size to divide the grayscale image into m calculation blocks, sort the grayscale values ​​of each block, and obtain the maximum pixel grayscale value max(x, y) and minimum grayscale value min(x, y) of each calculation block, as shown in the formula in the figure below. The result of subtracting the maximum grayscale value from the minimum grayscale value of 1 to m calculation blocks and then multiplying it by the maximum grayscale value is represented by F(k).

[0051] Further, in operation S204,

[0052]

[0053] Calculate the image clarity value corresponding to the current flange distance position, where D k is the clarity value of the kth image, Ω(y) is the square area centered on the pixel point with coordinate position y, and Ic(y) is the pixel value in a color channel of the square area.

[0054] After calculating the clarity values ​​corresponding to images with different blur levels, a clarity value curve can be drawn to intuitively and quickly determine the highest point of clarity.

[0055] Figure 3 The figure schematically shows a curve of actual definition values ​​calculated according to an embodiment of the present disclosure.

[0056] based on Figure 3 , the maximum definition value D can be quickly determined max .

[0057] The image clarity evaluation method provided by the embodiment of the present disclosure can be adapted to the calculation of the clarity of object images in areas with small grayscale gradients and inconspicuous changes, and has better signal-to-noise ratio, stability and unimodality.

[0058] Figure 4 A block diagram of an image clarity evaluation device according to an embodiment of the present disclosure is schematically shown.

[0059] like Figure 4 As shown, the image clarity evaluation device 500 may include, for example, an image acquisition module 410 and a calculation module 420 .

[0060] The image acquisition module 410 is used to continuously change the flange focal length of the measurement lens and acquire images using a sensor to obtain an image corresponding to each flange focal length.

[0061] The calculation module 420 is used to calculate the clarity values ​​of images collected at different flange distances by using an image clarity evaluation function based on the image dark channel enhanced grayscale gradient.

[0062] Further, Figure 5The block diagram of a computing module according to an embodiment of the present disclosure is schematically shown.

[0063] like Figure 5 As shown, the calculation module 420 may include, for example, a conversion unit 421 , a first traversal unit 422 , a second traversal unit 423 and a calculation unit 424 .

[0064] The conversion unit 421 is used to convert the image corresponding to each flange distance from an RGB image to a grayscale image.

[0065] The first traversal unit 422 is used to traverse the grayscale image with a preset search window, and determine the maximum pixel grayscale value and the minimum pixel grayscale value corresponding to each search in the traversal process.

[0066] The second traversal unit 423 traverses the RGB image, separates the values ​​of the R, G, and B channels of each pixel, and obtains the minimum value of the pixels in the R, G, and B channels.

[0067] The calculation unit 424 is used to calculate the clarity value of the image corresponding to the flange distance according to the maximum pixel gray value, the minimum pixel gray value and the minimum pixel value in the R, G, and B channels.

[0068] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0069] For example, any multiple of the image acquisition module 410 and the computing module 420 can be combined in one module / unit / subunit for implementation, or any one of the modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functions of one or more of these modules / units / subunits can be combined with at least part of the functions of other modules / units / subunits and implemented in one module / unit / subunit. According to an embodiment of the present disclosure, at least one of the image acquisition module 410 and the computing module 420 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the image acquisition module 410 and the computing module 420 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.

[0070] It should be noted that the image clarity evaluation device part in the embodiment of the present disclosure corresponds to the image clarity evaluation method part in the embodiment of the present disclosure, and their specific implementation details and technical effects are also the same, which will not be repeated here.

[0071] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0072] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0073] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0074] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.

[0075] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0076] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0077] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.

[0078] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or the RAM 603 described above and / or one or more memories other than the ROM 602 and the RAM 603 .

[0079] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.

Claims

1. A method for evaluating image clarity, characterized in that: include: The flange focal distance of the measuring lens is continuously changed, and the image corresponding to each flange focal distance is obtained by using the sensor to collect images; For each image corresponding to the flange distance, convert the image corresponding to the flange distance from an RGB image to a grayscale image; Traversing the grayscale image with a preset search window, and determining a maximum pixel grayscale value and a minimum pixel grayscale value corresponding to each search in the traversal process; Traverse the RGB image, split the R, G, and B channel values ​​of each pixel, and obtain the minimum pixel value in the R, G, and B channels; according to All the maximum pixel grayscale values ​​are accumulated, where (x, y) is the coordinate position of the pixel point, maxG i (x, y) is the maximum pixel grayscale value corresponding to the i-th search, minG i (x, y) is the minimum pixel gray value corresponding to the i-th search, m is the total number of searches during the traversal process, k is the image number corresponding to the current flange distance position, and F(k) is the cumulative result of all maximum pixel gray values ​​in the k-th image; according to Calculate the image clarity value corresponding to the current flange distance position, where D k is the clarity value of the kth image, Ω(y) is the square area centered on the pixel with coordinate position y, and I c (y) is the pixel value in a color channel of the square area.

2. The image clarity evaluation method according to claim 1, characterized in that: The converting the image corresponding to the flange distance from an RGB image to a grayscale image comprises: Obtaining the resolution of the RGB image; The RGB image is converted into a grayscale image according to the resolution.

3. An image clarity evaluation device, characterized in that: include: An image acquisition module, used to continuously change the flange focal length of the measuring lens and acquire images using a sensor to obtain an image corresponding to each flange focal length; Computing module, including: A conversion unit, for converting the image corresponding to each flange distance from an RGB image to a grayscale image; A first traversal unit, used for traversing the grayscale image with a preset search window, and determining a maximum pixel grayscale value and a minimum pixel grayscale value corresponding to each search in the traversal process; The second traversal unit traverses the RGB image, splits the R, G, and B channel values ​​of each pixel, and obtains the minimum pixel value in the R, G, and B channels; Computing unit for: according to All the maximum pixel grayscale values ​​are accumulated, where (x, y) is the coordinate position of the pixel point, maxG i (x, y) is the maximum pixel grayscale value corresponding to the i-th search, minG i (x, y) is the minimum pixel gray value corresponding to the i-th search, m is the total number of searches during the traversal process, k is the image number corresponding to the current flange distance position, and F(k) is the cumulative result of all maximum pixel gray values ​​in the k-th image; according to Calculate the image clarity value corresponding to the current flange distance position, where D k is the clarity value of the kth image, Ω(y) is the square area centered on the pixel with coordinate position y, and I c (y) is the pixel value in a color channel of the square area.

4. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of claim 1 or 2.

5. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor implements the method according to claim 1 or 2.

Citation Information

Patent Citations

  • Definition evaluation value calculation method and device, camera and storage medium

    CN112950523A

  • Image focusing accuracy evaluation method and system

    CN114972084A