[go: up one dir, main page]

CN116778015A - Model edge tracing method and device, electronic equipment and storage medium - Google Patents

Model edge tracing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116778015A
CN116778015A CN202310762928.2A CN202310762928A CN116778015A CN 116778015 A CN116778015 A CN 116778015A CN 202310762928 A CN202310762928 A CN 202310762928A CN 116778015 A CN116778015 A CN 116778015A
Authority
CN
China
Prior art keywords
edge
map
target model
target
preset threshold
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
CN202310762928.2A
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202310762928.2A priority Critical patent/CN116778015A/en
Publication of CN116778015A publication Critical patent/CN116778015A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The application provides a method, a device, electronic equipment and a storage medium for model description, wherein the method comprises the steps of obtaining a target model to be described and normal information of the target model; performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph; performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value; and carrying out fuzzy processing on the first edge map based on the second edge map to obtain a tracing effect map of the target model, so that the tracing effect map of the finally obtained target model can realize the tracing effect of the ink-water style.

Description

Model edge tracing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of model rendering technologies, and in particular, to a method and apparatus for model edge tracing, an electronic device, and a storage medium.
Background
This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
Stroking is a technique commonly used in graphics rendering to enhance the feel of contours and stereo perception of images by adding lines to the edges of the image model. However, in the related art, the method of tracing the edges of the model only simulates the effect produced by a hard pen, and cannot produce the rich texture effects of thickness, pen touch, halation and rice paper in the ink painting.
Disclosure of Invention
In view of the foregoing, the present application is directed to a method, an apparatus, an electronic device and a storage medium for model description.
Based on the above objects, the present application provides a method for model tracing, comprising:
acquiring a target model of a to-be-traced edge and normal information of the target model;
determining an initial threshold value corresponding to each set of adjacent vertices in the target model based on the target noise map;
performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map;
performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; wherein the first preset threshold is less than the second preset threshold;
And blurring processing is carried out on the first edge map based on the second edge map, so that a tracing effect map of the target model is obtained.
Based on the same inventive concept, the exemplary embodiments of the present application also provide a device for model description, including:
the acquisition module is used for acquiring a target model of the edge to be traced and normal information of the target model;
the determining module is used for determining an initial threshold value corresponding to each group of adjacent vertexes in the target model based on the target noise map;
the first extraction module is used for extracting edges of the target model based on a first preset threshold and the normal information to obtain a first edge map;
the second extraction module is used for extracting edges of the target model based on a second preset threshold and the normal information to obtain a second edge map; wherein the first preset threshold is less than the second preset threshold;
and the blurring module is used for blurring the first edge map based on the second edge map to obtain a tracing effect map of the target model.
Based on the same inventive concept, the exemplary embodiments of the present application also provide an electronic device including a memory, a processor, and a computer program stored on the memory and executable by the processor, the processor implementing the method of model tracing as described above when executing the program.
Based on the same inventive concept, exemplary embodiments of the present application also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of model stroking as described above.
From the above, the method, the device, the electronic equipment and the storage medium for model description provided by the application acquire the target model to be described and the normal information of the target model; performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph; performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value; and blurring processing is carried out on the first edge map based on the second edge map to obtain a tracing effect map of the target model, blurring processing is carried out on the first edge map with thinner lines through the second edge map with thicker lines, and the diffusion effect of ink on paper can be simulated, so that the tracing effect map of the finally obtained target model can realize the tracing effect of the ink-water style.
Drawings
In order to more clearly illustrate the technical solutions of the present application or related art, the drawings that are required to be used in the description of the embodiments or related art will be briefly described below, and it is apparent that the drawings in the following description are only embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort to those of ordinary skill in the art.
Fig. 1 is a schematic diagram of an application scenario according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of model tracing according to an embodiment of the application;
FIG. 3 is a schematic diagram of a tracing effect of a target model according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a model hemming device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a specific electronic device according to an embodiment of the present application.
Detailed Description
The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are presented merely to enable those skilled in the art to better understand and practice the application and are not intended to limit the scope of the application in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
According to the embodiment of the application, a method, a system, electronic equipment and a storage medium for model description are provided.
In this document, it should be understood that any number of elements in the drawings is for illustration and not limitation, and that any naming is used only for distinction and not for any limitation.
The principles and spirit of the present application are explained in detail below with reference to several representative embodiments thereof.
Summary of The Invention
At present, in the related art, the method for tracing the edges of the model can only simulate the effect produced by a hard pen, and cannot produce rich pen touch, halation and texture effects of rice paper in ink painting. In addition, the related technology also uses a mode of back vertex extension to finish the edge tracing effect of the model, but the method has larger performance consumption on a rendering engine and cannot be suitable for scenes with a large number of models.
In order to solve the above problems, the present application provides a method for tracing a model, which specifically includes:
acquiring a target model of a to-be-traced edge and normal information of the target model; performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph; performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value; and blurring processing is carried out on the first edge map based on the second edge map to obtain a tracing effect map of the target model, blurring processing is carried out on the first edge map with thinner lines through the second edge map with thicker lines and different thicknesses, and the diffusion effect of ink on paper can be simulated, so that the tracing effect map of the finally obtained target model can realize the tracing effect of the ink and water style.
Having described the basic principles of the present application, various non-limiting embodiments of the application are described in detail below.
Application scene overview
In some specific application scenarios, the method of model tracing of the present application may be applied to various platforms or systems involving model tracing. As an example, referring to fig. 1, the application scenario includes at least one server 102 and at least one terminal 101. Terminal devices include, but are not limited to, desktop computers, mobile phones, mobile computers, tablet computers, media players, smart wearable device televisions, personal digital assistants (personal digital assistant, PDAs), or other electronic devices capable of performing the functions described above, and the like. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms. The server and the terminal can communicate through a network so as to realize data transmission. Wherein the network may be a wired network or a wireless network, which is not particularly limited by the present application.
The server may be a server providing various services. In particular, the server may be configured to provide background services for applications running on the terminal. Optionally, in some implementations, the method for model tracing provided by the embodiment of the present application may be performed by a terminal device. Alternatively, in some implementations, the method for model tracing provided by the embodiments of the present application may be performed by a server. The server may be hardware or software. When the server is hardware, the server may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (e.g., software or software modules for providing distributed services), or as a single software or software module. The embodiment of the present application is not particularly limited thereto.
Alternatively, the wireless network or wired network uses standard communication techniques and/or protocols. The network is typically the internet, but can be any network including, but not limited to, a local area network (local area network, LAN), metropolitan area network (metropolitan area network, MAN), wide area network (wide area network, WAN), mobile, wired or wireless network, private network, or any combination of virtual private networks. In some embodiments, data exchanged over the network is represented using techniques and/or formats including hypertext markup language (HTML), extensible markup language (extensible markup language, XML), and the like. In addition, all or some of the links can be encrypted using conventional encryption techniques such as secure socket layer (secure socket layer, SSL), transport layer security (transport layer security, TLS), virtual private network (virtual private network, VPN), internet protocol security (internet protocol security, IPsec), and the like. In other embodiments, custom and/or dedicated data communication techniques can also be used in place of or in addition to the data communication techniques described above.
The method of model stroking according to an exemplary embodiment of the present application is described below in connection with a specific application scenario. It should be noted that the above application scenario is only shown for the convenience of understanding the spirit and principle of the present application, and the embodiments of the present application are not limited in any way. Rather, embodiments of the application may be applied to any scenario where applicable.
Exemplary method
Referring to fig. 2, an embodiment of the present application provides a method of model tracing, and an execution subject of the method of model tracing may be, but is not limited to, a server or a terminal device. The method comprises the following steps:
s101, acquiring a target model of a to-be-traced edge and normal line information of the target model.
In particular implementations, the target model of the to-be-traced edge may be any one or more models in the rendered image. The normal information of the model includes the normal of each vertex on the model, alternatively, the normal of each vertex may be represented by a vector or spatial coordinates.
S102, carrying out edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph.
In the implementation, edge extraction can be performed on the target model according to a first preset threshold and the normal information, so as to obtain a first edge map. Note that, the specific operation of performing edge extraction may refer to the method of edge extraction in the related art, which is not limited. Alternatively, vertices with normal differences between adjacent vertices greater than a first preset threshold may be directly determined as edge vertices, and then the first edge map is determined through all the edge vertices.
In some embodiments, edge extraction is performed on the target model based on a first preset threshold and the normal information to obtain a first edge map, which specifically includes:
acquiring a target noise map, and determining initial thresholds corresponding to each group of adjacent vertexes in the target model based on the target noise map so that the initial thresholds corresponding to each group of adjacent vertexes in the target model are not identical;
determining a first edge threshold corresponding to each group of adjacent vertexes based on the initial threshold and the first preset threshold;
determining a normal difference value of each group of adjacent vertexes based on the normal information;
determining adjacent vertexes of which the normal difference values are larger than the corresponding first edge threshold values as first edge vertexes;
And obtaining the first edge graph based on all the first edge vertexes.
In implementation, after the target noise map is obtained, an initial threshold corresponding to each set of adjacent vertices in the target model may be determined according to the target noise map. Because the gray values of the points in the target noise map are not evenly distributed, the specific initial threshold value with differentiation corresponding to each group of adjacent vertexes can be determined through the target noise map. When the edge extraction is performed on the target model through the initial threshold, the first preset threshold and the normal information, the first edge threshold corresponding to each group of adjacent vertexes is determined according to the initial threshold and the first preset threshold of each group of adjacent vertexes, alternatively, the first edge threshold can be obtained by directly multiplying the initial threshold and the first preset threshold, or the weighted sum of the initial threshold and the first preset threshold can be calculated and used as the first edge threshold, and the method is not limited. It should be noted that, since the initial thresholds corresponding to the different sets of adjacent vertices are different, the first edge threshold determined by the initial thresholds generates a difference between the different sets of adjacent vertices, and this difference may implement that the thickness of the line of the edge map finally extracted by the edge is different, that is, the number of edge vertices in the direction perpendicular to the extending direction of the line is different. After determining the first edge threshold value corresponding to each group of adjacent vertexes, determining the normal difference value of each group of adjacent vertexes, namely, the difference value of the normal lines of two vertexes in each group of adjacent vertexes, wherein the larger the normal difference value is, the larger the probability that the two vertexes belong to two different faces on the model is, and the junction between the faces in the model is the edge of the model. Therefore, in edge extraction, it is mainly determined whether the normal line difference between two adjacent vertices is greater than a set threshold. When the normal difference value of each group of adjacent vertexes is larger than the first edge threshold value corresponding to the group of adjacent vertexes, the group of adjacent vertexes are determined to be first edge vertexes, and then the first edge graph is obtained through all the first edge vertexes, namely, the first edge graph is formed by all the first edge vertexes, and optionally, all the first edge vertexes can be extracted to form the first edge graph corresponding to the target model.
In some embodiments, the target noise map is a randomly generated noise map, or a pre-set noise map. Optionally, the target noise map may be any noise map obtained randomly, or may be a noise map preset according to needs, and optionally, the preset noise map may be obtained by manually drawing. It should be noted that, in the embodiment of the present application, the target noise patch refers to a 2d noise patch.
In some embodiments, the step of obtaining the target noise map specifically includes:
and determining a target noise map corresponding to the target model from a plurality of preset noise maps.
In specific implementation, when the target noise map is determined, the target noise map matched with the target model can be determined from a plurality of preset noise pastes, so that the final obtained edge painting effect with the ink and wash style is more matched with the target model, and the pen method during drawing is more matched with the pen method during drawing Shui Mo. Alternatively, setting a plurality of preset noise maps corresponding to different types of models can be achieved, then labeling the type of each preset noise map, and then determining the target noise map from the plurality of preset noise maps according to the type of the current target model. Optionally, after setting a plurality of preset noise maps, the neural network model may also be trained to determine a target noise map corresponding to the target model. The specific process of training the neural network model may refer to a training method of the neural network model in the related art, which is not limited.
S103, carrying out edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold is smaller than the second preset threshold.
In the implementation, edge extraction can be performed on the target model according to a second preset threshold and the normal information, so as to obtain a second edge map. It should be noted that, the first preset threshold is smaller than the second preset threshold, and the first preset threshold and the second preset threshold may integrally control the thickness of the edge determined by edge extraction, so that the lines of the first edge map are smaller than those of the second edge map.
In some embodiments, edge extraction is performed on the target model based on a second preset threshold and the normal information to obtain a second edge map, which specifically includes:
acquiring a target noise map, and determining initial thresholds corresponding to each group of adjacent vertexes in the target model based on the target noise map so that the initial thresholds corresponding to each group of adjacent vertexes in the target model are not identical;
determining a second edge threshold corresponding to each group of adjacent vertexes based on the initial threshold and the second preset threshold;
Determining a normal difference value of each group of adjacent vertexes based on the normal information;
determining adjacent vertexes of which the normal difference value is larger than the corresponding second edge threshold value as second edge vertexes;
and obtaining the second edge graph based on all the second edge vertices.
It should be noted that the process of obtaining the second edge map is similar to the process of obtaining the first edge map, and will not be described herein. The main difference between the two is that the second edge threshold corresponding to the second edge graph is mainly obtained by participation of a second preset threshold larger than the first preset threshold, so that the lines in the second edge graph are thicker than those in the first edge graph.
In some embodiments, determining an initial threshold value corresponding to each set of neighboring vertices in the target model based on the target noise map specifically includes:
performing downsampling treatment on the target noise map to obtain a downsampled target noise map;
carrying out Gaussian blur processing on the target noise map after downsampling to obtain a target noise map after Gaussian blur processing;
and determining an initial threshold value corresponding to each group of adjacent vertexes in the target model based on the target noise map after Gaussian blur processing.
In specific implementation, if the frequency of the target noise map is too high, the accuracy of edge extraction may be affected, meanwhile, the Gaussian blur processing may be performed on the target noise map after the downsampling in consideration of the diffusion of fluid in the ink style in paper, and after the target noise map after the Gaussian blur processing is obtained, the initial threshold value corresponding to each group of adjacent vertexes in the target model may be determined more accurately according to the target noise map after the Gaussian blur processing.
In some embodiments, determining an initial threshold value corresponding to each group of adjacent vertices in the target model based on the gaussian blur processed target noise map specifically includes:
performing inverse processing on the target noise map after Gaussian blur processing to obtain an inverse target noise map;
for each set of adjacent vertices in the target model, determining a gray value of the adjacent vertex at a corresponding position in the inverted target noise map, and determining an initial threshold of the adjacent vertex based on the gray value of the corresponding position.
In a specific implementation, when determining the initial threshold value corresponding to each group of adjacent vertexes through the target noise map, the initial threshold value corresponding to each group of adjacent vertexes may be determined according to the color of the pixel point in the target noise map, in general, the darker the color (the deepest is black) of the pixel point in the target noise map is, the smaller the darker the color is for the gray value of the noise map, the gray value corresponding to black is 0, the gray value corresponding to white is 1, for convenience in calculation, the inverse processing may be performed on the target noise map after the gaussian blur processing, the gray value corresponding to black is 1, and the gray value corresponding to white is 0 after the inverse processing. After the inverse target noise map is obtained, the gray value of the corresponding position of each group of adjacent vertexes can be determined in the inverse target noise map, alternatively, each vertex in each group of adjacent vertexes is generally corresponding to one gray value, when the gray value of the corresponding position of each group of adjacent vertexes is determined, the target vertex can be determined from two adjacent vertexes, then the gray value of the target vertex is used as the gray value of the corresponding position of the group of adjacent vertexes, alternatively, the target vertexes can be determined according to the sequence of traversing all vertexes. Alternatively, in some embodiments, the average value of the gray values of the two vertices may be calculated as the gray value of the corresponding position of each group of adjacent vertices, or the maximum value may be selected from the average value as the gray value of the corresponding position of each group of adjacent vertices, which is not limited.
In some embodiments, determining the initial threshold of the neighboring vertex based on the gray value of the corresponding position specifically includes:
for each set of neighboring vertices in the target model, determining a normal change rate for the neighboring vertices based on normal information, determining an initial threshold for the neighboring vertices based on the normal change rate and the gray value for the corresponding location.
In particular, given that in an ink-style drawing, where the general model is curved, the corresponding lines produced will be thicker, the rate of change of normals to adjacent vertices may be further determined, which may be used to represent the degree of curvature of the target model at the set of vertices, in some embodiments. Alternatively, when calculating the normal change rate of the adjacent vertexes, the partial derivative of the normal of the adjacent two vertexes may be calculated, and the partial derivative may be used as the normal change rate of the adjacent vertexes, or the difference between the normal of the adjacent two vertexes may be directly calculated, and the difference may be used as the normal change rate of the adjacent vertexes, which is not limited. Alternatively, when calculating the difference value of the normals of the two adjacent vertexes, the normal information may be rendered into the 2D image, and then the difference value of the normals of the two adjacent vertexes may be determined according to the color difference value of the corresponding pixel point on the rendered 2D image. After the normal change rate of the adjacent vertexes is obtained, the initial threshold value of the adjacent vertexes can be determined together according to the normal change rate and the gray value of the corresponding position, so that the final obtained ink-wash style edge tracing effect can simulate a writing method with different writing brush thickness, and the thickness change of lines along with the bending degree can be controlled. Optionally, when determining the initial threshold value of the adjacent vertex according to the normal change rate and the gray value of the corresponding position, the initial threshold value may be obtained by directly multiplying the two values, or the two values may be weighted and summed, which is not limited.
And S104, blurring processing is carried out on the first edge map based on the second edge map, and a tracing effect map of the target model is obtained.
In the implementation, after the first edge map and the second edge map are obtained, the first edge map may be subjected to blurring processing according to the second edge map, so as to obtain an edge tracing effect map of the target model. The method for performing the blurring process specifically may refer to a method for performing a blurring process in the related art, and is not limited thereto.
In some embodiments, blurring processing is performed on the first edge map based on the second edge map to obtain a tracing effect map of the target model, which specifically includes:
randomly generating a 3d noise image corresponding to the target model, and superposing the 3d noise image and the second edge image to obtain a superposed second edge image;
and blurring processing is carried out on the first edge map based on the overlapped second edge map, so that a tracing effect map of the target model is obtained.
In the implementation, in order to enable lines in the final edge-tracing effect diagram of the target model to be more attached to lines of a writing brush in a ink painting, textures similar to that of the Chinese art paper or the writing brush are generated, when a second edge diagram is obtained, a 3d noise diagram corresponding to the target model is randomly generated first, optionally, the 3d noise diagram corresponding to the target model can be randomly generated through a Berlin noise algorithm, wherein the 3d noise diagram comprises randomly generated gray values corresponding to each point on the target model, after the 3d noise diagram is generated, the 3d noise diagram and the second edge diagram are overlapped to obtain an overlapped second edge diagram, so that disturbance of the 3d noise diagram is distributed around the lines of the overlapped second edge diagram, and then fuzzy processing is conducted on the first edge diagram according to the overlapped second edge diagram, so that the edge-tracing effect diagram of the target model is obtained.
In some embodiments, blurring processing is performed on the first edge map based on the superimposed second edge map to obtain an edge effect map of the target model, which specifically includes:
carrying out Gaussian blur processing on the superimposed second edge map to obtain a Gaussian blurred second edge map;
performing inversion treatment on the Gaussian blurred second edge map to obtain an inverted second edge map;
determining the blur radius of each pixel point in the first edge map based on the inverted second edge map;
and carrying out fuzzy processing on the first edge map based on the fuzzy radius of each pixel point to obtain a tracing effect map of the target model.
In the specific implementation, in order to make the lines of the superimposed second edge map smoother, firstly, performing Gaussian blur processing on the superimposed second edge map to obtain a Gaussian blurred second edge map, and in order to facilitate calculation, performing inversion processing on the Gaussian blurred second edge map to obtain an inverted second edge map. After the inversion, the gray value corresponding to black before in the second edge map is 1, the gray value corresponding to white is 0, and then the blurring radius of each pixel point in the first edge map is determined according to the second edge map after the inversion, and optionally, in general, the larger the gray value of each pixel point in the first edge map at the corresponding position in the second edge map after the inversion is, the larger the blurring radius corresponding to the larger the gray value of the position is, the larger the range of the halation effect of the position is after the blurring processing is, so that the range of the diffusion of the simulated ink in paper is larger. Alternatively, the blur radius of each pixel point in the first edge map may be obtained directly by multiplying the gray value of the corresponding position of each pixel point in the inverted second edge map by the initial blur radius, or alternatively, the blur radius of each pixel point in the first edge map may be determined by using the inverted second edge map by other calculation methods, which is not limited. After the blur radius of each pixel point in the first edge map is determined, the first edge map can be subjected to blur processing according to the blur radius of each pixel point, and an edge tracing effect map of the target model is obtained.
In some embodiments, referring to fig. 3, which is a schematic diagram of a stroking effect of a target model obtained by the method according to the embodiment of the present application, in which fig. 3 includes stroking lines of a plurality of target models, that is, fig. 3 illustrates stroking effects of a plurality of target models, it can be seen that the stroking lines in fig. 3 can achieve stroking effects of a water-ink style.
According to the method for tracing the model, provided by the application, a target model to be traced and normal information of the target model are obtained; determining an initial threshold value corresponding to each set of adjacent vertices in the target model based on the target noise map; performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph; performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value; and blurring processing is carried out on the first edge map based on the second edge map to obtain an edge tracing effect map of the target model, initial thresholds corresponding to each group of adjacent vertexes in the target model are determined through the target noise paste map, so that initial thresholds at different positions on the target model are different, further, when the edge extraction is carried out on the target model, edge maps with uneven line thickness distribution can be obtained, namely, the first edge map and the second edge map with different line thickness of the ink writing brush can be simulated, blurring processing is carried out on the first edge map with thinner line thickness through the second edge map with thicker line and different thickness, the diffusion effect of ink on paper can be simulated, and the edge tracing effect map of the finally obtained target model can realize the edge tracing effect of the ink writing brush style.
Exemplary apparatus
Based on the same inventive concept, the application also provides a device for drawing the edges of the model, which corresponds to the method of any embodiment.
Referring to fig. 4, the apparatus for model tracing includes:
the acquisition module 201 acquires a target model of a to-be-traced edge and normal information of the target model;
the first extraction module 202 performs edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map;
the second extraction module 203 performs edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; wherein the first preset threshold is less than the second preset threshold;
and the blurring module 204 performs blurring processing on the first edge map based on the second edge map to obtain a tracing effect map of the target model.
For convenience of description, the above system is described as being functionally divided into various modules, respectively. Of course, the functions of each module may be implemented in the same piece or pieces of software and/or hardware when implementing the present application.
The system of the foregoing embodiment is used to implement the corresponding model tracing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described herein.
Based on the same inventive concept, the application also provides an electronic device corresponding to the method of any embodiment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for tracing the model according to any embodiment when executing the program.
Fig. 5 shows a more specific hardware architecture of an electronic device according to this embodiment, where the device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 implement communication connections therebetween within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 1020 may store an operating system and other application programs, and when the embodiments of the present specification are implemented in software or firmware, the associated program code is stored in memory 1020 and executed by processor 1010.
The input/output interface 1030 is used to connect with an input/output module for inputting and outputting information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
Communication interface 1040 is used to connect communication modules (not shown) to enable communication interactions of the present device with other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 1050 includes a path for transferring information between components of the device (e.g., processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).
It should be noted that although the above-described device only shows processor 1010, memory 1020, input/output interface 1030, communication interface 1040, and bus 1050, in an implementation, the device may include other components necessary to achieve proper operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The electronic device of the foregoing embodiment is configured to implement the corresponding method for model tracing in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Exemplary program product
Based on the same inventive concept, the present application also provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of model tracing according to any of the embodiments above, corresponding to the method of any of the embodiments above.
The computer readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be used to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
The storage medium of the foregoing embodiments stores computer instructions for causing the computer to perform the method for model tracing according to any of the foregoing embodiments, and has the advantages of the corresponding method embodiments, which are not described herein.
Based on the same inventive concept, the present disclosure also provides a computer program product, corresponding to the method of any of the embodiments described above, comprising a computer program. In some embodiments, the computer program is executed by one or more processors, so that the processors perform the method of model tracing described in the foregoing embodiments, and have the advantages of the corresponding method embodiments, which are not described herein.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the application (including the claims) is limited to these examples; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the application, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the application as described above, which are not provided in detail for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure the embodiments of the present application. Furthermore, the devices may be shown in block diagram form in order to avoid obscuring the embodiments of the present application, and also in view of the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the present application are to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the application, it should be apparent to one skilled in the art that embodiments of the application can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the application has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The present embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, and the like, which are within the spirit and principles of the embodiments of the application, are intended to be included within the scope of the application.

