CN115170387A - Processing method of pixel stylized cartoon image based on artistic creation - Google Patents

Processing method of pixel stylized cartoon image based on artistic creation Download PDF

Info

Publication number
CN115170387A
CN115170387A CN202210876887.5A CN202210876887A CN115170387A CN 115170387 A CN115170387 A CN 115170387A CN 202210876887 A CN202210876887 A CN 202210876887A CN 115170387 A CN115170387 A CN 115170387A
Authority
CN
China
Prior art keywords
pixel
contour
cartoon image
color
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210876887.5A
Other languages
Chinese (zh)
Inventor
雷鹏
张三元
徐舒畅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN202210876887.5A priority Critical patent/CN115170387A/en
Publication of CN115170387A publication Critical patent/CN115170387A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/50Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/70Labelling scene content, e.g. deriving syntactic or semantic representations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a pixel stylized cartoon image processing method based on artistic creation. Firstly, gridding a cartoon image according to the size of a target pixel image to obtain all square pixel blocks of the cartoon image; then, obtaining and marking the contour line of the cartoon image by using a Canny detection algorithm, and determining the width of the main contour line of the cartoon image according to the contour line of the cartoon image; then, all the square pixel blocks of the cartoon image are classified into contour pixel blocks or non-contour pixel blocks according to the size of the square pixel blocks and the width of the main contour line; and finally, performing color filling on the classified square pixel blocks by using a pixel stylization processing method and a pixel block cluster artistic aesthetic optimization method to obtain a pixel stylized cartoon image. The method can accurately generate the corresponding pixel style image with any size according to the cartoon image, and the generated pixel image accords with the aesthetic sense of pixel art, is convenient for engineering application and has greater application value.

Description

