CN116797761A - 3D embossment generation method and system - Google Patents

3D embossment generation method and system Download PDF

Info

Publication number
CN116797761A
CN116797761A CN202310761242.1A CN202310761242A CN116797761A CN 116797761 A CN116797761 A CN 116797761A CN 202310761242 A CN202310761242 A CN 202310761242A CN 116797761 A CN116797761 A CN 116797761A
Authority
CN
China
Prior art keywords
module
model
vertex
picture
vertexes
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
CN202310761242.1A
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN202310761242.1A priority Critical patent/CN116797761A/en
Publication of CN116797761A publication Critical patent/CN116797761A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • G06T17/205Re-meshing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a 3D embossment generating method and system. The relief deformation degree established by the method is small, and the operation is simple and convenient; through the grid reconstruction and grid subdivision algorithm, the texture can be converted into the model surface relief while the quality of the grid is ensured.

Description

3D embossment generation method and system
Technical Field
The invention relates to the technical field of computers, in particular to a 3D embossment generating method and system.
Background
In general, the digital embossment grid can show exquisite details and appearance, the visual characteristics and geometric details of the rough model are improved by a method of encrypting and subdividing the grid, but a plurality of problems are caused by too abundant details of the surface of the model:
1. when the relief grid is rendered by using an OpenGL loader, the memory is occupied, the video memory is large, and program breakdown is often caused by insufficient video memory;
2. the file of the embossment grid occupies a larger space, so that the page operation is not smooth, network transmission and storage are very unfavorable, and a model needs to be simplified, but if the file is excessively simplified in pursuit of rendering and transmission speed, the model is distorted;
3. the embossing edge has serious sawtooth phenomenon, and the generation amount of the long and narrow triangle is more.
Therefore, a method and a system for generating 3D relief become a urgent problem to be solved.
Disclosure of Invention
The invention aims to solve the technical problem of providing a method and a system for generating a 3D embossment, which are used for realizing pixel-level direct embossment conversion of a two-dimensional picture on a three-dimensional model, designing and developing an optimal path selection and self-adaptive segmentation algorithm, subdividing grids and remarkably improving the details and smoothness of an engraving model.
In order to solve the technical problems, the technical scheme provided by the invention is a 3D embossment generating method, which comprises the following steps:
1) Selecting a source file: obtaining an engraved picture and model, and adjusting parameters of the picture and the model;
2) Global subdivision: acquiring three vertexes and three edges of the current face as parameters of a subdivision function, deleting the original face and creating four new faces to generate finer grids;
3) Model selection: the user sets polygon mesh and circulation line segment parameters, calculates the direction vector of the vertex and the vector from the vertex to the center, calculates the included angle between the vertex and the center, and selects and completes carving and selecting areas of different areas when the included angle is larger than a set threshold value;
4) Extracting a picture pattern: calculating first derivatives of the image in the horizontal direction and the vertical direction respectively through convolution operation, calculating gradient strength of each pixel point according to the derivatives in the two directions, obtaining the direction of the edge by calculating the ratio of gradients in the two directions and applying an arctangent function, and finally accurately identifying the image edge through analysis of the gradient strength and the direction;
5) Selecting and subdividing areas: extracting all vertexes in the selected area, traversing the vertexes through an iterator to find all adjacent faces, storing the faces as a set of faces, generating new vertexes on each face, deleting the original faces and creating three new faces; for each original vertex, moving its position to the average position of all its neighbors; performing edge overturning operation, creating a new surface in a new vertex connection mode, and completing reselection of the area and updating the state;
6) Carving: and converting the color picture into a gray picture, establishing a mapping relation between grid points and image pixels by the parameter area, and adjusting the height of the vertexes according to the gray value to generate embossments.
As an improvement, the parameters include model size, model position, ambient light, diffuse reflected light.
As an improvement, the mapping relation between the grid points and the image pixels adopts conformal mapping or conformal mapping.
In the step 6, after converting into a gray image, carrying out normalization processing to adjust the height of the normal vector of the vertex, wherein the higher the gray value is, the higher the height of the vertex is; the lower the gray value, the lower the height of the vertex.
A 3D relief generating system: the system comprises an acquisition module, a region selection module, an extraction module, a gridding module, an engraving module, a coloring module and a derivation module;
the acquisition module is used for acquiring a picture and a model of customized engraving and adjusting parameters of the picture and the model;
the selective area module is used for automatically selecting an engraving area in a selective area of a user;
the extraction module is used for identifying the image edge of the picture;
the gridding module is used for global subdivision or local subdivision, the complexity degree and the local characteristics of the model, and subdivision with different degrees is realized in different areas;
the engraving module is used for establishing a mapping relation between grid points and image pixels, and adjusting the height of the vertexes according to gray values to generate embossments;
the coloring module is used for previewing the effect of model coloring;
the export module is used for storing the engraving model. Compared with the prior art, the invention has the advantages that:
1) And establishing boundaries for grid parameterization by pre-cutting grids, establishing a mapping relation between grid points and image pixels by a parameter area, and then adjusting the height of vertexes according to gray values to generate embossments. The relief deformation degree established by the method is small, and the operation is simple and convenient;
2) Through the grid reconstruction and grid subdivision algorithm, the texture can be converted into the model surface relief while the quality of the grid is ensured.
Drawings
FIG. 1 is a schematic diagram of a 3D relief generating system of the present invention.
Fig. 2 is a diagram of an engraved product.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
The user can customize the carved pictures and models by clicking on the 'select model' and the 'select picture', and can start to operate the models only by clicking on the 'display'. If the model picture is wanted to be saved, the user can click on the screenshot at any time to save. If there is a question about the operation steps, the help button may be clicked to review the detailed tutorial. After loading the picture and model, the user may rotate the model by holding the left-key drag, holding the right-key to resize the model, and holding the center-key to move the model. Meanwhile, the sliding bar below the sliding bar is dragged to adjust the light effects of ambient light, diffuse reflection light and the like in the graphic window.
The user may select a global subdivision function. The triangle mesh is mainly subdivided, so that the detail degree and the precision of the graph are improved. First, the function receives a triangle face as a parameter, and the system finds the three vertices and three edges of the current face. A new vertex is then created for each edge, which is the midpoint of the original edge. If these midpoints already exist, then no recreating is needed. Then for each edge, if that edge is not at a boundary and the faces adjacent to it need to be subdivided, it recursively invokes the subdivision function. Finally, the original surface is deleted, and then four new surfaces are created to generate a finer grid, so that the fine grid has higher detail and precision, the simplicity of the whole grid structure can be maintained, and the detail display of the local area can be effectively improved.
In the process of selecting the area, an optimal path selection method with limited angles is adopted, so that the area selection of different areas is finished. The system selects regions from a given polygonal mesh and cyclic line segments to form a selected region. This selected region contains the boundary and the internal vertices. This function is selected using Breadth First Search (BFS) while taking into account both clockwise and counterclockwise directions. The selected vertices will be stored in queues and vectors, and the vertices will be marked after being selected, preventing repeated selection. To limit the direction angle of the path, we do this by comparing whether the current direction of the vertex and the center direction agree. The specific implementation mode is that the direction vector of the vertex and the vector from the vertex to the center are calculated, and then the included angle between the direction vector and the vector from the vertex to the center is calculated. If the included angle is greater than a certain threshold (here, 0.3, which corresponds to a cosine value of 0.3), then the current direction and the center direction are judged to be approximately consistent, and selection can be performed. The user only needs to select four points clockwise or anticlockwise by using the mouse, and the system can engrave in the optimal engraving area just selected. If the result is not ideal, the user may click the "reset" button to reselect the area, or choose to click "undo" back to the previous operation.
In extracting the picture pattern, we use the edge recognition algorithm in OpenCV to process the picture in order to more accurately recognize the image edge. The Sobel operator is an operator for edge detection, and an edge is identified by calculating gradient strength and direction of an image pixel point. The algorithm firstly calculates the first derivatives of the image in the horizontal direction and the vertical direction respectively through convolution operation. Then, the gradient intensity of each pixel point is calculated from the derivatives in both directions, which is generally regarded as the edge intensity. Meanwhile, the direction of the edge can also be obtained by calculating the ratio of the gradients of the two directions and applying an arctangent function. Finally, through analysis of gradient strength and direction, the Sobel operator can effectively identify and highlight edge information in the image. The innovative method enables edge recognition of the relief design to be more accurate and edge association information in the image to be captured more accurately, so that accuracy of the relief design is improved.
After finishing the selection of the selected area, the user can select the function of 'selecting the area and subdividing', so that the grid is subdivided. The algorithm firstly extracts all the vertexes in the selected area, then traverses the vertexes through the iterator to find all the adjacent faces, and stores the faces as a set of faces. New vertices (i.e., the centers of gravity of the triangles) are then generated on each face, deleting the original face and creating three new faces. At the same time, for each original vertex, its position is moved to the average position of all its neighbors. Finally, the flipping operation of the edge is performed, creating a new face in a new vertex connection. This results in the original edge being replaced with a new edge connecting the center of gravity. After the operation is finished, the area is reselected and the status is updated. The progress bar is updated simultaneously in the whole process, so that a user can know the operation progress conveniently. The user may then select "select smooth" to view the effect, or click on a "graffiti" button, changing the RGB values of the select to stain the select.
The user may select "relief" (engraving outwards) or "etching" (engraving inwards) and then click on "conformal map" or "conformal area map" to complete the engraving operation. The system converts the color picture into a grayscale picture. In this process, the red, green and blue values of each pixel are converted into a single gray value by linear weighting, i.e., gray=0.299×red+0.587×green+0.114×blue. For a picture, the gray value will generally be in the range of 0-255, and in order to convert it to the height value of the vertex, we need to normalize, i.e. map the gray value to a preset range, for example 0-1. Finally, we can use the normalized gray values to adjust the height of the vertex normal vector. The higher the gray value (closer to white), the higher the height of the vertex; the lower the gray value (closer to black), the lower the height of the vertex. If the effect of one engraving is not obvious, it is recommended to click on "conformal mapping" or "conformal area mapping" again.
After engraving is completed, the user may choose to "flat paint" to view the overall geometry, or "smooth paint" to preview the effect. In the calculation process, the plane coloring performs uniform coloring for each polygonal surface, namely all pixels on the same surface have the same color and brightness, and the influence of the pixel position in the surface on illumination is not considered. The smooth coloring is carried out by interpolation calculation according to the position of the pixel point on the surface of the object, the factors of a light source, a visual angle and the like, so that the color and the brightness of the surface of the object show smooth transition and are more real and natural.
Finally, the user can export the carved model into obj format through the 'save model', which is convenient for viewing and using.
While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (5)

