Image clarity scoring method, system, electronic device and readable storage medium
The target focus is determined through Fourier variation and focus labels, combined with pixel distance grouping and impact coefficient calculation, the problem of low efficiency of existing image definition algorithms is solved, and more accurate and efficient image definition scores are achieved.
Patent Information
- Application Number
- CN202210601760.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-05-30
AI Technical Summary
The existing image definition algorithm is inefficient, and edge detection has low accuracy in edge positioning, so it is impossible to correctly perceive image definition changes, which affects the timeliness and yield rate of production and processing.
The frequency domain image is obtained through Fourier variation, the target focus is determined based on the focus label, the pixel points are grouped based on the pixel distance, the influence coefficient is calculated, and the clarity score is determined based on the grayscale value.
The steps of the clarity scoring algorithm are simplified, efficiency is improved, image clarity can be evaluated more accurately, and the production and manufacturing quality of monitoring equipment is improved.
Smart Images

Figure CN115049595B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video processing technology, and in particular to an image clarity scoring method, system, electronic device and readable storage medium. Background Art
[0002] In existing monitoring equipment, the front face acquisition components include camera lenses and lens sensors. The camera lens is an optical component used to acquire images, while the lens sensor is set near the camera lens to obtain various parameters acquired by the camera lens. These parameters are used to correct the acquired images and improve the image quality. Among them, image clarity, as an important parameter for measuring image quality, is affected by the distance between the camera lens and the lens sensor. Therefore, the scoring accuracy of the image clarity algorithm has a huge impact on the use and production of monitoring equipment, and is also of great significance for the analysis of the causes of failed materials.
[0003] At present, image clarity algorithms usually obtain specific edge features in an image, and then judge the clarity of the current image through the numerical values obtained by edge detection. However, the accuracy of edge positioning by edge detection is low, and there is more than one edge feature. At the same time, edge detection is unstable in sensing noise in the image, resulting in the inability of edge detection to correctly perceive changes in image clarity, making the algorithm steps cumbersome and complicated, and causing the efficiency of the image clarity algorithm to be low, affecting the timeliness and yield rate of actual production and processing, and failing to meet industry requirements. Summary of the invention
[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0005] In view of the above-mentioned shortcomings of the prior art, the present invention discloses an image clarity scoring method, system, electronic device and readable storage medium to improve the efficiency of the image clarity algorithm.
[0006] The present invention discloses a method for scoring image clarity, comprising: obtaining an original image and a focus label corresponding to the original image, performing Fourier transform on the original image to obtain a frequency domain image corresponding to the original image; determining a target focus from pixel points of the frequency domain image according to the focus label, grouping the pixel points based on the pixel distance between the target focus and each pixel point to obtain a pixel point set corresponding to a plurality of pixel distance intervals; determining an influence coefficient corresponding to the pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set, and determining a clarity score corresponding to the original image based on the grayscale value of the pixel points in each pixel point set and each influence coefficient.
[0007] Optionally, the method also includes at least one of the following: if the original image includes a color image, after acquiring the original image and before performing a Fourier transform on the original image, converting the color image into a grayscale image; after performing a Fourier transform on the original image to obtain a frequency domain image corresponding to the original image, before determining the target focus from the pixels of the frequency domain image according to the focus label, grayscale binarization is performed on each pixel in the frequency domain image.
[0008] Optionally, the pixel points are grouped based on the pixel distance between the target focus and each of the pixel points to obtain pixel point sets corresponding to multiple pixel distance intervals, including: obtaining a first distance threshold, a second distance threshold, and a third distance threshold, wherein the first distance threshold is greater than the second distance threshold, and the second distance threshold is greater than the third distance threshold; in the frequency domain image, a circular area is established with the target focus as the center of the circle and the first distance threshold, the second distance threshold, and the third distance threshold as the radius in sequence, to obtain a first circular area, a second circular area, and a third circular area respectively; a first point set is established based on the pixel points located outside the first circular area, and the pixel distance interval corresponding to the first point set is large. The invention relates to a method for determining a pixel point set according to a first distance threshold; establishing a second point set according to pixel points located within the first circular area and outside the second circular area, wherein the pixel distance interval corresponding to the second point set is less than the first distance threshold and greater than the second distance threshold; establishing a third point set according to pixel points located within the second circular area and outside the third circular area, wherein the pixel distance interval corresponding to the third point set is less than the second distance threshold and greater than the third distance threshold; establishing a fourth point set according to pixel points located within the third circular area, wherein the pixel distance interval corresponding to the fourth point set is less than the third distance threshold; and determining the first point set, the second point set, the third point set and the fourth point set as pixel point sets.
[0009] Optionally, the influence coefficient corresponding to the pixel point set is determined by the following formula: α i =(S i +β)·(N i +λ), where α i is the influence coefficient corresponding to the i-th pixel set, S i is the minimum value in the pixel distance interval corresponding to the i-th pixel set, β is the preset distance coefficient, N i is the number of pixels corresponding to the i-th pixel set, and λ is the preset number coefficient.
[0010] Optionally, the clarity score corresponding to the original image is determined by the following formula: Where FV is the clarity score corresponding to the original image, n is the number of pixel points, G i is the sum of the grayscale values corresponding to the pixels in the i-th pixel set, α i is the influence coefficient corresponding to the pixel in the i-th pixel set.
[0011] Optionally, the method also includes: obtaining an image acquisition device, wherein the image acquisition device includes a device lens and a lens sensor; adjusting a test distance between the camera lens and the lens sensor based on a preset adjustment speed, and acquiring a sample image and a test distance corresponding to the sample image through the image acquisition device after a preset time period; determining a clarity score corresponding to each of the sample images, and determining an optimal distance from the test distances based on each of the clarity scores.
[0012] Optionally, the method also includes: acquiring an image to be tested, wherein the image to be tested includes several areas to be tested with the same area; determining an arbitrary reference area from the image to be tested, wherein the reference area is outside the area to be tested and the area of the reference area is the same as the area of the area to be tested; determining a clarity score corresponding to each of the areas to be tested and a clarity score corresponding to the reference area; comparing the clarity scores corresponding to the reference areas with the clarity scores corresponding to the areas to be tested, and determining whether the area to be tested is a dark corner area based on the comparison results.
[0013] The present invention discloses an image clarity scoring system, comprising: an acquisition module, used for acquiring an original image and a focus label corresponding to the original image, performing Fourier transform on the original image, and obtaining a frequency domain image corresponding to the original image; a grouping module, used for determining a target focus from pixel points of the frequency domain image according to the focus label, and grouping the pixel points based on the pixel distance between the target focus and each pixel point, and obtaining a pixel point set corresponding to a plurality of pixel distance intervals; a scoring module, used for determining an influence coefficient corresponding to a pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set, and determining a clarity score corresponding to the original image based on the grayscale value of the pixel points in each pixel point set and each influence coefficient.
[0014] The present invention discloses an electronic device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above method.
[0015] The present invention discloses a computer-readable storage medium, on which a computer program is stored: when the computer program is executed by a processor, the above method is implemented.
[0016] Beneficial effects of the present invention:
[0017] The frequency domain image corresponding to the original image is determined by Fourier transformation, the target focus is determined from the pixels of the frequency domain image according to the focus label of the original image, the pixels are divided into multiple pixel groups based on the pixel distance between the target focus and each pixel, and the influence coefficient corresponding to the pixel set is determined according to the pixel distance interval and / or the number of pixels corresponding to the pixel set, so as to determine the clarity score corresponding to the original image based on the grayscale value of the pixel in each pixel set and each influence coefficient. In this way, since the frequency domain grayscale value is proportional to the image clarity, the original image is converted from a time domain image to a frequency domain image, and multiple pixel groups are divided according to the distance from the target focus, and the influence coefficient corresponding to each pixel group is determined, and then the clarity score of the original image is determined by the grayscale value of the pixel and the influence coefficient of the pixel group. Compared with the edge detection algorithm, the algorithm steps for determining clarity through the frequency domain image are simple, which improves the efficiency of the image clarity scoring algorithm, thereby providing assistance to the production and manufacturing of monitoring equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flow chart of an image clarity scoring method in an embodiment of the present invention;
[0019] Figure 2-a is a schematic diagram of a grayscale image corresponding to an original image in an embodiment of the present invention;
[0020] Figure 2-b is a schematic diagram of a frequency domain image corresponding to an original image in an embodiment of the present invention;
[0021] Figure 2-c is a schematic diagram of a pixel point set in a frequency domain image in an embodiment of the present invention;
[0022] Figure 3 is a flow chart of an optimal distance determination method based on an image clarity scoring method in an embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of an image to be tested in an embodiment of the present invention;
[0024] Figure 5 is a structural schematic diagram of an image clarity scoring system in an embodiment of the present invention;
[0025] Figure 6 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and sub-samples in the embodiments can be combined with each other without conflict.
[0027] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0028] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0029] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0030] Unless otherwise stated, the term "plurality" means two or more.
[0031] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0032] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0033] Combination Figure 1 As shown, the embodiment of the present disclosure provides an image clarity scoring method, comprising:
[0034] Step S101, obtaining an original image and a focus label corresponding to the original image, performing Fourier transform on the original image, and obtaining a frequency domain image corresponding to the original image;
[0035] Step S102, determining a target focus from pixels of the frequency domain image according to the focus label, grouping the pixels based on the pixel distance between the target focus and each pixel, and obtaining pixel point sets corresponding to a plurality of pixel distance intervals;
[0036] Step S103, determining the influence coefficient corresponding to the pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set;
[0037] Step S104, determining a clarity score corresponding to the original image based on the grayscale values of the pixels in each pixel set and each influence coefficient.
[0038] The image clarity scoring method provided by the embodiment of the present disclosure is adopted to determine the frequency domain image corresponding to the original image through Fourier transformation, determine the target focus from the pixels of the frequency domain image according to the focus label of the original image, divide the pixels into multiple pixel groups based on the pixel distance between the target focus and each pixel, and determine the influence coefficient corresponding to the pixel set according to the pixel distance interval and / or the number of pixels corresponding to the pixel set, thereby determining the clarity score corresponding to the original image based on the grayscale value of the pixel in each pixel set and each influence coefficient. In this way, since the frequency domain grayscale value is proportional to the image clarity, the original image is converted from a time domain image to a frequency domain image, and multiple pixel groups are divided according to the distance from the target focus, and the influence coefficient corresponding to each pixel group is determined, and then the clarity score of the original image is determined by the grayscale value of the pixel and the influence coefficient of the pixel group. Compared with the edge detection algorithm, the algorithm steps for determining clarity through the frequency domain image are simple, which improves the efficiency of the image clarity scoring algorithm, thereby providing assistance to the production and manufacturing of monitoring equipment.
[0039] In some embodiments, based on the logic of Fourier algorithm, the time domain image is converted into a frequency domain image. The smaller the grayscale value of the pixels in any range in the frequency domain image, the less clear the image in that range is. Therefore, the clarity of the time domain image can be assumed to be the superposition of the grayscale values of the pixels in the frequency domain image. The larger the overall value obtained by the superposition, the clearer the time domain image is.
[0040] Optionally, the method also includes at least one of the following: if the original image includes a color image, after acquiring the original image and before performing a Fourier transform on the original image, the color image is converted into a grayscale image; after performing a Fourier transform on the original image to obtain a frequency domain image corresponding to the original image, before determining the target focus from the pixels of the frequency domain image according to the focus label, each pixel in the frequency domain image is gray-binarized.
[0041] Optionally, pixel points are grouped based on the pixel distance between the target focus and each pixel point to obtain pixel point sets corresponding to multiple pixel distance intervals, including: obtaining a first distance threshold, a second distance threshold, and a third distance threshold, wherein the first distance threshold is greater than the second distance threshold, and the second distance threshold is greater than the third distance threshold; in the frequency domain image, a circular area is established with the target focus as the center of the circle and the first distance threshold, the second distance threshold, and the third distance threshold as the radius in sequence, to obtain a first circular area, a second circular area, and a third circular area respectively; a first point set is established based on the pixel points outside the first circular area, and the pixel distances corresponding to the first point set are The interval is greater than the first distance threshold; a second point set is established based on the pixel points located within the first circular area and outside the second circular area, and the pixel distance interval corresponding to the second point set is less than the first distance threshold and greater than the second distance threshold; a third point set is established based on the pixel points located within the second circular area and outside the third circular area, and the pixel distance interval corresponding to the third point set is less than the second distance threshold and greater than the third distance threshold; a fourth point set is established based on the pixel points located within the third circular area, and the pixel distance interval corresponding to the fourth point set is less than the third distance threshold; the first point set, the second point set, the third point set and the fourth point set are determined as pixel point sets.
[0042] Optionally, the influence coefficient corresponding to the pixel point set is determined by the following formula:
[0043] α i =(S i +β)·(N i +λ),
[0044] In the formula, α i is the influence coefficient corresponding to the i-th pixel set, S i is the minimum value in the pixel distance interval corresponding to the i-th pixel set, β is the preset distance coefficient, N i is the number of pixels corresponding to the i-th pixel set, and λ is the preset number coefficient.
[0045] Optionally, the clarity score corresponding to the original image is determined by the following formula:
[0046]
[0047] In the formula, FV is the clarity score corresponding to the original image, n is the number of pixel points, G i is the sum of the grayscale values corresponding to the pixels in the i-th pixel set, α i is the influence coefficient corresponding to the pixel in the i-th pixel set.
[0048] In some embodiments, an original image is obtained and converted into a grayscale image. The converted grayscale image is as follows: Figure 2-aAs shown; the grayscale image corresponding to the original image is subjected to Fourier transformation to obtain the frequency domain image corresponding to the original image, and the grayscale binarization of each pixel in the frequency domain image is performed so that the grayscale value of each pixel is 0 or 1. The frequency domain image after grayscale binarization is as shown Figure 2-b As shown; the pixel point at the center of the frequency domain image is determined as the target focus according to the focus label, and circular areas are established based on the target focus with the first distance threshold, the second distance threshold, and the third distance threshold, respectively, to obtain the first circular area, the second circular area, and the third circular area, respectively, and then the first point set A, the second point set B, the third point set C, and the fourth point set D are obtained according to the first circular area, the second circular area, and the third circular area. The point sets are shown in Figure 2-c As shown; the clarity score corresponding to the original image is determined according to the first point set A, the second point set B, the third point set C and the fourth point set D.
[0049] Optionally, the method also includes: obtaining an image acquisition device, wherein the image acquisition device includes a device lens and a lens sensor; adjusting a test distance between the camera lens and the lens sensor based on a preset adjustment speed, and acquiring a sample image and a test distance corresponding to the sample image through the image acquisition device after a preset time period; determining a clarity score corresponding to each sample image, and determining an optimal distance from the test distances based on each clarity score.
[0050] Optionally, after collecting sample images and test distances corresponding to the sample images through an image acquisition device after every preset time period, the method further includes: taking the test distance between the camera lens and the lens sensor as the X-axis, and taking the clarity score corresponding to the sample image as the Y-axis, establishing a clarity change graph of the test distance and clarity score according to each sample image, and using the clarity change graph to take the test distance with the highest clarity score as the optimal distance between the camera lens and the lens sensor.
[0051] Combination Figure 3 As shown, the embodiment of the present disclosure provides an optimal distance determination method based on an image clarity scoring method, including:
[0052] Step S301, obtaining an image acquisition device, an initialization distance, and a final distance;
[0053] Wherein, the image acquisition device includes a device lens and a lens sensor;
[0054] Step S302, using the initialization distance as the test distance between the camera lens and the lens sensor;
[0055] Step S303, adjusting the test distance between the camera lens and the lens sensor based on a preset adjustment speed until a final distance is reached;
[0056] Among them, adjustment includes increase or decrease;
[0057] Step S304, when adjusting the test distance, collecting sample images and the test distance corresponding to the sample images through an image acquisition device after every preset time period;
[0058] Step S305, determining the clarity score corresponding to each sample image;
[0059] Step S306, determining the best distance from the test distances based on the clarity scores;
[0060] Step S307: taking the optimal distance as the test distance between the camera lens and the lens sensor.
[0061] Optionally, the method also includes: acquiring an image to be tested, wherein the image to be tested includes several areas to be tested with the same area; determining an arbitrary reference area from the image to be tested, wherein the reference area is outside the area to be tested and the area of the reference area is the same as the area of the area to be tested; determining a clarity score corresponding to each area to be tested and a clarity score corresponding to the reference area; comparing the clarity scores corresponding to the reference areas with the clarity scores corresponding to the areas to be tested, and determining whether the area to be tested is a dark corner area based on the comparison results.
[0062] In some embodiments, an image to be tested is obtained, wherein there is a test area E at each of the four corners of the image to be tested; a reference area F is determined from the image to be tested, and the image to be tested including the test area and the reference area is as follows: Figure 4 As shown; determine the clarity score corresponding to the area to be tested and the clarity score corresponding to the reference area; calculate the score difference between the clarity score corresponding to the reference area and the clarity score corresponding to each area to be tested; if the score difference is greater than a preset threshold, it is determined that the area to be tested corresponding to the score difference has a dark corner.
[0063] The image clarity scoring method provided by the embodiment of the present disclosure is used to determine the frequency domain image corresponding to the original image through Fourier transform, determine the target focus from the pixel points of the frequency domain image according to the focus label of the original image, divide the pixel points into multiple pixel point groups based on the pixel distance between the target focus and each pixel point, and determine the influence coefficient corresponding to the pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set, so as to determine the clarity score corresponding to the original image based on the grayscale value of the pixel points in each pixel point set and each influence coefficient, which has the following advantages:
[0064] First, since the grayscale value in the frequency domain is proportional to the image clarity, the original image is converted from a time domain image to a frequency domain image, and multiple pixel groups are divided according to the distance from the target focus, and the influence coefficient corresponding to each pixel group is determined. Then, the clarity score of the original image is determined by the grayscale value of the pixel and the influence coefficient of the pixel group. Compared with the edge detection algorithm, the algorithm steps for determining clarity through the frequency domain image are simple, which improves the efficiency of the image clarity scoring algorithm, thereby providing assistance to the production and manufacturing of monitoring equipment;
[0065] Second, it is implemented on the hardware platform and extended to functions such as lens adjustment and vignetting detection, which increases the scope of application of the detection and the popularity of the test.
[0066] Combination Figure 5 As shown, the embodiment of the present disclosure provides an image clarity scoring system, including an acquisition module 501, a change module 502, a grouping module 503, and a scoring module 504, wherein:
[0067] The acquisition module 501 is used to acquire the original image and the focus label corresponding to the original image;
[0068] The transformation module 502 is used to perform Fourier transformation on the original image to obtain a frequency domain image corresponding to the original image;
[0069] The grouping module 503 is used to determine the target focus from the pixel points of the frequency domain image according to the focus label, and group the pixel points based on the pixel distance between the target focus and each pixel point to obtain a pixel point set corresponding to a plurality of pixel distance intervals;
[0070] The scoring module 504 is used to determine the influence coefficient corresponding to the pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set, and determine the clarity score corresponding to the original image based on the grayscale value of the pixel points in each pixel point set and each influence coefficient.
[0071] The image clarity scoring system provided by the embodiment of the present disclosure is used to determine the frequency domain image corresponding to the original image through Fourier transformation, determine the target focus from the pixels of the frequency domain image according to the focus label of the original image, divide the pixels into multiple pixel groups based on the pixel distance between the target focus and each pixel, and determine the influence coefficient corresponding to the pixel set according to the pixel distance interval and / or the number of pixels corresponding to the pixel set, thereby determining the clarity score corresponding to the original image based on the grayscale value of the pixel in each pixel set and each influence coefficient. In this way, since the frequency domain grayscale value is proportional to the image clarity, the original image is converted from a time domain image to a frequency domain image, and multiple pixel groups are divided according to the distance from the target focus, and the influence coefficient corresponding to each pixel group is determined, and then the clarity score of the original image is determined by the grayscale value of the pixel and the influence coefficient of the pixel group. Compared with the edge detection algorithm, the algorithm steps for determining clarity through the frequency domain image are simple, which improves the efficiency of the image clarity scoring algorithm, thereby providing assistance to the production and manufacturing of monitoring equipment.
[0072] Combination Figure 6 As shown, an embodiment of the present disclosure provides an electronic device, including: a processor (processor) 600 and a memory (memory) 601; the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that the terminal executes any one of the methods in this embodiment. Optionally, the electronic device may also include a communication interface (Communication Interface) 602 and a bus 603. Among them, the processor 600, the communication interface 602, and the memory 601 can communicate with each other through the bus 603. The communication interface 602 can be used for information transmission. The processor 600 can call the logic instructions in the memory 601 to execute the method in the above embodiment.
[0073] In addition, the logic instructions in the memory 601 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0074] The memory 601 is a computer-readable storage medium that can be used to store software programs, computer executable programs, such as program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor 600 executes functional applications and data processing by running the program instructions / modules stored in the memory 601, that is, implementing the methods in the above embodiments.
[0075] The memory 601 may include a program storage area and a database file area, wherein the program storage area may store an operating system and an application required for at least one function; the database file area may store data created according to the use of the terminal device, etc. In addition, the memory 601 may include a high-speed random access memory and may also include a non-volatile memory.
[0076] The electronic device provided by the embodiment of the present disclosure is used to determine the frequency domain image corresponding to the original image through Fourier transformation, determine the target focus from the pixels of the frequency domain image according to the focus label of the original image, divide the pixels into multiple pixel groups based on the pixel distance between the target focus and each pixel, and determine the influence coefficient corresponding to the pixel set according to the pixel distance interval and / or the number of pixels corresponding to the pixel set, so as to determine the clarity score corresponding to the original image based on the grayscale value of the pixel in each pixel set and each influence coefficient. In this way, since the frequency domain grayscale value is proportional to the image clarity, the original image is converted from a time domain image to a frequency domain image, and multiple pixel groups are divided according to the distance from the target focus, and the influence coefficient corresponding to each pixel group is determined, and then the clarity score of the original image is determined by the grayscale value of the pixel and the influence coefficient of the pixel group. Compared with the edge detection algorithm, the algorithm steps for determining clarity through the frequency domain image are simple, which improves the efficiency of the image clarity scoring algorithm, thereby providing assistance to the production and manufacturing of monitoring equipment.
[0077] The embodiments of the present disclosure further provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in the embodiments is implemented.
[0078] The computer-readable storage medium in the embodiments of the present disclosure can be understood by ordinary technicians in the field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the execution includes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.
[0079] The electronic device disclosed in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run the computer program so that the electronic device executes each step of the above method.
[0080] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0081] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0082] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation can be changed. Parts and sub-samples of some embodiments may be included in or replace parts and sub-samples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0083] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0084] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0085] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for scoring image clarity, characterized in that: include: Acquire an original image and a focus label corresponding to the original image, perform Fourier transform on the original image, and obtain a frequency domain image corresponding to the original image; Determining a target focus from the pixel points of the frequency domain image according to the focus label, grouping the pixel points based on the pixel distance between the target focus and each of the pixel points, and obtaining a pixel point set corresponding to a plurality of pixel distance intervals; Determine the influence coefficient corresponding to the pixel point set according to the pixel distance interval and / or the number of pixels corresponding to the pixel point set, and determine the clarity score corresponding to the original image based on the grayscale value of the pixel point in each pixel point set and each influence coefficient; The influence coefficient corresponding to the pixel point set is determined by the following formula: α i =(S i +β)·(N i +λ), where α i is the influence coefficient corresponding to the i-th pixel set, S i is the minimum value in the pixel distance interval corresponding to the i-th pixel point set, β is the preset distance coefficient, N i is the number of pixels corresponding to the i-th pixel set, and λ is the preset number coefficient; The clarity score corresponding to the original image is determined by the following formula: Where FV is the clarity score corresponding to the original image, n is the number of pixel points, G i is the sum of the grayscale values corresponding to the pixels in the i-th pixel set, α i is the influence coefficient corresponding to the pixel in the i-th pixel set.
2. The method according to claim 1, characterized in that The method further comprises at least one of the following: If the original image includes a color image, after acquiring the original image and before performing Fourier transform on the original image, converting the color image into a grayscale image; After performing Fourier transform on the original image to obtain a frequency domain image corresponding to the original image, each pixel in the frequency domain image is gray-binarized before determining the target focus from the pixels in the frequency domain image according to the focus label.
3. The method according to claim 1, characterized in that The pixel points are grouped based on the pixel distance between the target focus and each of the pixel points to obtain a plurality of pixel point sets corresponding to pixel distance intervals, including: Acquire a first distance threshold, a second distance threshold, and a third distance threshold, wherein the first distance threshold is greater than the second distance threshold, and the second distance threshold is greater than the third distance threshold; In the frequency domain image, taking the target focus as the center of the circle, and taking the first distance threshold, the second distance threshold and the third distance threshold as the radius, a circular area is established to obtain a first circular area, a second circular area and a third circular area respectively; Establishing a first point set according to pixel points outside the first circular area, wherein a pixel distance interval corresponding to the first point set is greater than the first distance threshold; Establishing a second point set according to pixel points located within the first circular area and outside the second circular area, wherein a pixel distance interval corresponding to the second point set is smaller than the first distance threshold and larger than the second distance threshold; Establishing a third point set according to the pixel points located within the second circular area and outside the third circular area, wherein the pixel distance interval corresponding to the third point set is less than the second distance threshold and greater than the third distance threshold; Establishing a fourth point set according to the pixel points located within the third circular area, wherein the pixel distance interval corresponding to the fourth point set is smaller than the third distance threshold; The first point set, the second point set, the third point set and the fourth point set are determined as pixel point sets.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire an image acquisition device, wherein the image acquisition device includes a device lens and a lens sensor; Adjusting the test distance between the device lens and the lens sensor based on a preset adjustment speed, and acquiring a sample image and the test distance corresponding to the sample image through the image acquisition device after every preset time period; Determine a clarity score corresponding to each of the sample images, and determine an optimal distance from the test distances based on each of the clarity scores.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire an image to be tested, wherein the image to be tested includes a plurality of test areas of the same area; Determine any reference area from the image to be tested, wherein the reference area is outside the area to be tested and the area of the reference area is the same as the area of the area to be tested; Determine the clarity score corresponding to each of the tested areas and the clarity score corresponding to the reference area; The clarity scores corresponding to the reference area are compared with the clarity scores corresponding to the area to be tested, and whether the area to be tested is a dark corner area is determined according to the comparison result.
6. An image clarity scoring system, characterized in that: include: An acquisition module, used to acquire an original image and a focus label corresponding to the original image; A transformation module, used for performing Fourier transformation on the original image to obtain a frequency domain image corresponding to the original image; A grouping module, used to determine a target focus from the pixel points of the frequency domain image according to the focus label, and group the pixel points based on the pixel distance between the target focus and each of the pixel points to obtain a pixel point set corresponding to a plurality of pixel distance intervals; A scoring module, configured to determine an influence coefficient corresponding to the pixel point set according to a pixel distance interval and / or a number of pixels corresponding to the pixel point set, and determine a clarity score corresponding to the original image based on a grayscale value of a pixel point in each pixel point set and each influence coefficient; The influence coefficient corresponding to the pixel point set is determined by the following formula: α i =(S i +β)·(N i +λ), where α i is the influence coefficient corresponding to the i-th pixel set, S i is the minimum value in the pixel distance interval corresponding to the i-th pixel point set, β is the preset distance coefficient, N i is the number of pixels corresponding to the i-th pixel set, and λ is the preset number coefficient; The clarity score corresponding to the original image is determined by the following formula: Where FV is the clarity score corresponding to the original image, n is the number of pixel points, G i is the sum of the grayscale values corresponding to the pixels in the i-th pixel set, α i is the influence coefficient corresponding to the pixel in the i-th pixel set.
7. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Automatic focusing method
CN104917970A
Video fuzzy anomaly detection method and system based on frequency domain skewness and frequency domain peak value
CN114205578A