Method, device, computer equipment and medium for generating ink painting images

By obtaining the scenery lines input by the user, the problems of time and technical requirements for generation of ink paintings in the prior art are solved, and fast and efficient ink painting generation are achieved.

CN114332267BActive Publication Date: 2025-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
CN202111310160.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-05
Publication Date
2025-08-29
Estimated Expiration
2041-11-05

AI Technical Summary

Technical Problem

Generating ink paintings in existing painting software takes a lot of time and requires strong painting skills, making it difficult for users to quickly generate high-quality ink painting images.

Method used

By obtaining the scenery lines on the user's operation interface, an initial scenery image is generated, and the scenery outline and texture lines are generated based on it, and then ink-washing processing is performed to automatically generate a complete image in the ink style.

Benefits of technology

It improves the intelligence and efficiency of ink painting image generation, improves the user experience, and simplifies the generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332267B_ABST
    Figure CN114332267B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, computer device, and medium for generating an ink painting image, which is applied to the field of image processing technology. The method includes: obtaining scene lines input on a user operation interface and generating an initial scene image based on the scene lines; generating a scene outline in the initial scene image based on the scene lines included in the initial scene image, and adding texture lines to the initial scene image from which the scene outline is generated to obtain a texture line image; performing ink-wash processing on the texture line image to obtain a scene ink image of the initial scene image, and displaying the scene ink image on the user operation interface. A complete ink painting image can be automatically generated based on the scene lines, thereby improving the efficiency of generating ink painting images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, computer equipment and medium for generating ink painting images. Background Art

[0002] Ink painting is a form of painting that is often considered a representative form of traditional Chinese painting, also known as traditional Chinese painting. Currently, users can usually use painting software to create ink paintings. However, creating ink paintings in painting software requires users to spend a lot of time in the painting software. If users want a good ink painting, they also need strong painting skills. Therefore, how to quickly generate an ink painting based on user input has become an urgent problem that needs to be solved. Summary of the Invention

[0003] The embodiments of the present application provide a method, apparatus, computer equipment, and medium for generating an ink painting image, which can automatically generate a complete ink painting image based on the lines of a scene, thereby improving the efficiency of generating ink painting images.

[0004] A first aspect of an embodiment of the present application discloses a method for generating an ink painting image, the method comprising:

[0005] Acquiring scene lines input on a user operation interface, and generating an initial scene image based on the scene lines;

[0006] generating a scene outline in the initial scene image according to scene lines included in the initial scene image, and adding texture lines to the initial scene image from which the scene outline is generated, to obtain a texture line image;

[0007] The texture line image is subjected to ink-wash processing to obtain a scene ink-wash image of the initial scene image, and the scene ink-wash image is displayed on the user operation interface.

[0008] A second aspect of an embodiment of the present application discloses a device for generating an ink painting image, the device comprising:

[0009] a generating unit, configured to obtain scene lines inputted on a user operation interface, and generate an initial scene image based on the scene lines;

[0010] a first determining unit configured to generate a scene outline in the initial scene image according to scene lines included in the initial scene image, and to add texture lines to the initial scene image from which the scene outline is generated, to obtain a texture line image;

[0011] The second determining unit is configured to perform ink-wash processing on the texture line image to obtain a scene ink-wash image of the initial scene image, and display the scene ink-wash image on the user operation interface.

[0012] A third aspect of an embodiment of the present application discloses a computer device, comprising a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect above.

[0013] A fourth aspect of an embodiment of the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method of the first aspect.

[0014] A fifth aspect of the present application discloses a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method of the first aspect.

[0015] In an embodiment of the present application, the scene lines input on the user operation interface can be obtained, and an initial scene image can be generated based on the scene lines. Then, a scene outline can be generated in the initial scene image based on the scene lines included in the initial scene image, and texture lines can be added to the initial scene image of the generated scene outline to obtain a texture line image. Furthermore, the texture line image can be subjected to ink-wash processing to obtain a scene ink image of the initial scene image, and the scene ink image can be displayed on the user operation interface. Through the above method, a complete image in ink style can be automatically generated based on the simple lines input by the user, which effectively improves the intelligence of image generation, effectively improves the efficiency of generating ink painting images, and also improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 This is a schematic diagram of the architecture of a system for generating ink painting images provided in an embodiment of the present application;

[0018] Figure 2 This is a flow chart of a method for generating an ink painting image provided in an embodiment of the present application;

[0019] Figure 3a This is a schematic diagram of a user operation interface provided in an embodiment of the present application;

[0020] Figure 3b is an image schematic diagram of an initial scene image provided by an embodiment of the present application;

[0021] Figure 3c This is a structural diagram of a line processing model provided in an embodiment of the present application;

[0022] Figure 3d This is a schematic diagram of the structure of a residual block provided in an embodiment of the present application;

[0023] Figure 4a This is a schematic diagram of the structure of a generative adversarial model provided in an embodiment of the present application;

[0024] Figure 4b Schematic diagram of a target parabola provided in an embodiment of the present application;

[0025] Figure 4c This is a schematic diagram of a texture line image provided by an embodiment of the present application;

[0026] Figure 4d Schematic diagram of a gradient feature operator provided in an embodiment of the present application;

[0027] Figure 5 This is a flow chart of a method for generating an ink painting image provided in an embodiment of the present application;

[0028] Figure 6a This is an image schematic diagram of determining an animation area provided by an embodiment of the present application;

[0029] Figure 6b This is a schematic diagram of a user operation interface provided in an embodiment of the present application;

[0030] Figure 6c This is a schematic diagram of a user operation interface provided in an embodiment of the present application;

[0031] Figure 7 1 is a schematic structural diagram of a device for generating an ink painting image provided in an embodiment of the present application;

[0032] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0034] This application may relate to the field of artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is also the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0035] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0036] Computer vision (CV) is the science of making machines "see." Specifically, it refers to machine vision, where cameras and computers replace the human eye in identifying, tracking, and measuring objects. This involves further processing the images, transforming them into images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, autonomous driving, and smart transportation. It also includes common biometric recognition technologies such as facial recognition and fingerprint recognition.

[0037] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning / deep learning typically includes techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.

