Image compression coding method based on color layering
Through the image compression and coding method based on color layering, the problems of low image compression efficiency, high computational complexity and low reconstruction of the reconstruction in the prior art are solved, and efficient image compression and high authenticity reconstruction are achieved.
Patent Information
- Application Number
- CN202411971729.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-16
AI Technical Summary
The prior art has low compression efficiency, high computational complexity, and low reconstruction image quality in image compression. In particular, the GAN model generates more image edges and color distortions in image compression.
The image compression and encoding method based on color layering is adopted, and the color layering is obtained through the color clustering algorithm. Each color layer is simply represented by contour and color sampling points, and the original reconstructed image is obtained by decoding the generated network.
This improves the compression rate of image transmission, maintains the high-altitude of the image, and reduces edge and color distortion during image compression.
Smart Images

Figure CN120014076A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of computer vision, and in particular to an image compression coding method based on color stratification. Background Art
[0002] Chinese color culture has a long history. It is an aesthetic system that has been continuously enriched and developed by the people of all ethnic groups in my country in the production and life practices for thousands of years. It reflects the thinking wisdom of ancient ancestors in the natural world, social life, folk religion, production technology, etc. It is the crystallization of the splendid civilization of the Chinese nation; Chinese color expressions, such as paintings, murals, New Year paintings, weaving and embroidery, clothing, carpets, etc., are a comprehensive color system composed of concepts, materials, skills, and expressions. With the development of digital intelligent technology, cultural digitization has become an inevitable trend of global cultural knowledge sharing and services, and is the main battlefield for independent innovation of the new generation of digital technology.
[0003] Deficiencies of existing technology:
[0004] Currently, both traditional and deep learning-based image compression methods face their own challenges and opportunities. Image compression has low compression efficiency, high computational complexity, and low quality of reconstructed images. The GAN model generates images with more edge and color distortion in image compression. Summary of the invention
[0005] The purpose of the present invention is to provide an image compression coding method based on color layering to solve the problems raised in the above background technology.
[0006] To achieve the above object, the present invention provides the following technical solution: a color layered image compression coding method, the image compression coding method specifically comprising the following steps:
[0007] S1. Input the number of colors and use the color clustering algorithm to obtain color stratification;
[0008] S2, encode each color layer and simply represent it with contours and color sampling points;
[0009] S3. Decode the encoded information using the generative network to obtain the original reconstructed image.
[0010] Preferably, the step S1 specifically includes the following steps:
[0011] a1. By using color extraction algorithms to count the color proportions of different types of cultural relics, common colors are screened out and a color priori database is established;
[0012] a2. The user sets the desired number of color extraction and number of cluster categories;
[0013] a3. Input the image and text pairs into the deep learning model and first convert them into color clustering graphs by the generator.
[0014] Preferably, the step a3 specifically includes the following steps:
[0015] b1, converted from the generator to a color clustering graph;
[0016] b2. Use the classifier to verify the consistency between the clustering results and the original text labels;
[0017] b3. Iteratively train and optimize the model to output an accurate clustering map, and calculate the final representative color based on it.
[0018] Preferably, the step S2 specifically includes the following steps:
[0019] c1. Layering: By using color extraction technology, each image can be classified into multiple color clusters, and the i-th color cluster is recorded as B i , the average color value in the color cluster, denoted by C i , then:
[0020]
[0021] Where n is the number of pixels in the color value range, P(x,y) is the index value of the pixel with coordinates x,y in the image, and the color value P(x,y) is converted from the RGB value of the pixel. i , is the left boundary of pixel value, R i is the pixel value right boundary:
[0022] P(x,y)=(r<<10)+(g<<5)+b
[0024] Cluster the original image X by color to get the result B i Layered to get layers M with different color clusters i , all M i After merging, the original image X can be obtained:
[0025]
[0026] c2. Extract line drawings and vectorize them. For each color layer M i ,have:
[0027]
[0028] Where V i Represents for layer M i The extracted vectorized image, c i1 …,c ik For layer M iThe color value of the color block sampled from the i ,c i1 ,c i2 …,c ik ) is a mapping of the original image reconstructed through line drawings and color blocks;
[0029] c3, color point sampling: in layer M i Upsample the most representative color point and vector image V i Content transferred as final storage.
[0030] Preferably, the step S3 specifically includes the following steps:
[0031] d1. Simulate the decoding process as an image-to-image conversion problem, input m vectorized images V i , and P i ={c i1 ,c i2 ,…,c in} is represented as a mask image I i With a three-channel RGB image C i , the generator uses the VGG19 network architecture, and the loss function of the training process is as follows:
[0032]
[0033] in Measures the pixel-level difference between the reconstructed image and the original image, λ 1 is its weight parameter, Measures the structural similarity difference between the reconstructed image and the original image, λ 2 is its weight parameter, It is a machine vision measurement parameter. The specific calculation process is as follows:
[0034]
[0035] in Representative layer In the feature layer of VGG19, μ i Represents the weight of each layer. The machine vision measurement parameter is obtained by multiplying and adding the difference of each feature layer with the weight;
[0036] d2. After decoding to obtain the reconstructed layer, each layer is merged to obtain the final output image.
[0037] Preferably, the color points sampled in step c3 should ensure that the reconstructed layer obtained in the process of image true reconstruction With the original layer M iThe gap between the two layers is the smallest, and the gap between the two layers is evaluated using SSIM.
[0038] Preferably, in step b1, the image-text pair (x, y) is input into the generator g(x), and the color clustering map of the original image is obtained after convolution of the generator.
[0039] Preferably, in step b2, the classifier f(x) is used to distinguish Text category like If it is the same as the input y, it indicates that the generated result is valid; otherwise, it indicates that the generated result fails.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] The invention discloses a method for image compression coding based on color stratification, and the specific steps include S1, inputting the number of colors, and obtaining color stratification by using a color clustering algorithm; S2, encoding each color stratification, and simply representing it with contours and color sampling points; S3, decoding the coded information using a generative network to obtain an authentic reconstructed image; the method solves the problem of simple representation of image compression coding and thus improving transmission efficiency; in the encoding stage, the image is divided into multiple color layers, and a single color representation model of different layers is constructed by jointly sampling edges and colors; in the decoding stage, a GAN model with fine-grained discrimination capability is introduced to generate images with less edge and color distortion, and based on a color stratification coding strategy, the image transmission compression rate is improved and the image authenticity is maintained at a high level. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A flow chart of a color layered image compression coding method provided by an embodiment of the present invention;
[0043] Figure 2 A network structure diagram of a generator provided by an embodiment of the present invention;
[0044] Figure 3 , 4 , 5 is a vectorized image in sampling provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In the description of the present invention, it is necessary to understand that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicating orientations or positional relationships are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0047] In the description of this patent, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "setting" should be understood in a broad sense, for example, it can be fixed connection, setting, or detachable connection, setting, or integrated connection, setting. For ordinary technicians in this field, the specific meanings of the above terms in this patent can be understood according to specific circumstances.
[0048] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "several" is two or more, unless otherwise clearly and specifically defined.
[0049] Example
[0050] See also Figure 1-2 As shown, the present invention provides a technical solution of a color-layered image compression coding method: the image compression coding method specifically comprises the following steps:
[0051] S1. Input the number of colors and use the color clustering algorithm to obtain color stratification;
[0052] a1. By using the color extraction algorithm to count the color proportions of different types of cultural relics, common colors are screened out and a color prior database is established; the user selects the input data type in advance. If the input pattern data type is known, the color prior module is started to inform the color that is likely to appear in the color extraction data type in advance. By adding weight values in the color library, the color extraction result is closer to the expected color, thereby improving the accuracy of the algorithm;
[0053] a2. The user sets the desired number of color extraction and clustering categories to meet personalized color analysis needs;
[0054] a3. Input the image and text pairs into the deep learning model, and first convert them into color clustering graphs by the generator;
[0055] b1. Converted from the generator to a color cluster map. Input the image-text pair (x, y) into the generator g(x). After convolution by the generator, the color cluster map of the original image is obtained.
[0056] b2. Use the classifier to verify the consistency between the clustering results and the original text labels, and use the classifier f(x) to distinguish Text category like If it is the same as the input y, it indicates that the generated result is valid, otherwise, it indicates that the generated result fails;
[0057] b3. Iteratively train and optimize the model to output an accurate clustering map, and calculate the final representative color based on it;
[0058] S2, encode each color layer and simply represent it with contours and color sampling points;
[0059] The basic idea of encoding is to cluster and layer the original image X according to color to obtain multiple color layers M i ; Since each layer M i The colors are similar and the tone is single. They are represented by the outline of a layer and some representative colors. The layers can be decoded approximately through generative learning. Each layer After merging, the reconstructed image can be obtained
[0060] c1. Layering: By using color extraction technology, each image can be classified into multiple color clusters, and the i-th color cluster is recorded as B i , the average color value in the color cluster, denoted by C i , then:
[0061]
[0062] Where n is the number of pixels in the color value range, P(x,y) is the index value of the pixel with coordinates x,y in the image, and the color value P(x,y) is converted from the RGB value of the pixel. i , is the left boundary of pixel value, R i is the pixel value right boundary:
[0063] P(x,y)=(r<<10)+(g<<5)+b
[0065] The above conversion maps the pixels in the two-dimensional image to a one-dimensional array. Each pixel in the image corresponds to an index value P(x, y) in the one-dimensional array. i , R iRepresents the left and right index boundary values of the i-th color type in the one-dimensional array. This step is to map the two-dimensional image to a one-dimensional array for easier calculation;
[0066] Cluster the original image X by color to get the result B i Layered to get layers M with different color clusters i , all M i After merging, the original image X can be obtained:
[0067]
[0068] c2. Extract line drawings and vectorize them. For each color layer M i ,have:
[0069]
[0070] Where V i Represents for layer M i The extracted vectorized image, c i1 …,c ik For layer M i The color value of the color block sampled from the i ,c i1 ,c i2 …,c ik ) is a mapping of the original image reconstructed through line drawings and color blocks;
[0071] c3, color point sampling: in layer M i Upsample the most representative color point and vector image V i As the final storage and transmission content, the sampled color points must ensure the reconstructed layer obtained during the image true reconstruction process. With the original layer M i The gap between the two layers is the smallest. The gap between the two layers is evaluated using SSIM. The specific rules are as follows:
[0072] The lines in the extracted vectorized image can be sampled in three main cases, such as Figure 3 , 4 , 5, sampling is carried out in the horizontal and vertical directions. If the vectorized line is Figure 3 Indicates that the angle α with the horizontal direction is greater than 45°, then the sampling points p1 and p2 are located at a distance of one pixel on both sides of the horizontal direction; if Figure 4 As shown in , if the angle α with the horizontal direction is less than 45°, then sample points p1 and p2 at a distance of one pixel in the vertical direction; for curved lines, only sample a point p1 from the inside of the curve in the direction of the horizontal tangent point, as shown in Figure 5 As shown;
[0073] The first round of sampling scans each vectorized curve from left to right and from top to bottom in the figure. For each vectorized curve, pixel points are sampled according to the sampling rule and the pixel point coordinates are recorded. Assume that the sampling point set is P = {p 1 ,p 2 ,…,p k}, a total of k points, then the vectorized curve and all coordinate point sets P are passed into the generation network as input, and one point is discarded in each round according to the feedback result of the generator; the cycle is repeated until the points in the set P reach the set threshold n, and the threshold n determines the final reconstruction quality to a certain extent; in order to speed up the sampling operation, before the number of points in the sampling point set P is greater than the set threshold N, some points that are far away from each other (the distance is greater than the set parameter r) can be removed at the same time, and 1 / x points of the total number of points are discarded in each round; when the number of points in the set P is lower than the set threshold N, one point is removed in each round, which can greatly improve the speed of the algorithm sampling points;
[0074] S3, decoding the encoded information using a generative network to obtain an original reconstructed image;
[0075] d1. Simulate the decoding process as an image-to-image conversion problem, input m vectorized images V i , and P i ={c i1 ,c i2 ,…,c in} is represented as a mask image I i With a three-channel RGB image C i , the generator uses the VGG19 network architecture, and the loss function of the training process is as follows:
[0076]
[0077] in Measures the pixel-level difference between the reconstructed image and the original image, λ 1 is its weight parameter, Measures the structural similarity difference between the reconstructed image and the original image, λ 2 is its weight parameter, It is a machine vision measurement parameter. The specific calculation process is as follows:
[0078]
[0079] in Representative layer In the feature layer of VGG19, μ iRepresents the weight of each layer. The machine vision measurement parameters are obtained by multiplying the difference of each feature layer with the weight and adding them together. The discriminator uses PatchGAN. The advantage is that the discriminator pays more attention to the local detail features in the image, which helps to restore the local color details.
[0080] d2. After decoding to obtain the reconstructed layer, each layer is merged to obtain the final output image.
[0081] The working principle of the present invention is as follows:
[0082] The present invention discloses a method for image compression coding based on color stratification, and the specific steps include S1, inputting the number of colors, and obtaining color stratification using a color clustering algorithm; S2, encoding each color stratification, and simply representing it with contours and color sampling points; S3, decoding the coded information using a generative network to obtain an authentic reconstructed image; the method solves the problem of simple representation of image compression coding and thus improving transmission efficiency; in the encoding stage, the image is divided into multiple color layers, and a single color representation model of different layers is constructed by joint edge and color sampling; in the decoding stage, a GAN model with fine-grained discrimination capability is introduced to generate images with less edge and color distortion, and based on the color stratification coding strategy, the image transmission compression rate is improved and the image authenticity is maintained at a high level.
[0083] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A color layered image compression coding method, characterized in that: The image compression coding method specifically comprises the following steps: S1. Input the number of colors and use the color clustering algorithm to obtain color stratification; S2, encode each color layer and simply represent it with contours and color sampling points; S3. Decode the encoded information using the generative network to obtain the original reconstructed image.
2. The method for image compression encoding based on color layering according to claim 1, characterized in that: The step S1 specifically includes the following steps: a1. By using color extraction algorithms to count the color proportions of different types of cultural relics, common colors are screened out and a color priori database is established; a2. The user sets the desired number of color extraction and number of cluster categories; a3. Input the image and text pairs into the deep learning model and first convert them into color clustering graphs by the generator.
3. The method for image compression encoding based on color layering according to claim 2, characterized in that: The step a3 specifically includes the following steps: b1, converted from the generator to a color clustering graph; b2. Use the classifier to verify the consistency between the clustering results and the original text labels; b3. Iteratively train and optimize the model to output an accurate clustering map, and calculate the final representative color based on it.
4. The method for image compression encoding based on color layering according to claim 1, characterized in that: The step S2 specifically includes the following steps: c1. Layering: By using color extraction technology, each image can be classified into multiple color clusters, and the i-th color cluster is recorded as B i , the average color value in the color cluster, denoted by C i , then: Where n is the number of pixels in the color value range, P(x,y) is the index value of the pixel with coordinates x,y in the image, and the color value P(x,y) is converted from the RGB value of the pixel. i , is the left boundary of pixel value, R i is the right boundary of pixel value: P(x,y)=(r<<10)+(g<<5)+b; Cluster the original image X by color to get the result B i Layered to get layers M with different color clusters i , all M i After merging, the original image X can be obtained: c2. Extract line drawings and vectorize them. For each color layer M i ,have: Where V i Represents for layer M i The extracted vectorized image, c i1 …,c ik For layer M i The color value of the color block sampled from the i ,c i1 ,c i2 …,c ik ) is a mapping of the original image reconstructed through line drawings and color blocks; c3, color point sampling: in layer M i Upsample the most representative color point and vector image V i Content transferred as final storage.
5. The method for image compression encoding based on color layering according to claim 1, characterized in that: The step S3 specifically comprises the following steps: d1. Simulate the decoding process as an image-to-image conversion problem, input m vectorized images V i , and P i ={c i1 ,c i2 ,…,c in } is represented as a mask image I i With a three-channel RGB image C i , the generator uses the VGG19 network architecture, and the loss function of the training process is as follows: in Measures the pixel-level difference between the reconstructed image and the original image, λ1 is its weight parameter, Measures the structural similarity difference between the reconstructed image and the original image, λ2 is its weight parameter, It is a machine vision measurement parameter. The specific calculation process is as follows: in Representative layer In the feature layer of VGG19, μ i Represents the weight of each layer. The machine vision measurement parameter is obtained by multiplying and adding the difference of each feature layer with the weight; d2. After decoding to obtain the reconstructed layer, each layer is merged to obtain the final output image.
6. The method for image compression encoding based on color layering according to claim 4, characterized in that: The color points sampled in step c3 must ensure that the reconstructed layer obtained in the process of true image reconstruction With the original layer M i The gap between the two layers is the smallest, and the gap between the two layers is evaluated using SSIM.
7. The method for image compression encoding based on color layering according to claim 3 is characterized in that: In step b1, the image-text pair (x, y) is input into the generator g(x), and the color clustering map of the original image is obtained after convolution by the generator.
8. The method for image compression encoding based on color layering according to claim 3 is characterized in that: In step b2, the classifier f(x) is used to distinguish Text category like If it is the same as the input y, it indicates that the generated result is valid; otherwise, it indicates that the generated result fails.
Citation Information
Cited By
Radar data blind area filling method and system based on 3D-GANs
CN121010708A