A processing method of pixel stylized cartoon images based on artistic creation

By performing meshing and color filling optimization on cartoon images, the problems of time-consuming and labor-intensive pixel image generation and non-adjustable size in existing technologies are solved, enabling the rapid generation of high-quality, artistic pixel images.

CN115170387BActive Publication Date: 2026-04-07ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, pixel image generation is time-consuming and labor-intensive, making it difficult to quickly obtain a large number of high-quality pixel images. Furthermore, the generated pixel images cannot be flexibly resized and contain artifacts, lacking artistic aesthetic appeal.

Method used

By meshing the cartoon image, the Canny detection algorithm is used to obtain the contour lines, and the pixel blocks are classified into contour blocks and non-contour blocks. The k-means method is used to optimize the color filling in the HSV color space to generate a pixel-stylized cartoon image.

Benefits of technology

It enables the rapid generation of high-quality pixel images, adapts to different size requirements, ensures the integrity and artistry of image content, and simplifies the pixel image generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170387B_ABST
    Figure CN115170387B_ABST
Patent Text Reader

Abstract

The application discloses a kind of processing methods of pixel stylization cartoon image based on artistic creation. First, the application carries out grid processing on the cartoon image according to the size of the target pixel image, and obtains all square pixel blocks of the cartoon image. Then, the outline of the cartoon image is obtained and marked using the Canny detection algorithm, and the main outline width of the cartoon image is determined according to the outline of the cartoon image. Then, according to the size of the square pixel block and the main outline width, all square pixel blocks of the cartoon image are classified into contour pixel blocks or non-contour pixel blocks. Finally, the classified square pixel blocks are filled with color using a pixel stylization processing method and a pixel block cluster art aesthetic optimization method, and a pixel stylized cartoon image is obtained. The application can accurately generate a corresponding pixel style image of any size according to the cartoon image. The generated pixel image conforms to the pixel art aesthetic, is convenient for engineering application, and has great application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image pixelation method, specifically a method for processing pixel-stylized cartoon images based on artistic creation. Background Technology

[0002] Pixel iconography, also known as pixel art, refers to images drawn using pixels as the unit of measurement. It first appeared in computer application icons and early 8-bit video games. Since the 21st century, it has been widely used in the internet, GUI (Graphical User Interface), and games. As an independent art style, pixel art is characterized by clear outlines, vibrant colors, and a free-flowing style.

[0003] Currently, pixel images are mainly drawn by designers, but this process is time-consuming and labor-intensive, and the efficiency and output are difficult to guarantee, making it difficult to obtain a large number of pixel images in a short period of time.

[0004] Existing deep learning algorithms for pixel image generation mainly rely on large datasets of paired pixel images, but paired pixel image data is difficult to collect. In addition, existing algorithms take a lot of time to generate pixel images and cannot flexibly generate pixel images of arbitrary sizes. At the same time, the generated pixel images have artifacts and lack good artistic aesthetics. Summary of the Invention

[0005] To address the problem of obtaining a large number of high-quality pixel images in the background art, this invention provides a method for processing pixel-stylized cartoon images based on artistic creation.

[0006] The technical solution adopted by this invention to solve its technical problem is as follows:

[0007] 1) Mesh the cartoon image according to the size of the target pixel image to obtain all square pixel blocks of the cartoon image;

[0008] 2) Use the Canny detection algorithm to obtain and mark the outline of the cartoon image, and determine the width W of the main outline of the cartoon image based on the outline. line ;

[0009] 3) Based on the size G of the square pixel block pixel and the width of the main outline W line The cartoon image is classified into either outline pixel blocks or non-outline pixel blocks.

[0010] 4) filling the color of the classified square pixel blocks by using the pixel stylization processing method and the pixel block cluster artistic aesthetic optimization method, and obtaining the cartoon image after pixel stylization.

[0011] In the step 2), the distance between each contour line of the cartoon image and the corresponding adjacent contour line is calculated to form a contour line distance set, and the most distance in the contour line distance set is taken as the main contour line width W of the cartoon image. line .

[0012] The step 3) is specifically:

[0013] When the main contour line width W line is less than or equal to the size G pixel of the square pixel block, all the square pixel blocks containing the contour line of the cartoon image are contour pixel blocks, when the main contour line width W line is greater than the size G pixel of the square pixel block, all the square pixel blocks containing the contour line of the cartoon image are non-contour pixel blocks, and all the square pixel blocks not containing the contour line of the cartoon image are non-contour pixel blocks.