[0038] The solutions provided in the embodiments of the present application may involve image processing, machine learning and other technologies in artificial intelligence computer vision technology, which are specifically illustrated by the following embodiments.

[0039] In an embodiment of the present application, in order to convert the scene lines input by the user on the user operation interface into an image in the style of ink painting, an embodiment of the present application provides a method for generating an ink painting image. The general principle of the method for generating an ink painting image is as follows: the scene lines input on the user operation interface can be obtained, and an initial scene image is generated based on the scene lines. Then, the initial scene image is converted into a scene ink image. For example, the initial scene image can be subjected to line processing to obtain a texture line image corresponding to the initial scene image. For example, the line processing can be to generate a scene outline in the initial scene image based on the scene lines included in the initial scene image, and add texture lines to the initial scene image of the generated scene outline, etc., to obtain a texture line image. Furthermore, the texture line image can be subjected to ink processing to obtain a scene ink image corresponding to the initial scene image. After obtaining the scene ink image, the scene ink image can be displayed on the user operation interface. Through the above method, a complete image in the ink painting style related to the user input can be automatically generated based on the simple lines input by the user, which effectively improves the intelligence of image generation, improves the efficiency of ink painting generation, and also improves the user experience.

[0040] In a specific implementation, the execution subject of the above-mentioned method for generating an ink painting image can be a computer device, which can be a server or a terminal. The terminal mentioned here can be a device such as a smartphone, tablet computer, laptop computer, desktop computer, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, etc.

[0041] This application can be applied to the field of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of technical network systems require a large amount of computing and storage resources, such as video websites, image websites, and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark and need to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All types of industry data require strong system backend support, which can only be achieved through cloud computing. For example, the data involved in this application can be stored in the "cloud", and the data in the cloud can be accessed and expanded at any time according to demand.

[0042] In one implementation, taking the execution subject of the ink painting image generation method as a server as an example, the ink painting image generation method provided in this application can be specifically applied to the ink painting image generation system, see Figure 1 , Figure 1 This is a schematic diagram of the architecture of a system for generating an ink painting image provided in an embodiment of the present application. The present application involves a terminal 101 and a server 102.

[0043] Taking terminal 101 as an example, a user can input a scene line on the user interface of terminal 101. The scene line can be a simple line entered by the user in the drawing area of ​​the user interface. The line can be of any shape, for example, a regular curved line, an irregular curved line, a straight line, etc. After terminal 101 detects the user inputting a line in the drawing area of ​​the user interface, it can obtain the scene line on the user interface and send the scene line to server 102. After receiving the scene line, server 102 can generate an initial scene image based on the scene line and convert the initial scene image into a scene ink image. The scene ink image refers to an image in an ink painting style. Subsequently, server 102 sends the determined scene ink image to terminal 101 so that it is displayed on the user interface of the terminal. Terminal 101 and server 102 can be connected directly or indirectly via wired or wireless communication, which is not limited in this application.

[0044] In one implementation, the ink painting image generation system can be applied to painting software such as applications or mini-programs. Users can input some simple mountain contours on the relevant interface of the painting software such as applications or mini-programs. Then, the ink painting image generation method in this application can generate an ink image of the scenery based on the mountain contour input by the user and display it on the interface.

[0045] In one implementation, the user can input some simple lines on the user operation interface, such as arc lines similar to the outline of a mountain, so as to generate an ink image of the scenery based on the lines; or, the user can also import an image with simple lines on the user operation interface, so as to generate an ink image of the scenery based on the image, and the image with simple lines can be an image drawn in advance by the user.

[0046] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application:

[0047] See Figure 2 , Figure 2 This is a flow chart of a method for generating an ink painting image provided by an embodiment of the present application. The method for generating an ink painting image can be executed by the aforementioned computer device, which can be a terminal or a server. For ease of explanation, the present application embodiment uses the method for generating an ink painting image executed by a computer device as an example. The method for generating an ink painting image includes the following steps:

[0048] S201: Acquire scene lines input on a user operation interface, and generate an initial scene image based on the scene lines.

[0049] In one implementation, the server can output a user interface and display it on a terminal. If a user requires a few simple lines or outlines to create a complete ink-and-wash style image, the user can enter scene lines on the interface to subsequently create an ink-and-wash style image. These scene lines can be the outline of a scene or a few simple lines. For example, if a landscape ink-and-wash style image is desired, the scene lines can be, for example, the outline of a mountain. After detecting the scene lines on the user interface, the scene lines can be acquired and an initial scene image can be generated based on them. This initial scene image can include the scene lines. After the initial scene image is generated, subsequent steps can be performed using this initial scene image to create an ink-and-wash style image, which is the scene ink-and-wash image described later.

[0050] In one implementation, the user operation interface may include a user operation area and a result display area. The user operation area may include a drawing area and a confirmation control. The drawing area may be used for the user to input a scene line, and the result display area may be used to display an image generated based on the scene line input in the drawing area. For example, the user operation interface may be as follows: Figure 3a As shown, the user operation area can be Figure 3a As shown in the area marked by 301, the result shows that the area can be Figure 3a As shown in the area marked by 302, the drawing area in the user operation area can be as follows Figure 3a As shown in the area marked by 303 in FIG, the confirmation control in the user operation area can be as follows Figure 3a As shown by the control marked by 304 in the drawing. The user can input scenery lines in the drawing area, such as the several lines displayed in the drawing area marked by 302 can be scenery lines. After the user inputs the scenery lines, the confirmation control marked by 304 can be clicked to trigger the generation of the scenery ink image. After detecting that the confirmation control marked by 304 is triggered, the scenery lines in the drawing area can be obtained to generate an initial scenery image based on the scenery lines. The initial scenery image can be composed of scenery lines in the drawing area, wherein the size of the initial scenery image can be determined according to the size of the drawing area, or the area where the scenery lines are located in the drawing area, or a preset size, or can be determined according to other methods, which are not limited in this application. The size of the initial scenery image can be the size of the drawing area, or can be smaller than the size of the drawing area. For example, the initial scenery image generated based on the several lines displayed in the drawing area marked by 302 can be as follows Figure 3b shown.

[0051] S202: generating a scene outline in the initial scene image according to scene lines included in the initial scene image, and adding texture lines to the initial scene image for generating the scene outline, to obtain a texture line image.