1. A method of generating a 3D relief, comprising the steps of:
1) Selecting a source file: obtaining an engraved picture and model, and adjusting parameters of the picture and the model;
2) Global subdivision: acquiring three vertexes and three edges of the current face as parameters of a subdivision function, deleting the original face and creating four new faces to generate finer grids;
3) Model selection: the user sets polygon mesh and circulation line segment parameters, calculates the direction vector of the vertex and the vector from the vertex to the center, calculates the included angle between the vertex and the center, and selects and completes carving and selecting areas of different areas when the included angle is larger than a set threshold value;
4) Extracting a picture pattern: calculating first derivatives of the image in the horizontal direction and the vertical direction respectively through convolution operation, calculating gradient strength of each pixel point according to the derivatives in the two directions, obtaining the direction of the edge by calculating the ratio of gradients in the two directions and applying an arctangent function, and finally accurately identifying the image edge through analysis of the gradient strength and the direction;
5) Selecting and subdividing areas: extracting all vertexes in the selected area, traversing the vertexes through an iterator to find all adjacent faces, storing the faces as a set of faces, generating new vertexes on each face, deleting the original faces and creating three new faces; for each original vertex, moving its position to the average position of all its neighbors; performing edge overturning operation, creating a new surface in a new vertex connection mode, and completing reselection of the area and updating the state;
6) Carving: and converting the color picture into a gray picture, establishing a mapping relation between grid points and image pixels by the parameter area, and adjusting the height of the vertexes according to the gray value to generate embossments.
2. A method of generating a 3D relief as claimed in claim 1, wherein: the parameters include model size, model position, ambient light, diffuse reflected light.
3. A method of generating a 3D relief as claimed in claim 1, wherein: and the mapping relation between the grid points and the image pixels adopts conformal mapping or conformal mapping.
4. A method of generating a 3D relief as claimed in claim 1, wherein: in the step 6, after converting into a gray image, carrying out normalization processing to adjust the height of the normal vector of the vertex, wherein the higher the gray value is, the higher the height of the vertex is; the lower the gray value, the lower the height of the vertex.
5. A 3D embossing system, characterized by: the system comprises an acquisition module, a region selection module, an extraction module, a gridding module, an engraving module, a coloring module and a derivation module;
the acquisition module is used for acquiring a picture and a model of customized engraving and adjusting parameters of the picture and the model;
the selective area module is used for automatically selecting an engraving area in a selective area of a user;
the extraction module is used for identifying the image edge of the picture;
the gridding module is used for global subdivision or local subdivision, the complexity degree and the local characteristics of the model, and subdivision with different degrees is realized in different areas;
the engraving module is used for establishing a mapping relation between grid points and image pixels, and adjusting the height of the vertexes according to gray values to generate embossments;
the coloring module is used for previewing the effect of model coloring;
the export module is used for storing the engraving model.
CN202310761242.1A 2023-06-27 2023-06-27 3D embossment generation method and system Pending CN116797761A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310761242.1A CN116797761A (en) 2023-06-27 2023-06-27 3D embossment generation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310761242.1A CN116797761A (en) 2023-06-27 2023-06-27 3D embossment generation method and system

Publications (1)

Publication Number Publication Date
CN116797761A true CN116797761A (en) 2023-09-22

Family

ID=88043515

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310761242.1A Pending CN116797761A (en) 2023-06-27 2023-06-27 3D embossment generation method and system

Country Status (1)

Country Link
CN (1) CN116797761A (en)

Similar Documents

Publication Publication Date Title
US10861232B2 (en) Generating a customized three-dimensional mesh from a scanned object
US10489970B2 (en) 2D image processing for extrusion into 3D objects
US9773302B2 (en) Three-dimensional object model tagging
US7365744B2 (en) Methods and systems for image modification
Yemez et al. 3D reconstruction of real objects with high resolution shape and texture
CN107452010A (en) A kind of automatically stingy nomography and device
US7889913B2 (en) Automatic compositing of 3D objects in a still frame or series of frames
US10204447B2 (en) 2D image processing for extrusion into 3D objects
CN109712223B (en) Three-dimensional model automatic coloring method based on texture synthesis
Olsen et al. Image-assisted modeling from sketches.
EP2528042B1 (en) Method and device for the re-meshing of 3D polygon models
Ramanarayanan et al. Constrained texture synthesis via energy minimization
CN109448093B (en) Method and device for generating style image
US6744440B1 (en) Image processing apparatus, recording medium, and program
CN116797761A (en) 3D embossment generation method and system
KR100602739B1 (en) Semi-automatic field based image metamorphosis using recursive control-line matching
Cushen et al. Markerless real-time garment retexturing from monocular 3d reconstruction
Heo et al. Local spherical harmonics for facial shape and albedo estimation
CN117274511B (en) Box-type 3D preview system and method in packaging field
Zhang et al. Vision-related MLS image deformation using saliency map
CN116993888A (en) Edge rendering method, apparatus, device, storage medium, and computer program product
Oh A system for image-based modeling and photo editing
Oriti et al. A single RGB image based 3D object reconstruction system
Lin Non-photorealistic Rendering for 3D Mesh Models
Pereira et al. RGBN image editing

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