Claims (13)

1. A method of model tracing, comprising:
acquiring a target model of a to-be-traced edge and normal information of the target model;
performing edge extraction on the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph;
performing edge extraction on the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value;
and blurring processing is carried out on the first edge map based on the second edge map, so that a tracing effect map of the target model is obtained.
2. The method of claim 1, wherein the edge extraction is performed on the target model based on a first preset threshold and the normal information to obtain a first edge map, and specifically includes:
Acquiring a target noise map, and determining initial thresholds corresponding to each group of adjacent vertexes in the target model based on the target noise map so that the initial thresholds corresponding to each group of adjacent vertexes in the target model are not identical;
determining a first edge threshold corresponding to each group of adjacent vertexes based on the initial threshold and the first preset threshold;
determining a normal difference value of each group of adjacent vertexes based on the normal information;
determining adjacent vertexes of which the normal difference values are larger than the corresponding first edge threshold values as first edge vertexes;
and obtaining the first edge graph based on all the first edge vertexes.
3. The method of claim 1, wherein the edge extraction is performed on the target model based on a second preset threshold and the normal information to obtain a second edge map, and specifically includes:
acquiring a target noise map, and determining initial thresholds corresponding to each group of adjacent vertexes in the target model based on the target noise map so that the initial thresholds corresponding to each group of adjacent vertexes in the target model are not identical;
determining a second edge threshold corresponding to each group of adjacent vertexes based on the initial threshold and the second preset threshold;
Determining a normal difference value of each group of adjacent vertexes based on the normal information;
determining adjacent vertexes of which the normal difference value is larger than the corresponding second edge threshold value as second edge vertexes;
and obtaining the second edge graph based on all the second edge vertices.
4. A method according to claim 2 or 3, wherein the target noise map is a randomly generated noise map or a predetermined noise map.
5. A method according to claim 2 or 3, wherein determining an initial threshold value for each set of neighboring vertices in the target model based on the target noise map, in particular comprises:
performing downsampling treatment on the target noise map to obtain a downsampled target noise map;
carrying out Gaussian blur processing on the target noise map after downsampling to obtain a target noise map after Gaussian blur processing;
and determining an initial threshold value corresponding to each group of adjacent vertexes in the target model based on the target noise map after Gaussian blur processing.
6. The method according to claim 5, wherein determining the initial threshold value corresponding to each set of neighboring vertices in the target model based on the gaussian blur processed target noise map, specifically comprises:
Performing inverse processing on the target noise map after Gaussian blur processing to obtain an inverse target noise map;
for each set of adjacent vertices in the target model, determining a gray value of the adjacent vertex at a corresponding position in the inverted target noise map, and determining an initial threshold of the adjacent vertex based on the gray value of the corresponding position.
7. The method according to claim 6, wherein determining the initial threshold value of the neighboring vertices based on the gray values of the corresponding locations, in particular comprises:
for each set of neighboring vertices in the target model, determining a normal change rate for the neighboring vertices based on normal information, determining an initial threshold for the neighboring vertices based on the normal change rate and the gray value for the corresponding location.
8. A method according to claim 2 or 3, wherein the step of obtaining a target noise map comprises:
and determining a target noise map corresponding to the target model from a plurality of preset noise maps.
9. The method according to claim 1, wherein blurring the first edge map based on the second edge map, to obtain a stroked effect map of the target model, specifically includes:
Randomly generating a 3d noise image corresponding to the target model, and superposing the 3d noise image and the second edge image to obtain a superposed second edge image;
and blurring processing is carried out on the first edge map based on the overlapped second edge map, so that a tracing effect map of the target model is obtained.
10. The method according to claim 9, wherein blurring the first edge map based on the superimposed second edge map to obtain a stroked effect map of the target model, specifically comprising:
carrying out Gaussian blur processing on the superimposed second edge map to obtain a Gaussian blurred second edge map;
performing inversion treatment on the Gaussian blurred second edge map to obtain an inverted second edge map;
determining the blur radius of each pixel point in the first edge map based on the inverted second edge map;
and carrying out fuzzy processing on the first edge map based on the fuzzy radius of each pixel point to obtain a tracing effect map of the target model.
11. A device for model tracing, comprising:
the acquisition module is used for acquiring a target model of the edge to be traced and normal information of the target model;
The first extraction module is used for extracting edges of the target model based on a first preset threshold and the normal information to obtain a first edge map; the first preset threshold is used for controlling the thickness of the edge of the first edge graph;
the second extraction module is used for extracting edges of the target model based on a second preset threshold and the normal information to obtain a second edge map; the second preset threshold is used for controlling the thickness of the edge of the second edge graph; the first preset threshold value is smaller than the second preset threshold value;
and the blurring module is used for blurring the first edge map based on the second edge map to obtain a tracing effect map of the target model.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable by the processor, the processor implementing the method of any one of claims 1 to 10 when the program is executed.
13. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 10.
CN202310762928.2A 2023-06-26 2023-06-26 Model edge tracing method and device, electronic equipment and storage medium Pending CN116778015A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310762928.2A CN116778015A (en) 2023-06-26 2023-06-26 Model edge tracing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310762928.2A CN116778015A (en) 2023-06-26 2023-06-26 Model edge tracing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116778015A true CN116778015A (en) 2023-09-19

