Virtual object generation method and device

By extracting line information, redrawing and three-dimensional restoration from the two-dimensional basic images, combined with the texture mapping of neural networks, the complexity of three-dimensional virtual object generation in the existing technology is solved, and efficient and real three-dimensional virtual object generation is achieved.

CN119540447APending Publication Date: 2025-02-28SHIYOU OASIS (SHANGHAI) DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411478918.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The existing three-dimensional virtual object generation methods are complex, resulting in inefficient generation, especially when dealing with contour lines, light and shadow features, and texture mapping.

Method used

By obtaining a two-dimensional basic image containing virtual objects, extracting line information using edge detection functions, performing multi-scale line enhancement processing, redrawing virtual objects, performing three-dimensional space restoration, and using neural networks for texture mapping.

Benefits of technology

The three-dimensional virtual object generation process is simplified and the generation efficiency is improved. The generated three-dimensional virtual objects have real material and three-dimensional sense.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540447A_ABST
    Figure CN119540447A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual object generation method and device. The method comprises the following steps: generating an initial line profile diagram, and carrying out multi-scale line enhancement processing on the initial line profile diagram to generate an optimized line profile diagram; redrawing the virtual object based on the line contour information in the optimized line contour map and the shadow features in the basic image to generate a redrawn virtual object; based on the redrawn virtual object, performing three-dimensional reduction on the virtual object by using an adaptive three-dimensional space reduction algorithm to generate a three-dimensional virtual object model; and performing texture mapping on the three-dimensional virtual object model by using a neural network, and mapping the texture to the surface of the three-dimensional virtual object model based on the color features in the basic image to generate a three-dimensional virtual object with a real material. The technical problem that in the prior art, generation of the three-dimensional virtual object is complex is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a method and device for generating a virtual object. Background Art

[0002] Existing methods for generating 3D virtual objects usually rely on complex modeling tools and algorithms, involving the construction of geometric structures and the addition of surface textures to enhance visual effects. However, these methods are often complex when dealing with the contours, light and shadow features, and texture mapping of virtual objects, resulting in low generation efficiency.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide a method and device for generating a virtual object, so as to at least solve the technical problem of complex generation of three-dimensional virtual objects in the prior art.

[0005] According to one aspect of an embodiment of the present invention, a method for generating a virtual object is provided, comprising: obtaining a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features; determining an edge detection function based on the position of each pixel in the basic image, extracting line information of the virtual object from the basic image based on the edge detection function, generating a preliminary line contour map, and performing multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map; redrawing the virtual object based on the line contour information in the optimized line contour map and the light and shadow features in the basic image to generate a redrawn virtual object; based on the redrawn virtual object, performing three-dimensional restoration of the virtual object using an adaptive three-dimensional space restoration algorithm to generate a three-dimensional virtual object model; performing texture mapping on the three-dimensional virtual object model using a neural network, and mapping the texture onto the surface of the three-dimensional virtual object model based on the color features in the basic image to generate the three-dimensional virtual object with real material.

[0006] According to another aspect of an embodiment of the present invention, a device for generating a virtual object is provided, comprising: an acquisition module configured to acquire a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features; a contour generation module configured to determine an edge detection function based on the position of each pixel in the basic image, extract line information of the virtual object from the basic image based on the edge detection function, generate a preliminary line contour map, and perform multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map; a redrawing module configured to redraw the virtual object based on the line contour information in the optimized line contour map and the light and shadow features in the basic image to generate a redrawn virtual object; a restoration module configured to perform three-dimensional restoration of the virtual object based on the redrawn virtual object using an adaptive three-dimensional space restoration algorithm to generate a three-dimensional virtual object model; a texture mapping module configured to perform texture mapping on the three-dimensional virtual object model using a neural network, and map the texture onto the surface of the three-dimensional virtual object model based on the color features in the basic image to generate the three-dimensional virtual object with real material.

[0007] In an embodiment of the present invention, a two-dimensional basic image containing a virtual object is obtained, wherein the basic image contains color features and light and shadow features; an edge detection function is determined based on the position of each pixel in the basic image, and line information of the virtual object is extracted from the basic image based on the edge detection function to generate a preliminary line contour map, and multi-scale line enhancement processing is performed on the preliminary line contour map to generate an optimized line contour map; based on the line contour information in the optimized line contour map and the light and shadow features in the basic image, the virtual object is redrawn to generate a redrawn virtual object; based on the redrawn virtual object, an adaptive three-dimensional space restoration algorithm is used to perform three-dimensional restoration on the virtual object to generate a three-dimensional virtual object model; a neural network is used to perform texture mapping on the three-dimensional virtual object model, and based on the color features in the basic image, the texture is mapped to the surface of the three-dimensional virtual object model to generate the three-dimensional virtual object with real material. Through the above scheme, the relatively complex technical problem of generating three-dimensional virtual objects in the prior art is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0009] Figure 1 is a flow chart of a method for generating a virtual object according to an embodiment of the present invention;

[0010] Figure 2 is a flow chart of another method for generating a virtual object according to an embodiment of the present invention;

[0011] Figure 3 is a flow chart of a method for edge detection and line contour extraction based on a basic image according to an embodiment of the present invention;

[0012] Figure 4 is a flow chart of a shape redrawing method according to an embodiment of the present invention;

[0013] Figure 5 is a flow chart of a method for restoring a virtual object according to an embodiment of the present invention;

[0014] Figure 6 is a schematic structural diagram of a device for generating a virtual object according to an embodiment of the present invention;

[0015] Figure 7 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0016] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0017] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0018] According to an embodiment of the present invention, a method embodiment of a method for generating a virtual object is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0019] Figure 1 is a method for generating a virtual object according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0020] Step S102, obtaining a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features;

[0021] By analyzing the spatial position and brightness gradient of each pixel in the basic image, the corresponding edge strength and direction are calculated; based on the edge strength and direction information, an edge detection function is constructed, wherein the edge detection function is used to identify the edge information of the virtual object.

[0022] Step S104, determining an edge detection function based on the position of each pixel in the basic image, extracting line information of the virtual object from the basic image based on the edge detection function, generating a preliminary line contour map, and performing multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map.

[0023] The edge detection function is applied to each pixel of the basic image to extract line features at the edge; the extracted edge information is combined into continuous lines through threshold processing and line connection algorithm to generate the preliminary line profile map. Afterwards, the preliminary line profile map is subjected to multi-scale line enhancement processing to generate an optimized line profile map.

[0024] Step S106 , redrawing the virtual object based on the line contour information in the optimized line contour image and the light and shadow features in the basic image to generate a redrawn virtual object.

[0025] Based on the thickness and direction of the lines in the optimized line contour map, the shape of the virtual object is redrawn; using the light and shadow features in the basic image, the brightness and shadow effects of the surface of the virtual object are adjusted, so that the redrawn virtual object has three-dimensionality and authenticity.

[0026] Step S108, based on the redrawn virtual object, using an adaptive three-dimensional space restoration algorithm, three-dimensionally restore the virtual object to generate a three-dimensional virtual object model.

[0027] Based on the outline and light and shadow information of the redrawn virtual object, an adaptive three-dimensional space restoration algorithm is applied to deduce the depth and shape of the virtual object; based on the depth and shape of the virtual object, a three-dimensional geometric model of the virtual object is constructed, and a three-dimensional virtual object model consistent with the shape of the virtual object is generated.

[0028] For example, first, derive depth information. Depth information can be obtained by, for example, an image-based depth estimation method. For example, a learning-based depth estimation model is used to infer the depth distribution of a virtual object by analyzing texture changes, shadows, and line profile information in a two-dimensional image. In addition, binocular vision technology can be combined to derive the three-dimensional depth of a virtual object through two-dimensional images of different perspectives. By calculating the parallax in the two images, the positional relationship of the virtual object in three-dimensional space can be determined, thereby generating a depth map. Then, a three-dimensional geometric model is constructed. After obtaining the depth information of the virtual object, its three-dimensional geometric model is constructed. Based on the depth map of the virtual object, a three-dimensional mesh model of the object can be generated by a surface reconstruction algorithm (such as the Marching Cubes algorithm). The algorithm converts depth information into a three-dimensional geometric structure by constructing an isosurface in three-dimensional space. In order to ensure the smoothness and accuracy of the geometric model, a smoothing filter can also be applied during the surface reconstruction process to post-process the generated mesh model to eliminate noise and irregular surface structures.

[0029] Step S110, using a neural network to perform texture mapping on the three-dimensional virtual object model, based on the color features in the basic image, mapping the texture onto the surface of the three-dimensional virtual object model, and generating the three-dimensional virtual object with real material.

[0030] The color features of the three-dimensional virtual object model and the basic image are input into a neural network, and a texture adapted to the surface shape of the virtual object is generated using the neural network; based on the geometric structure of the three-dimensional virtual object model, the generated texture is mapped to the surface of the three-dimensional virtual object model to generate the three-dimensional virtual object with a real material feel.

[0031] Figure 2 Another method for generating a virtual object according to an embodiment of the present invention. This embodiment describes a method for generating a three-dimensional virtual object based on a two-dimensional basic image, including the steps of obtaining a basic image, edge detection, line contour extraction, multi-scale enhancement processing, virtual object redrawing, three-dimensional restoration, and texture mapping. This method realizes the generation of a three-dimensional virtual object with a sense of reality and stereoscopic effect from a two-dimensional image by combining image processing technology, three-dimensional modeling technology, and neural network texture mapping technology. Figure 2 As shown, the method comprises the following steps:

[0032] Step S202: Acquire a two-dimensional basic image containing a virtual object.

[0033] The base image not only contains the basic contour information of the virtual object, but also contains the color features and light and shadow features of the surface of the virtual object. In the present invention, the input of the base image can be a static two-dimensional image or a dynamic video frame. In order to ensure that the subsequent processing steps can proceed smoothly, the base image needs to meet certain resolution requirements to ensure that each pixel in the image can provide sufficient details. By preprocessing the image, removing noise, and enhancing contrast, the accuracy of subsequent edge detection and contour extraction can be improved.

[0034] After obtaining the basic image, we first need to analyze each pixel of the image, mainly analyzing the spatial position of each pixel and its brightness gradient. Brightness gradient refers to the rate of change of the gray value of a pixel as its position changes, which can reflect the edge information in the image. By calculating the gradient value of each pixel, we can get the degree of change of the area to which the pixel belongs, thus providing a data basis for subsequent edge detection.

[0035] Step S204: edge detection and line contour extraction based on the basic image.

[0036] After obtaining the base image containing the virtual object, edge detection is performed on the base image to extract the line contour of the virtual object. Edge detection is used to identify the area where the gray value in the image changes dramatically, that is, the edge in the image.

[0037] like Figure 3 As shown, the image detection method includes the following steps:

[0038] Step S2042, constructing an edge detection function.

[0039] The implementation of edge detection depends on the edge detection operator. Common edge detection operators include Sobel operator, Canny operator, etc. In the implementation of the present invention, it is preferred to use the Canny edge detection operator, which can reduce the influence of noise by Gaussian filtering the image, and obtain more accurate and continuous edges through operations such as non-maximum suppression and double threshold detection.

[0040] Specifically, Canny edge detection first smoothes the image to reduce noise interference. By selecting the appropriate Gaussian kernel size, the strength of the filter can be controlled to balance the retention of noise and details. Then, the Sobel operator is used to calculate the gradient amplitude and direction of the image. The position of the edge in the image is determined by the change in the gradient. After that, the result of the gradient calculation is non-maximum suppressed to eliminate pixels that do not belong to the edge, thereby retaining the precise position of the edge. Finally, by setting high and low thresholds, strong edges and weak edges are distinguished, and the continuity of the edge is ensured by connecting the weak edge and the strong edge.

[0041] Step S2044, extracting line contours.

[0042] The edge detection function can extract the preliminary contour information of the virtual object. In order to ensure that the contour information of the virtual object is complete and continuous, the edge detection is combined with the threshold processing and line connection algorithm. By setting a certain threshold, the noise edge in the image is removed and the main contour information is retained. Then, the scattered edge points are connected into continuous lines through the line connection algorithm to form a complete contour map.

[0043] Step S2046, multi-scale line enhancement.

[0044] After the preliminary line contour map is generated, some line details may be lost or the lines may not be smooth enough. Therefore, it is necessary to perform multi-scale line enhancement processing on the preliminary line contour map.

[0045] Multi-scale processing is to decompose the image at multiple scales through Gaussian pyramid to separate the different frequency components in the image. By adjusting the enhancement parameters at different scales, the details can be processed in a refined manner. For example, for low-frequency components, the thickness of the lines and the overall sense of the contour can be enhanced; while for high-frequency components, the sharpness of the detailed lines can be enhanced.

[0046] Multi-scale enhancement processing can be done using a guided filter-based method. The guided filter maintains edge information and improves the contrast and clarity of the lines during the enhancement process. Finally, an optimized line contour map is generated.

[0047] Step S206: redraw the virtual object based on line contours and light and shadow features.

[0048] After the line contour extraction is completed, the virtual object is redrawn. The core of the redrawing process is to use the extracted line contour information and the light and shadow features in the basic image to redraw the shape and surface details of the virtual object. By fine-tuning the thickness of the line and the changes in light and shadow, a more three-dimensional and realistic virtual object can be generated.

[0049] like Figure 4As shown, the shape redrawing method includes the following steps:

[0050] Step S2062, redrawing the shape.

[0051] The basis of shape redrawing is the optimized line contour. In this process, the outline of the virtual object is first redrawn based on the thickness and direction of the line contour. In order to ensure that the shape of the virtual object is more accurate, adjustments based on geometric features can also be introduced during the shape redrawing process. For example, irregular edge lines can be smoothed using Bezier curves to make the redrawn virtual object more natural.

[0052] Step S2064, adjusting light and shadow characteristics.

[0053] The three-dimensional sense of virtual objects depends largely on the processing of light and shadow. In the base image, the light and shadow features already provide information about the brightness and shadow of the virtual object surface. When redrawing, by analyzing these light and shadow features, the brightness and shadow of the virtual object surface can be adjusted to enhance the three-dimensional sense of the object.

[0054] Specifically, the illumination changes on the surface of the virtual object after redrawing can be calculated using a normal-based illumination model (such as the Lambertian model or the Phong model). Normal information can be derived from the gradient direction obtained in the previous edge detection process. By adjusting the illumination intensity at different positions on the surface of the virtual object, the brightness changes of the object at different angles can be ensured to conform to the real light and shadow effects.

[0055] Step S208, restoring the virtual object.

[0056] The 3D restoration of virtual objects is a key step in converting the information in the 2D base image into a 3D model. Through the adaptive 3D space restoration algorithm, the depth information and shape of the virtual object are derived and a 3D geometric model is generated.

[0057] like Figure 5 As shown, the restoration steps include the following:

[0058] Step S2082, analyzing contour and light and shadow information.

[0059] First, the outline information of the virtual object after redrawing and its surface light and shadow characteristics are obtained. The outline information includes the edge and shape characteristics of the object, while the light and shadow information records the distribution of the light source, reflection intensity and shadow area. This information is converted into a series of basic data for space restoration through algorithms.

[0060] Step S2084, applying an adaptive three-dimensional space restoration algorithm.

[0061] Based on the extracted contour and light and shadow information, an adaptive 3D space restoration algorithm is applied. The adaptive algorithm automatically adjusts the calculation parameters according to the local complexity and characteristics of the object to ensure accurate acquisition of depth information in different areas. Specifically, the algorithm first derives the depth values ​​of different points based on the rate of change of the contour, and further refines the depth calculation based on the difference in light and shadow. In this process, the front and back relationship, surface undulations, and spatial distribution of the virtual object are determined, laying the foundation for the subsequent 3D model construction.

[0062] Step S2086, constructing a photography matrix and a projection matrix.

[0063] In order to accurately reconstruct the spatial depth information of the virtual object, it is first necessary to construct a photographic matrix. The photographic matrix is ​​constructed based on the relative position relationship between the virtual camera device and the virtual object. Specifically, the forward vector, lateral vector, and upward vector of the photographic device are derived through the positional relationship between the device's observation point and the virtual object. These vectors determine the orientation and position of the photographic device in the virtual three-dimensional space, so that the field of view of the photographic device can remain stable and controllable in the virtual scene, thereby providing a basic coordinate system for the precise projection of the virtual object. Then, the photographic matrix is ​​constructed based on the forward vector, lateral vector, and upward vector of the photographic device.

[0064] After constructing the photography matrix, the projection matrix is ​​then generated. By simulating the perspective effect in the natural perspective, the three-dimensional coordinates of the virtual object are converted into the coordinate space of the projection plane. In this embodiment, the projection matrix is ​​generated based on factors such as the perspective of the photographic device, the clipping boundary, and the observation depth. Then, based on the projection matrix, the depth information of virtual objects at different distances in the observation space is converted into the relative position and scaling ratio on the two-dimensional projection surface by using nonlinear transformation. Through this conversion process, the objects in the virtual scene present an effect that conforms to the perspective law on the display plane, thereby ensuring that the observer can correctly perceive the distance relationship and size changes of the objects.

[0065] The combination of the photography matrix and the projection matrix enables the depth information and geometric shapes of virtual objects to be accurately and consistently presented from different perspectives. This not only provides reliable data support for the construction of the 3D model of the virtual object, but also ensures the authenticity of the light and shadow effects and depth performance in the subsequent rendering process, thereby greatly improving the spatial perception and visual expression of the virtual scene.

[0066] Step S2088, constructing a three-dimensional geometric model.

[0067] After determining the depth and shape information of the virtual object, a 3D geometric model of the virtual object is constructed based on this data. Specifically, the basic geometric shape of the virtual object, such as surface, angle, and volume, is first generated based on the depth information. Then, the boundary processing of the geometric model is optimized based on the contour shape details of the object to ensure consistency with the actual shape. Through the constructed 3D geometric model, the shape of the virtual object can be extended from the contour and light and shadow information in the 2D image to the 3D space, completing the shape restoration.

[0068] To ensure the authenticity of the generated three-dimensional virtual object model, this embodiment also applies an adaptive optimization algorithm. By analyzing the normal information of the model surface and the angle of illumination of the light source, the details of the model are further adjusted and optimized. For example, special processing is performed on the edges, complex surface textures, and highly reflective areas of the model to ensure that these areas can show a higher level of detail and light and shadow effects when rendered. In addition, a neural network is used to further optimize the texture mapping process of the three-dimensional model to ensure that the texture is distortion-free at different viewing angles.

[0069] Step S210: Generate a three-dimensional virtual object with real material through texture mapping.

[0070] After the construction of the 3D geometric model is completed, the virtual object is texture mapped to give it a real material effect. Texture mapping enhances the visual effect of the model by mapping the texture information of the 2D image to the surface of the 3D model.

[0071] Texture mapping is to correspond each pixel of a two-dimensional image to the vertex of a three-dimensional model, thereby projecting the color features of the image onto the three-dimensional model. In this embodiment, by combining the color features in the base image with the three-dimensional geometric model, texture mapping of the virtual object can be achieved. Traditional texture mapping methods rely on simple geometric mapping relationships and cannot fully adapt to complex three-dimensional geometric structures. In the present invention, a texture mapping optimization method based on a neural network is adopted. By inputting the texture features of the three-dimensional model and the base image into the neural network, the neural network can automatically learn and generate texture information suitable for the surface shape of the virtual object. The neural network model of the present application is trained using a convolutional neural network (CNN). The input of the model is the texture features of the base image and the geometric features of the three-dimensional model, and the output is the optimized texture mapping result. During the training process, supervised learning is performed through a large amount of sample data, and the model can learn the mapping relationship between different geometric shapes and textures.

[0072] In the specific implementation, the surface of the 3D model needs to be flattened first to generate a UV coordinate map suitable for texture mapping. Then, the optimized texture information is mapped to the surface of the 3D model to ensure that the texture details can accurately correspond to the 3D geometric structure. In this way, the final generated virtual object not only has a three-dimensional geometric structure, but also has a real material feel, making it perform well in application scenarios such as virtual reality, games, and animations.

[0073] The present invention proposes a method for generating three-dimensional virtual objects based on two-dimensional images, which combines image processing technology, edge detection and contour extraction algorithms, multi-scale enhancement technology and neural network-based texture mapping optimization technology to achieve high-quality three-dimensional virtual object generation.

[0074] The present application also provides a device for generating a virtual object, such as Figure 6 As shown, it includes: an acquisition module 62, which is configured to acquire a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features; a contour generation module 64, which is configured to determine an edge detection function based on the position of each pixel in the basic image, extract line information of the virtual object from the basic image based on the edge detection function, generate a preliminary line contour map, and perform multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map; a redrawing module 66, which is configured to redraw the virtual object based on the line contour information in the optimized line contour map and the light and shadow features in the basic image to generate a redrawn virtual object; a restoration module 68, which is configured to perform three-dimensional restoration on the virtual object based on the redrawn virtual object using an adaptive three-dimensional space restoration algorithm to generate a three-dimensional virtual object model; a texture mapping module 69, which is configured to perform texture mapping on the three-dimensional virtual object model using a neural network, and map the texture to the surface of the three-dimensional virtual object model based on the color features in the basic image to generate the three-dimensional virtual object with real material.

[0075] It should be noted that the virtual object generation device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the virtual object generation device provided in the above embodiment and the virtual object generation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0076] Figure 7 FIG. 1 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure. It should be noted that: Figure 7The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0077] like Figure 7 As shown, the electronic device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0078] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0079] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, various functions defined in the method and apparatus of the present application are executed. In some embodiments, the electronic device may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0080] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a virtual object, characterized in that: include: Acquire a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features; Determining an edge detection function based on the position of each pixel in the basic image, extracting line information of the virtual object from the basic image based on the edge detection function, generating a preliminary line contour map, and performing multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map; Redrawing the virtual object based on the line contour information in the optimized line contour image and the light and shadow features in the basic image to generate a redrawn virtual object; Based on the redrawn virtual object, using an adaptive three-dimensional space restoration algorithm, three-dimensionally restore the virtual object to generate a three-dimensional virtual object model; The three-dimensional virtual object model is texture mapped by using a neural network, and the texture is mapped onto the surface of the three-dimensional virtual object model based on the color features in the basic image to generate the three-dimensional virtual object with real material.

2. The method according to claim 1, characterized in that Determining an edge detection function based on the position of each pixel in the base image includes: By analyzing the spatial position and brightness gradient of each pixel in the base image, the corresponding edge strength and direction are calculated; An edge detection function is constructed based on the edge strength and direction information, wherein the edge detection function is used to identify edge information of the virtual object.

3. The method according to claim 1, characterized in that Extracting line information of the virtual object from the basic image based on the edge detection function to generate a preliminary line contour map, including: Applying the edge detection function to each pixel of the base image to extract line features at the edge; The extracted edge information is combined into continuous lines through threshold processing and line connection algorithm to generate the preliminary line contour map.

4. The method according to claim 1, characterized in that Redrawing the virtual object based on the line contour information in the optimized line contour image and the light and shadow features in the basic image to generate the redrawn virtual object includes: Redrawing the appearance of the virtual object based on the thickness and direction of the lines in the optimized line outline map; The light and shadow features in the basic image are used to adjust the brightness and shadow effect of the surface of the virtual object, so that the redrawn virtual object has three-dimensionality and authenticity.

5. The method according to claim 1, characterized in that: Based on the redrawn virtual object, an adaptive three-dimensional space restoration algorithm is used to perform three-dimensional restoration on the virtual object to generate a three-dimensional virtual object model, including: Based on the outline and light and shadow information of the redrawn virtual object, an adaptive three-dimensional space restoration algorithm is applied to deduce the depth and shape of the virtual object; Based on the depth and shape of the virtual object, a three-dimensional geometric model of the virtual object is constructed, and a three-dimensional virtual object model consistent with the shape of the virtual object is generated.

6. The method according to claim 1, characterized in that The three-dimensional virtual object model is texture mapped by using a neural network, and the texture is mapped onto the surface of the three-dimensional virtual object model based on the color features in the basic image to generate the three-dimensional virtual object with real material, including: Inputting the color features of the three-dimensional virtual object model and the basic image into a neural network, and using the neural network to generate a texture adapted to the surface shape of the virtual object; Based on the geometric structure of the three-dimensional virtual object model, the generated texture is mapped to the surface of the three-dimensional virtual object model to generate the three-dimensional virtual object with a real material feel.

7. A device for generating a virtual object, characterized in that: include: An acquisition module is configured to acquire a two-dimensional basic image containing a virtual object, wherein the basic image contains color features and light and shadow features; a contour generation module, configured to determine an edge detection function based on the position of each pixel in the base image, extract line information of the virtual object from the base image based on the edge detection function, generate a preliminary line contour map, and perform multi-scale line enhancement processing on the preliminary line contour map to generate an optimized line contour map; a redrawing module configured to redraw the virtual object based on the line contour information in the optimized line contour image and the light and shadow features in the basic image to generate a redrawn virtual object; A restoration module is configured to perform three-dimensional restoration on the virtual object based on the redrawn virtual object by using an adaptive three-dimensional space restoration algorithm to generate a three-dimensional virtual object model; The texture mapping module is configured to perform texture mapping on the three-dimensional virtual object model using a neural network, and based on the color features in the basic image, map the texture onto the surface of the three-dimensional virtual object model to generate the three-dimensional virtual object with real material.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 6.

9. A computer device, characterized in that: include: Memory and processor, The memory stores a computer program; The processor is used to execute the computer program stored in the memory, and when the computer program is run, the processor is enabled to execute the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.