Texture mapping method and system for three-dimensional model and terminal equipment
By obtaining the camera's internal and external parameters matrix and combining the center of gravity interpolation method, the three-dimensional model texture map is optimized, and the color unreality caused by shadow mapping is solved, achieving the effect of maintaining fine texture under the simplified model.
Patent Information
- Application Number
- CN202410629326.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2044-05-21
AI Technical Summary
In the prior art, the texture mapping method will map image shadows to a three-dimensional model, resulting in the problem of different color and unreality of the model.
By obtaining the camera's internal and external parameter matrix, the corresponding relationship matrix between the three-dimensional model and the physically captured image is determined, and the simplified three-dimensional model is textured using the center of gravity interpolation method to optimize shadow problems and maintain fine texture effect.
Maintain fine texture under simplified three-dimensional model, improve the authenticity of the model, and solve the problem of different colors and light and dark.
Smart Images

Figure CN120431233A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional model texture mapping of a projector, and in particular to a texture mapping method, system and terminal equipment for a three-dimensional model. Background Art
[0002] Generally, a 3D scanner can obtain the true color of a model, help enhance the realism of the 3D model, and further improve the details of the model.
[0003] Currently, 3D model color restoration techniques are primarily divided into two approaches: vertex shading and texture mapping. Vertex shading requires a dense mesh to capture fine color information, resulting in a large amount of 3D model data, hindering subsequent model processing such as editing and design. While texture mapping can preserve fine texture details on simplified model data, traditional texture mapping methods project image shadows onto the model, resulting in inconsistent color and a lack of realism.
[0004] Therefore, it is necessary to propose a method for three-dimensional model texture mapping to solve the above technical problems. Summary of the Invention
[0005] The purpose of the present invention is to provide a texture mapping method, system and terminal device for a three-dimensional model to solve the problem in the prior art that image shadows are mapped onto the model, resulting in the model having different colors and being unrealistic.
[0006] To achieve the above objectives, in a first aspect, a texture mapping method for a three-dimensional model is provided, the method comprising:
[0007] Acquire an original three-dimensional model and process the original three-dimensional model to obtain a simplified three-dimensional model; obtain a camera intrinsic parameter matrix and a camera extrinsic parameter matrix, wherein the camera extrinsic parameter matrix is the pose information corresponding to different shooting angles of the original three-dimensional model;
[0008] Determining a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix;
[0009] Based on the first correspondence matrix and the original three-dimensional model, a two-dimensional texture image at each shooting angle is determined, and a second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model is determined to perform texture mapping on the simplified three-dimensional model based on the second correspondence.
[0010] As a further improvement of the present invention, determining the two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model includes:
[0011] determining whether a mesh area of the original three-dimensional model is within a corresponding shooting angle based on a mesh normal of the original three-dimensional model and a shooting angle of the physical shooting image;
[0012] If the grid area of the original three-dimensional model is within the corresponding shooting angle of view, a mapping relationship between the original three-dimensional model grid and the pixels of the physical shooting image is established based on the first correspondence matrix; based on the mapping relationship, the pixels of the physical shooting image are assigned values using the centroid interpolation method to form a two-dimensional texture image of the corresponding angle.
[0013] As a further improvement of the present invention, based on the mapping relationship, the pixels of the physical captured image are assigned values using a barycentric interpolation method to form a two-dimensional texture image of a corresponding angle, including:
[0014] Obtaining pixel coordinates of the physical captured image corresponding to the coordinates of the original three-dimensional model based on the mapping relationship, so as to determine whether the mesh vertices of the original three-dimensional model are within the corresponding shooting angle of view based on the pixel coordinates of the physical captured image;
[0015] The barycentric interpolation method is used to assign colors to the pixels corresponding to the grid within the shooting angle of view to form a two-dimensional texture image corresponding to the shooting angle of view.
[0016] As a further improvement of the present invention, determining whether the mesh vertices of the original three-dimensional model are within the corresponding shooting perspective based on the pixel coordinates of the physical shot image includes:
[0017] Determine the minimum bounding rectangle of pixel coordinates based on the pixel coordinates corresponding to the mesh vertices of the original three-dimensional model;
[0018] A barycentric interpolation method is used to determine whether all pixels within the minimum bounding rectangle are located within the pixel coordinate bounding box of the mesh vertex mapping.
[0019] As a further improvement of the present invention, determining whether all pixels within the minimum bounding rectangle are located within the pixel coordinate bounding box of the mesh vertex mapping using a barycentric interpolation method includes:
[0020] The result of weighted summation of the three vertex pixels of the triangle in the grid area is used as the target pixel point in the corresponding minimum enclosing rectangle;
[0021] Based on the judgment result of whether there is a weighting coefficient less than 0 among the three vertex pixels of the triangle, it is determined whether the target pixel point is within the pixel coordinate bounding box mapped by the mesh vertex.
[0022] As a further improvement of the present invention, based on the judgment result of whether there is a weighting coefficient less than 0 among the three vertex pixels of the triangle, determining whether the target pixel point is within the pixel coordinate bounding box mapped by the mesh vertex includes:
[0023] If any of the three vertex pixels of the triangle has a weighting coefficient less than 0, then the target pixel point is not within the pixel coordinate bounding box of the mesh vertex mapping;
[0024] If there is no weighting coefficient less than 0 among the three vertex pixels of the triangle, the target pixel point is within the pixel coordinate bounding box mapped by the grid vertex, and the color value obtained by weighted summation of the pixels of the three vertices determined according to the weighting coefficient is assigned to the target pixel point.
[0025] As a further improvement of the present invention, determining a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix includes:
[0026] The product of the camera extrinsic parameter matrix and the camera intrinsic parameter matrix is used as the first correspondence matrix.
[0027] As a further improvement of the present invention, determining a second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model includes:
[0028] Multiplying the coordinates of the simplified three-dimensional model by a transformation matrix corresponding to the shooting angle of view to obtain pixel coordinates corresponding to the physical shot image;
[0029] The specific color information of the mesh vertices of the simplified three-dimensional model and the corresponding pixel coordinates is used as a second corresponding relationship between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model.
[0030] In a second aspect, a texture mapping system for a three-dimensional model is provided, comprising:
[0031] A model acquisition unit is used to acquire an original three-dimensional model and process the original three-dimensional model to obtain a simplified three-dimensional model;
[0032] A parameter acquisition unit, configured to acquire a camera intrinsic parameter matrix and a camera extrinsic parameter matrix, wherein the camera extrinsic parameter matrix is the pose information corresponding to different shooting angles of the original three-dimensional model;
[0033] a first determining unit, configured to determine, based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix, a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model;
[0034] a second determining unit, configured to determine a two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model, and determine a second correspondence between the two-dimensional texture image and mesh vertices of the simplified three-dimensional model; and
[0035] A data processing unit is configured to perform texture mapping on the simplified three-dimensional model based on the second corresponding relationship.
[0036] In a third aspect, the present invention provides a terminal device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method described in the first aspect.
[0037] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect.
[0038] The beneficial effects of the present invention are:
[0039] The present invention's texture mapping method for a 3D model utilizes a camera extrinsic parameter matrix and a camera intrinsic parameter matrix to determine a first correspondence matrix between the pixel coordinate system of the physical captured image corresponding to the original 3D model and the coordinate system of the original 3D model. Based on the first correspondence matrix and the original 3D model, a 2D texture image for each shooting angle is determined. The simplified 3D model is then mapped based on a second correspondence between the 2D texture image and the vertices of the model mesh simplified from the original 3D model. This method optimizes the shading issues inherent in traditional texture mapping, maintaining fine textures within the simplified 3D model and thus enhancing the realism of the 3D model. This solves the prior art issue of projecting image shadows onto the model, resulting in inconsistent and unrealistic color. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic flow chart of a texture mapping method for a three-dimensional model according to an embodiment of the present invention;
[0041] Figure 2 A schematic flow chart of a texture mapping method for a three-dimensional model according to another embodiment of the present invention;
[0042] Figure 3 A schematic diagram showing the principle of mapping occlusion by mapping points on the original 3D model to points on the corresponding shooting perspective image;
[0043] Figure 4 Schematic diagram for determining whether the mesh area of the original 3D model is within the shooting angle of view;
[0044] Figure 5A schematic flow chart of a texture mapping method for a three-dimensional model according to another embodiment of the present invention;
[0045] Figure 6 A schematic diagram showing the principle of determining whether mesh vertices are mapped within the image range;
[0046] Figure 7 A schematic flow chart of a texture mapping method for a three-dimensional model according to another embodiment of the present invention;
[0047] Figure 8 A schematic flow chart of a texture mapping method for a three-dimensional model according to another embodiment of the present invention;
[0048] Figure 9 A schematic diagram showing the principle of determining whether a pixel point P is within a mesh triangle;
[0049] Figure 10 A schematic flow chart of a texture mapping method for a three-dimensional model according to another embodiment of the present invention;
[0050] Figure 11 A schematic diagram of a texture of a grid corresponding to an optimal viewing angle according to an embodiment of the present invention;
[0051] Figure 12 A schematic structural diagram of a texture mapping system for a three-dimensional model according to an embodiment of the present invention;
[0052] Figure 13 A topological structure diagram of a computer-readable storage medium disclosed in the present invention. DETAILED DESCRIPTION
[0053] The present invention is described in detail below with reference to the various embodiments shown in the accompanying drawings, but it should be noted that these embodiments are not limitations of the present invention, and any equivalent transformations or substitutions in functions, methods, or structures made by ordinary technicians in this field based on these embodiments are all within the scope of protection of the present invention.
[0054] The technical solutions provided by various embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0055] Example 1:
[0056] Figure 1 This invention relates to a texture mapping method for a three-dimensional model (hereinafter referred to as "mapping method" or "method"), which solves the problem in the prior art of mapping image shadows onto the model, resulting in uneven color and unrealistic modeling. The method of this embodiment includes:
[0057] Step 102: Obtain the original 3D model and process it to obtain a simplified 3D model. The original 3D model is directly obtained from 3D reconstruction, i.e., it is an unreduced mesh model with color information attached to its vertices. The simplified 3D model is the original 3D model obtained after mesh simplification and smoothing. The specific degree of simplification of the simplified 3D model is determined based on actual needs and is not limited here.
[0058] Step 104: Obtain a camera intrinsic parameter matrix and a camera extrinsic parameter matrix. The camera extrinsic parameter matrix is the pose information of the original three-dimensional model corresponding to different shooting angles.
[0059] It should be noted that the pose information for each shooting angle (i.e., shooting view) is derived from the established rotational posture and the distance information between the original 3D model coordinate system and the camera coordinate system, namely the camera extrinsic parameter matrix. The camera extrinsic parameter matrix is different for each shooting view. Among them, the camera intrinsic parameter matrix includes the coordinates of the principal point of the camera image, the pixel size parameters, and the lens focal length. It is obtained through camera calibration and is unique and deterministic.
[0060] Step 106: Determine a first correspondence matrix between the pixel coordinate system of the physical captured image corresponding to the original three-dimensional model and the coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix.
[0061] Specifically, the camera extrinsic parameter matrix is multiplied by the camera intrinsic parameter matrix to obtain the first correspondence matrix. The first correspondence matrix contains multiple transformation matrices from the original 3D model coordinate system to the pixel coordinate system of the physical captured image. The calculation formula for a pixel at a certain angle in the first correspondence matrix is shown in Equation 1.
[0062] P p =K*[R i *T i ]*P w (1)
[0063] Among them, P p is the image coordinate mapped to the corresponding shooting angle, K is the camera internal parameter matrix, [R i T i ] is the camera extrinsic parameter matrix of the i-th shooting angle, P w is the second coordinate of the world coordinate of the grid point (x, y, z, 1), where R i is the rotation matrix of the i-th angle, T i is the translation matrix of the i-th angle, R i and T i The combined matrix is 3*4 as the camera extrinsic parameter matrix.
[0064] Step 108. Determine the two-dimensional texture images at each shooting angle based on the first correspondence matrix and the original three-dimensional model, and determine a second correspondence between the two-dimensional texture images and the mesh vertices of the simplified three-dimensional model, so as to perform texture mapping on the simplified three-dimensional model based on the second correspondence.
[0065] like Figure 2 As shown, the specific operations of "determining the two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model" in step 108 include:
[0066] Step 202: Determine whether the mesh area of the original 3D model is within the corresponding shooting angle based on the mesh normal of the original 3D model and the shooting angle of the physical shooting image.
[0067] It is worth noting that Figure 3 As shown in the figure, when determining the 2D texture image under each shooting angle, the same angle image point P may have a mapping relationship with multiple points on the original 3D model, such as P1 and P2. However, point P2 is not actually visible under this angle, so it is necessary to determine and exclude the occlusion point. Specifically, Figure 4 To explain, when determining and eliminating occlusion points, the mesh normal of the original 3D model and the viewing angle corresponding to the physical captured image are used to determine whether the mesh area of the original 3D model is visible within the corresponding shooting angle. If the mesh normal of the original 3D model and the shooting angle are the same, the mesh area of the original 3D model is not visible within the corresponding shooting angle; otherwise, the mesh area of the original 3D model is within the corresponding shooting angle.
[0068] Step 204: If the mesh area of the original 3D model is within the corresponding shooting viewpoint, a mapping relationship is established between the mesh area of the original 3D model and the pixels of the physical captured image based on the first correspondence matrix. Otherwise, the mapping relationship is discarded. In this manner, all mesh areas of the original 3D model are traversed to all corresponding shooting viewpoints to establish a mapping relationship between each mesh area within the corresponding shooting viewpoint and the corresponding pixel of the physical captured image.
[0069] Step 206: Based on the mapping relationship, use the barycentric interpolation method to assign values to the pixels of the physical captured image to form a two-dimensional texture image of the corresponding angle.
[0070] Ginseng Figure 5 As shown, the specific steps of step 206 include:
[0071] Step 502: Obtain pixel coordinates of the physical captured image corresponding to the coordinates of the original 3D model based on the mapping relationship, so as to determine whether the mesh vertices of the original 3D model are within the corresponding shooting perspective based on the pixel coordinates of the physical captured image.
[0072] That is, based on the first correspondence, we can get the pixel coordinates of the physical shooting view image corresponding to the original 3D model coordinates, and then further determine whether the mesh vertex is mapped within the image range based on the pixel coordinates. If the mesh vertex is within the image range, the RGB value of the mesh vertex is placed on the corresponding image coordinates, such as Figure 6 shown.
[0073] Among them, Figure 7 As shown, the specific operations of "determining whether the mesh vertices of the original 3D model are within the corresponding shooting angle of view based on the pixel coordinates of the physical shot image" in step 502 include:
[0074] Step 702: Determine the minimum bounding rectangle of pixel coordinates based on the pixel coordinates corresponding to the mesh vertices of the original three-dimensional model.
[0075] Step 704. Determine whether all pixels within the minimum enclosing rectangle are within the pixel coordinate bounding box mapped to the mesh vertices using the barycentric interpolation method. Specifically, this embodiment determines the minimum enclosing rectangle based on the pixel coordinates mapped to the mesh vertices and uses the barycentric interpolation method to determine whether all pixels within the rectangle are within the pixel coordinate bounding box mapped to the mesh vertices. The so-called barycentric interpolation method, which determines whether all pixels within the minimum enclosing rectangle are within the pixel coordinate bounding box mapped to the mesh vertices, actually uses the barycentric interpolation calculation method to determine whether a point (i.e., a pixel) is within the corresponding triangle in the mesh area.
[0076] Among them, Figure 8 As shown, step 704 specifically includes:
[0077] Step 7041: Take the result of weighted summation of the three vertex pixels of the triangle in the grid area as the target pixel point in the corresponding minimum enclosing rectangle.
[0078] Step 7042: Based on the judgment result of whether there is a weighting coefficient less than 0 among the three vertex pixels of the triangle, determine whether the target pixel point is within the pixel coordinate bounding box (ie, the minimum bounding rectangle) mapped by the mesh vertex.
[0079] Combine Figure 9 To explain, the so-called centroid interpolation means representing a point inside a triangle by the weighted sum of the pixels of the three vertices of the triangle (point A, point B, point C) (i.e., the sum result), where the sum of the weighted coefficients of the pixels at each vertex is 1.
[0080] P(x,y)=αA+βB+γC (2)
[0081] Where α + β + γ = 1. The coordinates of point P are two-dimensional points, and the unique values of α, β, and γ can be obtained by solving Formula 2 and the sum of the weighted coefficients being 1.
[0082] Specifically, if any of the three vertex pixels of the triangle have a weighting coefficient less than 0, then the target pixel (e.g., point D) is not within the bounding box of the pixel coordinates mapped to the mesh vertex. If no weighting coefficient is less than 0 for any of the three vertex pixels of the triangle, then the target pixel (e.g., point P) is within the bounding box of the pixel coordinates mapped to the mesh vertex. The color value obtained by weighting the pixels of the three vertices determined by the weighting coefficients is assigned to the target pixel. In other words, if any of the three calculated weights α, β, and γ is less than 0, then the pixel (e.g., point D) is considered to be outside the triangle and is discarded.
[0083] Step 504: Use the barycentric interpolation method to assign colors to the pixels corresponding to the grid within the shooting angle of view to form a two-dimensional texture image corresponding to the shooting angle of view.
[0084] If point P is inside the triangle, then the color value of the current position is interpolated according to the centroid weight. The color value of point P can be obtained by weighting the RGB values of the three vertices of the triangle (point A, point B, point C) using weights, and the color value is assigned to the image using formula 3, thereby forming a two-dimensional texture image corresponding to the shooting perspective.
[0085] P(R,G,B)=αA(R,G,B)+βB(R,G,B)+γC(R,G,B) (3)
[0086] like Figure 10 As shown, the specific steps of "determining the second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model" in step 108 may include:
[0087] Step 1002: Multiply the coordinates of the simplified 3D model by the transformation matrix corresponding to the shooting angle to obtain the pixel coordinates of the corresponding physical shot image.
[0088] Step 1004. The specific color information of the mesh vertices of the simplified 3D model and the corresponding pixel coordinates is used as the second correspondence between the 2D texture image and the mesh vertices of the simplified 3D model. The specific color information of the corresponding pixel coordinates is obtained by the mesh vertices of the simplified 3D model. Thus, the specific color information of the mesh vertices of the simplified 3D model and the corresponding pixel coordinates is the second correspondence of this embodiment, such as Figure 11 As shown in the figure, a mapping relationship is formed between the triangular facets (i.e., triangular regions) of the simplified 3D model mesh and the specific color information (i.e., texture image) of the corresponding pixel coordinates at the optimal viewing angle. The optimal viewing angle refers to the triangle with the lowest loss weight at the current viewing angle. The loss weight can be determined based on factors such as the triangle normal and the viewing angle. This mapping is similar to traditional problem mapping and will not be described in detail.
[0089] It should be understood that the texture mapping method for a 3D model in this embodiment utilizes a camera extrinsic parameter matrix and a camera intrinsic parameter matrix to determine a first correspondence matrix between the pixel coordinate system of the physical captured image corresponding to the original 3D model and the coordinate system of the original 3D model. Based on the first correspondence matrix and the original 3D model, a 2D texture image for each shooting angle is determined. The simplified 3D model is then mapped based on a second correspondence between the 2D texture image and the vertices of the simplified model mesh of the original 3D model. This method can optimize the shadowing issues associated with traditional texture mapping, maintain fine textures within the simplified 3D model, and thus enhance the realism of the 3D model. Thus, this embodiment addresses the prior art issue of projecting image shadows onto the model, resulting in inconsistent and unrealistic color.
[0090] Example 2:
[0091] like Figure 12 As shown, this embodiment also provides a texture mapping system 120 for a three-dimensional model, which includes a model acquisition unit 121 for acquiring an original three-dimensional model to process the original three-dimensional model to obtain a simplified three-dimensional model; a parameter acquisition unit 122 for acquiring a camera intrinsic parameter matrix and a camera extrinsic parameter matrix, the camera extrinsic parameter matrix being the posture information of the original three-dimensional model at different shooting angles; a first determination unit 123 for determining a first correspondence matrix between a pixel coordinate system of a physical shot image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix; a second determination unit 124 for determining a two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model, and determining a second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model; and for texture mapping the simplified three-dimensional model based on the second correspondence.
[0092] In this embodiment, the 3D model texture mapping system 120 uses the camera extrinsic parameter matrix and the camera intrinsic parameter matrix obtained by the parameter acquisition unit 122 to determine a first correspondence matrix between the physical captured image pixel coordinate system corresponding to the original 3D model and the original 3D model coordinate system. A second determination unit 124 then determines a 2D texture image for each shooting angle based on the first correspondence matrix and the original 3D model. The data processing unit 125 then maps the simplified 3D model based on the second correspondence between the 2D texture image and the vertices of the simplified model mesh of the original 3D model. This optimizes the shading issues associated with traditional texture mapping, maintains fine textures within the simplified 3D model, and thus improves the realism of the 3D model. This embodiment solves the prior art problem of projecting image shadows onto the model, resulting in inconsistent and unrealistic color.
[0093] It should be noted that the technical solutions of the texture mapping system of the three-dimensional model of this embodiment are the same as those in the first embodiment. Please refer to the first embodiment for the technical solutions, which will not be repeated here.
[0094] Example 3:
[0095] The embodiment of the present invention further provides a terminal device, which may include a processor, a memory, and a computer program stored in the memory and operable on the processor, wherein the computer program is executed by the processor to implement the above-mentioned Figure 1 The various processes of the embodiment of the texture mapping method for a three-dimensional model shown in the figure can achieve the same technical effect. To avoid repetition, they will not be described here.
[0096] Example 4:
[0097] Combine Figure 13 As shown, this embodiment also discloses a specific implementation of a computer-readable storage medium 1300. The computer-readable storage medium 1300 can be configured in whole or in part in a physical computer, server, cluster server or data center.
[0098] In this embodiment, the computer-readable storage medium 1300 stores computer program instructions 1301 . When the computer program instructions 1301 are read and executed by a processor 1302 , the steps of the texture mapping method for a three-dimensional model disclosed in the first embodiment are executed.
[0099] Optionally, the computer-readable storage medium 1300 can be configured as a server, and the server runs on a physical device used to build a private cloud, hybrid cloud, or public cloud. Furthermore, the computer-readable storage medium 1300 can be configured as a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or the like.
[0100] The computer-readable storage medium 1300 is used to store a program. After receiving the execution instruction, the processor 1302 executes the texture mapping method for a three-dimensional model disclosed in the first embodiment.
[0101] At the same time, the processor 1302 disclosed in this embodiment may be an integrated circuit chip with signal processing capabilities. The processor 1302 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or the general-purpose processor may also be any conventional processor.
[0102] For the technical solutions of the computer-readable storage medium 1300 disclosed in this embodiment that are the same as those in the first and / or second embodiments, please refer to the first and / or second embodiments and will not be repeated here.
[0103] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
[0104] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
[0105] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
Claims
1. A texture mapping method for a three-dimensional model, characterized in that: The method comprises: Acquire an original three-dimensional model and process the original three-dimensional model to obtain a simplified three-dimensional model; Obtaining a camera intrinsic parameter matrix and a camera extrinsic parameter matrix, wherein the camera extrinsic parameter matrix is the pose information corresponding to different shooting angles of the original three-dimensional model; Determining a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix; Based on the first correspondence matrix and the original three-dimensional model, a two-dimensional texture image at each shooting angle is determined, and a second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model is determined to perform texture mapping on the simplified three-dimensional model based on the second correspondence.
2. The method according to claim 1, characterized in that Determining a two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model includes: determining whether a mesh area of the original three-dimensional model is within a corresponding shooting angle based on a mesh normal of the original three-dimensional model and a shooting angle of the physical shooting image; If the mesh area of the original three-dimensional model is within the corresponding shooting angle of view, establishing a mapping relationship between the mesh of the original three-dimensional model and the pixels of the physical shot image based on the first correspondence matrix; Based on the mapping relationship, the pixels of the physical captured image are assigned values using a barycentric interpolation method to form a two-dimensional texture image of a corresponding angle.
3. The method according to claim 2, characterized in that Based on the mapping relationship, the pixels of the physical captured image are assigned values by using a barycentric interpolation method to form a two-dimensional texture image of a corresponding angle, including: Obtaining pixel coordinates of the physical captured image corresponding to the coordinates of the original three-dimensional model based on the mapping relationship, so as to determine whether the mesh vertices of the original three-dimensional model are within the corresponding shooting angle of view based on the pixel coordinates of the physical captured image; The barycentric interpolation method is used to assign colors to the pixels corresponding to the grid within the shooting angle of view to form a two-dimensional texture image corresponding to the shooting angle of view.
4. The method according to claim 3, characterized in that Determining whether mesh vertices of the original 3D model are within the corresponding shooting perspective based on the pixel coordinates of the physical shot image includes: Determine the minimum bounding rectangle of pixel coordinates based on the pixel coordinates corresponding to the mesh vertices of the original three-dimensional model; A barycentric interpolation method is used to determine whether all pixels within the minimum bounding rectangle are located within the pixel coordinate bounding box of the mesh vertex mapping.
5. The method according to claim 4, characterized in that Determining whether all pixels within the minimum bounding rectangle are within the pixel coordinate bounding box of the mesh vertex mapping using a barycentric interpolation method includes: The result of weighted summation of the three vertex pixels of the triangle in the grid area is used as the target pixel point in the corresponding minimum enclosing rectangle; Based on the judgment result of whether there is a weighting coefficient less than 0 among the three vertex pixels of the triangle, it is determined whether the target pixel point is within the pixel coordinate bounding box mapped by the mesh vertex.
6. The method according to claim 5, characterized in that Based on the judgment result of whether there is a weight coefficient less than 0 among the three vertex pixels of the triangle, determine whether the target pixel point is within the pixel coordinate bounding box mapped by the mesh vertex, including: If any of the three vertex pixels of the triangle has a weighting coefficient less than 0, then the target pixel point is not within the pixel coordinate bounding box of the mesh vertex mapping; If there is no weighting coefficient less than 0 among the three vertex pixels of the triangle, the target pixel point is within the pixel coordinate bounding box mapped by the grid vertex, and the color value obtained by weighted summation of the pixels of the three vertices determined according to the weighting coefficient is assigned to the target pixel point.
7. The method according to claim 1, characterized in that Determining a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix includes: The product of the camera extrinsic parameter matrix and the camera intrinsic parameter matrix is used as the first correspondence matrix.
8. The method according to claim 1, characterized in that Determining a second correspondence between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model includes: Multiplying the coordinates of the simplified three-dimensional model by a transformation matrix corresponding to the shooting angle of view to obtain pixel coordinates corresponding to the physical shot image; The specific color information of the mesh vertices of the simplified three-dimensional model and the corresponding pixel coordinates is used as a second corresponding relationship between the two-dimensional texture image and the mesh vertices of the simplified three-dimensional model.
9. A texture mapping system for a three-dimensional model, characterized in that: include: A model acquisition unit is used to acquire an original three-dimensional model and process the original three-dimensional model to obtain a simplified three-dimensional model; A parameter acquisition unit, configured to acquire a camera intrinsic parameter matrix and a camera extrinsic parameter matrix, wherein the camera extrinsic parameter matrix is the pose information corresponding to different shooting angles of the original three-dimensional model; a first determining unit, configured to determine, based on the camera extrinsic parameter matrix and the camera intrinsic parameter matrix, a first correspondence matrix between a pixel coordinate system of a physical captured image corresponding to the original three-dimensional model and a coordinate system of the original three-dimensional model; a second determining unit, configured to determine a two-dimensional texture image at each shooting angle based on the first correspondence matrix and the original three-dimensional model, and determine a second correspondence between the two-dimensional texture image and mesh vertices of the simplified three-dimensional model; as well as, A data processing unit is configured to perform texture mapping on the simplified three-dimensional model based on the second corresponding relationship.
10. A terminal device comprising: A memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the computer program implements the steps of the method according to claim 1 when executed by the processor.
Citation Information
Patent Citations
Realistic three-dimensional color texture reconstruction method
CN110599578A
Finger three-dimensional model texture mapping method based on UV mapping
CN113012271A
Three-dimensional model texture mapping method and related device
CN115797535A