Family

ID=88009607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310762928.2A Pending CN116778015A (en) 2023-06-26 2023-06-26 Model edge tracing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116778015A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117274432A (en) * 2023-09-20 2023-12-22 书行科技(北京)有限公司 Method, device, equipment and readable storage medium for generating image edge special effect

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117274432A (en) * 2023-09-20 2023-12-22 书行科技(北京)有限公司 Method, device, equipment and readable storage medium for generating image edge special effect
CN117274432B (en) * 2023-09-20 2024-05-14 书行科技(北京)有限公司 Method, device, equipment and readable storage medium for generating image edge special effect

Similar Documents

Publication Publication Date Title
JP2023515654A (en) Image optimization method and device, computer storage medium, computer program, and electronic equipment
US20200175700A1 (en) Joint Training Technique for Depth Map Generation
CN113240783B (en) Stylized rendering method and device, readable storage medium and electronic equipment
US11080833B2 (en) Image manipulation using deep learning techniques in a patch matching operation
CN110378947B (en) 3D model reconstruction method and device and electronic equipment
CN109754464B (en) Method and apparatus for generating information
JP2015215895A (en) Method and system for restoring depth value of depth image
US9437034B1 (en) Multiview texturing for three-dimensional models
CN111724313B (en) Shadow map generation method and device
CN114937050B (en) Green screen cutout method, device and electronic equipment
CN113763249A (en) Text image super-resolution reconstruction method and related equipment
US8854392B2 (en) Circular scratch shader
US20240303784A1 (en) Noise reduction for lightmap
CN108960012B (en) Feature point detection method and device and electronic equipment
CN113610958A (en) 3D image construction method and device based on style migration and terminal
CN113766117B (en) Video de-jitter method and device
CN116778015A (en) Model edge tracing method and device, electronic equipment and storage medium
WO2018030593A1 (en) Laplacian patch-based image synthesis method and device
CN112132871B (en) Visual feature point tracking method and device based on feature optical flow information, storage medium and terminal
CN110378948A (en) 3D model reconstruction method, device and electronic equipment
CN112053434B (en) Disparity map generation method, three-dimensional reconstruction method and related device
CN116579942A (en) Image processing method, apparatus, device, medium and program product
US9077963B2 (en) Systems and methods for generating a depth map and converting two-dimensional data to stereoscopic data
CN114913287A (en) Three-dimensional human body model reconstruction method and system
CN114638746A (en) Cartoon head portrait generation method, device, equipment and medium based on portrait

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