[0014] The step 4) is specifically:

[0015] 4.1) performing the step 4.2) on each contour pixel block, traversing each contour pixel block and processing each contour pixel block; performing the step 4.3) on each non-contour pixel block, traversing each non-contour pixel block and processing each non-contour pixel block;

[0016] 4.2) using the k-means method to extract the main color of each contour pixel block, then converting the extracted main color from the RGB color space to the HSV color space, screening the extracted main color by using the brightness value V to obtain a first target color, then calculating the ratio of the number of pixel points occupied by the first target color in the current contour pixel block to the number of all pixel points in the current contour pixel block, when the ratio is greater than 50%×W line ×G pixel , the first target color is taken as the filling color of the current contour pixel block, otherwise, the current contour pixel block is recorded as a non-contour pixel block, and the step 4.3) is performed to process the non-contour pixel block;

[0017] 4.3) Use the k-means method to extract the primary color for each non-contour pixel block. Then, convert the extracted primary color from the RGB color space to the HSV color space. Use the lightness value V to filter the extracted primary color to obtain the second target color. Next, calculate the ratio of the number of pixels of the second target color in the current non-contour pixel block to the total number of pixels in the current non-contour pixel block. When this ratio is greater than 50% × W line ×G pixel If the target color is the same, then the second target color is used as the fill color of the current non-contour pixel block; otherwise, the color with the most pixels in the current non-contour pixel block is used as the fill color of the current non-contour pixel block.

[0018] 4.4) The initial pixel image is composed of all processed pixel blocks. All side-by-side overlapping pixel blocks in the initial pixel image are recorded as non-contour pixel blocks. Repeat step 4.3) to optimize the color filling of each non-contour pixel block, and then update the initial pixel image to obtain a pixel-stylized cartoon image.

[0019] The side-by-side overlapping pixel blocks are the pixel blocks between two diagonally adjacent pixel blocks.

[0020] The beneficial effects of this invention are mainly reflected in:

[0021] 1) The pixel stylization processing method specially constructed in this invention ensures the integrity of the image content by subdividing the image content, thus guaranteeing the quality of the pixel image, and ensures the artistry of the generated pixel image by optimizing the artistic aesthetics of pixel block clusters.

[0022] 2) This invention can quickly acquire a large number of high-quality pixel images and meet the needs of various sizes. The processing time to generate a 64×64 pixel image from a 1080×1080 cartoon image is only about 10 seconds.

[0023] 3) The method of the present invention is simple and easy to apply, produces high-quality pixel images, and the processing model does not require staff to have professional knowledge and experience in computer image processing. It has great application potential in pixel image generation. Attached Figure Description

[0024] Figure 1 This is a flowchart of the method of the present invention.

[0025] Figure 2 This is a schematic diagram of the preprocessing involved in the method of the present invention.

[0026] Figure 3 This is a schematic diagram of the pixel stylization processing scheme of the present invention.

[0027] Figure 4This is a schematic diagram of the pixel block cluster art aesthetic optimization scheme of the present invention.

[0028] Figure 5 This is a schematic diagram of the cartoon image to be processed in an embodiment of the present invention.

[0029] Figure 6 This is a schematic diagram of a pixel-stylized cartoon image in an embodiment of the present invention.

[0030] Figure 7 This is a schematic diagram of a pixelated image generated by existing image pixelation methods. Detailed Implementation

[0031] To more clearly illustrate the purpose and technical solution of this invention, the invention will be further described in detail below with reference to the accompanying drawings.

[0032] like Figure 1 As shown, the present invention includes the following steps:

[0033] 1) Based on the size of the target pixel image, the cartoon image (e.g.) Figure 2 (a) is shown in the image. The image is then meshed, as shown in the image. Figure 2 As shown in (b), all square pixel blocks of the same size in the cartoon image are obtained;

[0034] 2) Use the Canny detection algorithm to obtain and label the outline of the cartoon image, such as... Figure 2 As shown in (c), the width W of the main outline of the cartoon image is determined based on the outline of the cartoon image. line ;