[0052] In one implementation, line processing can be performed on the initial scene image to obtain a textured line image of the initial scene image. Line processing can refer to adding lines of different styles to the initial scene image to fill the initial scene image with lines, so that the textured line image obtained through line processing can represent a relatively complete image. For example, line processing on the initial scene image can generate a scene outline in the initial scene image based on scene lines included in the initial scene image. To enhance the completeness and richness of the image, texture lines can be added to the initial scene image from which the scene outline is generated to obtain a textured line image.

[0053] Assuming that, for a subsequently generated landscape-style ink painting image, the line processing of the initial scene image can be to generate, for example, a mountain outline based on the scene lines in the initial scene image. The mountain outline can be referred to as a mountain outline. Furthermore, texture lines, such as mountain texture, can be added to the generated initial scene image having a mountain outline. Texture lines of specific scene objects, such as trees, flowers, grass, attics, and thatched houses, can also be added. When adding texture lines of specific scene objects, such as trees and attics, the specific scene objects, such as trees and attics, can be generated on the initial scene image having a mountain outline, with the generated specific scene objects being composed of lines. Alternatively, the texture lines of the specific scene objects can be added to the initial scene image having a mountain outline in the form of image blocks. For example, an image block corresponding to a tree can be added to the initial scene image having a mountain outline. Alternatively, an image block corresponding to an attic can be added to the initial scene image having a mountain outline.

[0054] In one implementation, a line processing model can be invoked to perform line processing on scene lines included in an initial scene image to obtain a texture line image. This line processing includes generating a scene outline in the initial scene image and adding texture lines to the initial scene image containing the generated scene outline. Specifically, the initial scene image can be input into the line processing model, and the output of the line processing model is the texture line image corresponding to the initial scene image.

[0055] In one implementation, the model structure of the line processing model can be as follows: Figure 3c As shown, from Figure 3cAs can be seen, the line processing model includes a downsampling module, a residual module, and an upsampling module. The network model structure can be bilaterally symmetrical. The downsampling module can include one or more downsampling layers, the number of upsampling layers in the upsampling module is the same as the number of upsampling layers, and the residual module can include one or more residual blocks. Assume that the number of downsampling layers and the number of upsampling layers are both n, and the number of residual blocks is m. These n and m can be preset and are not limited in this application. For example, practice has shown that when n = 6 and m = 9, the line processing model performs better. The downsampling module can be used to encode the initial scene image to obtain feature maps of different sizes of the initial scene image. The residual module can be used to fuse the feature maps of different sizes obtained by the downsampling module to obtain a fused feature map. The downsampling module can decode the fused feature map to obtain a texture line image corresponding to the initial scene image.

[0056] In one implementation, the structure of any residual block in the residual module can be as follows: Figure 3d As shown, the weight layer can be a convolutional layer. The residual block can be implemented in the form of a skip connection, that is, the input of the residual block can be directly added to the output of the residual block and then activated. For example, Figure 3d In the example, the residual block can include two weight layers, where x represents the input of the residual block. Assuming that F1(x) is obtained after processing by the first weight layer and the activation function, and F2(x) is obtained after processing by the second weight layer, the output of the residual block is F3(F2(x)+x). Here, F1(·) represents the effect of the first weight layer and the first activation function, F2(·) represents the effect of the second weight layer, and F3(·) represents the effect of the second activation function.

[0057] In one implementation, the line processing model can be trained using a generative adversarial model using a first training image set. The first training image set can include one or more first training image pairs, each of which can include a first training image and a first labeled image corresponding to the first training image. The first training image can be an image generated by lines in a scene, and the first labeled image can be obtained by performing line processing on the first training image.

[0058] In one implementation, Figure 4a The figure shows a schematic diagram of the structure of a generative adversarial model provided by an embodiment of the present application. Figure 4aAs shown, the generative adversarial model can include a generation module and a discrimination module. The line processing model is composed of the generation module in the generative adversarial model. The generation module is used to generate a corresponding predicted image based on the input image, and the discrimination module is used to discriminate the predicted image based on the label image (real image) corresponding to the input image, determining whether the predicted image is a real image or a fake image. If the predicted image is a real image, the output of the discrimination module is close to 1, and if the predicted image is a fake image, the output of the discrimination module is close to 0. The purpose of training the generative adversarial model is to make it as difficult as possible for the discrimination module to distinguish whether the predicted image obtained by the generation module is a real image or a fake image, that is, to make the predicted image obtained by the generation module as close to the label image (real image) corresponding to the input image as possible. Therefore, after the generative adversarial model is trained and the trained generative adversarial model is obtained, the model parameters of the generation module in the generative adversarial model are also trained, that is, the generation module in the trained generative adversarial model can be used as a line processing model.

[0059] In one implementation, the steps of training a generative adversarial model using a first training image set to obtain a line processing model can be described as follows, wherein, taking any first training image pair in the first training image set as an example, first, the first training image in the first training image pair can be input into the generation module in the generative adversarial model to obtain a predicted image of the first training image. After obtaining the predicted image, the predicted image and the first label image in the first training image pair can be input into the discrimination module in the generative adversarial model to obtain a discrimination result. Furthermore, the generative adversarial model can be trained based on the predicted image, the first label image, and the discrimination result to obtain target model parameters. The target model parameters include the model parameters of the generation module. After obtaining the target model parameters, the line processing model can be determined based on the target model parameters, and the line processing model includes the generation module after the model parameters are updated.

[0060] In one implementation, when training the generative adversarial model based on the predicted image, the first label image, and the discrimination result, the loss function used can be as shown in Formula 2-1.

[0061] L=L1×k1+L GAN ×k2 Formula 2-1

[0062] Among them, L1 can be used to predict the difference between the image and the first label image. For example, L1 can be specifically L1=||I t -G(I s )||,I t represents the first label image, G(·) represents the effect of the generation module, G(I s) represents the output of the generation module, namely G(I s ) represents the predicted image. L GAN is the loss of the discriminative module, for example, L GAN Specifically, it can be L GAN =-∑logD(I t ,G(I s )), where D(·) represents the effect of the discriminant module, which aims to determine whether the predicted image generated by the generation module is real. K1 is the adjustment coefficient of L1, and k2 is the L GAN For example, practice has shown that when k1=1 and k2=1, the model effect of the generated adversarial model is better.

[0063] In one implementation, in an embodiment of the present application, the subsequently generated ink-and-wash image of a landscape is taken as an example for explanation. The specific implementation method of performing line processing on the first training image to obtain the first label image corresponding to the first training image can be described as follows. A plurality of target parabolas can be added to the first training image first, and the target parabola can be used to simulate the shape of a mountain, wherein the target parabola can be a standard parabola with a vertical axis of symmetry and an opening downward. For example, the target parabola can be as follows: Figure 4b As shown, Figure 4b The parabola shown in the figure has a vertical axis of symmetry and opens downward. When adding multiple target parabolas to the first training image, the target parabolas can be added based on the scenery lines in the first training image. For example, each scenery line in the first training image can be modified into a target parabola. If the first training image has fewer scenery lines, in order to make the subsequent scenery ink painting image richer and more vivid, a target parabola of any size can be added at any position in the first scenery image, so that the target parabola can be used to simulate the shapes of various mountain sizes.

[0064] After adding multiple target parabolas to the first training image, a first label image corresponding to the first training image can be obtained based on the multiple target parabolas. For example, a scene outline can be determined based on the multiple target parabolas, and texture lines can be added to obtain the first label image corresponding to the first training image. Optionally, a first training image including a scene outline can be generated based on the multiple target parabolas. After obtaining the first training image including the scene outline, texture lines can be added to the first training image including the scene outline to obtain the first label image corresponding to the first training image. The texture lines can include scene texture corresponding to the scene outline and object texture corresponding to the target scene object. For example, if the subsequently generated scene ink painting image is a landscape painting image, the scene outline determined based on the multiple target parabolas can be a mountain outline, the scene texture corresponding to the scene outline included in the texture lines can include a mountain texture, and the object texture corresponding to the target scene object included in the texture lines can include object texture corresponding to target scene objects such as trees, flowers, grass, attics, and thatched houses. The object texture can refer to the lines generated to form a specific scene object. Among them, when adding the object texture corresponding to the target scene object, in addition to directly generating the target scene object in the image as described above (the target scene object is composed of lines), it is also possible to add an image block corresponding to the target scene object in the image, that is, the image block corresponding to the target scene object can be pre-set, and when texture lines need to be added, the pre-set image block corresponding to the target scene object can be directly obtained.

[0065] In one implementation, an example is provided in which texture lines include scene textures corresponding to scene contours and object textures corresponding to target scene objects. A specific implementation method for adding texture lines to a first training image including a scene contour to obtain a first label image may be as follows: first, based on the slopes of target points on each of a plurality of target parabolas, scene textures corresponding to the scene contours may be added to the first training image including the scene contour to obtain an initial texture image. Next, object textures corresponding to the target scene object are added to the initial texture image to obtain a first label image corresponding to the first training image. The order of performing the steps of adding the scene texture corresponding to the scene contour and adding the object texture corresponding to the target scene object on the first training image is not limited in this application.

[0066] In the specific implementation, any target parabola among multiple target parabolas is used, and combined with Figure 4b The target parabola shown in FIG is used as an example for explanation, and it is assumed that the subsequently generated scene ink-wash image is a landscape scene ink-wash image. Two target points (a first point and a second point) can be determined on the target parabola. For example, Figure 4bThe P1 shown can be the first point, P2 can be the second point, and the target point can also be other points on the target parabola, which is not specifically limited in this application. After determining the first point and the second point, the line above the target line in the target parabola can be determined as the mountain contour (or understood as the landscape contour). The target line refers to the line formed between the first point and the second point. For example, Figure 4b The arc segment between P1 and P2 shown in the figure is the outline of a mountain. Through the above method, a first training image including a mountain outline can be obtained. Then, a texture line can be added to the target area formed by the mountain outline and the target line, and the texture line can be a mountain texture. Optionally, the mountain texture can be determined according to the slope of the target point. For example, the first slope of the target parabola at the first point and the second slope of the target parabola at the second point can be determined, and then the mountain texture is added to the target area based on the first slope and the second slope. The mountain texture can be simulated using a line segment. For example, the mountain texture may include a first line segment with a first slope and a second line segment with a second slope. When adding mountain texture to the target area, as Figure 4b As shown, one or more first line segments can be randomly added at points passing through the line segment P1 to M, and one or more second line segments can be randomly added at points passing through the line segment P2 to M. The heights of the first and second line segments can be less than a preset height. For example, the preset height can be 1 / 3 or 1 / 2 of the distance from P3 to M. Using the above method, a mountain texture corresponding to the mountain contour can be added to the first training image including the mountain contour to obtain an initial texture image.

[0067] After obtaining the initial texture image, the object texture corresponding to the target scene object can also be added to the initial texture image, thereby obtaining the first label image corresponding to the first training image. The target scene object can be a scene object such as a tree, a flower, a grass, a loft, a thatched house, etc. For example, the object texture corresponding to the target scene object can be added to a specified area. The specified area can refer to a target area based on the mountain contour (a target area composed of the mountain contour and the target line). The object texture corresponding to the target scene object can be added to the specified area in a random manner. That is, the object texture corresponding to the target scene object can be randomly added to the mountain contour and the target area. Figure 4b As shown, object textures corresponding to target scene objects such as trees, flowers, and grass can be randomly added on the arc segment between P1 and P2 and in the arc area formed by P1, P2, and P3, and object textures corresponding to target scene objects such as attics and thatched houses can be randomly added in the triangular area formed by P1, P2, and P3.

[0068] For example, assuming that there is a scene line in the first training image, the first label image obtained with the scene line can be as follows: Figure 4c As shown. Figure 4c The area marked by 401 may be a mountain texture, and the area marked by 402 may be an object texture corresponding to a target scene object (eg, a tree, a loft).

[0069] S203: performing ink-wash processing on the texture line image to obtain a scene ink-wash image of the initial scene image, and displaying the scene ink-wash image on the user operation interface.