Processing method of pixel stylized cartoon image based on artistic creation
Technical Field
The invention relates to an image pixelation method, in particular to a pixel stylized cartoon image processing method based on artistic creation.
Background
A Pixel image (Pixel iconography), which is an image drawn in units of pixels, is also called Pixel Art (Pixel Art). The earliest icons (Icon) presented in computer applications, and the early 8-bit video games. The use of the internet, GUI (graphical User Interface), and games has been widespread for the twenty-first century. The pixel art is an independent art style, and has the style characteristics of clear outline, bright color, no restriction and the like.
At present, pixel images are mainly drawn by designers, but the designers are time-consuming and labor-consuming in drawing, the working efficiency and the output quantity are difficult to guarantee, and a large number of pixel images are difficult to obtain in a short period.
The existing deep learning algorithm for generating pixel images mainly depends on a large amount of paired pixel image data sets, but the paired pixel image data is difficult to collect; in addition, the existing algorithm takes a lot of time to generate pixel images, and pixel images with any size cannot be generated flexibly; meanwhile, the generated pixel image has artifacts and does not have good artistic aesthetics.
Disclosure of Invention
In order to solve the problem of how to obtain a large number of high-quality pixel images in the background art, the invention provides a pixel stylized cartoon image processing method based on artistic creation.
The technical scheme adopted by the invention for solving the technical problems is as follows:
1) Gridding the cartoon image according to the size of the target pixel image to obtain all square pixel blocks of the cartoon image;
2) Obtaining and marking the contour line of the cartoon image by using a Canny detection algorithm, and determining the main contour line width W of the cartoon image according to the contour line of the cartoon image line
3) According to the size G of a square pixel block pixel And the width W of the main contour line line Classifying all square pixel blocks of the cartoon image into contour pixel blocks or non-contour pixel blocks;
4) And performing color filling on the classified square pixel blocks by utilizing a pixel stylization processing method and a pixel block cluster artistic aesthetic optimization method to obtain a pixel stylized cartoon image.
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 distance with the maximum contour line distance set is taken as the width W of the main contour line of the cartoon image line
The step 3) is specifically as follows:
when the width W of the main contour line line Less than or equal to the size G of a square pixel block pixel When the main contour line width W is larger than the main contour line width W, all the square pixel blocks containing the contour lines of the cartoon image are contour pixel blocks line Larger than the size G of a square pixel block pixel And then, all the square pixel blocks containing the contour lines of the cartoon image are non-contour pixel blocks, wherein all the square pixel blocks containing no contour lines of the cartoon image are non-contour pixel blocks.
The step 4) is specifically as follows:
4.1 Step 4.2) is carried out on each contour pixel block, each contour pixel block is traversed, and each contour pixel block is processed; step 4.3) is executed for each non-contour pixel block, and each non-contour pixel block is traversed and processed;
4.2 Using a k-means method to extract a main color of each contour pixel block, then converting the extracted main color from an RGB color space to an HSV color space, screening the extracted main color by using a brightness value V to obtain a first target color, then calculating the ratio of the number of pixels of the first target color in the current contour pixel block to the number of all pixels in the current contour pixel block, and when the ratio is more than 50% multiplied by W line ×G pixel If so, taking the first target color as the filling color of the current contour pixel block, otherwise, marking the current contour pixel block as a non-contour pixel block, and executing the step 4.3) to process the non-contour pixel block;
4.3 Using the k-means methodExtracting a main color of each non-contour pixel block, converting the extracted main color from an RGB color space to an HSV color space, screening the extracted main color by using a brightness value V to obtain a second target color, calculating the ratio of the number of pixel points of the second target color in the current non-contour pixel block to the number of all pixel points in the current non-contour pixel block, and when the ratio is more than 50% multiplied by W line ×G pixel If so, taking the second target color as the filling color of the current non-contour pixel block, otherwise, taking the color with the largest number of pixel points in the current non-contour pixel block as the filling color of the current non-contour pixel block;
4.4 All the processed pixel blocks form an initial pixel image, all the pixel blocks which are overlapped side by side in the initial pixel image are marked as non-contour pixel blocks, the step 4.3) is repeated, color filling optimization is carried out on all the non-contour pixel blocks, then the initial pixel image is updated, and the cartoon image with stylized pixels is obtained.
The pixel blocks which are overlapped side by side are pixel blocks between two diagonally adjacent pixel blocks.
The invention has the following beneficial effects:
1) The specially constructed pixel stylization processing method ensures that the image content is completely reserved by subdividing the image content, ensures the quality of the pixel image, and ensures the artistry of the generated pixel image by optimizing the artistic aesthetics of the pixel block cluster.
2) The method can quickly acquire a large number of high-quality pixel images and meet the requirements of various sizes, and the processing time for generating a pixel image with the size of 64 multiplied by 64 by one cartoon image with the size of 1080 multiplied by 1080 is only about 10 seconds.
3) The method is simple and easy to apply, the quality of the processed pixel image is high, the maintenance of the processing model does not need the knowledge and experience of the working personnel for computer image professional processing, and the method has larger application potential in the pixel image generation.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
FIG. 2 is a schematic diagram of the pretreatment involved in the process of the present invention.
FIG. 3 is a schematic diagram of a pixel stylization processing scheme of the present invention.
FIG. 4 is a schematic diagram of the optimization scheme of the invention for artistic appreciation of pixel block clusters.
FIG. 5 is a schematic diagram of a cartoon image to be processed in the embodiment of the present invention.
FIG. 6 is a schematic diagram of a stylized pixel image of a cartoon image in an embodiment of the invention.
Fig. 7 is a schematic diagram of a pixel image generated by a conventional image pixelation method.
Detailed Description
In order to more clearly illustrate the objects and technical solutions of the present invention, the present invention will be further described in detail with reference to the accompanying drawings.
As shown in fig. 1, the present invention comprises the steps of:
1) Gridding the cartoon image (as shown in (a) of fig. 2) according to the size of the target pixel image, and obtaining all square pixel blocks with the same size of the cartoon image as shown in (b) of fig. 2;
2) The contour lines of the cartoon image are obtained and marked by using a Canny detection algorithm, and as shown in (c) of FIG. 2, the main contour line width W of the cartoon image is determined according to the contour lines of the cartoon image line
In step 2), calculating the distance between each contour line of the cartoon image and the corresponding adjacent contour line to form a contour line distance set, and taking the distance with the maximum contour line distance set as the main contour line width W of the cartoon image line
The distance between two adjacent contour lines is calculated as follows:
respectively taking two points with different contour lines, wherein the coordinates of the two points are respectively (x) 1 ,y 1 )、(x 2 ,y 2 ) The distance D between the two points can be obtained by calculation using formula (1), and as shown in fig. 2 (D) and fig. 2 (e), the minimum value of the distance between the two points is the distance of the contour line, and formula (1) is:
Figure BDA0003762720490000031
3) According to the size G of a square pixel block pixel And main contour width W line Classifying all square pixel blocks of the cartoon image into contour pixel blocks or non-contour pixel blocks;
the step 3) is specifically as follows:
when the width W of the main contour line line Less than or equal to the size G of a square pixel block pixel When all the square pixel blocks containing the contour lines of the cartoon image are contour pixel blocks, as shown in (a 2) and (a 3) of fig. 3, when the main contour line width W line Larger than the size G of a square pixel block pixel Then, all the square pixel blocks containing the contour lines of the cartoon image are non-contour pixel blocks, as shown in fig. 3 (a 1), wherein all the square pixel blocks containing no contour lines of the cartoon image are non-contour pixel blocks.
4) And performing color filling on the classified square pixel blocks by using a pixel stylization processing method and a pixel block cluster artistic aesthetic optimization method to obtain a pixel stylized cartoon image serving as a target pixel image.
The step 4) is specifically as follows:
4.1 Step 4.2) is carried out on each contour pixel block, each contour pixel block is traversed, and each contour pixel block is processed; step 4.3) is executed for each non-contour pixel block, each non-contour pixel block is traversed, and each non-contour pixel block is processed;
4.2 Using a k-means method to extract main colors of each contour pixel block, in specific implementation, extracting three main colors, converting the extracted main colors from an RGB color space to an HSV color space, screening the extracted main colors by using a brightness value V, wherein the main color with the minimum brightness value is a target color to obtain a first target color, calculating the ratio of the number of pixel points of the first target color in the current contour pixel block to the number of all pixel points in the current contour pixel block (namely a square pixel block), and when the ratio is more than 50 percentW line ×G pixel And taking the first target color as the filling color of the current contour pixel block, wherein the target colors are RGB color spaces. Otherwise, recording the current contour pixel block as a non-contour pixel block, and then executing the step 4.3) to process the non-contour pixel block; as shown in fig. 3 (b 1).
4.3 Using k-means to extract the main color of each non-contour pixel block, in the concrete implementation, extracting three main colors, then converting the extracted main color from RGB color space to HSV color space, screening the extracted main color by using a brightness value V, wherein the main color with the minimum brightness value is the target color, obtaining a second target color, then calculating the ratio of the number of pixel points of the second target color in the current non-contour pixel block to the number of all pixel points in the current non-contour pixel block (namely a square pixel block), and when the ratio is more than 50% multiplied by W line ×G pixel If so, taking the second target color as the filling color of the current non-contour pixel block, otherwise, taking the color with the largest number of pixel points in the current non-contour pixel block as the filling color of the current non-contour pixel block; as shown in (b 2) and (b 3) of fig. 3. The pixel stylization processing method is formed by steps 4.1) -4.3).
4.4 As shown in fig. 4, the pixel arrangement logic is such that the number of pixel blocks is gradually increased when the curve is close to a straight line and gradually decreased when the curve is close to a curve. And (4) forming an initial pixel image by all the processed contour pixel blocks and/or non-contour pixel blocks, marking all the pixel blocks which are overlapped side by side in the initial pixel image as non-contour pixel blocks, repeating the step 4.3), performing color filling optimization on all the non-contour pixel blocks, further updating the initial pixel image, and obtaining a cartoon image with stylized pixels as a target pixel image, wherein the cartoon image is shown in (c 1) - (c 3) of fig. 3. And 4.4) forming a pixel block cluster artistic aesthetic optimization method. The pixel blocks overlapped side by side are pixel blocks between two diagonally adjacent pixel blocks, namely the pixel blocks overlapped side by side are adjacent to the two diagonally adjacent pixel blocks.
The specific embodiment is as follows:
the invention adopts the cartoon image shown in figure 5 to carry out pixel stylization treatment; as shown in fig. 6, pixel images of different sizes are generated, in which sizes of (a), (b), and (c) of fig. 6 are 32 × 32, 48 × 48, and 64 × 64, respectively. Fig. 7 shows a pixel image generated after the conventional algorithm processes fig. 5, and the sizes of (a), (b), and (c) in fig. 7 are 32 × 32, 48 × 48, and 64 × 64 in this order.
The embodiment shows that the method can generate high-quality pixel images with any size, has good artistry, and has great application potential in the aspect of acquiring a large number of pixel images.
The foregoing detailed description is intended to illustrate and not limit the invention, which is intended to be within the spirit and scope of the appended claims, and any changes and modifications that fall within the true spirit and scope of the invention are intended to be covered by the following claims.

