Image definition judgment method and device, equipment and medium
By combining gradient information and Laplace operator information and dynamically adjusting the clarity weight coefficient, the accuracy problem of image clarity assessment under complex backgrounds is solved, and the edge detection accuracy and the reliability of the assessment results are improved.
Patent Information
- Application Number
- CN202510577827.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-09-05
AI Technical Summary
Existing methods have difficulty in accurately extracting edge information in images with complex backgrounds and rich details, resulting in inaccurate clarity assessment and affecting image detection accuracy.
Combining gradient information and Laplace operator information, the clarity weight coefficient is dynamically adjusted through a preset image contour detection algorithm to comprehensively evaluate image clarity.
The accuracy of edge detection and clarity assessment under complex backgrounds is improved, and the reliability and adaptability of the assessment results are enhanced.
Smart Images

Figure CN120598833A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image clarity judgment method, device, equipment and medium. Background Art
[0002] In the fields of image processing and computer vision, assessing image clarity is key to ensuring the accuracy and reliability of subsequent tasks. However, in practical applications, existing methods often struggle to accurately extract edge information when faced with complex backgrounds and images rich in details, resulting in inaccurate clarity assessment results.
[0003] In complex scenes, image edges are often intertwined with the background, making it difficult for traditional algorithms to effectively distinguish between true edges and background noise. Furthermore, many edge detection algorithms are sensitive to parameter settings, and improper parameter selection can further reduce detection accuracy. This lack of edge detection accuracy directly impacts the reliability of sharpness assessment, especially in applications requiring high precision.
[0004] Therefore, there is an urgent need for a method that can more accurately extract edge information and comprehensively consider image features to improve the accuracy of clarity assessment. Summary of the Invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide an image clarity determination method, apparatus, device and medium that overcome the above problems or at least partially solve the above problems.
[0006] In order to solve the above problem, an embodiment of the present invention discloses a method for determining image clarity, the method comprising:
[0007] Determining gradient information and Laplacian operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplacian information is used to represent the clarity of the image;
[0008] Determine the clarity weight coefficient according to the preset image contour detection algorithm;
[0009] determining a target clarity of the image according to the gradient information, the Laplacian operator information, and the clarity weight coefficient;
[0010] When the target clarity is greater than a preset threshold, the image is determined to be a clear image.
[0011] Optionally, acquiring gradient information and Laplacian operator information of the image includes:
[0012] Determine the grayscale value matrix of the image;
[0013] According to the gray value matrix, gradient information and Laplacian operator information of the image are determined.
[0014] Optionally, the gray value matrix includes a target area gray value matrix, and determining the gray value matrix of the image includes:
[0015] Segmenting the image according to a preset segmentation rule to obtain a plurality of sub-region images;
[0016] determining at least one target area image from the plurality of sub-area images;
[0017] Determining the grayscale value of the target area image;
[0018] A matrix composed of the grayscale values of the target area image is used as a target area grayscale value matrix.
[0019] Optionally, determining the gradient information and Laplacian operator information of the image according to the gray value matrix includes:
[0020] Determining the Laplace variance of the target area image through the target area grayscale value matrix;
[0021] The Laplace variance is used as Laplace operator information.
[0022] Optionally, the target clarity of the image is determined by the following formula:
[0023] G=(G1+G2)·α, where G represents the target clarity of the image, G1 represents the gradient information of the image, G2 represents the Laplace information of the image, and α represents the clarity weight coefficient.
[0024] Optionally, determining the clarity weight coefficient according to a preset image contour detection algorithm includes:
[0025] When it is determined by a preset image contour detection algorithm that a closed contour exists in the image, setting the clarity weight coefficient to a first preset coefficient;
[0026] When it is determined by a preset image contour detection algorithm that no closed contour exists in the image, setting the clarity weight coefficient to a second preset coefficient;
[0027] Optionally, determining the gradient information and Laplacian operator information of the image according to the gray value matrix includes:
[0028] Determining the average gradient and Laplace variance of the image using the grayscale value matrix;
[0029] The average gradient is used as gradient information, and the Laplace variance is used as Laplace operator information.
[0030] On the other hand, an embodiment of the present invention further discloses an image clarity determination device, comprising:
[0031] An image information determination module, configured to determine gradient information and Laplace operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplace information is used to represent the clarity of the image;
[0032] A weight coefficient determination module is used to determine the clarity weight coefficient according to a preset image contour detection algorithm;
[0033] a target clarity determination module, configured to determine a target clarity of the image based on the gradient information, the Laplacian operator information, and the clarity weight coefficient;
[0034] The image judgment module is used to determine that the image is a clear image when the target clarity is greater than a preset threshold.
[0035] Optionally, the image information determination module includes:
[0036] Gray value matrix acquisition submodule, used to determine the gray value matrix of the image;
[0037] The information determination submodule is used to determine the gradient information and Laplacian operator information of the image according to the gray value matrix.
[0038] Optionally, the gray value matrix includes a target area gray value matrix, and the gray value matrix acquisition submodule includes:
[0039] a subregion determining unit, configured to segment the image according to a preset segmentation rule to obtain a plurality of subregion images;
[0040] a target region determining unit, configured to determine at least one target region image from the plurality of sub-region images;
[0041] a grayscale value determining unit, configured to determine the grayscale value of the target area image;
[0042] The region grayscale determination unit is configured to use a matrix formed by grayscale values of the target region image as a target region grayscale value matrix.
[0043] Optionally, the information determination submodule includes:
[0044] a variance determining unit, configured to determine the Laplace variance of the target area image by using the target area grayscale value matrix;
[0045] The Laplace operator obtaining unit is configured to use the Laplace variance as Laplace operator information.
[0046] Optionally, the target clarity of the image is determined by the following formula:
[0047] The clarity calculation unit is used for G=(G1+G2)·α, where G represents the target clarity of the image, G1 represents the gradient information of the image, G2 represents the Laplace information of the image, and α represents the clarity weight coefficient.
[0048] Optionally, the weight coefficient determination module includes:
[0049] A first preset coefficient setting submodule is configured to set the clarity weight coefficient to a first preset coefficient when it is determined through a preset image contour detection algorithm that a closed contour exists in the image;
[0050] A second preset coefficient setting submodule is configured to set the clarity weight coefficient to a second preset coefficient when it is determined through a preset image contour detection algorithm that no closed contour exists in the image;
[0051] Optionally, the information determination submodule includes:
[0052] a gradient and variance determination unit, configured to determine the average gradient and Laplace variance of the image using the grayscale value matrix;
[0053] The gradient and operator determination unit is configured to use the average gradient as gradient information and the Laplace variance as Laplace operator information.
[0054] Accordingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various steps of the above-mentioned image clarity judgment method embodiment are implemented.
[0055] Accordingly, an embodiment of 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 various steps of the above-mentioned image clarity determination method embodiment are implemented.
[0056] The embodiments of the present invention offer the following advantages: gradient information reflects the intensity of local brightness variations in an image, highlighting significant edges within the image; while Laplacian information further quantifies the sharpness of image details, enhancing the ability to capture weak edges and subtle structures. The combination of these two types of information enables the solution to accurately extract edge features even in complex backgrounds, avoiding the drawback of traditional algorithms that struggle to distinguish true edges from background interference, thereby significantly improving the accuracy of clarity assessment. Dynamically determining the clarity weight coefficient through a pre-set image contour detection algorithm further enhances the reliability of the assessment results. In complex scenes, different areas contribute differently to overall clarity. The solution adjusts the weight coefficient to ensure that the clarity of key areas is given higher priority. This dynamic adjustment mechanism avoids the assessment bias caused by fixed weights in traditional methods, ensuring that the assessment results are more in line with practical needs. Finally, the target clarity is calculated by combining the gradient information, Laplacian information, and the clarity weight coefficient, and the image clarity is determined by comparing it with a preset threshold. This not only improves the accuracy of edge detection, but also significantly enhances the reliability and adaptability of clarity assessment in complex backgrounds through multi-dimensional information fusion and weight adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is a flowchart of an embodiment of a method for determining image clarity according to the present invention;
[0058] Figure 2 is a flow chart of an embodiment of a method for determining image clarity of the present invention;
[0059] Figure 3 It is a structural block diagram of an embodiment of an image clarity judgment device of the present invention. DETAILED DESCRIPTION
[0060] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0061] One of the core concepts of the present invention is that gradient information can reflect the intensity of local brightness changes in an image, highlighting significant edges in the image; Laplacian information further quantifies the sharpness of image details, enhancing the ability to capture weak edges and subtle structures. The combination of these two types of information enables accurate edge feature extraction and image clarity judgment even in complex backgrounds.
[0062] Reference Figure 1 , shows a flowchart of an embodiment of a method for determining image clarity of the present invention, which may specifically include the following steps:
[0063] Step 101: determining gradient information and Laplacian operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplacian information is used to represent the clarity of the image;
[0064] The gradient information of the image described in the present invention can be the gradient of the image (Image Gradient). The gradient is used to represent the rate of change of brightness of each pixel in the image, and can describe the direction and intensity of the fastest brightness change of the point. Its mathematical representation is the first-order derivative of the image pixel. Its physical meaning is similar to the steepness of the slope in a topographic map; in an image, areas with large gradients generally correspond to locations where brightness suddenly changes, such as the edges of objects or texture boundaries in the image, and areas with small gradients can represent areas where brightness transitions smoothly in the image, such as the sky and blurred background. A clear image generally has the characteristics of sharp edges of objects or obvious brightness mutations at the edges and large gradient values; while a blurred image generally has smooth edges and slow brightness changes, that is, small gradient values. The gradient quantifies the steepness of the edges in the image and is an intuitive reflection of clarity.
[0065] The Laplacian information described in the present invention can be the Laplacian value (Laplacian Information) of an image. Essentially, it uses the Laplacian operator to measure the curvature or convexity of the brightness variation at a point in the image. Its mathematical representation is the second-order derivative of the image pixel, that is, the rate of change of the image's rate of change. Its physical meaning represents a sudden peak or a concave valley in a local area of the image. When the Laplacian information of a pixel in an image is positive, it can indicate that the brightness at that point is higher than the surrounding area, such as the bright side of a sharp edge. When the Laplacian information is negative, it can indicate that the brightness at that point is lower than the surrounding area, such as the dark side of a sharp edge. A clear image is generally characterized by rich detail and abundant high-frequency components, such as sharp edges or fine textures, while a blurred image is characterized by suppressed high-frequency signals. Laplacian information can reflect the intensity of local contrast in an image. The higher the contrast, the clearer the details, and the larger the Laplacian information value.
[0066] Gradient information and Laplacian operator information are used to quantify the sharpness of edges and details in an image from the perspective of first-order and second-order changes, respectively. The essence of image clarity lies in the strength of high-frequency signals, and blur attenuates these signals, resulting in a decrease in gradient and Laplacian values. Combining these two provides a comprehensive assessment of clarity.
[0067] In one embodiment, step 101 may include the following sub-steps:
[0068] Sub-step S11, determining the gray value matrix of the image;
[0069] Gray value is the brightness value of a pixel in a single-channel image, representing a continuous gradient from pure black (0) to pure white (255). Compressing RGB (R, red, G, green, B, blue) color information into a single brightness channel can reflect the human eye's sensitivity to light and shade. The contrast difference of image edges and textures is reflected by the change in gray value, and the gray value is also the basis for the subsequent calculation of gradient information and Laplacian operator information. The gray value matrix (Gray ValueMatrix) is a two-dimensional matrix composed of the gray value information of the image. The rows and columns of the matrix correspond to the image pixel coordinates, and the matrix element value at the corresponding position is the gray value of that position. The matrix form can provide input for convolution operations (such as convolution operations of gradient information and convolution operations of Laplacian operator information).
[0070] In general, the method to determine the grayscale value can be calculated through the psychological formula of grayscale value, for example: Gray = R × 0.299 + G × 0.587 + B × 0.114, where: Gray represents the pixel value of the grayscale image after conversion; R represents the red component of the RGB original image; G represents the green component of the RGB original image; B represents the brightness component of the RGB original image; when using calculation, the formula will be relatively optimized, because the computer CPU is relatively slow for floating-point operations, but the integer operation speed is very fast and the accuracy is high, so the actual programming can use a variant formula. For example, the amplification coefficient method can be used to convert it into: Gray = (R*229+G*587+B*114+500) / 1000; it can also be converted into multiplication and bit shift operations: Gray = (R*19595+G*38469+B*7472)>>16,
[0071] In one embodiment, the gray value matrix includes a target area gray value matrix, and sub-step S11 may include the following sub-steps:
[0072] Sub-step S111, segmenting the image according to a preset segmentation rule to obtain a plurality of sub-region images;
[0073] Not all areas of an image have equal value for image clarity assessment. Therefore, segmentation can be used to exclude low-relevance areas and focus processing resources on critical areas. This approach, similar to the human eye's attention mechanism, ignores less important information to improve decision-making efficiency. Furthermore, image segmentation can also help conserve resources. Generally, processing the entire high-definition image requires significant computational resources. Processing only the target area significantly reduces computational effort and is more suitable for real-time systems or resource-constrained scenarios. For example, in the clarity assessment of maintenance images in telecommunications operations and maintenance services, image segmentation allows for faster clarity assessment due to limited device processing capabilities. It also saves storage resources and better meets the specific needs of telecommunications operations and maintenance services. For example, when users upload on-site maintenance images through user terminals, they often capture them with their mobile phones and upload them to the system. These user-generated images are often too large or blurry, making them difficult for backend operators to quickly monitor and monitor on-site operations. It also makes it difficult for backend operators to observe and identify maintenance faults from these images. These challenges can be effectively addressed using the above method. Therefore, the segmentation method can be dynamically selected according to the scene, such as central area segmentation, semantic target segmentation or high gradient area segmentation.
[0074] For example, center region segmentation can be used when key targets are typically located in the center of the image. High gradient region segmentation can be used to detect high-contrast targets such as text and metal edges. Semantic target segmentation uses artificial intelligence technology to accurately identify business-related targets in complex backgrounds.
[0075] By properly segmenting the image, the accuracy and efficiency of clarity assessment can be improved. From central region segmentation to semantic segmentation, different methods serve different scenario needs and should be selected based on actual conditions.
[0076] Sub-step S112, determining at least one target area image from the multiple sub-area images;
[0077] Sub-step S113, determining the grayscale value of the target area image;
[0078] Sub-step S114 : using the matrix formed by the grayscale values of the target area image as the target area grayscale value matrix.
[0079] Correspondingly, the method for determining the grayscale value and the grayscale value matrix of the target area can reuse the method for determining the grayscale value and the grayscale value matrix of the normal image, which will not be described in detail here.
[0080] Sub-step S12: determining the gradient information and Laplacian operator information of the image according to the gray value matrix.
[0081] As mentioned above, the gradient represents the first-order derivative change in pixel brightness in an image, reflecting the direction and strength of the edge. Based on the grayscale value matrix of the image, predefined operators such as the Sobel operator and the Prewitt operator can be combined with grayscale matrix convolution to extract the horizontal and vertical gradients of the image. The corresponding output can be a gradient magnitude matrix, with each element representing the edge strength of the corresponding pixel. The mean, variance, or sum of the gradient magnitudes can be calculated to indicate image clarity, with larger values indicating clearer images.
[0082] The Laplace operator mentioned above represents the change in the second-order derivative of pixel brightness in the image, reflecting the curvature of the local area. It can be determined by directly calculating the second-order derivative by convolving the Laplace kernel with the grayscale matrix. The output can be a Laplace response matrix, where the positive and negative values of the matrix elements represent the bright and dark edges respectively.
[0083] For example, in addition to using the gray value matrix to determine the gradient information and Laplace operator information of the image, it can also be achieved by directly calculating the gradient of each channel in the RGB color space, taking the maximum value or weighted synthesis of multi-channel gradient calculation methods, or converting the image to the frequency domain, analyzing the energy of the high-frequency component by frequency domain analysis, or using a preset neural network such as deep learning to extract high-level features of the image, and then predicting the clarity score of the image, etc. The present invention is not limited to this.
[0084] In one embodiment, sub-step S12 may include the following sub-steps:
[0085] Sub-step S121, determining the Laplace variance of the target area image through the target area grayscale value matrix;
[0086] The process of determining the Laplace variance of the target area image through the target area grayscale value matrix can be divided into two main steps:
[0087] The first step is to determine the Laplacian value based on the grayscale value matrix, which is a key indicator to quantify the local contrast intensity of each pixel in the image.
[0088] For example, a specific method for calculating the Laplacian value can be determined according to the following formula: dst(i,j) = -4src(i,j) + src(i+1,j) + src(i-1,j) + src(i,j+1) + src(i,j-1), where src(i,j) represents the value of the element in the i-th row and j-th column of the grayscale value matrix, and dst(i,j) is the Laplacian value of the corresponding element. The core idea of this formula is to compare the grayscale difference between a pixel and its four neighboring pixels above, below, and to the left and right. This enhances the contrast between the central pixel and the surrounding pixels. The values of the four neighboring pixels above, below, and to the left (each weighted by +1) are added to this value to reflect local brightness changes. Combined with the grayscale value matrix, the output of the Laplacian value calculation can be a Laplacian value matrix. At image edges and details, the central pixel differs significantly from the surrounding pixels, and the absolute value of dst(i,j) is large. In smooth areas, however, the central pixel differs only slightly from the surrounding pixels, and dst(i,j) approaches zero.
[0089] After obtaining the Laplace values, the variance can be calculated from the Laplace value matrix. Variance can be used to measure the overall fluctuation of the Laplace value matrix: a high variance indicates that the Laplace values fluctuate greatly, indicating that there are many sharp edges and rich details in the area, and the image can be considered a clear image. A low variance indicates that the Laplace values tend to be consistent, indicating that the area is smooth or blurred, and the image can be considered a blurred image.
[0090] Sub-step S122: using the Laplace variance as Laplace operator information.
[0091] By using the Laplace variance as the Laplace operator information of the image, the clarity of the image can be evaluated from the dimension of the second-order derivative of the image, making the evaluation result more specific and comprehensive. In addition to the variance, the clarity of the image can also be expressed by the absolute value, mean, sum of squares, etc. of the Laplace value, which is not limited in the present invention.
[0092] In one embodiment, sub-step S12 may further include the following sub-steps:
[0093] Determining the average gradient and Laplace variance of the image using the grayscale value matrix;
[0094] Using the average gradient as gradient information and the Laplace variance as Laplace operator information;
[0095] In addition to the Laplace level, the clarity of the image can also be expressed by calculation at the gradient level. For example, the average of the root mean square of the horizontal gradient and the vertical gradient of the image can be used as the clarity output value.
[0096] Step 102: determining a clarity weight coefficient according to a preset image contour detection algorithm;
[0097] The clarity weight coefficient is used to measure the influence of different areas in the image on the overall clarity score. Furthermore, in order to improve the accuracy of clarity assessment, an image contour detection algorithm can be introduced to assign corresponding weights based on the contour detection results in the image to accurately predict the clarity of the image.
[0098] In one embodiment, step 102 may include the following sub-steps:
[0099] Sub-step S21, when it is determined by a preset image contour detection algorithm that there is a closed contour in the image, setting the clarity weight coefficient to a first preset coefficient;
[0100] A closed contour can refer to a closed area enclosed by continuous edges, such as a device label box or port boundary. A closed contour typically corresponds to a key part of a specific device and may contain important information. A preset image contour detection algorithm is used to determine whether a closed contour exists in the image to be processed. If a closed contour is detected, the clarity weighting factor is set to the first preset factor. The first preset factor is a larger value, indicating that the clarity of the area has a higher weight on the overall score. This is because closed contour areas often contain critical device information, and their clarity directly affects operation and maintenance decisions.
[0101] Sub-step S22, when it is determined by the preset image contour detection algorithm that there is no closed contour in the image, the clarity weight coefficient is set to a second preset coefficient
[0102] If no closed contours are detected, the area is likely to be background or other unimportant features. In this case, the clarity weighting factor is set to the second preset factor. The second preset factor is a smaller value, indicating that the clarity of the area has a lower impact on the overall score. This is because areas without closed contours typically do not contain critical information, and their clarity is less important for operation and maintenance decisions.
[0103] Exemplarily, the above-mentioned image segmentation method can be combined to perform contour detection on the target area obtained by segmentation. If a closed contour is detected in the target area, the clarity weight coefficient is set to 2. If no closed contour is detected, the clarity weight coefficient is set to 1. The preset image contour detection algorithm can be the Canny algorithm. The Canny algorithm is a classic image edge detection algorithm. Its main function is to extract significant edge information from the image. In addition to using the Canny algorithm combined with the average gradient of the image to find the closed contour of the image, the Sobel operator can be combined with a contour search algorithm such as the findContours function in OpenCV or the Laplace operator can be directly used to detect zero crossing points in the image, thereby extracting edge information or using deep learning techniques such as convolutional neural networks or other deep learning models to directly predict edges or closed contours in the image. The present invention is not limited to this.
[0104] Step 103: determining a target clarity of the image according to the gradient information, the Laplacian operator information, and the clarity weight coefficient;
[0105] After obtaining the image's gradient information, Laplace operator information, and clarity weight coefficient, we can use relevant processing logic and certain mathematical methods to quantify the image's total clarity value.
[0106] In one embodiment, the target clarity in step 103 may be determined using the following formula:
[0107] G = (G1 + G2) α, where G represents the target definition of the image, G1 represents the gradient information of the image, G2 represents the Laplace information of the image, and α represents the definition weight coefficient;
[0108] Step 104: If the target clarity is greater than a preset threshold, determine that the image is a clear image.
[0109] Generally, the preset threshold value can be set based on experience. For example, the value of the preset threshold value can be 200.
[0110] In one embodiment, an image clarity judgment method of the present invention can be used in an operation and maintenance diagram recognition scenario under telecommunications services. In order to adapt to the business characteristics of operation and maintenance diagram recognition in telecommunications scenarios, the image clarity judgment method described in the present invention can be combined with webAssembly technology to complete image-related processing functions by executing specific code in the browser, thereby identifying the clarity of the image.
[0111] Gradient information reflects the intensity of local brightness variations in an image, highlighting significant edges. Laplacian information further quantifies the sharpness of image details, enhancing the ability to capture weak edges and subtle structures. The combination of these two types of information enables the solution to accurately extract edge features even in complex backgrounds, avoiding the difficulty traditional algorithms have in distinguishing true edges from background interference, significantly improving the accuracy of sharpness assessment. Dynamically determining the sharpness weight coefficient through a pre-set image contour detection algorithm further enhances the reliability of the assessment results. In complex scenes, different areas contribute differently to overall sharpness. The solution adjusts the weight coefficient to ensure that the sharpness of key areas is given higher priority. This dynamic adjustment mechanism avoids the assessment bias caused by fixed weights in traditional methods, ensuring that the assessment results are more in line with practical needs. Finally, the gradient information, Laplacian information, and the sharpness weight coefficient are combined to calculate the target sharpness, and the image sharpness is determined by comparing it with a preset threshold. This not only improves the accuracy of edge detection, but also significantly enhances the reliability and adaptability of sharpness assessment in complex backgrounds through multi-dimensional information fusion and weight adjustment.
[0112] Reference Figure 2 , which shows a flow chart of an embodiment of an image clarity judgment method according to the present invention used in a telecom operation and maintenance image clarity recognition scenario:
[0113] First, the operation and maintenance personnel upload the on-site operation and maintenance images through the operation and maintenance terminal. The operation and maintenance terminal uses the browser WebAssembly technology installed on it to perform a series of pre-processing on the on-site operation and maintenance images.
[0114] By using WebAssembly technology, the on-site operation and maintenance image is uploaded in the file format. The server receives the uploaded on-site operation and maintenance image file, encodes it using preset encoding rules, and uses websocket technology to transmit the on-site operation and maintenance image file and load it into the virtual file system.
[0115] The virtual file system allocates memory from the main memory to form a folder list vector and a file list vector. The corresponding file list file pointer points to the file block of the specific storage file, which stores the image file of the corresponding on-site operation and maintenance image:
[0116] For example, the on-site operation and maintenance image may be partitioned, and the partitioned images of the on-site operation and maintenance image may be segmented and extracted according to the high gradient region segmentation method described above;
[0117] The extracted sub-field operation and maintenance images and the entire field operation and maintenance image are partitioned and stored in various memory blocks of the virtual file system. The image file of the field operation and maintenance image can then be loaded from the virtual file system. The partitioned images of the field operation and maintenance image file are used to calculate the Laplacian operator information of the sub-image and the gradient information of the entire image, thereby obtaining the total clarity G1. The method for determining the Laplacian operator information and the gradient information has been described in detail above and will not be repeated here.
[0118] After obtaining the total clarity G1, the system uses a preset threshold to determine whether the on-site operation and maintenance images uploaded by the operator are clear. If the judgment result shows that the on-site operation and maintenance images are clear, the images are allowed to be submitted to the business system for processing. If the judgment result shows that the on-site operation and maintenance images are not clear, a corresponding prompt is given and the images are rejected from being submitted to the business system.
[0119] When you want to retrieve a live operation and maintenance image, you can use the external functions defined by calling WebAssembly technology to export the corresponding high-definition operation and maintenance image and clarity value. The display method can use Canvas technology. Since the WebAssembly and Canvas technologies mentioned above are existing technologies, they will not be elaborated here.
[0120] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0121] Reference Figure 3 , shows a structural block diagram of an embodiment of an image clarity judgment device of the present invention, which may specifically include the following modules:
[0122] An image information determination module 201 is configured to determine gradient information and Laplacian operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplacian information is used to represent the clarity of the image;
[0123] The gradient information of an image can be the gradient of the image (Image Gradient). The gradient is used to represent the rate of change of brightness of each pixel in the image. It can describe the direction and intensity of the fastest brightness change at that point. Its mathematical representation is the first-order derivative of the image pixel. Its physical meaning is similar to the steepness of the slope in a topographic map. In an image, areas with large gradients generally correspond to locations where brightness changes suddenly, such as the edges of objects or the junctions of textures in the image, and areas with small gradients can represent areas with smooth brightness transitions in the image, such as the sky and blurred backgrounds. Clear images generally have the characteristics of sharp edges of objects or obvious brightness mutations at the edges, as well as large gradient values; while blurred images generally have smooth edges and slow brightness changes, that is, small gradient values. The gradient quantifies the steepness of the edges in the image and is an intuitive reflection of clarity.
[0124] Laplacian information can be the Laplacian value of an image. Essentially, it uses the Laplacian operator to measure the curvature or convexity of brightness variations at a specific point in the image. Its mathematical representation is the second-order derivative of the image pixel, which is the rate of change of the image's rate of change. Its physical meaning represents abrupt peaks or valleys in a local area of the image. When the Laplacian information of a pixel in an image is positive, it indicates that the brightness at that point is higher than the surrounding area, such as the bright side of a sharp edge. When the Laplacian information is negative, it indicates that the brightness at that point is lower than the surrounding area, such as the dark side of a sharp edge. A sharp image is generally characterized by rich detail and abundant high-frequency components, such as sharp edges or fine textures, while a blurred image is characterized by suppressed high-frequency signals. Laplacian information reflects the intensity of local contrast in the image. Higher contrast and clearer details result in larger Laplacian information values.
[0125] Gradient information and Laplacian operator information are used to quantify the sharpness of edges and details in an image from the perspectives of first-order and second-order changes, respectively. The essence of image clarity lies in the strength of high-frequency signals, and blur attenuates these signals, resulting in a decrease in gradient and Laplacian values. Combining these two factors provides a comprehensive assessment of clarity.
[0126] The weight coefficient determination module 202 is used to determine the clarity weight coefficient according to a preset image contour detection algorithm;
[0127] The clarity weight coefficient is used to measure the influence of different areas in the image on the overall clarity score. Furthermore, in order to improve the accuracy of clarity assessment, an image contour detection algorithm can be introduced to assign corresponding weights based on the contour detection results in the image to accurately predict the clarity of the image.
[0128] a target clarity determination module 203, configured to determine a target clarity of the image based on the gradient information, the Laplacian operator information, and the clarity weight coefficient;
[0129] After obtaining the image's gradient information, Laplace operator information, and clarity weight coefficient, we can use relevant processing logic and certain mathematical methods to quantify the image's total clarity value.
[0130] The image determination module 204 is configured to determine that the image is a clear image when the target clarity is greater than a preset threshold.
[0131] Generally, the preset threshold value can be set based on experience. For example, the value of the preset threshold value can be 200.
[0132] In one embodiment, the image information determination module includes:
[0133] Gray value matrix acquisition submodule, used to determine the gray value matrix of the image;
[0134] The information determination submodule is used to determine the gradient information and Laplacian operator information of the image according to the gray value matrix.
[0135] In one embodiment, the gray value matrix includes a target area gray value matrix, and the gray value matrix acquisition submodule includes:
[0136] a subregion determining unit, configured to segment the image according to a preset segmentation rule to obtain a plurality of subregion images;
[0137] a target region determining unit, configured to determine at least one target region image from the plurality of sub-region images;
[0138] a grayscale value determining unit, configured to determine the grayscale value of the target area image;
[0139] The region grayscale determination unit is configured to use a matrix formed by grayscale values of the target region image as a target region grayscale value matrix.
[0140] In one embodiment, the information determination submodule includes:
[0141] a variance determining unit, configured to determine the Laplace variance of the target area image by using the target area grayscale value matrix;
[0142] The Laplace operator obtaining unit is configured to use the Laplace variance as Laplace operator information.
[0143] In one embodiment, the target clarity of the image is determined by the following formula:
[0144] The clarity calculation unit is used for G=(G1+G2)·α, where G represents the target clarity of the image, G1 represents the gradient information of the image, G2 represents the Laplace information of the image, and α represents the clarity weight coefficient.
[0145] In one embodiment, the weight coefficient determination module includes:
[0146] A first preset coefficient setting submodule is configured to set the clarity weight coefficient to a first preset coefficient when it is determined through a preset image contour detection algorithm that a closed contour exists in the image;
[0147] A second preset coefficient setting submodule is configured to set the clarity weight coefficient to a second preset coefficient when it is determined through a preset image contour detection algorithm that no closed contour exists in the image;
[0148] In one embodiment, the information determination submodule includes:
[0149] a gradient and variance determination unit, configured to determine the average gradient and Laplace variance of the image using the grayscale value matrix;
[0150] The gradient and operator determination unit is configured to use the average gradient as gradient information and the Laplace variance as Laplace operator information.
[0151] Gradient information reflects the intensity of local brightness variations in an image, highlighting significant edges. Laplacian information further quantifies the sharpness of image details, enhancing the ability to capture weak edges and subtle structures. The combination of these two types of information enables the solution to accurately extract edge features even in complex backgrounds, avoiding the difficulty traditional algorithms have in distinguishing true edges from background interference, significantly improving the accuracy of sharpness assessment. Dynamically determining the sharpness weight coefficient through a pre-set image contour detection algorithm further enhances the reliability of the assessment results. In complex scenes, different areas contribute differently to overall sharpness. The solution adjusts the weight coefficient to ensure that the sharpness of key areas is given higher priority. This dynamic adjustment mechanism avoids the assessment bias caused by fixed weights in traditional methods, ensuring that the assessment results are more in line with practical needs. Finally, the gradient information, Laplacian information, and the sharpness weight coefficient are combined to calculate the target sharpness, and the image sharpness is determined by comparing it with a preset threshold. This not only improves the accuracy of edge detection, but also significantly enhances the reliability and adaptability of sharpness assessment in complex backgrounds through multi-dimensional information fusion and weight adjustment.
[0152] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0153] An embodiment of the present invention also provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned image clarity judgment method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0154] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned image clarity judgment method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0155] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0156] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0157] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0158] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0160] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0161] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0162] The above is a detailed introduction to the image clarity judgment method, device, equipment and medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for determining image clarity, characterized in that: The method comprises: Determining gradient information and Laplacian operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplacian information is used to represent the clarity of the image; Determine the clarity weight coefficient according to the preset image contour detection algorithm; determining a target clarity of the image according to the gradient information, the Laplacian operator information, and the clarity weight coefficient; When the target clarity is greater than a preset threshold, the image is determined to be a clear image.
2. The image clarity judgment method according to claim 1, wherein: Determining the gradient information and Laplacian operator information of the image includes: Determine the grayscale value matrix of the image; According to the gray value matrix, gradient information and Laplacian operator information of the image are determined.
3. The image clarity determination method according to claim 2, wherein: The gray value matrix includes a target area gray value matrix, and the gray value matrix of the determined image includes: Segmenting the image according to a preset segmentation rule to obtain a plurality of sub-region images; determining at least one target area image from the plurality of sub-area images; Determining the grayscale value of the target area image; A matrix composed of the grayscale values of the target area image is used as a target area grayscale value matrix.
4. The image clarity determination method according to claim 3, wherein: Determining the gradient information and Laplacian operator information of the image according to the gray value matrix includes: Determining the Laplace variance of the target area image through the target area grayscale value matrix; The Laplace variance is used as Laplace operator information.
5. The image clarity determination method according to claim 4, wherein: The target clarity of the image is determined by the following formula: G=(G1+G2)·α, where G represents the target clarity of the image, G1 represents the gradient information of the image, G2 represents the Laplace information of the image, and α represents the clarity weight coefficient.
6. The image clarity determination method according to claim 1, wherein: Determining the clarity weight coefficient according to a preset image contour detection algorithm includes: When it is determined by a preset image contour detection algorithm that a closed contour exists in the image, setting the clarity weight coefficient to a first preset coefficient; When it is determined by a preset image contour detection algorithm that no closed contour exists in the image, the clarity weight coefficient is set to a second preset coefficient.
7. The image clarity determination method according to claim 2, wherein: Determining the gradient information and Laplacian operator information of the image according to the gray value matrix includes: Determining the average gradient and Laplace variance of the image using the grayscale value matrix; The average gradient is used as gradient information, and the Laplace variance is used as Laplace operator information.
8. An image clarity judgment device, characterized in that: The device comprises: An image information determination module, configured to determine gradient information and Laplace operator information of an image, wherein the gradient information is used to represent the clarity of the image, and the Laplace information is used to represent the clarity of the image; A weight coefficient determination module is used to determine the clarity weight coefficient according to a preset image contour detection algorithm; a target clarity determination module, configured to determine a target clarity of the image based on the gradient information, the Laplacian operator information, and the clarity weight coefficient; The image judgment module is used to determine that the image is a clear image when the target clarity is greater than a preset threshold.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the image clarity judgment method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image clarity determination method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Visual judgment method, system and equipment and storage medium
CN121482702A