[0070] In one implementation, ink painting processing may refer to converting a texture line image into an ink painting style image. For example, the ink painting processing may be to add a background layer to the texture line image, such as a light-colored background layer. The texture line image with the background layer added is then blurred so that the resulting image (i.e., the ink painting image of the scene) appears to be flickering. Considering that the texture line image may be a color image, the texture line image may be subjected to black and white processing before adding the background layer to the texture line image, so as to adjust the texture line image to a black and white effect image. In order to make the black and white contrast of the image stronger and conform to the picture characteristics of ink painting, the saturation of the texture line image may also be reduced.

[0071] In one implementation, the ink-wash conversion model can be called to perform ink-wash processing on the texture line image to obtain the scene ink-wash image of the initial scene image. Figure 3cThe structure of the line processing model shown differs from the line processing model in that the number of downsampling layers in the downsampling module and the number of residual blocks in the residual module in the ink-wash conversion model are different. For example, practice has shown that when n = 1 (the number of downsampling layers) and m = 15 (the number of residual blocks), the ink-wash conversion model performs better. The input of the ink-wash conversion model is a texture line image, and the output is a scene ink-wash image. The ink-wash conversion model is also trained based on a generative adversarial network. The training image set used to train the generative adversarial network is a second training image set. The second training image set may include one or more second training image pairs, each of which may include a second training image and a second label image corresponding to the second training image. The second label image includes an ink-wash image, which is a real ink-wash style image. For example, the ink-wash image may be an ink-wash style image disclosed on a website, and the second training image is obtained by performing image edge processing on the second label image. Image edge processing may be performed using a gradient feature operator or a deep learning method, which is not limited in this application. For example, the gradient feature operator may be a Sobel operator or a Canny operator, or other operators, which are not limited in this application.

[0072] In one implementation, the present application uses a gradient feature operator to perform image edge processing, and the gradient feature operator is a sobel operator as an example. First, the gradient feature operator can be used to perform a convolution operation on the second label image to obtain an edge detection map of the second label image. The gradient feature operator can include a horizontal gradient convolution kernel and a vertical gradient convolution kernel, for example, Figure 4d The convolution kernel marked by 403 is a horizontal gradient convolution kernel, and the convolution kernel marked by 404 is a vertical gradient convolution kernel. The second label image can be convolved based on the horizontal gradient convolution kernel to obtain a horizontal grayscale image of the second label image, and the second label image can be convolved based on the vertical gradient convolution kernel to obtain a vertical grayscale image of the second label image. The pixel value corresponding to each pixel in the horizontal grayscale image represents the image grayscale value of the pixel in the horizontal direction, and the pixel value corresponding to each pixel in the vertical grayscale image represents the image grayscale value of the pixel in the vertical direction. For example, the horizontal grayscale image can be obtained by calculation as shown in Formula 2-2, and the vertical grayscale image can be obtained by calculation as shown in Formula 2-3. After obtaining the horizontal grayscale image and the vertical grayscale image, the edge detection image of the second label image can be obtained based on the horizontal grayscale image and the vertical grayscale image. For example, the edge detection image can be obtained by calculation as shown in Formula 2-4.

[0073] G x =G_x*A Formula 2-2

[0074] Gy =G_y*A Formula 2-3

[0075] |G|=|G x |+|G y | Formula 2-4

[0076] Among them, A represents the second label image, G_x represents the horizontal gradient convolution kernel, G x Represents the horizontal grayscale image; G_y represents the vertical gradient convolution kernel, G y Represents a vertical grayscale image; G represents an edge detection image.

[0077] Then, after obtaining the edge detection image, the edge detection image is binarized to obtain a second training image. For example, a specific implementation of binarizing the edge detection image may be as follows: updating the pixel values ​​of pixels in the edge detection image whose pixel values ​​are greater than or equal to a first preset threshold to a first value. When the pixel value of a certain pixel is greater than or equal to the first value, the pixel can be determined to be an edge point. Updating the pixel values ​​of pixels in the edge detection image whose pixel values ​​are less than the first preset threshold to a second value. The first preset threshold can be pre-set, for example, the first preset threshold can be 220, or other values ​​that are smaller than 255 but have a small difference from 255. The first preset threshold is not specifically limited unless otherwise specified in the application. The first value can be 0, and the second value can be 255. It should be understood that when the pixel value of a certain pixel is 0, it indicates that the color corresponding to the pixel is black, and when the pixel value of a certain pixel is 255, it indicates that the color corresponding to the pixel is white. Then, through the above-mentioned image binarization process, the edge detection image can be processed into a black and white image. This black and white image is the second training image. The white in this second training image represents the background, and the black represents the edge contours, that is, the outlines of various scenes. For example, if the first label image contains scenes such as trees and attics, the second training image will display the outlines of the trees, attics, etc.

[0078] In one implementation, after obtaining the scene ink painting, the scene ink painting can be displayed on the user operation interface. For example, the scene ink painting can be displayed on Figure 3a In the result display area marked by 302.

[0079] In an embodiment of the present application, scene lines input on a user operation interface can be obtained, and an initial scene image can be generated based on the scene lines. Then, a scene outline can be generated in the initial scene image based on the scene lines included in the initial scene image, and texture lines can be added to the initial scene image from which the scene outline was generated to obtain a texture line image. Furthermore, the texture line image can be ink-processed to obtain a scene ink image of the initial scene image, and the scene ink image can be displayed on the user operation interface. Through the above method, a complete ink image can be automatically generated based on simple lines input by the user, effectively improving the intelligence of image generation, effectively increasing the efficiency of generating ink images, and improving the user experience.

[0080] See Figure 5 , Figure 5 This is a flow chart of a method for generating an ink painting image provided by an embodiment of the present application. The method for generating an ink painting image can be executed by the aforementioned computer device, which can be a terminal or a server. For ease of explanation, the present application embodiment uses a computer device executing the image processing method as an example. The method for generating an ink painting image includes the following steps:

[0081] S501: Acquire scene lines input by a user on a user operation interface, and generate an initial scene image based on the scene lines.

[0082] S502: generating a scene outline in the initial scene image according to scene lines included in the initial scene image, and adding texture lines to the initial scene image in which the scene outline is generated, to obtain a texture line image.

[0083] S503: performing ink-wash processing on the texture line image to obtain a scene ink-wash image of the initial scene image.

[0084] S504: Determine an animation area from the scene ink image according to the pixel values ​​of the pixel points included in the texture line image.