Claims (5)

1. A pixel stylized cartoon image processing method based on artistic creation is characterized by comprising the following steps:
1) Gridding the cartoon image according to the size of the target pixel image to obtain all square pixel blocks of the cartoon image;
2) Obtaining and marking the contour line of the cartoon image by using a Canny detection algorithm, and determining the main contour line width W of the cartoon image according to the contour line of the cartoon image line
3) According to the size G of a square pixel block pixel And main contour width W line Classifying all square pixel blocks of the cartoon image into contour pixel blocks or non-contour pixel blocks;
4) And performing color filling on the classified square pixel blocks by utilizing a pixel stylization processing method and a pixel block cluster artistic aesthetic optimization method to obtain a pixel stylized cartoon image.
2. The method as claimed in claim 1, wherein in step 2), the contour lines of the cartoon image and the corresponding adjacent contour lines are calculatedThe distance of the cartoon image is the maximum distance in the contour line distance set, and the main contour line width W of the cartoon image is the maximum distance in the contour line distance set line
3. The method for processing the pixel stylized cartoon image based on artistic creation as claimed in claim 1, wherein the step 3) is specifically as follows:
when the width W of the main contour line line Less than or equal to the size G of a square pixel block pixel When the main contour line width W is larger than the main contour line width W, all the square pixel blocks containing the contour lines of the cartoon image are contour pixel blocks line Larger than the size G of a square pixel block pixel And then, all the square pixel blocks containing the contour lines of the cartoon image are non-contour pixel blocks, wherein all the square pixel blocks containing no contour lines of the cartoon image are non-contour pixel blocks.
4. The method for processing the pixel stylized cartoon image based on artistic creation as claimed in claim 1, wherein the step 4) is specifically as follows:
4.1 Step 4.2) is carried out on each contour pixel block, each contour pixel block is traversed, and each contour pixel block is processed; step 4.3) is executed for each non-contour pixel block, and each non-contour pixel block is traversed and processed;
4.2 Using a k-means method to extract a main color of each contour pixel block, then converting the extracted main color from an RGB color space to an HSV color space, screening the extracted main color by using a brightness value V to obtain a first target color, then calculating the ratio of the number of pixels of the first target color in the current contour pixel block to the number of all pixels in the current contour pixel block, and when the ratio is more than 50% multiplied by W line ×G pixel If so, taking the first target color as the filling color of the current contour pixel block, otherwise, recording the current contour pixel block as a non-contour pixel block, and executing the step 4.3) to process the non-contour pixel block;
4.3) Extracting the main color of each non-contour pixel block by using a k-means method, converting the extracted main color from an RGB color space to an HSV color space, screening the extracted main color by using a brightness value V to obtain a second target color, calculating the ratio of the number of pixels of the second target color in the current non-contour pixel block to the number of all pixels in the current non-contour pixel block, and when the ratio is more than 50% multiplied by W line ×G pixel If so, taking the second target color as the filling color of the current non-contour pixel block, otherwise, taking the color with the largest number of pixel points in the current non-contour pixel block as the filling color of the current non-contour pixel block;
4.4 All the processed pixel blocks form an initial pixel image, all the pixel blocks which are overlapped side by side in the initial pixel image are marked as non-contour pixel blocks, the step 4.3) is repeated, color filling optimization is carried out on all the non-contour pixel blocks, then the initial pixel image is updated, and the cartoon image with stylized pixels is obtained.
5. The method of claim 4, wherein the blocks of pixels that are overlapped side by side are blocks of pixels between two diagonally adjacent blocks of pixels.
CN202210876887.5A 2022-07-25 2022-07-25 Processing method of pixel stylized cartoon image based on artistic creation Pending CN115170387A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210876887.5A CN115170387A (en) 2022-07-25 2022-07-25 Processing method of pixel stylized cartoon image based on artistic creation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210876887.5A CN115170387A (en) 2022-07-25 2022-07-25 Processing method of pixel stylized cartoon image based on artistic creation