[0035] In step 2), the distances between each contour line of the cartoon image and its corresponding adjacent contour lines are calculated and a contour line distance set is formed. The distance with the largest value in the contour line distance set is taken as the width W of the main contour line of the cartoon image. line .

[0036] The method for calculating the distance between two adjacent contour lines is as follows:

[0037] Take two points on different contour lines, with coordinates (x1, y1) and (x2, y2) respectively. The distance D between the two points can be calculated using formula (1), such as... Figure 2 (d) and Figure 2 As shown in (e), the minimum distance between two points is the distance between the contour lines, as given by formula (1):

[0038]

[0039] 3) Based on the size G of the square pixel block pixel and the width of the main outline W lineThe cartoon image is classified into either outline pixel blocks or non-outline pixel blocks.

[0040] Step 3) specifically refers to:

[0041] When the width of the main outline is W line The size of the square pixel block G is less than or equal to the size of the square pixel block. pixel In a cartoon image, all square pixel blocks containing outlines are considered outline pixel blocks, such as... Figure 3 As shown in (a2) and (a3), when the width W of the main outline line Larger than the size G of the square pixel block pixel In a cartoon image, all square pixel blocks with outlines are considered non-outline pixel blocks, such as... Figure 3 As shown in (a1), all square pixel blocks without outlines in the cartoon image are non-outline pixel blocks.

[0042] 4) The pixel stylization processing method and the pixel block cluster art aesthetic optimization method are used to fill the classified square pixel blocks with color to obtain the pixel stylized cartoon image and use it as the target pixel image.

[0043] Step 4) specifically involves:

[0044] 4.1) For each contour pixel block, execute step 4.2), traverse each contour pixel block and process each contour pixel block; for each non-contour pixel block, execute step 4.3), traverse each non-contour pixel block and process each non-contour pixel block.

[0045] 4.2) The k-means method is used to extract the primary color for each contour pixel block. Specifically, three primary colors are extracted, and then the extracted primary colors are converted from the RGB color space to the HSV color space. The primary colors are then filtered using the lightness value V, and the primary color with the lowest lightness value is the target color, thus obtaining the first target color. Next, the ratio of the number of pixels occupied by the first target color in the current contour pixel block to the total number of pixels in the current contour pixel block (i.e., the square pixel block) is calculated. When this ratio is greater than 50% × W, the target color is selected. line ×G pixel If the target color is selected, the first target color is used as the fill color of the current contour pixel block, and all target colors are in the RGB color space. Otherwise, the current contour pixel block is recorded as a non-contour pixel block, and step 4.3) is executed to process the non-contour pixel block; for example... Figure 3 As shown in (b1).

[0046] 4.3) The k-means method is used to extract the primary color for each non-contour pixel block. Specifically, three primary colors are extracted, and then the extracted primary colors are converted from the RGB color space to the HSV color space. The primary colors are then filtered using the lightness value V, and the primary color with the lowest lightness value is the target color, thus obtaining the second target color. Next, the ratio of the number of pixels occupied by the second target color in the current non-contour pixel block to the total number of pixels in the current non-contour pixel block (i.e., the square pixel block) is calculated. When this ratio is greater than 50% × W, the target color is selected. line ×G pixel If the second target color is selected, it will be used as the fill color of the current non-contour pixel block; otherwise, the color with the most pixels in the current non-contour pixel block will be used as the fill color of the current non-contour pixel block. Figure 3 As shown in (b2) and (b3), the pixel stylization processing method is constituted by steps 4.1)-4.3).

[0047] 4.4) For example Figure 4 As shown, the pixel arrangement logic is that when the curve is close to a straight line, the number of pixel blocks gradually increases, and when the curve is close to a bend, the number of pixel blocks gradually decreases. The initial pixel image is composed of all processed contour pixel blocks and / or non-contour pixel blocks. All side-by-side overlapping pixel blocks in the initial pixel image are recorded as non-contour pixel blocks. Step 4.3) is repeated to optimize the fill color of each non-contour pixel block, thereby updating the initial pixel image to obtain a pixel-stylized cartoon image, which is then used as the target pixel image. Figure 3 As shown in (c1)-(c3). Step 4.4) constitutes the pixel block cluster art aesthetic optimization method. The side-by-side overlapping pixel block is the pixel block between two diagonally adjacent pixel blocks, that is, the side-by-side overlapping pixel block is adjacent to both diagonally adjacent pixel blocks. Specific implementation examples:

[0049] This invention employs, as follows Figure 5 The cartoon image shown has been pixel-stylized; such as Figure 6 As shown, pixel images of different sizes were generated, among which, Figure 6 The dimensions of (a), (b), and (c) are 32*32, 48*48, and 64*64, respectively. Figure 7 Processing with existing algorithms Figure 5 The generated pixel image Figure 7 The dimensions of (a), (b), and (c) are 32*32, 48*48, and 64*64, respectively.

[0050] As can be seen from the above embodiments, the method of the present invention can generate high-quality pixel images of any size, with good artistic quality, and has great application potential in acquiring a large number of pixel images.

[0051] The above specific embodiments are used to explain and illustrate the present invention, but not to limit the present invention. Any modifications and changes made to the present invention within the spirit and scope of the claims shall fall within the protection scope of the present invention.

Claims

1. A method for processing pixel-stylized cartoon images based on artistic creation, characterized in that, Includes the following steps: 1) Mesh the cartoon image according to the size of the target pixel image to obtain all square pixel blocks of the cartoon image; 2) Use the Canny detection algorithm to obtain and mark the outline of the cartoon image, and determine the width of the main outline of the cartoon image based on the outline. W line ; 3) Based on the size of the square pixel block G pixel and the width of the main outline W line The cartoon image is classified into either outline pixel blocks or non-outline pixel blocks. 4) The classified square pixel blocks are filled with color using pixel stylization and pixel block clustering art aesthetics optimization methods to obtain a pixel-stylized cartoon image. Step 4) specifically involves: 4.1) For each contour pixel block, execute step 4.2), traverse each contour pixel block and process each contour pixel block; for each non-contour pixel block, execute step 4.3), traverse each non-contour pixel block and process each non-contour pixel block. 4.2) Use the k-means method to extract the primary color for each contour pixel block, then convert the extracted primary color from the RGB color space to the HSV color space. Use the lightness value V to filter the extracted primary colors to obtain the first target color. Then calculate the ratio of the number of pixels of the first target color in the current contour pixel block to the total number of pixels in the current contour pixel block. When this ratio is greater than 50% × W line × G pixel If the target color is not specified, the first target color is used as the fill color of the current contour pixel block; otherwise, the current contour pixel block is recorded as a non-contour pixel block, and step 4.3 is executed to process the non-contour pixel block. 4.3) Use the k-means method to extract the primary color for each non-contour pixel block. Then, convert the extracted primary color from the RGB color space to the HSV color space. Use the lightness value V to filter the extracted primary color to obtain the second target color. Next, calculate the ratio of the number of pixels of the second target color in the current non-contour pixel block to the total number of pixels in the current non-contour pixel block. When this ratio is greater than 50% × W line × G pixel If the target color is the same, then the second target color is used as the fill color of the current non-contour pixel block; otherwise, the color with the most pixels in the current non-contour pixel block is used as the fill color of the current non-contour pixel block. 4.4) The initial pixel image is composed of all processed pixel blocks. All side-by-side overlapping pixel blocks in the initial pixel image are recorded as non-contour pixel blocks. Repeat step 4.3) to optimize the color filling of each non-contour pixel block, and then update the initial pixel image to obtain a pixel-stylized cartoon image. The side-by-side overlapping pixel blocks are the pixel blocks between two diagonally adjacent pixel blocks.

2. The method for processing pixel-stylized cartoon images based on artistic creation according to claim 1, characterized in that, In step 2), the distances between each contour line of the cartoon image and its corresponding adjacent contour lines are calculated and a contour line distance set is formed. The distance with the largest value in the contour line distance set is taken as the width of the main contour line of the cartoon image. W line .

3. The method for processing pixel-stylized cartoon images based on artistic creation according to claim 1, characterized in that, Step 3) specifically refers to: When the width of the main outline W line Smaller than or equal to the size of a square pixel block G pixel At that time, all square pixel blocks containing outlines in a cartoon image are outline pixel blocks, and when the width of the main outline is... W line Larger than the size of a square pixel block G pixel In a cartoon image, all square pixel blocks with outlines are non-outline pixel blocks, and all square pixel blocks without outlines in a cartoon image are non-outline pixel blocks.