Filter effect verification method, system, device and storage medium
By calculating the similarity between the image to be tested and the template image to be tested, the actual filter parameters of the image to be tested are determined, and compared with the parameters during the original image processing, the problem of insufficient accuracy of the filter parameter verification in the prior art is solved, and the accuracy of the verification is improved.
Patent Information
- Application Number
- CN202010685593.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-16
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2040-07-16
AI Technical Summary
The prior art has accuracy problems when verifying filter parameters, especially in filters with less obvious effects, and it is easy to have filter parameters that are not detected.
By obtaining the similarity between the image to be tested and the multiple template images, the actual filter parameters of the image to be tested are determined, and compared with the filter parameters used in the original image processing to determine whether the filter effect is passed or not.
Improve the accuracy of filter parameter verification and reduce the situation where parameter errors are not detected due to insignificant filter effects.
Smart Images

Figure CN113947532B_ABST
Abstract
Description
Technical Field
[0001] This application relates to image processing technology, and in particular to a method, system, device, and storage medium for verifying filter effects. Background Art
[0002] Filters can achieve various image effects. Since people are keen on using filters to beautify the images they take, filters have become a standard feature in various image processing software and shooting software. Before the relevant software is shipped, manufacturers generally verify the filter function to ensure its normal use.
[0003] In the prior art, the filter of the image to be tested is usually determined by comparing a standard template image with the image to be tested one by one. However, due to systematic errors, a certain tolerance needs to be reserved for verification. Therefore, when the image to be tested is replaced with an image that is relatively close to it, it can often pass the verification.
[0004] When using the method of the prior art to verify whether the filter parameters (such as the addition ratio) of the filter are correct, errors often occur. This problem is particularly prominent in filters with inconspicuous effects. Summary of the Invention
[0005] To solve at least one of the above technical problems, this application provides a method, system, device, and storage medium for verifying filter effects to improve the accuracy of filter parameter verification.
[0006] According to a first aspect of this application, a method for verifying filter effects is provided, including the following steps:
[0007] Obtain an image to be tested, where the image to be tested is an image obtained by performing filter processing on a first image according to first filter parameters;
[0008] Obtain a plurality of template images, where the plurality of template images are a plurality of images obtained by performing filter processing on the first image according to different filter parameters;
[0009] Determine second filter parameters of the image to be tested according to the similarity between the image to be tested and the plurality of template images;
[0010] When the absolute value of the difference between the second filter parameters and the first filter parameters is less than a first threshold, it is determined that the filter effect verification passes.
[0011] In some embodiments, the determining the second filter parameters of the image to be tested according to the similarity between the image to be tested and the plurality of template images includes:
[0012] Calculate the similarity between the image to be tested and each of the template images;
[0013] Determine the filter parameters of the template image corresponding to the maximum similarity as the second filter parameter.
[0014] In some embodiments, the first image is composed of a plurality of rectangular color blocks of equal size, and the color difference between each rectangular color block and the adjacent rectangular color block is greater than a second threshold.
[0015] In some embodiments, the similarity between the image to be measured and the template image is calculated as follows:
[0016] Calculate the average color similarity of the rectangular color blocks at the same position of the image to be measured and the template image;
[0017] Calculate the average value of the average color similarities of all the rectangular color blocks to obtain the similarity between the image to be measured and the template image;
[0018] The average color refers to the average value of multiple pixel values in the rectangular color block.
[0019] In some embodiments, the image to be measured is obtained from a video to be measured, and the video to be measured is generated by a measured object.
[0020] According to the second aspect of the present application, a filter effect verification method is provided, including the following steps:
[0021] Obtain an image to be measured, where the image to be measured is an image obtained by performing a filter process on a third image according to a fourth filter parameter;
[0022] Obtain a third image and a fourth image, where the fourth image is an image obtained by performing a filter process on the third image according to a fifth filter parameter;
[0023] Determine the ratio of the difference between the image to be measured and the third image and the difference between the fourth image and the third image, and obtain the sixth filter parameter of the image to be measured according to the product of the ratio and the fifth filter parameter;
[0024] When the absolute value of the difference between the sixth filter parameter and the fourth filter parameter is less than a fourth threshold, it is determined that the filter effect verification passes.
[0025] According to the third aspect of the present application, a filter effect verification system is provided, including:
[0026] A first acquisition unit for acquiring an image to be measured and a plurality of template images, where the image to be measured is an image obtained by performing a filter process on a first image according to a first filter parameter, and the plurality of template images are a plurality of images obtained by performing filter processes on the first image according to different filter parameters;
[0027] A first filter parameter determination unit, configured to determine a second filter parameter of the image to be measured according to the similarity between the image to be measured and multiple template images;
[0028] A first determination unit, configured to determine that the filter effect verification passes when the absolute value of the difference between the second filter parameter and the first filter parameter is less than a first threshold.
[0029] According to a fourth aspect of the present application, a filter effect verification system is provided, including:
[0030] A second acquisition unit, configured to acquire an image to be measured, a third image, and a fourth image, where the image to be measured is an image obtained by performing filter processing on the third image according to a fourth filter parameter, and the fourth image is an image obtained by performing filter processing on the third image according to a fifth filter parameter;
[0031] A second filter parameter determination unit, configured to determine a first average value and a second average value, and obtain a sixth filter parameter of the image to be measured according to the product of the ratio of the first average value and the second average value and the fifth filter parameter; where the first average value is the average value of the differences between corresponding pixel points of the image to be measured and the third image, and the second average value is the average value of the differences between corresponding pixel points of the fourth image and the third image;
[0032] A second determination unit, configured to determine that the filter effect verification passes when the absolute value of the difference between the sixth filter parameter and the fourth filter parameter is less than a fourth threshold.
[0033] According to a fifth aspect of the present application, a filter effect verification device is provided, including a program, a memory, and a processor;
[0034] The program is stored in the memory, and the processor executes the program to implement the filter effect verification method.
[0035] According to a sixth aspect of the present application, a storage medium is provided, where the storage medium stores a program, and the program is executed by a processor to implement the filter effect verification method.
[0036] The beneficial effects of the embodiments of the present application are as follows: The present application determines the actual filter parameter of the image to be measured through a template image with a known filter parameter, then compares the actual filter parameter with the filter parameter used when performing filter processing on the original image, and then determines whether the verification can pass according to the absolute value of the difference between the two. Compared with the prior art, the present application can reduce the situation where an image to be measured with an incorrect actual filter parameter due to an unclear filter effect can still pass the verification, improving the accuracy when verifying filter parameters. Description of the Drawings
[0037] Figure 1 Flowchart of a filter effect verification method provided according to an embodiment of the present application;
[0038] Figure 2 System module block diagram for implementing a filter effect verification method provided according to an embodiment of the present application;
[0039] Figure 3a First interface schematic diagram of a filter processing software provided according to an embodiment of the present application;
[0040] Figure 3b Second interface schematic diagram of a filter processing software provided according to an embodiment of the present application;
[0041] Figure 3c Third interface schematic diagram of a filter processing software provided according to an embodiment of the present application;
[0042] Figure 3d Fourth interface schematic diagram of a filter processing software provided according to an embodiment of the present application;
[0043] Figure 3e Fifth interface schematic diagram of a filter processing software provided according to an embodiment of the present application;
[0044] Figure 4 Schematic diagram of a similarity curve provided according to an embodiment of the present application;
[0045] Figure 5 Sub-step flowchart of step 130 of the filter effect verification method provided according to an embodiment of the present application;
[0046] Figure 6 Another sub-step flowchart of step 130 of the filter effect verification method provided according to an embodiment of the present application;
[0047] Figure 7 Sub-step flowchart of step 620 of the filter effect verification method provided according to an embodiment of the present application;
[0048] Figure 8 Flowchart of steps 810 - 820 of the filter effect verification method provided according to an embodiment of the present application;
[0049] Figure 9 Schematic diagram of a first image provided according to an embodiment of the present application;
[0050] Figure 10 Flowchart of steps 1010 - 1020 of the filter effect verification method provided according to an embodiment of the present application;
[0051] Figure 11Flow chart of another filter effect verification method provided according to an embodiment of the present application;
[0052] Figure 12 Flow chart of another filter effect verification method provided according to an embodiment of the present application;
[0053] Figure 13 Flow chart of another filter effect verification method provided according to an embodiment of the present application;
[0054] Figure 14 Block diagram of a filter effect verification system provided according to an embodiment of the present application;
[0055] Figure 15 Block diagram of another filter effect verification system provided according to an embodiment of the present application;
[0056] Figure 16 Block diagram of a mobile phone provided according to an embodiment of the present application;
[0057] Figure 17 Block diagram of a server provided according to an embodiment of the present application. Detailed implementation manners
[0058] The present application will be further described below with reference to the accompanying drawings of the specification and specific embodiments. The described embodiments should not be regarded as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0059] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0061] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0062] Filters can be used to achieve various special effects on images. Adding a filter to the original image can be understood as superimposing an effect on the original image, or as performing a certain transformation on the original image. There are various forms of filters, such as red filters, blue filters, sepia filters (yellow filters), grayscale filters, and graphic filters, etc. In the embodiments of the present application, the pixel points in the original image can be described as P (a,b) , where (a, b) represents the coordinates of the pixel point in the image, and the filter effect can be described as G(P (a,b) ,(a,b)). Then the pixel points of the image after adding the filter can be described as, P (a,b) +G(P (a,b) ,(a,b)).
[0063] Filter parameters. In the present application, filter parameters can be used to describe the strength of the filter effect added. For example, in the present application, adding a red filter to the original image, then the filter parameter can be used to describe the percentage of the added red filter. After increasing the filter parameter, the pixel points of the image after adding the filter can be described as P (a,b) +K*G(P (a,b) ,(a,b)) or as P (a,b) +G(P (a,b) ,(a,b),K). Where K is the filter parameter.
[0064] It should be understood that the embodiments provided in the present application can be applied both in the verification of the filter effect of pictures and in the verification of the filter effect of videos.
[0065] In the related art of filter effect verification, the filter effect of a to-be-tested image is verified by comparing it with a corresponding template image, and it is determined whether the to-be-tested image can pass the verification according to the similarity between the two. For example, when verifying a to-be-tested image with a 10% red filter added, the related art only compares the to-be-tested image with a template image with a 10% red filter added, and determines whether the to-be-tested image passes the verification according to the size relationship between the similarity of the two and a threshold. Since there are systematic errors in actual engineering, a certain tolerance rate needs to be reserved for testing. For example, the verification threshold is set to 95%, leaving a 5% tolerance rate. Due to the existence of the tolerance rate, when using an image that is very similar to the to-be-tested image (hereinafter referred to as an interference image) to replace the to-be-tested image for verification, the interference image still has a certain probability of passing the verification. Therefore, in the related art when verifying filter parameters, once the filter effect itself is not obvious and the fluctuation of the filter parameters has little impact on the effect of the image after adding the filter, the related art cannot detect the incorrect addition of the filter parameters, resulting in a low accuracy rate of the related calculations when verifying the filter parameters. For example, the object under test adds a 10% red filter to the original image, but there is a program defect in the object under test, resulting in it actually adding a 20% red filter to the original image. In the related art, only the to-be-tested image is compared with a template image with a 10% red filter added. If the difference between the original images after adding 10% and 20% red filters is not significant, it may cause both to pass the verification. Therefore, the related art cannot detect this type of problem.
[0066] To this end, an embodiment of the present application proposes a filter effect verification method. The filter parameters actually added to the to-be-tested image are determined through a template image with known filter parameters, and the filter parameters are compared according to the actually added filter parameters and the filter parameters added when the object under test performs filter processing on the original image, so as to determine whether the filter parameters are correctly added. Specifically, in some embodiments of the present application, the similarity between the to-be-tested image and a template image with different filter parameters can be calculated to determine the actual filter parameters added to the to-be-tested image. In some embodiments of the present application, the actual filter parameters added to the test image can also be calculated according to a template image with a certain filter parameter (for example, 100%), the original image, the test image, and the filter parameter. Then, by comparing the actual filter parameters with the filter parameters set to be added by the object under test, the verification of the filter parameters is realized.
[0067] Referring to Figure 1 , this embodiment discloses a filter effect verification method, which can be applied to the hardware system described in Figure 2. Among them, it should be noted that the method disclosed in this embodiment is applied in Figure 2Among the servers 210, the object to be measured is the terminal 220 itself or the software running on the terminal 220. In this embodiment, the server 210 can be a single server or a distributed server, and the terminal can be a personal computer, a tablet computer, a mobile phone, etc.
[0068] In some other embodiments, the object to be measured and the method disclosed in this embodiment can run on the same device. For example, the object to be measured is an APP that has the function of adding filters to videos or images. At the same time, a test program is configured on the device where the APP runs, and when the test program is executed, the method disclosed in this embodiment can be implemented.
[0069] The method disclosed in this embodiment includes steps 110 to 140. Specifically:
[0070] Step 110, obtain a to-be-tested image, where the to-be-tested image is an image obtained by performing filter processing on a first image according to a first filter parameter.
[0071] Specifically, in this embodiment, the to-be-tested image is generated by the object to be measured. The to-be-tested image is an image obtained by the object to be measured performing filter processing on the first image, where the first image can be understood as the original image and the first image is a pre-set image. In this embodiment, the object to be measured can refer to hardware or software with filter processing functions. The object to be measured can be video processing software or image processing software.
[0072] The obtaining method of the to-be-tested image can be that after the object to be measured performs filter processing on the first image, it actively sends the to-be-tested image to the test program deployed on the server; it can also be that the test program deployed on the server actively requests to obtain it from the object to be measured; or the test program can read it from the memory storing the to-be-tested image.
[0073] The filter processing referred to in this embodiment includes but is not limited to the following filter processing methods:
[0074] Refer to Figure 3a , Figure 3a shows the filter addition interface of the object to be measured, and the interface includes a filter type selection bar 310, a filter parameter adjustment bar 320, and a display area 330. In Figure 3a the original image 340 is displayed in the display area 330.
[0075] Figure 3bThe display area 330 shows an image 350, which is obtained by adding a first filter effect to the original image. This filter effect is a global filter and is added to the entire original image. Among them, the filter effect can be uniform, that is, the effect added at each pixel point of the original image is the same, or the filter effect can be non-uniform, that is, the filter effects added at each pixel point of the original image are different.
[0076] Figure 3c The display area 330 shows an image 360, which is obtained by adding a second filter effect to the original image. This filter effect is a local filter and is added to a part of the original image.
[0077] Figure 3d The display area 330 shows an image 370, which is obtained by adding a third filter effect to the original image. This filter effect is a sticker, that is, text and / or an image is overlaid on the original image.
[0078] Figure 3e The display area 330 shows an image 380, which is an image obtained by deforming the original image. Of course, the deformation can be partial or global.
[0079] Step 120: Obtain a plurality of template images, which are a plurality of images obtained by performing filter processing on the first image according to different filter parameters.
[0080] Specifically, the template image can be a calibrated standard image, serving as a reference standard for evaluating the filter effect. When generating the template image, the program or hardware performing the filter processing is different from the object under test. The filter types used when generating the plurality of template images are the same as those used when generating the image to be tested, but different filter parameters are used when generating different template images. That is to say, for each filter type, there are a plurality of template images with different filter parameters configured in the server. For example, for the red filter, there are 10 template images such as the template image with a 10% filter effect, the template image with a 20% filter effect,..., the template image with a 90% filter effect, and the template image with a 100% filter effect. For the blue filter, there are 100 template images with filter effects from 1% to 100%. The number of template images that need to be configured for each filter type depends on the calibration algorithm and calibration accuracy.
[0081] The template images are stored in the server, and the test program obtains these template images from the memory of the server.
[0082] Step 130: Determine the second filter parameter of the image to be tested according to the similarity between the image to be tested and the plurality of template images.
[0083] Specifically, in this embodiment, similarity is used to describe the similarity degree between two images, and the similarity can be calculated by means such as color similarity or color histogram. The second filter parameter of the image to be measured may refer to the actual filter parameter of the image to be measured calculated or estimated through this step. The color similarity between two images can be represented by the average value of the similarities between the pixel points at each position in the two images. For two images with i*j pixel points in length and width, their similarity can be described by the following formula:
[0084]
[0085] Among them, represents the color similarity between two images, and c (a,b) represents the similarity between the pixel points at position (a, b) in the two images, wherein, the RGB value of the pixel point at position (a, b) in the first image is (r 1 , g 1 , b 1 ), and the RGB value of the pixel point at position (a, b) in the second image is (r 2 , g 2 , b 3 ).
[0086] The second filter parameter can be determined by the following methods:
[0087] Method 1: Calculate the similarities between the image to be measured and 100 template images with filter parameters of 1%, 2%,..., 99%, and 100%. Use the filter parameter of the template image with the highest similarity as the second filter parameter. Method 1 is equivalent to determining the template image with the greatest similarity to the image to be measured by an enumeration method.
[0088] Method 2: Calculate the similarities between the image to be measured and the template images corresponding to some filter parameters. For example, calculate the similarities between the image to be measured and 10 template images with filter parameters of 10%, 20%, 30%,..., 90%, and 100%. Use the filter parameter corresponding to the template image with the highest similarity as the second parameter. Method 2 is equivalent to an estimation method. Generally, the actual filter parameter of the image to be measured is closest to the filter parameter corresponding to the template image with the highest similarity. In the example of Method 2, the absolute difference between the estimation result and the actual result is less than 5%. Method 2 is applicable to embodiments with low precision requirements.
[0089] In Method 3, to reduce the computational complexity of Method 1, the similarity between the template image of some filter parameters and the image to be tested can be calculated first. Then, the interval where the filter parameters corresponding to the template image with the highest similarity to the image to be tested are located can be estimated. Next, all the template images with filter parameters within this interval are compared with the image to be tested to determine the template image with the highest similarity to the image to be tested, and the filter parameters corresponding to this template image are used as the second filter parameters.
[0090] For example, the similarity change curve between the image to be tested with an actual filter parameter of 55% and the template images with filter parameters ranging from 0% to 100% is as Figure 4 shown, and the change curve is in the shape of "^". When determining the interval where the filter parameters of the template image with the highest similarity to the image to be tested are located, the monotonicity change of the curve can be determined according to the filter parameters of the template images corresponding to the top three similarities ranked from largest to smallest, so as to determine the interval where the highest point is located. Since the similarity change curve is a straight line on both sides of the highest point, by judging whether the three similarities ranked from largest to smallest are on the same straight line, it can be determined whether the monotonicity of the curve has changed within the interval enclosed by the filter parameters corresponding to these three similarities. As shown in Figure 4, among the similarities between the template images with filter parameters of 0%, 20%, 40%, …, 80% and 100% and the image to be tested, the top three values ranked from largest to smallest are point C (corresponding to the filter parameter 60%), point B (corresponding to the filter parameter 40%), and point D (corresponding to the filter parameter 80%). It is obvious that point B, point C, and point D are not on the same straight line, so it can be judged that within the interval enclosed by the filter parameters corresponding to point B and point D, the monotonicity of the similarity curve has changed, that is, the maximum value of the similarity curve is between 40% and 80%. Therefore, when the filter parameter corresponding to the maximum value among the top three similarities ranked from largest to smallest is located between the filter parameters corresponding to the second and third similarities, it can be determined that the monotonicity of the similarity curve has changed within the interval enclosed by the filter parameters corresponding to the second and third similarities.
[0091] In some other embodiments, the filter parameters of the selected template images may not be evenly distributed in [0%, 100%]. For example, referring to Figure 4 , select the template images with filter parameters of 20%, 30%, 40%, and 60% to calculate the similarity with the image to be tested. Through calculation, it can be determined that in the coordinate system with the filter parameter on the abscissa and the similarity between the template image corresponding to the filter parameter and the image to be tested on the ordinate, the top three points E, point B, and point C are not on the same straight line. Therefore, it can be determined that within the interval of 30% - 60% of the filter parameter, the monotonicity of the similarity curve has changed, and thus it can be determined that the maximum value of the similarity curve is within this interval. For example, referring to Figure 4, select template images with filter parameters of 60%, 80%, 90% and 100% to calculate the similarity with the image to be measured. Through calculation, it can be determined that the points C, D and F corresponding to the top three similarities are on the same straight line. It can be judged that in the interval of 60% - 90%, the monotonicity of the similarity curve has not changed, and the similarity curve is decreasing in this interval. Therefore, it can be determined that the maximum value of the similarity curve is in the interval of 0 - 60%.
[0092] Step 140: When the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold, it is determined that the filter effect verification passes.
[0093] In this step, by comparing the calculated second filter parameter with the first filter parameter used when the object under test processes the first image, if the difference between the two is less than the set threshold, the verification of the filter effect passes; otherwise, it is determined that the verification of the filter effect fails. In some embodiments, the first threshold can be 5%, 10% or 30%.
[0094] The embodiments of the present application determine the actual filter parameter of the image to be measured by calculating the similarity between the image to be measured and multiple template images with different filter parameters, and then compare the actual filter parameter calculated from the image to be measured with the filter parameter configured when the object under test generates the image to be measured. In this way, it can be verified whether the filter parameter of the filter added by the object under test to the original image is correct, improving the accuracy of filter parameter verification compared with the prior art and making it easier to detect problems with incorrect filter parameters.
[0095] Refer to Figure 5 , this embodiment discloses a method for verifying filter effects. In this embodiment, Figure 1 In step 130 of the method shown, determine the second filter parameter of the image to be measured according to the similarity between the image to be measured and multiple template images, which specifically includes step 510 and step 520.
[0096] Step 510: Calculate the similarity between the image to be measured and each template image.
[0097] In this embodiment, the filter parameters of multiple template images are evenly distributed in the interval of [0%, 100%]. For example, template images with filter parameters of 0%, 1%, 2%, 3%,..., 99% and 100% can be obtained. In this step, calculate the similarity between the image to be measured and these template images one by one. In some other embodiments, the filter parameters of multiple template images can also be 0%, 5%, 10%, 15%,..., 95% and 100%, and the distribution distance of the filter parameters of the template images is determined according to the error requirement.
[0098] Step 520: Determine the filter parameters of the template image corresponding to the maximum similarity as the second filter parameters.
[0099] Specifically, in this step, the maximum value among the multiple similarities calculated in step 131 is used as the actual filter parameters of the image to be tested. Taking the filter parameters of multiple template images as 0%, 5%, 10%, 15%, ……, 95% and 100% as an example, in this embodiment, assuming that the filter parameter corresponding to the maximum similarity is 15%, then the interval where the actual maximum value of the similarity lies is 10% - 20%. Since the actual filter parameters are closer to 15% than 10% and 20%, it can be determined that the actual maximum value of the similarity lies between 12.5% and 17.5%. Therefore, 15% is used as the second filter parameter, and the error between it and the filter parameter corresponding to the actual maximum value is only 2.5%.
[0100] The algorithm of this embodiment is simple and easy to implement. This embodiment can determine the image most similar to the image to be tested from multiple template images, so as to determine the actual filter parameters of the image to be tested. Compared with the prior art, this embodiment is more sensitive and has higher detection accuracy when detecting whether the filter parameters are accurately added.
[0101] Refer to Figure 6 , this embodiment discloses a method for verifying filter effects. In this embodiment, step 130: Determine the second filter parameters of the image to be tested according to the similarities between the image to be tested and multiple template images, which specifically includes:
[0102] Step 610: Calculate the similarities between the image to be tested and multiple template images.
[0103] In this step, template images with different filter parameters are selected at a certain interval. For example, multiple template images with filter parameters of 0%, 20%, 40%, 60%, 80% and 100% are selected, and then the similarities between the image to be tested and these template images are calculated.
[0104] Step 620: Determine the interval where the filter parameters of the image to be tested are located according to the multiple similarities.
[0105] In this step, according to the characteristics of the similarity curve, the interval where the monotonicity of the similarity curve changes can be found, and the maximum value of the similarity curve will fall within this interval.
[0106] Step 630: Obtain multiple template images with filter parameters within this interval.
[0107] In this step, template images with filter parameters at each percentage within this interval can be obtained. For example, if the interval determined in step 620 is 40% - 60%, then in this step, template images with filter parameters of 40%, 41%, 42%, ……, 59% and 60% can be obtained at an interval of 1% (if already obtained, they can be skipped). Of course, within the allowable error range, template images with filter parameters within the interval can also be obtained at intervals of 2%, 3% or 5% to reduce the number of operations.
[0108] Step 640: Calculate the similarity between the image to be measured and multiple template images with filter parameters within this interval, and determine the filter parameter of the template image with the maximum similarity as the second filter parameter.
[0109] In this step, calculate the similarity between the currently obtained filter parameter and multiple template images within the interval determined in step 620 and the image to be measured, and take the maximum value as the actual filter parameter of the image to be measured.
[0110] In this embodiment, by calculating the similarity between the image to be measured and multiple template images, the interval where the filter parameter of the image to be measured is located is determined. Then, by enumeration or other methods, the similarity between the template images with filter parameters within this interval and the image to be measured is calculated, so as to select the template image with the highest similarity to the image to be measured, and take the filter parameter of this template image as the actual filter parameter of the image to be measured. This method can effectively reduce the number of similarity calculations and improve the efficiency of filter effect verification.
[0111] In some embodiments, the filter parameters of multiple template images are evenly distributed within [0, 100%]. For example, first obtain template images with filter parameters of 0%, 20%, 40%, 60%, 80% and 100%.
[0112] Refer to Figure 7 , in this embodiment, step 620: Determine the interval where the filter parameter of the image to be measured is located according to multiple similarities, specifically including:
[0113] 710: Determine the top three similarities in descending order of value among multiple similarities.
[0114] Taking Figure 4 as an example, the actual filter parameter of the image to be measured is 55% corresponding to point A, and the three template images with the highest similarity to the image to be measured correspond to point C (60%), point B (40%) and point D (80%) respectively. This step determines the similarities corresponding to point C, point B and point D.
[0115] 720: Determine the interval where the filter parameter of the image to be measured is located according to the filter parameters of the template images corresponding to the three similarities.
[0116] According to the law of the similarity curve, the maximum value of the similarity curve falls within the interval of the filter parameters corresponding to points C, B, and D. In this embodiment, the filter parameters corresponding to the template images ranked second and third in similarity to the image to be measured can be used as the two endpoints of the interval. For example, in this embodiment, 40% corresponding to point B and 80% corresponding to point D can be used as the two endpoints of the interval. That is, in this example, the interval within which the maximum value of the similarity curve falls is [40%, 80%].
[0117] Of course, assuming that the similarity curve is as Figure 4 shown, the similarity corresponding to point C > the similarity corresponding to point B > the similarity corresponding to point D, indicating that the maximum value of the similarity curve is closer to the similarity of point C. Therefore, the lower limit value of the interval can be determined by averaging the filter parameters corresponding to points C and B, and the upper limit value of the interval can be determined by averaging the filter parameters corresponding to points C and D. That is, the lower limit value is (40% + 60%) / 2 = 50%, and the upper limit value is (60% + 80%) / 2 = 70%. In this example, the interval is [50%, 70%].
[0118] That is to say, step 720 can be:
[0119] Determine the upper limit value of the interval according to the maximum value among the filter parameters of the three template images corresponding to the three similarities;
[0120] Determine the lower limit value of the interval according to the minimum value among the filter parameters of the three template images corresponding to the three similarities.
[0121] As in Figure 7 the embodiment shown, by determining the three similarities ranked top three in descending order of value among multiple similarities to determine the interval where the maximum value of the similarity curve is located, the calculation is simple, the accuracy is high, and the amount of calculation can be reduced by narrowing the range of the filter parameters of the template images.
[0122] This embodiment discloses a method for verifying the filter effect. The steps are the same as Figure 1 those in [reference]. In this embodiment, in order to reduce the storage space of the template images, multiple template images are calculated from one template image. In this embodiment, by storing a template image with a filter parameter of 100% in the server, hereinafter referred to as the second image, the second image is a template image obtained by performing filter processing on the first image (i.e., the original image) according to the filter parameter of 100%. Of course, this template is calibrated and used as a reference image for filter effect verification.
[0123] Therefore, in this embodiment, referring to Figure 8 , each template image is obtained in the following manner:
[0124] Step 810: Obtain a first image and a second image, where the second image is an image obtained by performing a filter process on the first image according to a third filter parameter.
[0125] Step 820: Calculate a template image according to the first image, the second image, the third filter parameter, and the filter parameter of the template image.
[0126] In this embodiment, the pixel points of the image after adding the filter can be described as P (a,b) +K*G(P (a,b) ,(a,b)), where P (a,b) represents the original pixel value at the position (a, b) in the original image, K is the filter parameter, and G(P (a,b) ,(a,b)) is the filter processing function of the pixel point.
[0127] It can be determined from the above formula that the pixel points in any template image can be described as: P 3 =P 1 +K 3 *G(P 3 ); The pixel points in the second image can be described as: P 2 =P 1 +K 2 *G(P 2 ).
[0128] Among them, P 3 is the pixel value of the point in the template image to be calculated, P 2 is the pixel value of the point at the same position in the second image, P 1 is the pixel value of the point at the same position in the first image, K 2 is the filter parameter of the second image, and K 3 is the filter parameter in the template image to be calculated.
[0129] Through the derivation of the above two formulas, the calculation method of the pixel point P 3 of the template image with the filter parameter K 3 is obtained:
[0130]
[0131] It can be seen from this formula that K 2 can be any parameter in the range of 1% to 100%.
[0132] Therefore, step 820: Calculate a template image according to the first image, the second image, the third filter parameter, and the filter parameter of the template image, specifically includes:
[0133] Calculate each pixel value in the template image, where the pixel value in the template image is calculated by the following method:
[0134] Calculate the pixel value P at a position in the second image 2 and the pixel value P at the same position in the first image 1 to obtain the difference (P 2 - P 1 );
[0135] Multiply the difference in pixel values at this position (P 2 - P 1 ) by the filter parameter K of the template image 3 , divide the product by the third filter parameter K 2 , and then add it to the pixel value P at the position in the first image 1 to obtain the pixel value P at the position in the template image 3 . Among them, the pixel value of each pixel point consists of three values (r, g, b). When calculating, the RGB three colors are calculated separately.
[0136] In this embodiment, according to the proportional relationship between the filter parameters of the second image and the filter parameters of the template image, template images with different filter parameters can be calculated. That is to say, as long as there is a template image with known filter parameters stored in the server, template images with any filter parameters can be calculated. This can greatly reduce the storage space required to store the template images.
[0137] In Figures 3a - 3e the example shown, a cartoon character is used as the first image (i.e., the original image). Using an irregular image as the original image will increase the calculation difficulty, and at the same time, the color richness may be insufficient, and it cannot fully reflect the influence of the filter effect on different colors.
[0138] Therefore, in this embodiment, an image as shown in Figure 9 is used as the first image.
[0139] Figure 9 The image shown in
[0140] is composed of multiple rectangular color blocks of equal size, and the color difference between each rectangular color block and the adjacent rectangular color block is greater than the second threshold. Figure 9 Specifically, the rectangular color blocks are squares. In the 1 image, there are a total of 18 * 32 squares, and each grid is a pure color, which can be red, blue, green, or yellow, etc. In order to enable the first image to be used to detect the influence of the filter on different colors, the colors of each grid are set to be different or the colors of adjacent grids are different. Among them, different colors mean that the color difference is greater than the second threshold. In this embodiment, the color difference between two colors can be measured by the sum of the squares of the differences in the RGB values of the two colors. For example, the RGB value of color one is (r 1 , g1 ),The RGB value of the second color is (r 2 , g 2 , b 2 ), and can be used to represent the difference between the first color and the second color.
[0141] In some embodiments, when calculating the color similarity, the characteristics of the first image, i.e., the colors within the same grid are the same, can be utilized. By comparing the average color of some pixel points within the same grid of the two images as the average color of the rectangular color block, and then using the average value of the color similarities of each color block as the similarity of the image, the number of operations can be reduced. In addition, due to the repetition of colors within the same color block in the first image, when using a histogram for similarity comparison, the amount of computation is also relatively low.
[0142] In an embodiment where an image as shown in Figure 9 is used as the original image, referring to Figure 10 , the similarity between the image to be tested and the template image can be calculated in the following manner:
[0143] Step 1010: Calculate the average color similarity of the rectangular color blocks at the same position of the image to be tested and the template image.
[0144] Step 1020: Calculate the average value of the average color similarities of all rectangular color blocks to obtain the similarity between the image to be tested and the template image.
[0145] The average color refers to the average value of multiple pixel values in the rectangular color block.
[0146] According to the above analysis, this embodiment can reduce the amount of computation when calculating the similarity between two images.
[0147] This embodiment discloses a method for verifying the filter effect. In the embodiment of Figure 1 , by determining the filter parameters of the template image with the highest similarity to the image to be tested as the actual filter parameters of the image to be tested. In this embodiment, when the filter type is correctly added, the correctness of the filter parameters can be verified. If the filter type is incorrect, the verification result will be inaccurate. For example, when verifying a red filter, a green filter is actually added. To verify whether the filter type itself is correct, referring to Figure 11 , the method further includes the steps:
[0148] Step 1110: Determine the similarity between the template image corresponding to the second filter parameters and the image to be tested as the verification value.
[0149] In this embodiment, a verification condition is added based on step 140. In this embodiment, in step 140, when the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold, it is determined that the filter effect verification passes. Specifically, it includes:
[0150] Step 1120: Determine whether the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold and the verification value is greater than the third threshold.
[0151] If it is satisfied, it is determined that the filter effect verification passes; if it is not satisfied, it is determined that the filter effect verification fails.
[0152] In this embodiment, the third threshold can be set to 0.95, 0.97, or 0.99.
[0153] Taking the first threshold as 5% and the third threshold as 0.97 as an example, when the first filter parameter is 15% and the second filter parameter is 17%, and the similarity between the image to be tested and the template image with a filter parameter of 17% is 0.99, the verification passes.
[0154] When the first filter parameter is 15% and the second filter parameter is 30%, and the similarity between the image to be tested and the template image with a filter parameter of 30% is 0.99, the verification fails.
[0155] When the first filter parameter is 15% and the second filter parameter is 17%, and the similarity between the image to be tested and the template image with a filter parameter of 17% is 0.80, the verification fails.
[0156] This embodiment simultaneously verifies whether the filter parameter is correct and whether the template image corresponding to the actual filter parameter and the image to be tested are similar enough to ensure that both the filter type and the filter parameter are added correctly or both meet the error requirements.
[0157] Refer to Figure 12 , this embodiment discloses a method for verifying filter effects. This embodiment can calculate the filter parameter of the image to be tested based on a template image with a known filter parameter. This embodiment is applicable to Figure 3b the global filter shown in (a,b) +K*G(P (a,b) ,(a,b)).
[0158] The method of this embodiment includes the following steps:
[0159] Step 1210: Obtain the image to be tested, where the image to be tested is an image obtained by performing filter processing on the third image according to the fourth filter parameter.
[0160] In this step, the image to be measured is the image obtained by the object to be measured performing a filter process on the third image (i.e., the original image) according to the fourth filter parameter.
[0161] Step 1220: Obtain the third image and the fourth image. The fourth image is the image obtained by performing a filter process on the third image according to the fifth filter parameter.
[0162] In this step, the fourth image is a template image with a known filter parameter (i.e., the fifth filter parameter), for example, a template image with a filter parameter of 100%.
[0163] Step 1230: Determine the first average value and the second average value, and obtain the sixth filter parameter of the image to be measured according to the product of the ratio of the first average value and the second average value and the fifth filter parameter. Among them, the first average value is the average value of the differences between the corresponding pixel points in the image to be measured and the third image, and the second average value is the average value of the differences between the corresponding pixel points in the fourth image and the third image.
[0164] In this step, according to the expression of the pixel points after adding the filter effect, the following relationship can be obtained:
[0165]
[0166] Among them, K T represents the actual filter parameter of the image to be measured, that is, the fourth filter parameter; K 5 represents the fifth filter parameter, that is, the filter parameter of the fourth image; P T represents the pixel value of the image to be measured, P 3 represents the pixel point value of the third image, P 4 represents the pixel point value of the fourth image. When dividing the two pixel values, one of the RGB three values can be used for calculation. P T -P 3 can represent the effect after subtracting the original image from the image to be measured, P 4 -P 3 can represent the effect after subtracting the original image from the fourth image. The ratio of these two is the same as the ratio of the filter parameter in the image to be measured and the filter parameter of the fourth image. Therefore, through the above formula, K T can be calculated using the values of each pixel point. Finally, the K TTake the average as the sixth filter parameter of the image to be measured. Specifically, this step can be understood as calculating the average of the differences between the corresponding pixel points (referring to the pixel points at the same position) in the image to be measured and the third image as the first average, calculating the average of the differences between the corresponding pixel points in the fourth image and the third image as the second average, and calculating the product of the ratio of the first average to the second average and the fifth filter parameter to obtain the actual filter parameter (the sixth filter parameter) of the image to be measured.
[0167] Step 1240: When the absolute value of the difference between the sixth filter parameter and the fourth filter parameter is less than the fourth threshold, it is determined that the filter effect verification passes.
[0168] In this embodiment, the actual filter parameter of the image to be measured is calculated through the template image and the original image, and then the actual filter parameter of the image to be measured is compared with the filter parameter used by the object under test when generating the image to be measured, so as to determine whether the filter parameter added by the object under test when performing filter processing on the original image is correct. Compared with the prior art, this embodiment can verify whether the added filter parameter is correct, improving the accuracy of verifying the filter parameter.
[0169] Refer to Figure 13 This embodiment discloses a method for verifying the filter effect applied in video processing software, which includes the following steps:
[0170] Step 1310: Store the template video and the original video in the server 210, where the template video is obtained by performing filter processing on the original video. When generating the template video, the same filter effect is added to each frame of the original video, and the filter parameter when adding the filter effect is 100%.
[0171] In this embodiment, the original video is a video with 30 frames per second and a total of 10 seconds. Each frame in the original video is the same as the Figure 9 shown image. The resolution of the video is 720*1280.
[0172] Among them, the template video is manually verified and used as a reference benchmark for filter effect verification.
[0173] Step 1320: Through an automated test case, call the video processing software running on the terminal 220 to add a filter with a filter parameter of a% to the original video to obtain the video to be measured. In this step, the video processing software is the object under test, and it may make mistakes when performing filter processing on the original video.
[0174] Step 1330: The video processing software sends the filter parameter a% and the video to be measured to the server 210.
[0175] Step 1340: The server reads the template video and extracts a frame of image F from the template video M , extracts a frame of image F from the image to be tested T , extracts a frame of image F from the original image 0 .
[0176] Step 1350: According to image F 0 and image F M , calculate the image F(x%) with filter parameters of each percentage. Among them, the pixel value of the pixel point of image F 0 can be represented by (R 0 , G 0 , B 0 ), and the pixel value of the pixel point of image F M can be represented by (R M , G M , B M ). The pixel value of the pixel point of F(x%) can be represented by (R 0 +x%*(R m -R 0 ), G 0 +x%*(G m -G 0 ), B 0 +x%*(B m -B 0 ).
[0177] Therefore, image F 0 and image F M are calculated pixel by pixel to obtain the image F(x%) of each percentage.
[0178] Step 1360: Calculate the color similarity between image F M and image F(0%), image F(10%), image F(20%), ……, image F(80%) and image F(100%) respectively. Among them, the color similarity can be calculated by using the histogram method or according to the similarity of each pixel point.
[0179] Referring to Figure 4 , the similarity curve in this embodiment is as Figure 4 shown. The maximum value of the similarity curve falls within the interval formed by the filter parameters corresponding to the image F(x%) whose similarity values are ranked top three from large to small. As Figure 4 shown, among these images, the one that is the same as image F TThe top three in similarity are Image F (60%), Image F (40%), and Image F (80%). In this embodiment, the maximum and minimum filter parameters among the three are taken to form the interval where the maximum value of the similarity curve lies. Among them, 40% is used as the lower limit of the interval, and 80% is used as the upper limit of the interval. Then, within the interval of [40%, 80%], the similarity between the template images with each percentage and Image F is calculated, and the maximum similarity C is determined. T of the filter parameter b% of the template image. b
[0180] Among them, in this step, the similarity between two images is calculated as follows: First, calculate the average color of each color block. The average color of color block 1 can be expressed as The average color of color block 2 can be expressed as Next, calculate the average color similarity of the color blocks at the same position in the two images, where the average color similarity refers to the similarity of the average colors of these two color blocks. The average color similarity can be expressed as Subsequently, calculate the average value of the average color similarities of all color blocks as the color similarity between the two images. The similarity between Image F (b%) and Image F T can be represented by .
[0181] Step 1370: Determine whether |a% - b%| is less than the threshold of 5%, and determine whether the similarity is greater than the threshold of 0.97. When both conditions are passed, it is determined that the verification of the filter effect passes. When any one of the two conditions fails, it is determined that the verification of the filter effect fails.
[0182] It should be understood that when verifying a video, the verification can be carried out by sampling from the video, or each frame image in the video can be verified.
[0183] This embodiment can accurately verify whether the filter parameters and filter types are correct. In addition, this embodiment has relatively good sensitivity and accuracy when verifying filters with an unclear verification effect. According to the characteristics of the color similarity curve, this embodiment designs a method of first sampling and then calculating the color similarity between the images corresponding to each filter parameter and the image to be tested one by one, which can reduce the amount of calculation. This embodiment only needs to use a template with a known filter parameter to verify the filter parameters and filter types, and does not need to store a large number of template images, saving storage space.
[0184] Referring to Figure 14 , this embodiment discloses a filter effect verification system, including:
[0185] A first acquisition unit 1410, configured to acquire a to-be-tested image and a plurality of template images, where the to-be-tested image is an image obtained by performing a filter process on a first image according to a first filter parameter, and the plurality of template images are a plurality of images obtained by performing filter processes on the first image according to different filter parameters;
[0186] A first filter parameter determination unit 1420, configured to determine a second filter parameter of the to-be-tested image according to the similarity between the to-be-tested image and the plurality of template images;
[0187] A first determination unit 1430, configured to determine that the filter effect verification passes when the absolute value of the difference between the second filter parameter and the first filter parameter is less than a first threshold.
[0188] Refer to Figure 15 , this embodiment discloses a filter effect verification system, including:
[0189] A second acquisition unit 1510, configured to acquire a to-be-tested image, a third image, and a fourth image, where the to-be-tested image is an image obtained by performing a filter process on the third image according to a fourth filter parameter, and the fourth image is an image obtained by performing a filter process on the third image according to a fifth filter parameter;
[0190] A second filter parameter determination unit 1520, configured to determine a first average value and a second average value, and obtain a sixth filter parameter of the to-be-tested image according to the product of the ratio of the first average value to the second average value and the fifth filter parameter; where the first average value is the average value of the differences between the corresponding pixel points of the to-be-tested image and the third image, and the second average value is the average value of the differences between the corresponding pixel points of the fourth image and the third image
[0191] A second determination unit 1530, configured to determine that the filter effect verification passes when the absolute value of the difference between the sixth filter parameter and the fourth filter parameter is less than a fourth threshold.
[0192] An embodiment of the present application further provides a device, which includes a program, a memory, and a processor. The program is stored in the memory, and the processor executes the program to implement the above filter verification method. The device will be introduced below with reference to the accompanying drawings. Please refer to Figure 16 , an embodiment of the present application provides a device, which may be a terminal device. The terminal device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, abbreviated as PDA), a point of sales (Point of Sales, abbreviated as POS), an in-vehicle computer, etc. Taking the terminal device as a mobile phone as an example:
[0193] Figure 16The block diagram of a partial structure of a mobile phone related to the terminal device provided in the embodiment of the present application is shown. Refer to Figure 16 , the mobile phone includes: a Radio Frequency (RF) circuit 1610, a memory 1620, an input unit 1630, a display unit 1640, a sensor 1650, an audio circuit 1660, a wireless fidelity (WiFi) module 1670, a processor 1680, and a power supply 1690 and other components. Among them, the input unit includes a touch panel and other input devices, and the display unit includes a display panel. Those skilled in the art can understand that Figure 16 the structure of the mobile phone shown in
[0194] does not limit the mobile phone, and may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements. Although not shown, the mobile phone may further include a camera, a Bluetooth module, etc., which will not be elaborated here. Figure 17 as shown in Figure 17 is the structure diagram of the server 1700 provided in the embodiment of the present application. The server 1700 may vary greatly due to configuration or performance, and may include one or more Central Processing Units (CPUs) 1722 (for example, one or more processors) and a memory 1732, and one or more storage media 1730 (for example, one or more mass storage devices) for storing application programs 1742 or data 1744. Among them, the memory 1732 and the storage media 1730 may be transient storage or persistent storage. The program stored in the storage media 1730 may include one or more modules (not marked in the figure), and each module may include a series of instruction operations on the server. Further, the central processor 1722 may be configured to communicate with the storage media 1730 and execute a series of instruction operations in the storage media 1730 on the server 1700.
[0195] The server 1700 may further include one or more power supplies 1726, one or more wired or wireless network interfaces 1750, one or more input / output interfaces 1758, and / or one or more operating systems 1741, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0196] The embodiment of the present application further provides a computer-readable storage medium, which is used to store program codes for executing the filter effect verification method in the foregoing various embodiments.
[0197] In the description of this application and the above-mentioned accompanying drawings, terms such as "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0198] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or a similar expression means any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0199] In several embodiments provided by this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms.
[0200] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0201] In addition, in each embodiment of the present application, each functional unit can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0202] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.
[0203] Regarding the step numbers in the above method embodiments, they are only set for the convenience of description and explanation, and no limitation is imposed on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0204] The above has specifically described the preferred embodiments of the present application, but the present application is not limited to the described embodiments. Those skilled in the art can make various equivalent deformations or substitutions without departing from the spirit of the present application, and these equivalent deformations or substitutions are all included within the scope defined by the claims of the present application.
Claims
1. A method for verifying filter effects, characterized in that, it includes the following steps: Obtain an image to be tested, where the image to be tested is an image obtained by performing a filter process on a first image according to first filter parameters; Obtain a plurality of template images, and each of the template images is obtained in the following manner: Obtain the first image and a second image, where the second image is an image obtained by performing a filter process on the first image according to third filter parameters; Calculate the template image according to the first image, the second image, the third filter parameters, and the filter parameters of the template image; wherein, the pixel value in the template image is calculated in the following manner: Calculate the difference between the pixel value at a position in the second image and the pixel value at the same position in the first image; Divide the product of the difference in pixel values at the position by the third filter parameter, and then add it to the pixel value at the position in the first image to obtain the pixel value at the position in the template image; Determine the second filter parameters of the image to be tested according to the similarity between the image to be tested and the plurality of template images; When the absolute value of the difference between the second filter parameters and the first filter parameters is less than a first threshold, it is determined that the filter effect verification passes.
2. The method according to claim 1, characterized in that, the step of determining the second filter parameters of the image to be tested according to the similarity between the image to be tested and the plurality of template images includes: Calculate the similarity between the image to be tested and the plurality of template images; Determine the interval where the filter parameters of the image to be tested are located according to the plurality of similarities; Obtain a plurality of template images whose filter parameters are within the interval; Calculate the similarity between the image to be tested and the plurality of template images whose filter parameters are within the interval, and determine the filter parameters of the template image with the maximum similarity as the second filter parameters.
3. The method according to claim 2, characterized in that, the step of determining the interval where the filter parameters of the image to be tested are located according to the plurality of similarities includes: Determine the top three similarities arranged in descending order of value among the plurality of similarities; Determine the interval where the filter parameters of the image to be tested are located according to the filter parameters of the template images corresponding to the three similarities; wherein, in the step of calculating the similarity between the image to be tested and the plurality of template images, the filter parameters of the plurality of template images are evenly distributed in [0, 100%].
4. The method according to claim 3, characterized in that, the step of determining the interval where the filter parameters of the image to be tested are located according to the filter parameters of the template images corresponding to the three similarities includes: Determine the upper limit value of the interval according to the maximum value of the filter parameters of the template images corresponding to the three similarities; Determine the lower limit value of the interval according to the minimum value of the filter parameters of the template images corresponding to the three similarities.
5. The method according to any one of claims 1-4, characterized in that, the method further includes the following steps: Determine the similarity between the template image corresponding to the second filter parameter and the image to be tested as the verification value; The step of determining that the filter effect verification passes when the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold includes: When the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold and the verification value is greater than the third threshold, it is determined that the filter effect verification passes.
6. A method for verifying filter effect, Characterized in that, The method further includes the following steps: Obtain an image to be tested, where the image to be tested is an image obtained by performing filter processing on a third image according to a fourth filter parameter; Obtain the third image and the fourth image, where the fourth image is an image obtained by performing filter processing on the third image according to a fifth filter parameter; Determine a first average value and a second average value, and obtain the sixth filter parameter of the image to be tested according to the product of the ratio of the first average value and the second average value and the fifth filter parameter; where the first average value is the average value of the differences between the corresponding pixel points in the image to be tested and the third image, and the second average value is the average value of the differences between the corresponding pixel points in the fourth image and the third image; When the absolute value of the difference between the sixth filter parameter and the fourth filter parameter is less than the fourth threshold, it is determined that the filter effect verification passes.
7. A filter effect verification system, Characterized in that, Includes: A first acquisition unit, configured to acquire an image to be tested and a plurality of template images, where the image to be tested is an image obtained by performing filter processing on a first image according to a first filter parameter, and each of the template images is obtained in the following manner: acquire the first image and a second image, where the second image is an image obtained by performing filter processing on the first image according to a third filter parameter; calculate the template image according to the first image, the second image, the third filter parameter, and the filter parameter of the template image; where the pixel value in the template image is calculated in the following manner: calculate the difference between the pixel value at a position in the second image and the pixel value at the position in the first image; divide the product of the difference in pixel values at the position and the filter parameter of the template image by the third filter parameter, and then add it to the pixel value at the position in the first image to obtain the pixel value at the position in the template image; A first filter parameter determination unit, configured to determine the second filter parameter of the image to be tested according to the similarity between the image to be tested and the plurality of template images; A first judgment unit, configured to determine that the filter effect verification passes when the absolute value of the difference between the second filter parameter and the first filter parameter is less than the first threshold.
8. A filter effect verification device, Characterized in that, Includes a program, a memory, and a processor; The program is stored in the memory, and the processor executes the program to implement the filter effect verification method according to any one of claims 1-6.
9. A storage medium, the storage medium stores a program, Characterized in that, The described program is executed by a processor to implement the method according to any one of claims 1-6.
Citation Information
Patent Citations
Method and device for checking image processing effect, and mobile terminal
CN106484614A