[0085] In one implementation, a scene ink image can be segmented to determine a target area within the scene ink image. The target area can be an animation area, and the animation area can be an area to which dynamic special effects can be added. In a specific implementation, the animation area can be determined from the scene ink image based on the pixel values ​​of the pixels included in the texture line image. For example, the scene ink image can be segmented based on the pixel values ​​of the pixels included in the texture line image. Optionally, the pixel values ​​of the pixels in the texture line image can be scanned from top to bottom, and the area containing the pixels in the texture line image whose pixel values ​​are greater than a second preset threshold is determined as a reference animation area. Among them, the second preset threshold can be set in advance, and the second preset threshold can be a value such as 240, 230, etc. The specific value is not limited in this application. The second preset threshold can be as close to 255 as possible. It can be understood that in an image, when the pixel value of a pixel point is 255, the color corresponding to the pixel point is white, that is, there is no scene at the position corresponding to the pixel point, then the position corresponding to the pixel point with a pixel value close to 255 may also not have a specific scene, and the area where there is no specific scene can be determined as the reference animation area.

[0086] Optionally, considering that when adding target animation effects to landscape-style ink-wash images, dynamic elements such as "cranes," "flying birds," "auspicious clouds," and "sun" are typically added, and these dynamic elements are typically added to the upper half of the ink-wash image, when determining the animation area within the ink-wash image based on the pixel values ​​of the pixels included in the texture line image, the upper half of the texture line image can be scanned for pixel values ​​in the texture line image from top to bottom. When the pixel value of a scanned pixel in the texture line image is greater than a second preset threshold, the pixel is marked as a first identifier. When the pixel value of a scanned pixel in the texture line image is less than or equal to the second preset threshold, the pixel and all pixels below it are marked as a second identifier. The area within the texture line image containing pixels with pixel values ​​greater than the second preset threshold can then be determined as the animation area, indicating that specific scenery, such as mountains, trees, or attics, is absent in this area. When determining the animation area, the present application can ensure that the animation area is in the rear area of ​​the scene ink image to avoid blocking the foreground scene.

[0087] The first mark and the second mark can be arbitrary and only need to be used to distinguish two different areas. For example, the first mark can be 1 and the second mark can be 0. Through the above marks, a mask image can be obtained based on the texture line image. Figure 6aThe image marked by 601 is a texture line image, and the image marked by 602 is a texture line image (mask image) obtained after marking. This image includes white and black areas. The area where the second mark is located can be the black area in the image marked by 602, and the area where the first mark is located can be the white area in the image marked by 602. This white area is the target animation area, i.e., the area where target animation effects can be added later. In actual scenes, it can represent the area behind the mountain.

[0088] The reference animation area determined above is an area within the textured line image. After determining the reference animation area within the textured line image, the animation area within the textured line image can be determined based on the reference animation area within the textured line image. It is understood that the textured line image and the scene ink image are of the same size and contain the same specific scene. Therefore, the area within the scene ink image that is co-located with the reference animation area within the textured line image can be determined as the animation area within the scene ink image.

[0089] S505: Acquire a target animation effect, and add the target animation effect to the animation area in the scene ink image to obtain the scene ink image with the target animation effect added.

[0090] Among them, the target animation feature can be dynamic elements such as "distant mountains", "cranes", "flying birds", "auspicious clouds", and "sun".

[0091] Optionally, the target animation effect can be randomly selected by the computer device from an animation effect library. For example, a pre-set animation effect library containing a variety of animation effects can be provided. Once the computer device determines the scene ink image, it can randomly select one or more animation effects from the animation effect library as the target animation effect.

[0092] Optionally, the target animation effect may be a fixed dynamic effect set by the computer device. For example, one or more animation effects may be pre-set. Then, after the computer device determines the ink image of the scene, the pre-set one or more animation effects may be determined as the target animation effect.

[0093] Optionally, the target animation effect may be determined based on a user's selection. For example, there may be animation effects for the user to select on the user operation interface. When the user's selection operation is detected, the animation effect selected by the user may be determined as the target animation effect.

[0094] In one implementation, after determining a target animation effect, the target animation effect can be added to the animation area of ​​the scene ink image, thereby obtaining a scene ink image with the target animation effect added. The scene ink image with the target animation effect added can be referred to as an ink animation image. When adding the target animation effect to the animation area, the effect can be added at any location within the animation area or at a specified location. The specified location can be pre-set, for example, the center or upper left of the animation area.

[0095] S506: Displaying the scene ink image with the target animation effect added on the user operation interface.

[0096] In one implementation, the ink image of the scene with the target animation effect added (ie, the ink animation image) can be displayed on the user operation interface. Figure 6b The images marked by 603 are from Figure 6b It can be seen from the figure that the target animation effect of the ink-and-wash animation image is "auspicious clouds".

[0097] In one implementation, the output may also be Figure 6c The user operation interface shown in FIG. 1 includes a control area for the user to select the desired image. The images for the user to select may include texture line images, scene ink images, and ink animation images. The control area may include texture line image controls, scene ink image controls, and ink animation image controls. For example, the control area may be as follows: Figure 6c In the area marked by 604, when a user clicks different controls in the area marked by 604, the image displayed in the result display area marked by 605 is also different. For example, when a user clicks the texture line image control, the image displayed in the result display area marked by 605 is a texture line image. For another example, when a user clicks the scenery ink image control, the image displayed in the result display area marked by 605 is a scenery ink image. For another example, when a user clicks the ink animation image control, the image displayed in the result display area marked by 605 is an ink animation image.

[0098] The specific implementation of steps S501-S503 can refer to the specific description of steps S201-S203 in the above embodiment, which will not be repeated here.

[0099] In an embodiment of the present application, the scene lines input by the user on the user operation interface can be obtained, and an initial scene image can be generated based on the scene lines. Thus, the initial scene image can be processed with lines to obtain a texture line image of the initial scene image, and then the texture line image can be processed with ink to obtain a scene ink image of the initial scene image. It is also possible to determine the animation area from the scene ink image based on the pixel values ​​of the pixel points included in the texture line image, and obtain the target animation special effect, so as to add the target animation special effect to the animation area in the scene ink image to obtain an ink animation image, so as to display the ink animation image on the user operation interface. Through the above method, an ink style image can be automatically generated based on the simple lines input by the user, and special effects processing can be performed on the ink style image to automatically generate an ink animation image, which effectively improves the intelligence of image generation, effectively improves the efficiency of generating ink animation images, and also improves the user experience.

[0100] See also Figure 7 , is a schematic diagram of the structure of a device for generating an ink painting image provided in an embodiment of the present application. The device for generating an ink painting image described in this embodiment includes:

[0101] A generating unit 701 is configured to obtain scene lines inputted on a user operation interface and generate an initial scene image based on the scene lines;

[0102] A first determining unit 702 is configured to generate a scene outline in the initial scene image according to scene lines included in the initial scene image, and to add texture lines to the initial scene image from which the scene outline is generated, to obtain a texture line image;

[0103] The second determining unit 703 is configured to perform ink-wash processing on the texture line image to obtain a scene ink-wash image of the initial scene image, and display the scene ink-wash image on the user operation interface.

[0104] In one implementation, the second determining unit 703 is specifically configured to:

[0105] determining an animation area from the scene ink image according to pixel values ​​of pixels included in the texture line image;

[0106] Acquire a target animation effect, and add the target animation effect to an animation region in the scene ink image to obtain a scene ink image with the target animation effect added;

[0107] The scene ink image with the target animation effect added thereto is displayed on the user operation interface.

[0108] In one implementation, the first determining unit 702 is specifically configured to:

[0109] Calling a line processing model to perform line processing on scene lines included in the initial scene image to obtain a texture line image, wherein the line processing includes generating a scene outline in the initial scene image and adding texture lines to the initial scene image having the generated scene outline;

[0110] The line processing model is obtained by training a generative adversarial model using a first training image set; the first training image set includes one or more first training image pairs, each first training image pair includes a first training image and a first label image corresponding to the first training image; the first training image is an image generated by scene lines, and the first label image is obtained by performing line processing on the first training image.

[0111] In one implementation, the generative adversarial model includes a generation module and a discrimination module; the first determination unit 702 is specifically configured to:

[0112] For any first training image pair in the first training image set, input the first training image in the first training image pair into a generation module in the generative adversarial model to obtain a predicted image of the first training image;

[0113] Inputting the predicted image and the first labeled image in the first training image pair into a discrimination module in the generative adversarial model to obtain a discrimination result;

[0114] Training the generative adversarial model according to the predicted image, the first label image, and the discrimination result to obtain target model parameters, wherein the target model parameters include model parameters of the generation module;

[0115] A line processing model is determined according to the target model parameters, and the line processing model includes a generation module.

[0116] In one implementation, the first determining unit 702 is specifically configured to:

[0117] adding a plurality of target parabolas to the first training image, and generating a first training image including a scene outline according to the plurality of target parabolas;

[0118] Texture lines are added to the first training image including the scene outline to obtain a first label image corresponding to the first training image.

[0119] In one implementation, the second determining unit 703 is specifically configured to:

[0120] Invoking an ink-and-wash conversion model to perform ink-and-wash processing on the texture line image to obtain a scene ink-and-wash image of the initial scene image;

[0121] The ink-wash conversion model is obtained by training a second training image set; the second training image set includes one or more second training image pairs, each second training image pair includes a second training image and a second label image corresponding to the second training image; the second label image includes an ink-wash image; the second training image is obtained by performing image edge processing on the second label image.

[0122] In one implementation, the second determining unit 703 is specifically configured to:

[0123] Performing a convolution operation on the second label image using a gradient feature operator to obtain an edge detection image of the second label image;

[0124] The pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are greater than or equal to the first preset threshold are updated to a first value, and the pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are less than the first preset threshold are updated to a second value to obtain a second training image.

[0125] In one implementation, the second determining unit 703 is specifically configured to:

[0126] Scanning the texture line image according to a top-to-bottom scanning rule;

[0127] Determining an area where pixels having pixel values ​​greater than a second preset threshold value in the texture line image are located as a reference animation area;

[0128] An animation area in the scene ink image is determined according to a reference animation area in the texture line image.

[0129] It is understood that the division of units in the embodiments of the present application is schematic and is merely a logical functional division. In actual implementation, other division methods may be used. The functional units in the embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0130] See also Figure 8 , Figure 8801 and 802. The figure is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device described in this embodiment can be a terminal or a server, and includes a processor 801 and a memory 802. Optionally, the computer device may also include a network interface 803. The processor 801, the memory 802, and the network interface 803 can exchange data.

[0131] The processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.

[0132] The memory 802 may include a read-only memory and a random access memory, and provides program instructions and data to the processor 801. A portion of the memory 802 may also include a non-volatile random access memory. When the processor 801 calls the program instructions, it is used to execute:

[0133] Determine a target object and a sample object set, where the sample object set includes one or more sample objects, and all sample objects in the sample object set correspond to M risk categories;

[0134] Determining N sample objects whose risk categories are target risk categories from the sample object set, where the target risk category is any one of the M risk categories;

[0135] Obtaining a risk weight of each of the N sample objects in the target risk category, and determining an association strength between the target object and each of the sample objects;

[0136] Determining the risk weight of the target object in the target risk category according to the risk weight of each sample object in the target risk category and the strength of association between the target object and each sample object;

[0137] The risk information of the target object is determined according to the risk weight of the target object in the target risk category.

[0138] In one implementation, the processor 801 is specifically configured to:

[0139] determining an animation area from the scene ink image according to pixel values ​​of pixels included in the texture line image;

[0140] Acquire a target animation effect, and add the target animation effect to an animation region in the scene ink image to obtain a scene ink image with the target animation effect added;

[0141] The scene ink image with the target animation effect added thereto is displayed on the user operation interface.

[0142] In one implementation, the processor 801 is specifically configured to:

[0143] Calling a line processing model to perform line processing on scene lines included in the initial scene image to obtain a texture line image, wherein the line processing includes generating a scene outline in the initial scene image and adding texture lines to the initial scene image having the generated scene outline;

[0144] The line processing model is obtained by training a generative adversarial model using a first training image set; the first training image set includes one or more first training image pairs, each first training image pair includes a first training image and a first label image corresponding to the first training image; the first training image is an image generated by scene lines, and the first label image is obtained by performing line processing on the first training image.

[0145] In one implementation, the generative adversarial model includes a generation module and a discrimination module; the processor 801 is specifically configured to:

[0146] For any first training image pair in the first training image set, input the first training image in the first training image pair into a generation module in the generative adversarial model to obtain a predicted image of the first training image;

[0147] Inputting the predicted image and the first labeled image in the first training image pair into a discrimination module in the generative adversarial model to obtain a discrimination result;

[0148] Training the generative adversarial model according to the predicted image, the first label image, and the discrimination result to obtain target model parameters, wherein the target model parameters include model parameters of the generation module;

[0149] A line processing model is determined according to the target model parameters, and the line processing model includes a generation module.

[0150] In one implementation, the processor 801 is specifically configured to:

[0151] adding a plurality of target parabolas to the first training image, and generating a first training image including a scene outline according to the plurality of target parabolas;

[0152] Texture lines are added to the first training image including the scene outline to obtain a first label image corresponding to the first training image.

[0153] In one implementation, the processor 801 is specifically configured to:

[0154] Invoking an ink-and-wash conversion model to perform ink-and-wash processing on the texture line image to obtain a scene ink-and-wash image of the initial scene image;

[0155] The ink-wash conversion model is obtained by training a second training image set; the second training image set includes one or more second training image pairs, each second training image pair includes a second training image and a second label image corresponding to the second training image; the second label image includes an ink-wash image; the second training image is obtained by performing image edge processing on the second label image.

[0156] In one implementation, the processor 801 is specifically configured to:

[0157] Performing a convolution operation on the second label image using a gradient feature operator to obtain an edge detection image of the second label image;

[0158] The pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are greater than or equal to the first preset threshold are updated to a first value, and the pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are less than the first preset threshold are updated to a second value to obtain a second training image.

[0159] In one implementation, the processor 801 is specifically configured to:

[0160] Scanning the texture line image according to a top-to-bottom scanning rule;

[0161] Determining an area where pixels having pixel values ​​greater than a second preset threshold value in the texture line image are located as a reference animation area;

[0162] An animation area in the scene ink image is determined according to a reference animation area in the texture line image.

[0163] The embodiment of the present application further provides a computer storage medium in which program instructions are stored. When the program is executed, the program may include: Figure 2 or Figure 5Part or all of the steps of the method for generating an ink painting image in the corresponding embodiment.

[0164] It should be noted that for the aforementioned various method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0165] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0166] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps performed in the above-described method embodiments.

[0167] The above is a detailed introduction to the method, device, computer equipment and medium for generating an ink painting image provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for generating an ink painting image, characterized in that: include: Acquiring scene lines input on a user operation interface, and generating an initial scene image based on the scene lines; Calling a line processing model to perform line processing on scene lines included in the initial scene image to obtain a texture line image, wherein the line processing includes generating a scene contour in the initial scene image and adding texture lines to the initial scene image having the generated scene contour; the line processing model is obtained by training a generative adversarial model using a first training image set; the first training image set includes one or more first training image pairs, each first training image pair including a first training image and a first label image corresponding to the first training image; the first training image is an image generated by scene lines, and the first label image is obtained by performing line processing on the first training image; wherein the step of performing line processing on the first training image to obtain a first label image corresponding to the first training image includes: adding a plurality of target parabolas to the first training image, generating a first training image including a scene contour based on the plurality of target parabolas; and adding texture lines to the first training image including the scene contour to obtain a first label image corresponding to the first training image; The texture line image is subjected to ink-wash processing to obtain a scene ink-wash image of the initial scene image, and the scene ink-wash image is displayed on the user operation interface.

2. The method according to claim 1, characterized in that The step of displaying the ink-wash image of the scene on the user operation interface includes: determining an animation area from the scene ink image according to pixel values ​​of pixels included in the texture line image; Acquire a target animation effect, and add the target animation effect to an animation region in the scene ink image to obtain a scene ink image with the target animation effect added; The scene ink image with the target animation effect added thereto is displayed on the user operation interface.

3. The method according to claim 1, characterized in that The generative adversarial model includes a generation module and a discrimination module; The step of training the generative adversarial model using the first training image set to obtain a line processing model includes: For any first training image pair in the first training image set, input the first training image in the first training image pair into a generation module in the generative adversarial model to obtain a predicted image of the first training image; Inputting the predicted image and the first labeled image in the first training image pair into a discrimination module in the generative adversarial model to obtain a discrimination result; Training the generative adversarial model according to the predicted image, the first label image, and the discrimination result to obtain target model parameters, wherein the target model parameters include model parameters of the generation module; A line processing model is determined according to the target model parameters, and the line processing model includes a generation module.

4. The method according to any one of claims 1 to 3, characterized in that The step of performing ink-wash processing on the texture line image to obtain the scene ink-wash image of the initial scene image includes: Invoking an ink-and-wash conversion model to perform ink-and-wash processing on the texture line image to obtain a scene ink-and-wash image of the initial scene image; The ink-wash conversion model is obtained by training a second training image set; the second training image set includes one or more second training image pairs, each second training image pair includes a second training image and a second label image corresponding to the second training image; the second label image includes an ink-wash image; the second training image is obtained by performing image edge processing on the second label image.

5. The method according to claim 4, characterized in that The step of performing image edge processing on the second label image to obtain a second training image includes: Performing a convolution operation on the second label image using a gradient feature operator to obtain an edge detection image of the second label image; The pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are greater than or equal to the first preset threshold are updated to a first value, and the pixel values ​​of the pixel points in the edge detection image whose pixel values ​​are less than the first preset threshold are updated to a second value to obtain a second training image.

6. The method according to claim 2, characterized in that Determining the animation area from the scene ink image according to the pixel values ​​of the pixel points included in the texture line image includes: Scanning the texture line image according to a top-to-bottom scanning rule; Determining an area where pixels having pixel values ​​greater than a second preset threshold value in the texture line image are located as a reference animation area; An animation area in the scene ink image is determined according to a reference animation area in the texture line image.

7. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image processing method and device and storage medium

    CN112017257A

  • Image processing method and device, storage medium and computer equipment

    CN113034523A

Cited By

  • 3D scene wash and ink painting style rendering method based on 3dsmax

    CN115880413A