Publications (1)

Publication Number Publication Date
CN115170387A true CN115170387A (en) 2022-10-11

Family

ID=83497646

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210876887.5A Pending CN115170387A (en) 2022-07-25 2022-07-25 Processing method of pixel stylized cartoon image based on artistic creation

Country Status (1)

Country Link
CN (1) CN115170387A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116778060A (en) * 2023-05-23 2023-09-19 北京乐信圣文科技有限责任公司 Bubble style image processing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116778060A (en) * 2023-05-23 2023-09-19 北京乐信圣文科技有限责任公司 Bubble style image processing method and device
CN116778060B (en) * 2023-05-23 2024-03-19 北京乐信圣文科技有限责任公司 Bubble style image processing method and device

Similar Documents

Publication Publication Date Title
CN110211192B (en) Rendering method from three-dimensional model to two-dimensional image based on deep learning
CN109872285B (en) Retinex low-illumination color image enhancement method based on variational constraint
WO2017219263A1 (en) Image super-resolution enhancement method based on bidirectional recursion convolution neural network
CN108830913B (en) Semantic level line draft coloring method based on user color guidance
US10489970B2 (en) 2D image processing for extrusion into 3D objects
CN106846390B (en) Image processing method and device
US10204447B2 (en) 2D image processing for extrusion into 3D objects
CN105957124B (en) With the natural image color edit methods and device for repeating situation elements
CN111951345B (en) GPU-based real-time image video oil painting stylization method
CN115170387A (en) Processing method of pixel stylized cartoon image based on artistic creation
Niu et al. Data augmentation on defect detection of sanitary ceramics
Wong et al. Model-based analysis of Chinese calligraphy images
CN110660018B (en) Image-oriented non-uniform style migration method
CN110675463A (en) Local color pencil drawing generation method and device
Uchida et al. Stylized line-drawing of 3D models using CNN with line property encoding
He Application of local color simulation method of landscape painting based on deep learning generative adversarial networks
Zhu et al. Sand painting conversion based on detail preservation
Zheng et al. A novel pencil drawing algorithm based on non-symmetry and anti-packing pattern representation model
CN113989263A (en) Image area saliency detection method based on super-pixel segmentation
Liu et al. Palette-based recoloring of natural images under different illumination
CN108428240B (en) Salient object segmentation method adaptive to input information
Chang et al. Artistic painting style transformation using a patch-based sampling method
Zhang et al. CBA-GAN: Cartoonization style transformation based on the convolutional attention module
CN103745493A (en) Method for generating two-dimensional inner shadow based on image processing
Xie et al. A colored pencil-drawing generating method based on interactive colorization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination