Image processing method, device, equipment and medium
By calculating the structural similarity of the edge gradient information of the image to be processed and the reference image, the problem of low image quality assessment accuracy and efficiency is solved, fast and accurate image quality assessment is achieved, and the accuracy of target detection is improved.
Patent Information
- Application Number
- CN202410153575.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-02-02
AI Technical Summary
The existing technology has low accuracy and efficiency when evaluating image quality, especially when processing low-quality images, which affects the accuracy of target detection.
By obtaining the edge gradient information of the image to be processed and the edge gradient information of the reference image generated based on the image to be processed, the structural similarity between the two is calculated, thereby determining the quality score of the image, reducing the amount of calculation and improving evaluation efficiency.
It improves the accuracy and efficiency of image quality assessment, can quickly and accurately filter out low-quality images, and improves the accuracy of target detection.
Smart Images

Figure CN118015033B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an image processing method, device, equipment and medium. Background Art
[0002] In the field of image processing and computer vision, object detection is an important technology. However, in practical applications, there are often low-quality images, such as blurred, dim, and distorted images, which will affect the accuracy of object detection. Therefore, how to quickly and accurately evaluate the quality of images in order to filter out low-quality images and improve the accuracy of object detection is a technical problem that needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus, device and medium, which can quickly and accurately evaluate the quality of an image.
[0004] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0005] Obtain multiple images to be processed;
[0006] For each of the multiple images to be processed, first edge gradient information of the image to be processed and second edge gradient information of a reference image are obtained, where the reference image is generated based on the image to be processed;
[0007] Determine a first structural similarity between the first gradient image and the second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image, wherein the first gradient image is generated based on the first edge gradient information of the image to be processed and the second gradient image is generated based on the second edge gradient information of the reference image;
[0008] Based on the first structural similarity, a quality score of the image to be processed is determined, and the quality score is used to evaluate the quality of the image to be processed.
[0009] In an optional implementation of the first aspect, before acquiring the second edge gradient information of the reference image, the method further includes:
[0010] Perform Gaussian blur processing on the image to be processed to obtain a reference image of the image to be processed.
[0011] In an optional implementation of the first aspect, the image to be processed includes a plurality of first pixel points, and a pixel value of each first pixel point;
[0012] Perform Gaussian blur processing on the image to be processed to obtain a reference image with the image to be processed, including:
[0013] For each first pixel point among the multiple first pixel points, perform the following operation:
[0014] Determine a pixel value of a first pixel point and a pixel value of a second pixel point adjacent to the first pixel point among the plurality of first pixel points;
[0015] A weighted summation process is performed on the pixel value of the first pixel point and the pixel value of the second pixel point based on a preset weight to obtain a target pixel value of the first pixel point, so as to obtain a reference image of the image to be processed.
[0016] In an optional implementation of the first aspect, obtaining first edge gradient information of the image to be processed and second edge gradient information of the reference image includes:
[0017] Extracting first edge gradient information of the image to be processed by using a Sobel operator, and extracting second edge gradient information of the reference image by using a Sobel operator;
[0018] The first edge gradient information includes edge gradient information in the horizontal direction of the image to be processed, and edge gradient information in the vertical direction of the image to be processed;
[0019] The second edge gradient information includes edge gradient information in the horizontal direction of the reference image and edge gradient information in the vertical direction of the reference image.
[0020] In an optional implementation of the first aspect, determining a first structural similarity between the first gradient image and the second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image includes:
[0021] Generate a first gradient image based on first edge gradient information of the image to be processed, and generate a second gradient image based on second edge gradient information of the reference image;
[0022] Determine N first image regions in the first gradient image, and determine N second image regions in the second gradient image;
[0023] Determine a second structural similarity between an i-th first image region among the N first image regions and an i-th second image region among the N second image regions, where i=1, 2, ..., N, to obtain N second structural similarities;
[0024] Determining a quality score of the image to be processed based on the first structural similarity includes:
[0025] Based on the N second structural similarities, a quality score of the image to be processed is determined.
[0026] In an optional implementation of the first aspect, determining N first image regions in the first gradient image and determining N second image regions in the second gradient image includes:
[0027] Dividing the first gradient image to obtain M first image regions, and calculating the first pixel gradient variance of each of the M first image regions;
[0028] Screening out N first image regions whose first pixel gradient variance is greater than a first preset value from the M first image regions;
[0029] Dividing the second gradient image to obtain M second image regions, and calculating the second pixel gradient variance of each second image region in the M second image regions;
[0030] N second image regions whose second pixel gradient variance is greater than a second preset value are obtained by screening out from the M second image regions.
[0031] In an optional implementation of the first aspect, determining a first structural similarity between an i-th first image region among the N first image regions and an i-th second image region among the N second image regions includes:
[0032]
[0033] in, is the pixel mean of the i-th first image region, is the pixel mean of the i-th second image area, is the pixel variance of the i-th first image region, is the pixel variance of the i-th second image region, is the pixel covariance between the i-th first image region and the i-th second image region, and C1, C2, and C3 are all constants.
[0034] In an optional implementation of the first aspect, the quality score of the image to be processed is determined based on the N second structural similarities, satisfying the following formula:
[0035]
[0036] Among them, Score is the quality score, i = 1, 2...N, SSIM(x i ,y i ) is the second structural similarity between the ith first image region and the ith second image region.
[0037] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0038] An acquisition module, used for acquiring multiple images to be processed;
[0039] The acquisition module is further used to acquire, for each of the multiple images to be processed, first edge gradient information of the image to be processed and second edge gradient information of a reference image, where the reference image is generated based on the image to be processed;
[0040] a determination module, configured to determine a first structural similarity between a first gradient image and a second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image, wherein the first gradient image is generated based on the first edge gradient information of the image to be processed, and the second gradient image is generated based on the second edge gradient information of the reference image;
[0041] The determination module is further used to determine the quality score of the image to be processed based on the first structural similarity, and the quality score is used to evaluate the quality of the image to be processed.
[0042] In a third aspect, an electronic device is provided, comprising: a memory for storing computer program instructions; and a processor for reading and running the computer program instructions stored in the memory to execute the image processing method provided by any optional implementation in the first aspect.
[0043] In a fourth aspect, a computer storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the image processing method provided by any optional implementation in the first aspect is implemented.
[0044] In a fifth aspect, a computer program product is provided. The computer program product includes a computer program, and the computer program is executed by a processor to implement the image processing method provided by any optional implementation in the first aspect.
[0045] In the embodiment of the present application, multiple images to be processed can be obtained, and for each of the multiple images to be processed, the first edge gradient information of the image to be processed and the second edge gradient information of the reference image generated based on the image to be processed are obtained, and the first structural similarity between the first gradient image and the second gradient image is determined based on the first edge gradient information and the second edge gradient information, and then the quality score of the image to be processed can be determined based on the first structural similarity. In this way, by obtaining the edge gradient information of the image to be processed and the edge gradient information of the reference image generated based on the image to be processed for calculation and comparison, not only the amount of calculation is reduced, the efficiency of image quality assessment is improved, but also the accuracy of quality assessment is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0047] Figure 1 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of an image before and after Gaussian blur processing provided in an embodiment of the present application;
[0049] Figure 3 is a flowchart of another image processing method provided in an embodiment of the present application;
[0050] Figure 4 is a schematic diagram of image division provided in an embodiment of the present application;
[0051] Figure 5 (a) is a schematic diagram of a test image provided in an embodiment of the present application;
[0052] Figure 5 (b) is a schematic diagram of a test image provided in an embodiment of the present application;
[0053] Figure 5 (c) is a schematic diagram of a test image provided in an embodiment of the present application;
[0054] Figure 6 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0055] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0057] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0058] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0059] In the field of image processing and computer vision, object detection is an important technology. However, in practical applications, there are often low-quality images, such as blurred, dim, and distorted images, which will affect the accuracy of object detection.
[0060] In order to prevent low-quality images from affecting the accuracy of target detection, it is necessary to evaluate the image quality in order to filter out low-quality images. However, when evaluating image quality, traditional algorithms mostly calculate the gradient information of the image, which easily results in lower scores when evaluating clear images with small gradient changes, resulting in lower accuracy of image quality evaluation.
[0061] In addition, the calculation of gradient information often requires all pixels of an image to participate in the calculation, which is a huge number of parameters. It will consume more time when the algorithm performs image quality assessment, which will lead to lower efficiency of image quality assessment.
[0062] Therefore, how to quickly and accurately evaluate image quality in order to filter out low-quality images and improve the accuracy of target detection is a technical problem that needs to be solved urgently.
[0063] In order to solve the problem of low accuracy and efficiency of image quality assessment in the above-mentioned prior art, the embodiments of the present application provide an image processing method, apparatus, device and medium, which can obtain multiple images to be processed, and for each of the multiple images to be processed, obtain the first edge gradient information of the image to be processed, and the second edge gradient information of the reference image generated based on the image to be processed, and determine the first structural similarity between the first gradient image and the second gradient image based on the first edge gradient information and the second edge gradient information, and then determine the quality score of the image to be processed based on the first structural similarity. In this way, by obtaining the edge gradient information of the image to be processed and the edge gradient information of the reference image generated based on the image to be processed for calculation and comparison, not only the amount of calculation is reduced, the efficiency of image quality assessment is improved, but also the accuracy of quality assessment is guaranteed.
[0064] It should be noted that the image processing method provided in the embodiment of the present application can be executed by an image processing device or a control module in the image processing device for executing the image processing method. In the embodiment of the present application, the image processing method provided in the embodiment of the present application is described by taking the image processing device executing the image processing method as an example.
[0065] The image processing method provided in the embodiment of the present application is described in detail below through specific embodiments in conjunction with the accompanying drawings.
[0066] Figure 1 It is a flowchart of an image processing method provided in an embodiment of the present application.
[0067] like Figure 1 As shown, the execution subject of the image processing method may be an image processing device, and the method may specifically include the following steps:
[0068] S110, obtaining a plurality of images to be processed.
[0069] The plurality of images to be processed may be images of the same scene. For example, the plurality of images to be processed may be images of a petroleum and petrochemical scene, which is not limited here.
[0070] In one example, the image processing device can use an image acquisition device to obtain video data of a scene, and the video data may include multiple images. The image processing device can use a computer program (Fast Forward Mpeg, FFmpeg) to extract the video data to obtain multiple images to be processed, for example, extracting an image from the video data at a preset time as the image to be processed. The preset time involved can be a time preset based on actual experience or situation, for example, the preset time can be 2 seconds.
[0071] S120, for each of the multiple images to be processed, obtaining first edge gradient information of the image to be processed and second edge gradient information of the reference image.
[0072] The reference image may be generated based on the image to be processed and used for reference comparison with the image to be processed, which is not limited in detail herein.
[0073] The first edge gradient information is the gradient information of the edge portion of the image to be processed, and correspondingly, the second edge gradient information is the gradient information of the edge portion of the reference image, which is not specifically limited here.
[0074] Specifically, after acquiring multiple images to be processed, the image processing device can acquire, for each image to be processed, first edge gradient information of the image to be processed and second edge gradient information of a reference image generated based on the image to be processed.
[0075] S130, determining a first structural similarity between the first gradient image and the second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image.
[0076] The first gradient image can be generated based on the first edge feature gradient information of the image to be processed, and the second gradient image can be generated based on the second edge gradient information of the reference image. Based on this, the first structural similarity is used to measure the similarity between the first gradient image and the second gradient image, and no further limitation is made here.
[0077] Specifically, after obtaining the first edge gradient information of the image to be processed and the second edge gradient information of the reference image, the image processing device can determine the first structural similarity between the first gradient image and the second gradient image based on the first edge gradient information of the image to be processed and the second edge gradient information of the reference image.
[0078] S140: Determine a quality score of the image to be processed based on the first structural similarity.
[0079] The above quality score can be used to evaluate the quality of the above image to be processed.
[0080] Specifically, after obtaining the first structural similarity, the image processing apparatus can determine the quality score of the image to be processed based on the first structural similarity.
[0081] In one embodiment, after the above S140, the above image processing method may further include the following steps:
[0082] Images with quality scores lower than a preset score threshold are filtered out from multiple images to be processed to obtain a target image.
[0083] Among them, the preset score threshold can be a threshold pre-set based on actual experience or situation, for example, it can be 0.6. It should be noted that in the embodiment of the present application, the score range of the quality score can be [0, 1], which is not specifically limited here.
[0084] Specifically, after obtaining the quality score of each image to be processed among the multiple images to be processed, the image processing device can obtain quality scores corresponding to the multiple images to be processed one by one, that is, obtain multiple quality scores. In this way, images with quality scores lower than a preset score threshold can be filtered out from the multiple images to be processed to obtain the target image.
[0085] In the embodiment of the present application, multiple images to be processed can be obtained, and for each of the multiple images to be processed, the first edge gradient information of the image to be processed and the second edge gradient information of the reference image generated based on the image to be processed are obtained, and the first structural similarity between the first gradient image and the second gradient image is determined based on the first edge gradient information and the second edge gradient information, and then the quality score of the image to be processed can be determined based on the first structural similarity. In this way, by obtaining the edge gradient information of the image to be processed and the edge gradient information of the reference image generated based on the image to be processed for calculation and comparison, not only the amount of calculation is reduced, the efficiency of image quality assessment is improved, but also the accuracy of quality assessment is guaranteed.
[0086] In one embodiment, before obtaining the second edge gradient information with reference to the image, the above-mentioned image processing method may further include the following steps:
[0087] Gaussian blur processing is performed on the image to be processed to obtain a reference image that is similar to the image to be processed.
[0088] Specifically, after acquiring a plurality of images to be processed, the image processing device can perform Gaussian blur processing on each of the plurality of images to be processed to obtain a reference image of the image to be processed.
[0089] In this embodiment, Gaussian blur processing can be performed on the image to be processed to obtain a reference image of the image to be processed, so that the image to be processed and the reference image can be compared to obtain the structural similarity between the two, so as to accurately evaluate the image quality of the image to be processed.
[0090] In one embodiment, the image to be processed may include a plurality of first pixel points and a pixel value of each first pixel point;
[0091] Based on this, the above-mentioned step of performing Gaussian blur processing on the image to be processed to obtain a reference image of the image to be processed may specifically include the following steps:
[0092] For each first pixel point among the multiple first pixel points, perform the following operation:
[0093] Determine a pixel value of a first pixel point and a pixel value of a second pixel point adjacent to the first pixel point among the plurality of first pixel points;
[0094] A weighted summation process is performed on the pixel value of the first pixel point and the pixel value of the second pixel point based on a preset weight to obtain a target pixel value of the first pixel point, so as to obtain a reference image of the image to be processed.
[0095] The second pixel point may include at least two pixel points, which is not limited here. In addition, the preset weight may be a weight pre-set based on actual experience or situation, which is not limited here.
[0096] Specifically, the image processing device can determine the pixel value of a first pixel among multiple first pixel points, as well as the pixel value of a second pixel adjacent to the first pixel among the multiple first pixel points, and then can perform weighted summation of the pixel value of the first pixel point and the pixel value of the second pixel point based on a preset weight to obtain the target pixel value of the first pixel point. In this way, the target pixel value of each first pixel among the multiple first pixel points can be obtained, and then a reference image of the image to be processed can be obtained.
[0097] It should be noted that the gradient change of low-quality images is not obvious after secondary blurring, while the gradient change of high-quality images is obvious after secondary blurring. Based on this, a method of using a Gaussian blur algorithm to produce a reference image for the image to be processed is adopted, so that each image to be processed can obtain its own reference image through Gaussian blurring. Specifically, the Gaussian kernel plays a core role in Gaussian blurring. The Gaussian kernel is a square pixel array, in which the pixel value corresponds to the value of a 2D Gaussian curve. The weight value within the kernel is calculated by a Gaussian function, and the Gaussian kernel is used to convolve the image with a normal distribution to realize the Gaussian blurring process of the image. This process can be regarded as a process of filtering high-frequency signals and retaining low-frequency signals. The size of the Gaussian kernel can be adjusted to control the degree of blurring. In the present invention, the size of the Gaussian kernel is set to 7*7. The specific implementation effect is as follows: Figure 2 The comparison before and after Gaussian blur is shown in the figure. The left picture is the original image, and the right picture is the reference image after Gaussian blur.
[0098] In this embodiment, the pixel value of each pixel in the image can be weighted averaged with the pixel values of adjacent pixels to achieve image smoothing and blurring effects, so that the image to be processed and the reference image can be compared to obtain the structural similarity between the two, so as to accurately evaluate the image quality of the image to be processed.
[0099] Considering that the human eye is most sensitive to edge information in the horizontal and vertical directions, in one embodiment, the above-mentioned steps of obtaining the first edge gradient information of the image to be processed and the second edge feature information of the reference image may specifically include the following steps:
[0100] Extracting first edge gradient information of the image to be processed by using a Sobel operator, and extracting second edge gradient information of the reference image by using a Sobel operator;
[0101] The first edge gradient information may include edge gradient information in the horizontal direction of the image to be processed, and edge gradient information in the vertical direction of the image to be processed;
[0102] The second edge gradient information may include edge gradient information in a horizontal direction of the reference image and edge gradient information in a vertical direction of the reference image.
[0103] Specifically, after acquiring multiple images to be processed, for each of the multiple images, the image processing device can use the Sobel operator to extract first edge gradient information of the image to be processed, and use the Sobel operator to extract second edge gradient information of the reference image.
[0104] It should be noted that the above-mentioned Sobel operator includes a Sobel operator in the horizontal direction, as shown in Table 1. For the Sobel operator in the horizontal direction, the result of multiplying the pixel with the Sobel operator shown in Table 1 and adding the result represents the gradient of the image in the horizontal direction. In addition, the above-mentioned Sobel operator may also include a Sobel operator in the vertical direction, as shown in Table 2. For the Sobel operator in the vertical direction, the result of multiplying the pixel with the Sobel operator shown in Table 2 and adding the result represents the gradient of the image in the vertical direction. Then, the gradient information in the horizontal direction and the vertical direction are weightedly combined based on the preset weights to obtain the final gradient information. It should be noted that the above-mentioned preset weights can be pre-set based on actual experience or circumstances. For example, the weights corresponding to the gradient information in the horizontal direction and the gradient information in the vertical direction can both be set to 0.5, which means that they are equally combined.
[0105] Table 1
[0106] -1 0 1 -2 0 2 -1 0 1
[0107] Table 2
[0108] -1 -2 -1 0 0 0 1 2 1
[0109] In this embodiment, the Sobel operator can be used to extract edge gradient information of the image to be processed and the reference image respectively. The edge gradient information may include edge gradient information in the horizontal direction and edge gradient information in the vertical direction. In this way, the accuracy of obtaining the edge gradient information is improved. Based on the edge feature information, it is also convenient to subsequently reduce the amount of calculation, thereby improving the efficiency of image quality assessment.
[0110] In one embodiment, Figure 3 As shown, the above S130 may specifically include the following steps:
[0111] S310, generating a first gradient image based on first edge gradient information of the image to be processed, and generating a second gradient image based on second edge gradient information of the reference image.
[0112] Specifically, after obtaining the first edge gradient information of the image to be processed and the second edge gradient information of the reference image, the image processing device can generate a first gradient image based on the first edge gradient information of the image to be processed, and generate second gradient information based on the second edge gradient information of the reference image.
[0113] S320: Determine N first image regions in the first gradient image, and determine N second image regions in the second gradient image.
[0114] Wherein, N is a positive integer greater than or equal to 1, and no further limitation is given here.
[0115] Specifically, after generating the first gradient image and the second gradient image, the image processing apparatus can determine N first image regions in the first gradient image, and determine N first image regions in the second gradient image.
[0116] S330 , determining a second structural similarity between an i th first image region among the N first image regions and an i th second image region among the N second image regions, to obtain N second structural similarities.
[0117] Among them, i=1, 2,...N.
[0118] Specifically, the image processing device can determine the first structural pixel degree between the i-th first image region and the i-th second image region among the N first image regions and the i-th second image region among the N second image regions, and thus obtain N second structural similarities.
[0119] In one example, assuming that N=3, the N first image regions may be N 1 、N2 、N 3 , the N second image regions can be In this way, we can calculate N 1 and N 2 and N 3 and The second structural similarity between .
[0120] It should be noted that after the blurred and occluded areas in the image become more blurred after Gaussian blurring, the gradient information near the image will not change significantly. However, those clear images often have more gradient information, which leads to a significant change in the gradient information before and after the image is transformed after Gaussian blurring. Based on this, if the second structural similarity is greater, the first image area and the second image area are more similar, the gradient change between the first image area and the second image area is less obvious, and the image quality is lower. Conversely, the smaller the second structural similarity is, the less similar the first image area and the second image area are, the gradient change between the first image area and the second image area is more obvious, and the image quality is higher.
[0121] In one embodiment, the above-mentioned S330 satisfies the following formula (1):
[0122]
[0123] in, is the pixel mean of the i-th first image region, is the pixel mean of the i-th second image area, is the pixel variance of the i-th first image region, is the pixel variance of the i-th second image region, is the pixel covariance between the i-th first image region and the i-th second image region, and C1, C2, and C3 are all constants.
[0124] In addition, C1=(k1L) 2 、C2=(k2L) 2 , C3=C2 / 2, representing three constants, k1 and k2 default to 0.01 and 0.03, and L is the image pixel value range of 255.
[0125] Based on this, the above S140 may specifically include the following steps:
[0126] Based on the N second structural similarities, a quality score of the image to be processed is determined.
[0127] Specifically, after obtaining N second structural similarities, the image processing apparatus can determine the quality score of the image to be processed based on the N second structural similarities.
[0128] In one embodiment, the above-mentioned S1401 satisfies the following formula (2):
[0129]
[0130] Among them, Score is the quality score, i = 1, 2...N, SSIM(x i ,y i ) is the second structural similarity between the ith first image region and the ith second image region.
[0131] In this embodiment, the comparison between the image to be processed and the reference image generated based on the image to be processed can be achieved with the image region as a unit, thereby ensuring the accuracy of quality assessment.
[0132] In one embodiment, the above-mentioned S320 may specifically include the following steps:
[0133] Dividing the first gradient image to obtain M first image regions, and calculating the first pixel gradient variance of each of the M first image regions;
[0134] Screening out N first image regions whose first pixel gradient variance is greater than a first preset value from the M first image regions;
[0135] Dividing the second gradient image to obtain M second image regions, and calculating the second pixel gradient variance of each second image region in the M second image regions;
[0136] N second image regions whose second pixel gradient variance is greater than a second preset value are obtained by screening out from the M second image regions.
[0137] The first preset value and the second preset value can be preset values based on actual experience or circumstances, and are not limited in detail herein. In addition, M is a positive integer, and M is greater than or equal to N.
[0138] Specifically, the image processing device can obtain M first image regions by dividing the first gradient image, and calculate the first pixel gradient variance value of each of the M first image regions, and then can screen out N first image regions whose first pixel gradient variance is greater than a first preset value from the above M first image regions.
[0139] Furthermore, the image processing device can obtain M second image regions by dividing the second gradient image, and calculate the second pixel gradient variance of each of the M second image regions, and then screen out N second image regions whose second pixel gradient variance is greater than a second preset value from the M second image regions.
[0140] In one example, taking the first gradient image as an example, Figure 4 As shown, the first gradient image is divided into 5×5 first image regions, and the first pixel gradient variance of each first image region is calculated. Then, based on the first pixel gradient variance of each first image region, three first image regions with the largest first pixel gradient variances are selected from the 5×5 first image regions.
[0141] In this embodiment, regions with rich gradient information can be screened out from multiple image regions of the first gradient image and the second gradient image for subsequent calculation, thereby ensuring the accuracy of image quality assessment.
[0142] Compared with the traditional method, the image processing method provided by the embodiment of the present application does not require additional reference images, can evaluate the quality of a single image, and has higher generalization performance. After experiments and tests, the image processing method provided by the embodiment of the present application has a quality inspection effect that is basically consistent with the effect of the human eye. The test image is as follows: Figure 5 As shown in (a), (b) and (c) in the figure, the image quality is arranged from left to right in descending order, and the image quality scores obtained by the detection method of the present invention are 0.84, 0.33 and 0.12 respectively. This shows that the method has a certain detection effect for low-quality images, and the detection effect is basically consistent with the effect of the human eye.
[0143] Based on the same inventive concept, the embodiment of the present application also provides an image processing device. Figure 6 The image processing device provided in the embodiment of the present application is described in detail.
[0144] Figure 6 It is a structural schematic diagram of an image processing device provided in an embodiment of the present application.
[0145] like Figure 6 As shown, the image processing device 600 may include: an acquisition module 610 and a determination module 620 .
[0146] An acquisition module 610 is used to acquire a plurality of images to be processed;
[0147] The acquisition module 610 is further used to acquire, for each of the multiple images to be processed, first edge gradient information of the image to be processed and second edge gradient information of a reference image, where the reference image is generated based on the image to be processed;
[0148] A determination module 620, configured to determine a first structural similarity between a first gradient image and a second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image, wherein the first gradient image is generated based on the first edge gradient information of the image to be processed and the second gradient image is generated based on the second edge gradient information of the reference image;
[0149] The determination module 620 is further configured to determine a quality score of the image to be processed based on the first structural similarity, where the quality score is used to evaluate the quality of the image to be processed.
[0150] In one embodiment, the above-mentioned image processing device may further include a processing module.
[0151] The processing module is used to perform Gaussian blur processing on the image to be processed before acquiring the second edge gradient information of the reference image to obtain a reference image of the image to be processed.
[0152] In one embodiment, the image to be processed includes a plurality of first pixel points and a pixel value of each first pixel point;
[0153] The above processing module is specifically used for:
[0154] For each first pixel point among the multiple first pixel points, perform the following operation:
[0155] Determine a pixel value of a first pixel point and a pixel value of a second pixel point adjacent to the first pixel point among the plurality of first pixel points;
[0156] A weighted summation process is performed on the pixel value of the first pixel point and the pixel value of the second pixel point based on a preset weight to obtain a target pixel value of the first pixel point, so as to obtain a reference image of the image to be processed.
[0157] In one embodiment, the acquisition module mentioned above is specifically used for:
[0158] Extracting first edge gradient information of the image to be processed by using a Sobel operator, and extracting second edge gradient information of the reference image by using a Sobel operator;
[0159] The first edge gradient information includes edge gradient information in the horizontal direction of the image to be processed, and edge gradient information in the vertical direction of the image to be processed;
[0160] The second edge gradient information includes edge gradient information in the horizontal direction of the reference image and edge gradient information in the vertical direction of the reference image.
[0161] In one embodiment, the above-mentioned determination module is specifically used to:
[0162] Generate a first gradient image based on first edge gradient information of the image to be processed, and generate a second gradient image based on second edge gradient information of the reference image;
[0163] Determine N first image regions in the first gradient image, and determine N second image regions in the second gradient image;
[0164] Determine a second structural similarity between an i-th first image region among the N first image regions and an i-th second image region among the N second image regions, where i=1, 2, ..., N, to obtain N second structural similarities;
[0165] Based on this, the above determination module is also specifically used for:
[0166] Based on the N second structural similarities, a quality score of the image to be processed is determined.
[0167] In one embodiment, the above-mentioned determination module is further specifically used for:
[0168] Dividing the first gradient image to obtain M first image regions, and calculating the first pixel gradient variance of each of the M first image regions;
[0169] Screening out N first image regions whose first pixel gradient variance is greater than a first preset value from the M first image regions;
[0170] Dividing the second gradient image to obtain M second image regions, and calculating the second pixel gradient variance of each second image region in the M second image regions;
[0171] N second image regions whose second pixel gradient variance is greater than a second preset value are obtained by screening out from the M second image regions.
[0172] In one embodiment, the first structural similarity between the i-th first image region among the N first image regions and the i-th second image region among the N second image regions is determined to satisfy the following formula:
[0173]
[0174] in, is the pixel mean of the i-th first image region, is the pixel mean of the i-th second image area, is the pixel variance of the i-th first image region, is the pixel variance of the i-th second image region, is the pixel covariance between the i-th first image region and the i-th second image region, and C1, C2, and C3 are all constants.
[0175] In one embodiment, based on the N second structural similarities, the quality score of the image to be processed is determined to satisfy the following formula:
[0176]
[0177] Among them, Score is the quality score, i = 1, 2...N, SSIM(x i ,y i ) is the second structural similarity between the ith first image region and the ith second image region.
[0178] In the embodiment of the present application, multiple images to be processed can be obtained, and for each of the multiple images to be processed, the first edge gradient information of the image to be processed and the second edge gradient information of the reference image generated based on the image to be processed are obtained, and the first structural similarity between the first gradient image and the second gradient image is determined based on the first edge gradient information and the second edge gradient information, and then the quality score of the image to be processed can be determined based on the first structural similarity. In this way, by obtaining the edge gradient information of the image to be processed and the edge gradient information of the reference image generated based on the image to be processed for calculation and comparison, not only the amount of calculation is reduced, the efficiency of image quality assessment is improved, but also the accuracy of quality assessment is guaranteed.
[0179] Each module in the image processing device provided in the embodiment of the present application can be implemented Figure 1 or Figure 3 The method steps of the illustrated embodiment can achieve the corresponding technical effects, and for the sake of brevity, they will not be repeated here.
[0180] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0181] The electronic device may include a processor 701 and a memory 702 storing computer program instructions.
[0182] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0183] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory.
[0184] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0185] The processor 701 implements any one of the image processing methods in the above embodiments by reading and executing computer program instructions stored in the memory 702 .
[0186] In one example, the electronic device may further include a communication interface 703 and a bus 710. Figure 7 As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 710 and communicate with each other.
[0187] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0188] Bus 710 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 710 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0189] In addition, in combination with the image processing method in the above embodiment, the embodiment of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, the image processing method provided in the embodiment of the present application is implemented.
[0190] The embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is executed by a processor to implement the image processing method provided in the embodiment of the present application.
[0191] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0192] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0193] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0194] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box 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, or other programmable image processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable image processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0195] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. An image processing method, characterized in that: The method comprises: Get multiple images to be processed; For each of the plurality of images to be processed, obtaining first edge gradient information of the image to be processed and second edge gradient information of a reference image, wherein the reference image is generated based on the image to be processed; Determining a first structural similarity between a first gradient image and a second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image, wherein the first gradient image is generated based on the first edge gradient information of the image to be processed and the second gradient image is generated based on the second edge gradient information of the reference image; Determining a quality score of the image to be processed based on the first structural similarity, wherein the quality score is used to evaluate the quality of the image to be processed; The determining, based on the first edge gradient information of the image to be processed and the second edge gradient information of the reference image, a first structural similarity between the first gradient image and the second gradient image comprises: Generate a first gradient image based on first edge gradient information of the image to be processed, and generate a second gradient image based on second edge gradient information of the reference image; Determine N first image regions in the first gradient image, and determine N second image regions in the second gradient image; Determine a second structural similarity between an i-th first image region among the N first image regions and an i-th second image region among the N second image regions, where i=1, 2, ..., N, to obtain N second structural similarities; The determining, based on the first structural similarity, a quality score of the image to be processed includes: Determining a quality score of the image to be processed based on the N second structural similarities; The quality score of the image to be processed is determined based on the N second structural similarities, satisfying the following formula: Among them, Score is the quality score, i = 1, 2...N, SSIM(x i ,y i ) is the second structural similarity between the ith first image region and the ith second image region.
2. The method according to claim 1, characterized in that: Before acquiring the second edge gradient information of the reference image, the method further includes: Gaussian blur processing is performed on the image to be processed to obtain a reference image of the image to be processed.
3. The method according to claim 2, characterized in that The image to be processed includes a plurality of first pixel points and a pixel value of each first pixel point; The step of performing Gaussian blur processing on the image to be processed to obtain a reference image that is similar to the image to be processed includes: For each first pixel point among the multiple first pixel points, perform the following operation: Determine a pixel value of the first pixel point and a pixel value of a second pixel point adjacent to the first pixel point among the plurality of first pixel points; A weighted summation process is performed on the pixel value of the first pixel point and the pixel value of the second pixel point based on a preset weight to obtain a target pixel value of the first pixel point, so as to obtain a reference image of the image to be processed.
4. The method according to claim 1, characterized in that Acquiring first edge gradient information of the image to be processed and second edge gradient information of the reference image, including: Extracting first edge gradient information of the image to be processed by using a Sobel operator, and extracting second edge gradient information of the reference image by using a Sobel operator; The first edge gradient information includes edge gradient information in the horizontal direction of the image to be processed, and edge gradient information in the vertical direction of the image to be processed; The second edge gradient information includes edge gradient information of a reference image in a horizontal direction and edge gradient information of the reference image in a vertical direction.
5. The method according to claim 1, characterized in that The determining of N first image regions in the first gradient image and determining N second image regions in the second gradient image includes: Dividing the first gradient image to obtain M first image regions, and calculating a first pixel gradient variance of each of the M first image regions; Screening out N first image regions whose first pixel gradient variance is greater than a first preset value from the M first image regions; Dividing the second gradient image to obtain M second image regions, and calculating a second pixel gradient variance of each second image region in the M second image regions; N second image regions whose second pixel gradient variance is greater than a second preset value are obtained by screening out from the M second image regions.
6. The method according to claim 1, characterized in that The determining of the first structural similarity between the i-th first image region among the N first image regions and the i-th second image region among the N second image regions satisfies the following formula: in, is the pixel mean of the i-th first image area, is the pixel mean of the i-th second image area, is the pixel variance of the i-th first image region, is the pixel variance of the i-th second image region, is the pixel covariance between the i-th first image region and the i-th second image region, and C1, C2, and C3 are all constants.
7. An image processing device, characterized in that: The device comprises: An acquisition module, used for acquiring multiple images to be processed; The acquisition module is further used to acquire, for each of the multiple images to be processed, first edge gradient information of the image to be processed and second edge gradient information of a reference image, wherein the reference image is generated based on the image to be processed; a determination module, configured to determine a first structural similarity between a first gradient image and a second gradient image based on first edge gradient information of the image to be processed and second edge gradient information of the reference image, wherein the first gradient image is generated based on the first edge gradient information of the image to be processed and the second gradient image is generated based on the second edge gradient information of the reference image; The determination module is further used to determine a quality score of the image to be processed based on the first structural similarity, wherein the quality score is used to evaluate the quality of the image to be processed; The determination module is specifically used for: Generate a first gradient image based on first edge gradient information of the image to be processed, and generate a second gradient image based on second edge gradient information of the reference image; Determine N first image regions in the first gradient image, and determine N second image regions in the second gradient image; Determine a second structural similarity between an i-th first image region among the N first image regions and an i-th second image region among the N second image regions, where i=1, 2, ..., N, to obtain N second structural similarities; The determining module is further specifically used for: Determining a quality score of the image to be processed based on the N second structural similarities; The determination module satisfies the following formula: Among them, Score is the quality score, i = 1, 2...N, SSIM(x i ,y i ) is the second structural similarity between the ith first image region and the ith second image region.
8. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the image processing method according to any one of claims 1 to 6.
9. A computer storage medium, characterized in that: The computer storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.
