A method and computer device for quantitatively calculating pixel differences of color block graphics
By grouping, layering, and calculating the deviation coefficient matrix of graphics, combined with RGB three primary color processing, the problem of quantitative evaluation of color block graphics is solved, and accurate quantitative evaluation of color block graphics is achieved, thereby improving the level of intelligence in color block graphic generation.
Patent Information
- Application Number
- CN202510384732.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-03-28
AI Technical Summary
Existing technologies lack quantitative evaluation and calculation methods for color block graphics, making it difficult to accurately assess the degree of difference between color block graphics.
By using graphic grouping, layering, deviation coefficient matrix calculation, and masking techniques, the pixel differences of color block graphics are quantified, including calculating the color quantization difference between ineffective and effective areas, and generating difference evaluation values by combining RGB three primary color processing.
It achieves precise quantitative evaluation of color block graphics, can capture edge sharpness and internal color purity, conforms to human visual sensitivity, and promotes the intelligent development of color block graphic generation technology.
Smart Images

Figure CN120259259B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision image processing technology, and in particular to a method and computer device for quantifying and calculating pixel differences in color block-type graphics. Background Technology
[0002] In the development of computer graphics generation, it is often necessary to compare and analyze computer-generated images with target images, propose quantitative indicators to characterize their differences, and feed them back to the computer program to improve the generation mechanism. One type of graphic is color block graphics, which are composed of color blocks of various colors, including regular and irregular color blocks. Each color block in a color block graphic has a clear boundary, and the color inside the boundary is uniform.
[0003] In the existing technology, commonly used calculation methods include distribution-based calculation functions, such as BCELoss (BinaRy CRoss-EntRopy Loss), region-based loss functions, such as Dice Loss, and boundary-based loss functions. These functions are often used for image segmentation and evaluation of general image generation. However, there is no evaluation calculation method specifically developed for color block graphics. Summary of the Invention
[0004] Firstly, in order to quantify the degree of difference between color block-type graphics, this application provides a method for quantifying the pixel differences of color block-type graphics.
[0005] The above-mentioned inventive objective of this application is achieved through the following technical solutions:
[0006] Step 1: Grouping of Figures: Prepare several figures for comparison, select one of them as the benchmark figure, denoted as figure A, and obtain the set of the remaining figures X1={A1,A2,...,Ai,...,An}, where n≥2 and i is an integer from 1 to n;
[0007] Step 2: Layered Image Teaming: Split images A1 to An into layers according to the three primary colors of RGB, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain the RGB layer set X2={A1_R,A1_G,A1_B,...,Ai_R,Ai_G,Ai_B,...,An_R,An_G,An_B}, where Ai_R is the red layer of image Ai, Ai_G is the green layer of image Ai, Ai_B is the blue layer of image Ai, n≥2, and i is an integer from 1 to n;
[0008] Step 3: Calculate the deviation coefficient matrix Y of the image: Identify the boundary pixel coordinates of the color block in image A, calculate the shortest distance from the boundary pixel coordinates of each pixel position in image A (excluding the color block) to the boundary pixel coordinates of the color block in image A, and form the deviation coefficient matrix Y;
[0009] Step 4: Calculate the pixel matrix Z of the non-effective region: Extract the overlapping regions of the non-color block regions in Figure A with all RGB layers respectively, and mark the quantized values of red, green and blue at the pixel positions of each overlapping region to obtain the set X3={Z_A1_R, Z_A1_G, Z_A1_B, ..., Z_Ai_R, Z_Ai_G, Z_Ai_B, ..., Z_An_R, Z_An_G, Z_An_B}, where Z_Ai_R is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_R, Z_Ai_G is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_G, Z_Ai_B is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_B, n≥2, i is an integer from 1 to n;
[0010] Step 5: Calculate the quantization difference value relative to the benchmark map in the ineffective region: Multiply all matrices in set X3 with the deviation coefficient matrix Y respectively, and accumulate and add the elements in the resulting numerical matrix to obtain set X4={L_A1_R, L_A1_G, L_A1_B, ..., L_Ai_R, L_Ai_G, L_Ai_B, ..., L_An_R, L_An_G, L_An_B}, where L_Ai_R is the red quantization difference value of layer Ai_R relative to map A in the ineffective region, L_Ai_G is the green quantization difference value of layer Ai_G relative to map A in the ineffective region, L_Ai_B is the blue quantization difference value of layer Ai_B relative to map A in the ineffective region, n≥2, i is an integer from 1 to n;
[0011] Step 6: Quantitative Evaluation of Effective Area Color: Split Image A into layers according to the RGB three primary colors, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain layers A_R, A_G, and A_B. Extract the overlapping areas of the color block areas in Image A with all RGB layers in set X2. Mark the corresponding red, green, and blue quantized values of the RGB layers in set X2 at the pixel positions of each overlapping area. Compare and calculate the RGB values of the pixel positions in each overlapping area with the corresponding RGB values of the pixel positions in layer A_R. Accumulate the differences at each pixel position to obtain the color difference values C_Ai_R, C_Ai_G, and C_Ai_B of the corresponding layers. Then, accumulate them to obtain the color quantization evaluation value, where C_Ai_R is the red difference value of layer Ai_R relative to Image A in the effective area, C_Ai_R is the green difference value of layer Ai_R relative to Image A in the effective area, and C_Ai_R is the blue difference value of layer Ai_R relative to Image A in the effective area.
[0012] Step 7: Output of Image Difference Evaluation Results: After accumulating the L_Ai_R, L_Ai_G, L_Ai_B, C_Ai_R, C_Ai_G, and C_Ai_B obtained in Steps 5 and 6, the difference evaluation value LAI of image Ai is obtained. The formula for the difference evaluation value LAI of image Ai is: LAI=L_Ai_R+L_Ai_G+L_Ai_B+C_Ai_R+C_Ai_G+C_Ai_B. According to the calculation results, the larger the value of LAI, the greater the difference between the image and the benchmark image, and the smaller the value, the closer they are.
[0013] Preferably, in step 3, the shortest distance from the calculated position of each pixel in Figure A (excluding the color block) to the boundary pixel coordinates of the color block in Figure A is proportionally converted according to the value range of 0 to 1 to form the deviation coefficient matrix Y.
[0014] Preferably, in step 4, the pixel positions of the color block areas in Figure A are marked as white, and the pixel positions of the non-color block areas are marked as black to form a layer mask. The layer mask is used to cover all RGB layers one by one, and the area in each RGB layer that overlaps with the black part of Figure A is extracted, thus obtaining the overlapping area between the non-color block areas and all RGB layers in Figure A.
[0015] Preferably, in step 4, the quantization values at all pixel positions in all matrices of set X3 are converted using the following formula: new value = 1 - (1 ÷ 255) × original value, to convert the values into a matrix with a range of 0 to 1.
[0016] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of a method for quantizing the pixel differences of color block-type graphics.
[0017] Thirdly, the present invention provides a computer storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, it implements the steps of a method for quantizing the pixel differences of color block-type graphics.
[0018] The beneficial effects of this invention are as follows: This invention generates a deviation coefficient matrix by calculating the distance from pixels in non-color block areas to the boundary, applying higher weight to color deviations in edge areas, effectively capturing color block blurring, jagged edges, or color penetration problems, and better aligning with human visual sensitivity to edge quality. Specifically, the color block graphic is split into RGB three channels for independent processing, enabling direct comparison of color value differences within the color block, strictly constraining color uniformity within the color block, and laying the foundation for subsequent channel-specific difference calculations. Then, through masking technology, color blocks and non-color block areas are accurately separated. Combined with pixel value normalization and distance normalization processing, the final graphic difference evaluation result is output, achieving a quantitative evaluation function driven by both boundary sensitivity and color consistency. Compared to traditional image segmentation evaluation indicators, this invention can accurately quantify edge sharpness and internal color purity in color block graphic generation tasks, solving the current lack of evaluation calculation methods specifically developed for color block graphics, and promoting the intelligent development of color block graphic generation technology.
[0019] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of images A, B, and C in an example of input color block graphics in one embodiment of this application;
[0021] Figure 2 This is a schematic diagram of an embodiment of the present application after the image C is split into three layers according to the three primary colors of RGB and the R, G, and B values are marked;
[0022] Figure 3 This is a schematic diagram of identifying the edge pixel coordinates of a color block using image A as an example in one embodiment of this application;
[0023] Figure 4 This is a schematic diagram of the coefficient matrix K of an image, using image A as an example, in one embodiment of this application;
[0024] Figure 5 This is a schematic diagram of a mask M_a created based on image A in one embodiment of this application;
[0025] Figure 6 This is a schematic diagram of matrices R_B_b and R_C_b after the mask M_a covers B_b and C_b in one embodiment of this application;
[0026] Figure 7 This is a schematic diagram illustrating the numerical conversion between matrix R_B_b and matrix R_C_b in one embodiment of this application;
[0027] Figure 8 This is a schematic diagram of multiplying the transformed matrices R_B_b and R_C_b with the coefficient matrix K of the image in one embodiment of this application;
[0028] Figure 9 This is a flowchart illustrating the process of this application. Detailed Implementation
[0029] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0030] It should be noted that the terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this disclosure.
[0031] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.
[0032] The following description, with reference to the accompanying drawings, describes a method and computer apparatus for quantifying pixel differences in color block-type graphics.
[0033] A method and computer device for quantifying pixel differences in color block-type graphics, comprising the following steps:
[0034] Step 1: Grouping of Figures: Prepare several figures for comparison, select one of them as the benchmark figure, denoted as figure A, and obtain the set of the remaining figures X1={A1,A2,...,Ai,...,An}, where n≥2 and i is an integer from 1 to n;
[0035] Step 2: Layered Image Teaming: Split images A1 to An into layers according to the three primary colors of RGB, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain the RGB layer set X2={A1_R,A1_G,A1_B,...,Ai_R,Ai_G,Ai_B,...,An_R,An_G,An_B}, where Ai_R is the red layer of image Ai, Ai_G is the green layer of image Ai, Ai_B is the blue layer of image Ai, n≥2, and i is an integer from 1 to n;
[0036] Step 3: Calculate the deviation coefficient matrix Y of the image: Identify the boundary pixel coordinates of the color block in image A, calculate the shortest distance from the boundary pixel coordinates of each pixel position in image A (excluding the color block) to the boundary pixel coordinates of the color block in image A, and form the deviation coefficient matrix Y;
[0037] It should be noted that, in this embodiment, in order to quantify the degree of difference between the comparison images, the pixels of Figure A1 to Figure An are all the same. The same pixels mean that the coordinate grid size of the pixel distribution is the same, and the pixel positions of Figure A1 to Figure An can correspond one by one.
[0038] Preferably, in step 3, the shortest distance from the position of each pixel in Figure A (excluding the color block) to the boundary pixel coordinates of the color block in Figure A is calculated and proportionally converted according to the value range of 0 to 1 to form the deviation coefficient matrix Y, so as to complete the pixel value normalization process and ensure that the algorithm has universality for images with different resolutions and color ranges.
[0039] Step 4: Calculate the pixel matrix Z of the non-effective region: Extract the overlapping regions of the non-color block regions in Figure A with all RGB layers respectively, and mark the quantized values of red, green and blue at the pixel positions of each overlapping region to obtain the set X3={Z_A1_R, Z_A1_G, Z_A1_B, ..., Z_Ai_R, Z_Ai_G, Z_Ai_B, ..., Z_An_R, Z_An_G, Z_An_B}, where Z_Ai_R is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_R, Z_Ai_G is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_G, Z_Ai_B is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_B, n≥2, i is an integer from 1 to n;
[0040] Preferably, in step 4, the pixel positions of the color block areas in Figure A are marked as white, and the pixel positions of the non-color block areas are marked as black to form a layer mask. The layer mask is used to cover all RGB layers one by one, and the area overlapping with the black part of Figure A in each RGB layer is extracted, that is, the overlapping area of the non-color block area and all RGB layers in Figure A is obtained. The use of mask technology can achieve accurate extraction, quickly separate the color block and non-color block areas, and reduce computational redundancy.
[0041] Furthermore, in step 4, the quantized values at all pixel positions in all matrices of set X3 are converted using the following formula: new value = 1 - (1 ÷ 255) × original value, to convert the values into a matrix with a range of 0 to 1, thereby completing the distance normalization process and ensuring that the algorithm is universal for images with different resolutions and color ranges.
[0042] Step 5: Calculate the quantization difference value relative to the benchmark map in the ineffective region: Multiply all matrices in set X3 with the deviation coefficient matrix Y respectively, and accumulate and add the elements in the resulting numerical matrix to obtain set X4={L_A1_R, L_A1_G, L_A1_B, ..., L_Ai_R, L_Ai_G, L_Ai_B, ..., L_An_R, L_An_G, L_An_B}, where L_Ai_R is the red quantization difference value of layer Ai_R relative to map A in the ineffective region, L_Ai_G is the green quantization difference value of layer Ai_G relative to map A in the ineffective region, L_Ai_B is the blue quantization difference value of layer Ai_B relative to map A in the ineffective region, n≥2, i is an integer from 1 to n;
[0043] It should be noted that each matrix in set X3 is multiplied by the deviation coefficient matrix Y, that is, the value of each pixel in each matrix in set X3 is multiplied by the coefficient value at the corresponding position in the deviation coefficient matrix Y to obtain a new matrix.
[0044] Step 6: Quantitative Evaluation of Effective Area Color: Split Image A into layers according to the RGB three primary colors, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain layers A_R, A_G, and A_B. Extract the overlapping areas of the color block areas in Image A with all RGB layers in set X2. Mark the corresponding red, green, and blue quantized values of the RGB layers in set X2 at the pixel positions of each overlapping area. Compare and calculate the RGB values of the pixel positions in each overlapping area with the corresponding RGB values of the pixel positions in layer A_R. Accumulate the differences at each pixel position to obtain the color difference values C_Ai_R, C_Ai_G, and C_Ai_B of the corresponding layers. Then, accumulate them to obtain the color quantization evaluation value, where C_Ai_R is the red difference value of layer Ai_R relative to Image A in the effective area, C_Ai_R is the green difference value of layer Ai_R relative to Image A in the effective area, and C_Ai_R is the blue difference value of layer Ai_R relative to Image A in the effective area.
[0045] Step 7: Output of Image Difference Evaluation Results: After accumulating the L_Ai_R, L_Ai_G, L_Ai_B, C_Ai_R, C_Ai_G, and C_Ai_B obtained in Steps 5 and 6, the difference evaluation value LAI of image Ai is obtained. The formula for the difference evaluation value LAI of image Ai is: LAI=L_Ai_R+L_Ai_G+L_Ai_B+C_Ai_R+C_Ai_G+C_Ai_B. According to the calculation results, the larger the value of LAI, the greater the difference between the image and the benchmark image, and the smaller the value, the closer they are.
[0046] This invention generates a deviation coefficient matrix by calculating the distance from pixels in non-block regions to the boundary, applying higher weight to color deviations in edge regions. This effectively captures issues such as blurry, jagged, or color-bleeding color blocks, better aligning with human visual sensitivity to edge quality. The color block graphic is split into three independent RGB channels, allowing direct comparison of color value differences within the color block. This strictly constrains color uniformity within the color block and lays the foundation for subsequent channel-specific difference calculations. Then, through masking technology, color blocks and non-block regions are precisely separated. Combined with pixel value normalization and distance normalization, the final graphic difference evaluation result is output, achieving a quantitative evaluation function driven by both boundary sensitivity and color consistency. Compared to traditional image segmentation evaluation metrics, this invention can accurately quantify edge sharpness and internal color purity in color block graphic generation tasks. It addresses the current lack of evaluation calculation methods specifically developed for color block graphics, promoting the intelligent development of color block graphic generation technology.
[0047] Secondly, based on the above-mentioned method for quantifying the pixel differences of color block-type graphics, this embodiment of the invention also provides a calculator device, which may be a personal computer, server, network device, etc., including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method for quantifying the pixel differences of color block-type graphics.
[0048] Thirdly, based on the above-mentioned method for quantifying the pixel differences of color block-type graphics, this embodiment of the invention also provides a computer storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the steps of the method for quantifying the pixel differences of color block-type graphics. Example
[0049] This embodiment is an example of quantifying the degree of difference between images A, B, and C.
[0050] 1. Input image A, image B, and image C.
[0051] like Figure 1 As shown, from left to right, there are images A, B, and C, each with a size of 8×9 pixels. One of these images is selected as the benchmark image (image A), and the degree of difference between image B and image A is calculated (denoted as L(ba)), and the degree of difference between image C and image A is calculated (denoted as L(ca)).
[0052] 2. Image layering and teaming
[0053] The non-benchmark images used for comparison, Figures B and C, are each split into three layers according to the RGB primary colors: a red layer, a green layer, and a blue layer, resulting in a total of six layers: B_r, B_g, B_b, C_r, C_g, and C_b. The pixel positions of each layer are labeled with the R, G, and B values, as follows: Figure 2 As shown in Figure C, this is an example.
[0054] 3. Calculate the coefficient matrix K of the image.
[0055] Since image A was selected as the benchmark, the deviation coefficient K for each pixel position was calculated based on image A. First, the edge pixel coordinates of the color blocks were identified, where, for example... Figure 3 The image shows the edge pixel coordinates of the color block in Figure A. Then, the shortest distance from each pixel position to the edge pixel coordinates of the color block is calculated. This distance is marked as the deviation coefficient K for the corresponding pixel position. The farther the color block edge is from the edge, the larger the value of k. And so on... Figure 4 As shown, distance normalization is used to adjust the range of k values, converting k values to a range of 0 to 1, with the minimum distance being "0" and the maximum distance being "1".
[0056] 4. Solve for the pixel matrix R of the non-effective region.
[0057] Solve for the ineffective region pixel matrix in images B and C respectively. Regions whose positions do not match the color blocks in image A are considered ineffective regions. The more pixels in the ineffective regions, the worse the final evaluation score will be. First, as... Figure 5 As shown, based on the benchmark image (i.e., image A), create a layer mask (M_a), marking colored areas as white and uncolored areas as black. Then, use the mask to cover the layers of images B and C, extracting the areas overlapping with the black areas. Taking B_b and C_b as examples, as follows... Figure 6 As shown, when B_b and C_b are covered by mask M_a respectively, matrices of non-valid regions are obtained, denoted as "R_B_b" and "R_C_b".
[0058] 5. R and K matrix operations
[0059] First, such as Figure 7 As shown, the matrices "R_B_b" and "R_C_b" obtained in the previous step are converted into matrices with elements ranging from 0 to 1. The conversion calculation formula is as follows:
[0060] The new value of an element = 1 - the original value × (1 ÷ 255)
[0061] For example: The original value is 54, and the converted value is: 1 - 54 × (1 ÷ 255) = 0.79.
[0062] Then, the R matrix is multiplied by the K-value matrix, that is, the value of each pixel in the R matrix is multiplied by the coefficient value of the corresponding position in the k-value matrix, which will give new matrix values. The elements in the numerical matrices obtained by multiplication are accumulated and added together. The final values represent the quantization difference between the B_b and C_b layers and the A image. The smaller the value, the closer it is to the benchmark image. Taking R_B_b and R_C_b as examples, L(ba)_b and L(ca)_b are calculated respectively.
[0063] like Figure 8 As shown, L(ba)_b = 8.51, L(ca)_b = 1.26. Similarly, each layer of b and c is calculated separately to obtain L(ba)_r, L(ba)_g, L(ba)_b, L(ca)_r, L(ca)_g, and L(ca)_b.
[0064] 6. Quantitative evaluation of effective area color
[0065] For pixels in invalid areas, they need to be erased to white. For pixels in valid areas, color differences need to be evaluated to obtain color evaluation values. These color evaluation values are compared across three RGB layers, and the results are denoted as: C(xx)_r, C(xx)_g, C(xx)_b
[0066] First, the benchmark image (Image A) needs to be color-split into three color layers: R, G, and B. Second, using the layer mask (M_a) mentioned in point 4 above, the area where the image to be evaluated overlaps with the target image is obtained in reverse.
[0067] Then, color comparison is performed in the overlapping area. The graphic to be evaluated is decomposed into three color layers: R, G, and B. The color values are compared and calculated with the corresponding layers of the benchmark image. The difference of each pixel is accumulated to obtain the color difference value of the corresponding layer.
[0068] Finally, by accumulating the color difference values of the three layers R, G, and B, a quantitative evaluation value of the color difference can be obtained. The color evaluation values are then added together so that when comparing Figure b with Figure a, we get: C(ba)_r, C(ba)_g, C(ba)_b, and when comparing Figure c with Figure a, we get: C(ca)_r, C(ca)_g, C(ca)_b.
[0069] 7. Output of the difference evaluation results between A and B
[0070] The values obtained in the previous step are accumulated to obtain the difference evaluation results between the image and image a. An example of the calculation formula is as follows:
[0071] L(ba)=L(ba)_r+L(ba)_g+L(ba)_b+ C(ba)_r+C(ba)_g+C(ba)_b
[0072] L(ca)=L(ca)_r+L(ca)_g+L(ca)_b+ C(ba)_r+C(ba)_g+C(ba)_b
[0073] Based on the calculation results, the values of L(ba) and L(ca) are obtained. The larger the value, the greater the difference between the image and the benchmark image, and the smaller the value, the closer they are.
[0074] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for quantitatively calculating pixel differences in color block-type graphics, characterized in that, Includes the following steps: Step 1: Grouping of Figures: Prepare several figures for comparison, select one of them as the benchmark figure, denoted as figure A, and obtain the set of the remaining figures X1={A1,A2,...,Ai,...,An}, where n≥2 and i is an integer from 1 to n; Step 2: Layered Image Teaming: Split images A1 to An into layers according to the three primary colors of RGB, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain the RGB layer set X2={A1_R,A1_G,A1_B,...,Ai_R,Ai_G,Ai_B,...,An_R,An_G,An_B}, where Ai_R is the red layer of image Ai, Ai_G is the green layer of image Ai, Ai_B is the blue layer of image Ai, n≥2, and i is an integer from 1 to n; Step 3: Calculate the deviation coefficient matrix Y of the image: Identify the boundary pixel coordinates of the color block in image A, calculate the shortest distance from the boundary pixel coordinates of each pixel position in image A (excluding the color block) to the boundary pixel coordinates of the color block in image A, and form the deviation coefficient matrix Y; Step 4: Calculate the pixel matrix Z of the non-effective region: Extract the overlapping regions of the non-color block regions in Figure A with all RGB layers respectively, and mark the quantized values of red, green and blue at the pixel positions of each overlapping region to obtain the set X3={Z_A1_R, Z_A1_G, Z_A1_B, ..., Z_Ai_R, Z_Ai_G, Z_Ai_B, ..., Z_An_R, Z_An_G, Z_An_B}, where Z_Ai_R is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_R, Z_Ai_G is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_G, Z_Ai_B is the matrix formed by the overlapping region of the non-color block regions in Figure A with layer Ai_B, n≥2, i is an integer from 1 to n; Step 5: Calculate the quantization difference value relative to the benchmark map in the ineffective region: Multiply all matrices in set X3 with the deviation coefficient matrix Y respectively, and accumulate and add the elements in the resulting numerical matrix to obtain set X4={L_A1_R, L_A1_G, L_A1_B, ..., L_Ai_R, L_Ai_G, L_Ai_B, ..., L_An_R, L_An_G, L_An_B}, where L_Ai_R is the red quantization difference value of layer Ai_R relative to map A in the ineffective region, L_Ai_G is the green quantization difference value of layer Ai_G relative to map A in the ineffective region, L_Ai_B is the blue quantization difference value of layer Ai_B relative to map A in the ineffective region, n≥2, i is an integer from 1 to n; Step 6: Quantitative Evaluation of Effective Area Color: Split Image A into layers according to the RGB three primary colors, and mark the quantized values of red, green, and blue at the pixel positions of each RGB layer to obtain layers A_R, A_G, and A_B. Extract the overlapping areas of the color block areas in Image A with all RGB layers in set X2. Mark the corresponding red, green, and blue quantized values of the RGB layers in set X2 at the pixel positions of each overlapping area. Compare and calculate the RGB values of the pixel positions in each overlapping area with the corresponding RGB values of the pixel positions in layer A_R. Accumulate the differences at each pixel position to obtain the color difference values C_Ai_R, C_Ai_G, and C_Ai_B of the corresponding layers. Then, accumulate them to obtain the color quantization evaluation value, where C_Ai_R is the red difference value of layer Ai_R relative to Image A in the effective area, C_Ai_R is the green difference value of layer Ai_R relative to Image A in the effective area, and C_Ai_R is the blue difference value of layer Ai_R relative to Image A in the effective area. Step 7: Output of Image Difference Evaluation Results: After accumulating the L_Ai_R, L_Ai_G, L_Ai_B, C_Ai_R, C_Ai_G, and C_Ai_B obtained in Steps 5 and 6, the difference evaluation value LAI of image Ai is obtained. The formula for the difference evaluation value LAI of image Ai is: LAI=L_Ai_R+L_Ai_G+L_Ai_B+C_Ai_R+C_Ai_G+C_Ai_B. According to the calculation results, the larger the value of LAI, the greater the difference between the image and the benchmark image, and the smaller the value, the closer they are.
2. The method for quantitatively calculating pixel differences in color block-type graphics as described in claim 1, characterized in that, In step 3, the shortest distance from the boundary pixel coordinates of each pixel position in Figure A (excluding the color block) to the color block in Figure A is proportionally converted according to the value range of 0 to 1 to form the deviation coefficient matrix Y.
3. The method for quantitatively calculating pixel differences in color block-type graphics as described in claim 1, characterized in that, In step 4, the pixel positions of the color block areas in Figure A are marked as white, and the pixel positions of the non-color block areas are marked as black to form a layer mask. The layer mask is used to cover all RGB layers one by one, and the area that overlaps with the black part of Figure A in each RGB layer is extracted, which is the overlapping area of the non-color block area and all RGB layers in Figure A.
4. The method for quantitatively calculating pixel differences in color block-type graphics as described in claim 2, characterized in that, In step 4, the quantization values at all pixel positions in all matrices of set X3 are converted. The conversion calculation formula is: new value = 1 - (1 ÷ 255) × original value, so as to convert it into a matrix with values ranging from 0 to 1.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for quantizing the pixel differences of color block type graphics as described in any one of claims 1 to 4.
6. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for quantizing the pixel differences of color block type graphics as described in any one of claims 1 to 4.
Citation Information
Patent Citations
RADAR parallax image optimization method and stereo matching parallax image optimization method and system
CN104680510A
Local re-coloring algorithm based on image segmentation
CN114187215A