WO2022262201A1 - Facial three-dimensional model visualization method and apparatus, electronic device, and storage medium - Google Patents

Facial three-dimensional model visualization method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2022262201A1
WO2022262201A1 PCT/CN2021/132548 CN2021132548W WO2022262201A1 WO 2022262201 A1 WO2022262201 A1 WO 2022262201A1 CN 2021132548 W CN2021132548 W CN 2021132548W WO 2022262201 A1 WO2022262201 A1 WO 2022262201A1
Authority
WO
WIPO (PCT)
Prior art keywords
facial
model
dimensional
dimensional model
vertex
Prior art date
Application number
PCT/CN2021/132548
Other languages
French (fr)
Chinese (zh)
Inventor
罗家祯
陈福兴
刘兴云
李志阳
齐子铭
Original Assignee
厦门美图宜肤科技有限公司
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 厦门美图宜肤科技有限公司 filed Critical 厦门美图宜肤科技有限公司
Priority to JP2022540757A priority Critical patent/JP7433444B2/en
Priority to KR1020227022198A priority patent/KR102622215B1/en
Publication of WO2022262201A1 publication Critical patent/WO2022262201A1/en

Links

Images

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/0059Measuring for diagnostic purposes; Identification of persons using light, e.g. diagnosis by transillumination, diascopy, fluorescence
    • A61B5/0062Arrangements for scanning
    • A61B5/0064Body surface scanning
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/103Detecting, measuring or recording devices for testing the shape, pattern, colour, size or movement of the body or parts thereof, for diagnostic purposes
    • A61B5/107Measuring physical dimensions, e.g. size of the entire body or parts thereof
    • A61B5/1072Measuring physical dimensions, e.g. size of the entire body or parts thereof measuring distances on the body, e.g. measuring length, height or thickness
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/103Detecting, measuring or recording devices for testing the shape, pattern, colour, size or movement of the body or parts thereof, for diagnostic purposes
    • A61B5/107Measuring physical dimensions, e.g. size of the entire body or parts thereof
    • A61B5/1079Measuring physical dimensions, e.g. size of the entire body or parts thereof using optical or photographic means
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/48Other medical applications
    • A61B5/4848Monitoring or testing the effects of treatment, e.g. of medication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • 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/005Tree description, e.g. octree, quadtree
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the present application relates to the technical field of three-dimensional models, and in particular, relates to a visualization method, device, electronic equipment and storage medium of a three-dimensional facial model.
  • the present application provides a method, device, electronic device and storage medium for visualizing a three-dimensional facial model, so as to intuitively display changes in the face, thereby solving the above-mentioned deficiencies in the prior art.
  • Some embodiments of the present application provide a method for visualizing a three-dimensional facial model, which may include:
  • first three-dimensional facial model and the second three-dimensional facial model of the subject are in triangular patch format;
  • the three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
  • the acquisition of the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments includes:
  • the calculating the pose transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model may include:
  • the attitude transformation matrix is calculated and acquired by using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
  • the calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model may include:
  • each vertex in the first 3D facial model calculate and acquire the distance from each vertex in the 1st 3D facial model to the closest triangular patch of the second 3D facial model.
  • calculate and acquire the distance between each vertex in the first three-dimensional facial model and the nearest triangle surface of the second three-dimensional facial model distance which can include:
  • the distance from each vertex in the first facial 3D model to the closest triangular patch of the second facial 3D model is obtained.
  • associating the vertices of the first three-dimensional facial model with the triangular patches in the small cube can include:
  • the vertex code and the index relationship of the small cube determine if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the triangle patch in the small cube .
  • the method may also include:
  • rendering the first facial three-dimensional model according to the distance to obtain a heat map model may include:
  • the calculating the three-dimensional contours respectively according to the first facial three-dimensional model and the second facial three-dimensional model to obtain the first contour model and the second contour model may include:
  • the second facial three-dimensional model is rendered according to the second three-dimensional contour line to obtain the second contour line model.
  • FIG. 1 Other embodiments of the present application also provide a three-dimensional facial model visualization device, and the three-dimensional facial model visualization device may include:
  • the three-dimensional model acquisition module can be configured to acquire the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are Triangular patch format;
  • a distance calculation module which may be configured to calculate the distance between coordinate points in the first three-dimensional facial model and the second three-dimensional facial model
  • the heat map visualization module may be configured to render the first facial three-dimensional model according to the distance to obtain a heat map model
  • the contour line visualization module may be configured to calculate three-dimensional contour lines respectively according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
  • the 3D model acquisition module may include:
  • a three-dimensional model acquisition unit may be configured to acquire the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments;
  • a pose transformation matrix calculation unit may be configured to calculate a pose transformation matrix between the first initial three-dimensional facial model and the second three-dimensional facial model;
  • the alignment unit may be configured to align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
  • the attitude transformation matrix calculation unit may include:
  • the first sphere interception subunit may be configured to intercept the first initial facial three-dimensional model with a preset radius with the nose tip position of the first initial facial three-dimensional model as the center of the sphere, to obtain the first initial A first sphere interception model corresponding to the facial three-dimensional model;
  • the second sphere intercepting subunit can be configured to use the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, and intercept the second facial three-dimensional model with the preset radius to obtain the second facial A second sphere interception model corresponding to the three-dimensional model;
  • the attitude transformation matrix calculation subunit may be configured to calculate and obtain the attitude transformation matrix by using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
  • the distance calculation module may be configured to calculate and obtain the distance from each vertex in the first 3D facial model to the second vertex according to the coordinates of each vertex in the first 3D facial model. The distance of the nearest triangle of the facial 3D model.
  • the distance calculation module may include:
  • a bounding box calculation unit may be configured to calculate the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
  • An octree building unit may be configured to build an octree structure for the minimum common cube bounding box of the first facial three-dimensional model
  • the equalizing unit may be configured to equally divide the minimum common cube bounding box of the second facial three-dimensional model with the depth of the octree structure to obtain a preset number of small cubes;
  • the first associating unit may be configured to associate the triangular patch of the second facial three-dimensional model with the small cube;
  • the second associating unit may be configured to associate the vertices of the first three-dimensional facial model with the triangles in the small cube according to the index relationship between the coordinates of the vertices of the first three-dimensional facial model and the small cube. patch association;
  • the distance calculation unit may be configured to obtain the distance between each vertex in the first facial three-dimensional model and the nearest triangle surface of the second facial three-dimensional model according to the distance between the vertex coordinates and the associated triangle surface. distance.
  • the second association unit may include:
  • the encoding calculation subunit may be configured to calculate the vertex encoding of the first facial three-dimensional model according to the octree structure
  • the second associating subunit can be configured to, according to the vertex code and the index relationship of the small cube, determine that if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the Describe the association of triangular patches in the small cube.
  • the device may also include:
  • the neighborhood judging unit may be configured to: if the triangular patch in the small cube associated with the vertex is an empty set, then use the small cube as the center to judge other small cubes in the neighborhood of the preset radius of the small cube Whether the triangles in the cube are an empty set;
  • the third associating subunit may be configured to: if the triangle faces in the other small cubes are not an empty set, associate the vertex with the triangle faces in the other small cubes.
  • the heat map visualization module may be configured to perform color rendering on any region of the first facial three-dimensional model according to the mapping relationship between the distance and the color table, to obtain the heat map model.
  • the contour visualization module may include:
  • a height map calculation unit configured to calculate a first height map of the first facial three-dimensional model and a second height map of the second facial three-dimensional model
  • a first two-dimensional contour calculation unit may be configured to calculate a first two-dimensional contour of the first facial three-dimensional model according to the first height map;
  • a second two-dimensional contour calculation unit may be configured to calculate a second two-dimensional contour of the second facial three-dimensional model according to the second height map;
  • the conversion unit may be configured to convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line;
  • the first contour line visualization unit may be configured to render the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
  • the second contour line visualization unit may be configured to render the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
  • Some other embodiments of the present application also provide an electronic device, which may include: a processor, a storage medium, and a bus.
  • the storage medium stores program instructions executable by the processor.
  • the processor communicates with the storage medium through a bus, and the processor executes the program instructions to execute the steps of the facial three-dimensional model visualization method described in any one of the above embodiments.
  • FIG. 1 Further embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, the facial three-dimensional model as described in any one of the above-mentioned embodiments is executed. Steps of the visualization method.
  • the present application provides a method, device, electronic device and storage medium for visualizing a three-dimensional facial model, by obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second facial three-dimensional model in triangular patch format; calculating the distance between the coordinate points in the first facial three-dimensional model and the second facial three-dimensional model; rendering the first facial three-dimensional model according to the distance to obtain a heat map model;
  • the three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
  • the facial depression or protrusion of the first three-dimensional facial model relative to the second three-dimensional facial model can be characterized according to the distance between the coordinate points of the first three-dimensional facial model and the second three-dimensional facial model, and
  • the difference between the two models' facial depressions or protrusions can be intuitively displayed, and the deformation and movement of the subject's face can be intuitively understood through the first contour model and the second contour model, so as to realize facial changes visualization.
  • Fig. 1 is a schematic flow chart of the first facial three-dimensional model visualization method provided by the embodiment of the present application
  • FIG. 2 is a schematic flow diagram of a second facial three-dimensional model visualization method provided by an embodiment of the present application
  • FIG. 3 is a schematic flow diagram of a third facial three-dimensional model visualization method provided in an embodiment of the present application.
  • FIG. 4 is a schematic flow diagram of a fourth facial three-dimensional model visualization method provided in an embodiment of the present application.
  • FIG. 5 is a schematic flow diagram of a fifth facial three-dimensional model visualization method provided in an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a neighborhood small cube provided by an embodiment of the present application.
  • FIG. 7 is a schematic flow diagram of a sixth facial three-dimensional model visualization method provided by the embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a facial three-dimensional model visualization device provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of an electronic device provided by an embodiment of the present application.
  • the facial three-dimensional model visualization method provided by the embodiment of the present application is executed by an electronic device with a facial three-dimensional model visualization function.
  • the electronic device connected by device communication receives the facial three-dimensional model sent by the modeling device.
  • the electronic device may be a beauty instrument, or may be a smart phone, a tablet computer, a server, a desktop computer, a notebook computer, etc., which is not limited here.
  • Fig. 1 is a schematic flow chart of the first facial three-dimensional model visualization method provided by the embodiment of the present application; as shown in Fig. 1, the method may include:
  • S10 Acquiring the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments.
  • the first three-dimensional facial model and the second three-dimensional facial model are facial three-dimensional models of the same subject at two different moments, and both the first three-dimensional facial model and the second three-dimensional facial model can be acquired by a three-dimensional scanning device. Furthermore, the first three-dimensional facial model is obtained through a three-dimensional scanning model, and the second three-dimensional facial model is a professional, such as a plastic surgeon, who simulates plastic surgery on the first three-dimensional facial model. By adjusting the first three-dimensional facial model derived from the facial structure. To facilitate subsequent calculations, it is necessary to ensure that the first facial 3D model and the second facial 3D model are in the triangular patch format, which means that the facial 3D model is composed of multiple triangular surfaces.
  • first three-dimensional facial model and the second three-dimensional facial model are high-precision, high-resolution three-dimensional models with texture maps.
  • S20 Calculate the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model.
  • calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model may include: calculating the distance from the vertices of the first three-dimensional facial model to the second three-dimensional facial model and calculating the second three-dimensional facial model The distance from the vertices of to the first facial 3D model.
  • the vertices of the first facial three-dimensional model are the key points for establishing the first facial three-dimensional model, or the triangle vertices of the triangular patch in the first facial three-dimensional model, and the vertices of the first facial three-dimensional model are calculated to the second facial three-dimensional model
  • the process of the distance is: calculate the shortest distance from the vertex of the first facial 3D model to the second facial 3D model. In an optional calculation method, you can calculate the distance from each vertex of the first facial 3D model to the second The distance of all vertices of the face 3D model to determine the closest distance.
  • the distance from each vertex in the first three-dimensional facial model to the nearest triangle patch of the second three-dimensional facial model is calculated and acquired.
  • first facial 3D model and the second facial 3D model are high-precision models with a very large number of vertices
  • the distance to the nearest triangular patch to the vertex can be determined as the first distance, and the calculation method of the point-to-surface distance will not be described in detail here.
  • S30 Render the first facial three-dimensional model according to the distance to obtain a heat map model.
  • the heat map model is used to display the muscle condition of any region of the subject's face.
  • the directed distance is positive, indicating that The first three-dimensional facial model is convex relative to the second three-dimensional facial model at this coordinate point, and the directional distance is negative, indicating that the first three-dimensional facial model is concave relative to the second three-dimensional facial model at this coordinate point, and the calculation
  • the color value of each coordinate point in the area where the first facial three-dimensional model is located, and the first facial three-dimensional model is rendered according to the color value to obtain a heat map model.
  • S40 Calculating three-dimensional contour lines respectively according to the first three-dimensional facial model and the second three-dimensional facial model, to obtain a first contour line model and a second contour line model.
  • the contour line model is used to show the trend of any area of the subject's face, and the three-dimensional contour line of the first three-dimensional face model is determined according to the height value of each vertex of the first three-dimensional face model in the preset height direction , rendering the 3D contour line of the first facial 3D model on the first facial 3D model to obtain the first contour line model.
  • the calculation process of the second contour model is the same as that of the first contour model, and will not be repeated here.
  • the facial three-dimensional model visualization method obtaineds the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are triangular surfaces slice format; calculate the distance between the coordinate points in the first facial three-dimensional model and the second facial three-dimensional model; render the first facial three-dimensional model according to the distance, and obtain a heat map model; according to the first facial three-dimensional model and the second facial three-dimensional model The three-dimensional contour lines of the two facial 3D models are calculated respectively to obtain the first contour line model and the second contour line model.
  • the facial depression or protrusion of the first 3D facial model relative to the second 3D facial model can be characterized according to the distance between the coordinate points of the first 3D facial model and the second 3D facial model , and intuitively display the difference between the two models' facial depression or protrusion through the heat map model, and intuitively understand the deformation and movement of the subject's face through the first contour model and the second contour model, so as to realize the Visualization of facial changes.
  • FIG. 2 is a schematic flow chart of the second method for visualizing a three-dimensional facial model provided in the embodiment of the present application.
  • the above S10 may include:
  • S11 Acquire the first initial three-dimensional facial model and the second three-dimensional facial model of the subject at the two different moments.
  • the acquisition method of the first initial facial three-dimensional model and the second facial three-dimensional model is as described above in S10, and will not be described in detail here. Since the angles and facial movements of the facial three-dimensional models acquired at different times are different, it is necessary to One of the three-dimensional facial models is corrected, and the solution of the embodiment of the present application is to correct the first initial three-dimensional facial model.
  • S12 Calculate a pose transformation matrix of the first initial three-dimensional facial model and the second three-dimensional facial model.
  • S13 Align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix, to obtain the first facial three-dimensional model.
  • the attitude transformation matrix Correction may be performed on the first initial three-dimensional facial model, so as to align the first initial three-dimensional facial model in the coordinate system where the second three-dimensional facial model is located, to obtain a corrected first three-dimensional facial model.
  • the alignment formula is:
  • the facial three-dimensional model visualization method obtaineds the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments, and calculates the first initial facial three-dimensional model and the second facial three-dimensional model
  • the attitude transformation matrix of the first facial three-dimensional model is aligned to the second facial three-dimensional model according to the attitude transformation matrix to obtain the first facial three-dimensional model.
  • the first initial facial 3D model can be aligned with the second facial 3D model, avoiding the inclination deviation between the facial 3D models at different times, resulting in the thermal map model and the contour model When the visual comparison is performed, there is a deviation in the result, which improves the accuracy of the comparison result.
  • FIG. 3 is a schematic flowchart of the third method for visualizing a three-dimensional facial model provided in the embodiment of the present application.
  • the above S12 may include:
  • the position of the tip of the nose can be used as the center of the sphere, and the first initial facial 3D model can be calculated with a preset radius Perform interception to obtain the first sphere interception model.
  • S122 Take the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, intercept the second facial three-dimensional model with a preset radius, and obtain a second spherical intercepting model corresponding to the second facial three-dimensional model.
  • the process of intercepting the second 3D facial model to obtain the second sphere interception model is the same as the process of the first initial facial 3D model, and will not be repeated here.
  • the preset transformation matrix calculation method is used to calculate the attitude transformation matrix that aligns the first sphere interception model to the second sphere interception model
  • the preset transformation matrix calculation method may be an iterative closest point (Iterative Closest Point, ICP) algorithm.
  • the facial 3D model visualization method takes the position of the tip of the nose of the first initial facial 3D model as the center of the sphere, intercepts the first initial facial 3D model with a preset radius, and obtains the first initial facial 3D model corresponding to the first A sphere interception model, taking the position of the tip of the nose of the second facial 3D model as the center of the sphere, and intercepting the second facial 3D model with a preset radius to obtain a second sphere interception model corresponding to the second facial 3D model, using a preset transformation matrix
  • the calculation method, as well as the first sphere interception model and the second sphere interception model calculate and obtain the attitude transformation matrix.
  • the first initial facial 3D model and the second facial 3D model are respectively sphere intercepted to omit the cheek regions on both sides that contribute less to the calculation of the pose transformation matrix, and the first The sphere interception model and the second sphere interception model reduce the calculation amount and improve the calculation efficiency when the attitude transformation matrix is calculated using the preset transformation matrix calculation method.
  • FIG. 4 is a schematic flowchart of the fourth method for visualizing a three-dimensional facial model provided in the embodiment of the present application.
  • the above S20 may include:
  • S21 Calculate the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model.
  • the maximum length is obtained from the length, width and height of the first 3D facial model and the length, width and height of the second 3D facial model.
  • width, and height, and according to the maximum length, width, and height establish the minimum common cube bounding boxes of the first facial three-dimensional model and the second facial three-dimensional model, and the minimum common cube bounding boxes can completely surround the first facial three-dimensional respectively model and a second facial 3D model.
  • the octree structure is a tree-like data structure used to describe a three-dimensional space.
  • the cube stores multiple vertices of the 3D model of the first face, and then sequentially splits the small cubes stored with multiple vertices.
  • the depth N of the split is used to indicate the number of times the small cube is split. The depth can be determined according to the requirements. Before reaching the depth of segmentation, if there is no vertex in the small cube, the segmentation will be stopped in advance.
  • the depth of the octree structure is the number of times the minimum common cube bounding box of the first facial three-dimensional model is segmented plus one, that is, once divided, the depth of the octree structure is 2.
  • the minimum common cube bounding box of the second facial three-dimensional model is equally divided into N3 small cubes.
  • S24 Associating the triangular patch of the second facial three-dimensional model with the small cube.
  • the small cube is coded according to preset rules, and the vertex coordinates of the first three-dimensional facial model and the small cube of the second three-dimensional facial model are determined according to the position of the vertex coordinates of the first three-dimensional facial model in the octree structure. According to the index relationship, the vertices of the first facial three-dimensional model are associated with the corresponding triangular faces in the small cube.
  • each small cube contains multiple triangular faces
  • the distance between the vertex and each triangular face is calculated according to the vertex coordinates of the vertex, so as to determine the distance between the vertex and the nearest triangular face.
  • the facial three-dimensional model visualization method calculates the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model, and establishes an octree structure for the smallest common cube bounding box of the first facial three-dimensional model , with the depth of the octree structure, the minimum common cube bounding box of the second facial 3D model is equally divided to obtain a preset number of small cubes.
  • the The vertices of the first facial 3D model are associated with the triangular patches in the small cube, and according to the distance between the vertex coordinates and the associated triangular patches, the nearest triangle from each vertex in the first facial 3D model to the second facial 3D model is obtained The patch distance.
  • the method provided in the embodiment of the present application calculates the distance between the vertices and the associated triangles by establishing the association relationship between the vertices of the first three-dimensional facial model and the triangular patches of the second facial three-dimensional model, so as to determine the shortest distance. Avoid calculating the distance between vertices and all triangular faces, reduce the amount of calculation, and improve calculation efficiency.
  • FIG. 5 is a schematic flow chart of the fifth method for visualizing a three-dimensional facial model provided in the embodiment of the present application.
  • the above S25 may include:
  • vertex encoding is binary encoding
  • specific encoding process is illustrated with the following example:
  • the vertex coordinates (x min , y min , z min , x max , y max , z max ) (0,0,0,16,16,16).
  • the vertex encoding adopts Morton encoding, and the index value (i, j, k) of the vertex P is calculated.
  • the specific calculation formula is:
  • the small cube determines the small cube associated with the vertex, and determine whether the associated patch sequence of the small cube is an empty set.
  • the index relationship between the vertex code and the small cube can be expressed by the following formula:
  • the facial three-dimensional model visualization method provided by the embodiment of the present application calculates the vertex code of the first facial three-dimensional model according to the octree structure, and determines the triangular surface in the small cube associated with the vertex according to the index relationship between the vertex code and the small cube Piece is not the empty set, associate the vertices with the triangular patches in the cuboid.
  • the vertices can be associated with the triangular patches in the small cube through calculation, so as to reduce the number of calculations for the distance between the vertices and the triangular patches, and improve the calculation efficiency.
  • the embodiment of the present application also provides a method for visualizing a three-dimensional facial model, as shown in FIG. 5, the above-mentioned method may also include:
  • the preset radius is set to 2
  • the neighborhood corresponding to the radius of the small cube 2 contains 8 small cubes.
  • Figure 6 is a small cube in the neighborhood provided by the embodiment of the present application As shown in Figure 6, the radius of the small cube on the left is 1, centered on the small cube on the left, and the preset radius is 2. The resulting small cube in the domain is shown on the right. It is judged whether the triangular patches in the triangular patch sequences of other small cubes in the neighborhood of the preset radius are empty sets.
  • the triangular patches in the triangular patch sequence in other small cubes are not empty sets, associate the vertices with all the triangular patches in the triangular patch sequence of the corresponding small cube, if there are multiple other small cubes If the triangles in the sequence of triangles in the middle triangle are not an empty set, associate the vertices with all the triangles in the triangles of other small cubes that are not empty sets.
  • the preset radius is increased by 1, and S253-S254 is continued.
  • the small cube is used as the center to judge the triangular faces in other small cubes in the neighborhood of the preset radius of the small cube. Whether the triangle face is an empty set, if the triangle face in other small cubes is not an empty set, associate the vertex with the triangle face in other small cubes.
  • the method provided in the embodiment of the present application can ensure that each vertex has an associated triangular surface, so as to ensure the accuracy of the results when calculating the heat map and contour lines.
  • the embodiment of the present application also provides a method for visualizing a three-dimensional facial model, and the above S30 may include:
  • color rendering is performed on any area of the first facial 3D model to obtain a heat map model.
  • the color table is a strip that changes gradually according to "blue-cyan-green-yellow-orange-red", which contains a total of N C colors, and the kth (0 ⁇ k ⁇ N C ) color in the color table Expressed by C(k).
  • a and b respectively represent the boundary of the mapping interval, and a ⁇ b.
  • a color value can be used to color render any region to obtain a heat map model.
  • the method for visualizing a 3D facial model provided in the embodiment of the present application performs color rendering on any region of the first 3D facial model according to the mapping relationship between distance and color table, to obtain a heat map model.
  • the difference in facial muscle changes can be visualized through the thermal map model.
  • the second facial three-dimensional model is a simulation method made by professionals, the required medicine in the plastic surgery process can be determined according to the facial differences. Dosage is convenient for preoperative program design.
  • the heat map model provided in the embodiment of the present application is obtained by rendering on the first 3D facial model, or by calculating the nearest triangular surface from the vertices of the second 3D facial model to the first 3D facial model
  • FIG. 7 is a schematic flowchart of the sixth method for visualizing a three-dimensional facial model provided in the embodiment of the present application.
  • the above S40 may include:
  • S41 Calculate a first height map of the first three-dimensional facial model and a second height map of the second three-dimensional facial model.
  • the method for calculating the first height map may be:
  • the specific straightening method is: make the center point of the eyes of the 3D model of the first face parallel to the X-axis of the 3D Cartesian coordinate system, and make the 3D model of the first face
  • the central axis of the head of the 3D model is parallel to the Y axis of the 3D Cartesian coordinate system, so that the Z axis of the 3D Cartesian coordinate system passes through the nose tip of the first facial 3D model, and the nose tip is located at a preset coordinate point of the Z axis.
  • the distance between the tip of the nose and the origin of the Z axis is 150mm.
  • a coordinate map of the first three-dimensional facial model is established.
  • the two-dimensional coordinates (x, y) of the vertices store the three-dimensional coordinates (x, y, z) of the vertices.
  • the two-dimensional coordinate (x, y) position of the vertex stores the height value h of the vertex.
  • the calculation method of the second height map is the same as that of the above first height map, and will not be repeated here.
  • S42 Calculate the first two-dimensional contour line of the first facial three-dimensional model according to the first height map.
  • a preset contour line calculation method is used to calculate the first height map of the first three-dimensional facial model to obtain the first two-dimensional contour line of the first three-dimensional facial model.
  • the preset contour calculation method is the MarchingSquares algorithm.
  • S43 Calculate a second two-dimensional contour line of the second facial three-dimensional model according to the second height map.
  • the calculation method of the second two-dimensional contour line is the same as the calculation method of the first two-dimensional contour line in S42 above, which will not be repeated here.
  • S44 Convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line.
  • the vertices of the first 2D contour line are converted into 3D coordinates to obtain the first 3D contour of the first 3D facial model line;
  • the vertices of the second two-dimensional contour line are converted into three-dimensional coordinates, and the second three-dimensional contour line of the second facial three-dimensional model is obtained.
  • S45 Render the first facial three-dimensional model according to the first three-dimensional contour line to obtain a first contour line model.
  • the first three-dimensional contour line is rendered in the first facial three-dimensional model according to the three-dimensional coordinates of the vertices to obtain the first contour line model.
  • the first three-dimensional contour line is colored according to a mapping relationship between a height difference of the first three-dimensional contour line and a color table.
  • mapping relationship between the first three-dimensional contour line and the height difference, and the mapping relationship between the height difference and the color table the mapping relationship between the first three-dimensional contour line and the color table is determined, and according to the mapping relationship, the first three-dimensional contour line Line coloring to obtain the first contour line model after coloring.
  • the mapping relationship between the height difference and the color table can be defined according to the requirements, and there is no limitation here.
  • the height value of the first three-dimensional contour line can be based on the first three-dimensional contour line
  • the three-dimensional coordinates of the line determine the corresponding two-dimensional coordinates from the coordinate map, and then determine the height value corresponding to the two-dimensional coordinates from the height map.
  • S46 Render the second facial three-dimensional model according to the second three-dimensional contour line to obtain a second contour line model.
  • the specific rendering method is the same as the above-mentioned S45, and will not be repeated here.
  • the second three-dimensional contour line is colored according to the mapping relationship between the height difference of the second three-dimensional contour line and the color table, and the calculation method of the height difference of the second three-dimensional contour line is the same as that of the first three-dimensional contour line.
  • the calculation method of the height difference of the three-dimensional contour line is the same, and will not be repeated here.
  • the points with the same height difference as their respective highest points have the same color.
  • the facial three-dimensional model visualization method calculates the first height map of the first facial three-dimensional model and the second height map of the second facial three-dimensional model, and calculates the second height map of the first facial three-dimensional model according to the first height map A two-dimensional contour line, calculate the second two-dimensional contour line of the second facial three-dimensional model according to the second height map, convert the first two-dimensional contour line into the first three-dimensional contour line, the second two-dimensional contour line Convert the line to the second 3D contour line, render the first 3D facial model according to the first 3D contour line, obtain the first contour line model, and render the second 3D facial model according to the second 3D contour line , to get the second contour model.
  • the deformation and movement of the subject's face can be intuitively understood, so as to realize the visualization of facial changes.
  • FIG. 8 is a schematic structural diagram of a three-dimensional facial model visualization device provided by the embodiment of the present application.
  • the The facial three-dimensional model visualization device may include:
  • the three-dimensional model acquisition module 10 can be configured to obtain the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are triangle faces Format;
  • the distance calculation module 20 may be configured to calculate the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
  • the thermal map visualization module 30 may be configured to render the first facial three-dimensional model according to the distance to obtain a thermal map model
  • the contour line visualization module 40 may be configured to calculate the three-dimensional contour line according to the first three-dimensional facial model and the second three-dimensional facial model, respectively, to obtain the first contour line model and the second contour line model.
  • the three-dimensional model acquisition module 10 may include:
  • the three-dimensional model acquisition unit may be configured to acquire the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at two different moments;
  • a posture transformation matrix calculation unit may be configured to calculate the posture transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model;
  • the alignment unit may be configured to align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
  • the attitude transformation matrix calculation unit may include:
  • the first sphere intercepting subunit can be configured to use the nose tip position of the first initial facial three-dimensional model as the center of the sphere, and intercept the first initial three-dimensional facial model with a preset radius to obtain the first initial three-dimensional facial model corresponding to the first three-dimensional facial model.
  • a sphere intercept model ;
  • the second sphere intercepting subunit can be configured to use the nose tip position of the second facial three-dimensional model as the center of the sphere, and intercept the second facial three-dimensional model with a preset radius to obtain a second spherical intercept corresponding to the second facial three-dimensional model Model;
  • the attitude transformation matrix calculation subunit can be configured to calculate and obtain the attitude transformation matrix by adopting a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
  • the distance calculation module 20 may be configured to calculate and obtain the closest triangular surface from each vertex in the first three-dimensional facial model to the second three-dimensional facial model according to the coordinates of each vertex in the first three-dimensional facial model slice distance.
  • the distance calculation module 20 may include:
  • a bounding box calculation unit may be configured to calculate the minimum common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
  • An octree building unit which can be configured to build an octree structure for the minimum common cube bounding box of the first facial three-dimensional model
  • the equalizing unit can be configured to equally divide the minimum common cube bounding box of the second facial three-dimensional model with the depth of the octree structure to obtain a preset number of small cubes;
  • the first associating unit may be configured to associate the triangular patch of the second facial three-dimensional model with the small cube;
  • the second associating unit may be configured to associate the vertices of the first three-dimensional facial model with the triangular patches in the small cube according to the index relationship between the coordinates of the vertices of the first three-dimensional facial model and the small cube;
  • the distance calculation unit may be configured to obtain the distance from each vertex in the first three-dimensional facial model to the nearest triangle surface of the second three-dimensional facial model according to the distance between the vertex coordinates and the associated triangle surface.
  • the second association unit may include:
  • the encoding calculation subunit can be configured to calculate the vertex encoding of the first facial three-dimensional model according to the octree structure
  • the second association subunit can be configured to: according to the vertex code and the index relationship of the small cube, determine if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the triangle patch in the small cube .
  • the device may also include:
  • the neighborhood judging unit can be configured as follows: if the triangular patch in the small cube associated with the vertex is an empty set, then use the small cube as the center to judge the triangular patches in other small cubes in the neighborhood of the small cube’s preset radius Is it an empty set;
  • the third associating subunit may be configured as: if the triangular faces in other small cubes are not an empty set, associate the vertices with the triangular faces in other small cubes.
  • the heat map visualization module 30 may also be configured to perform color rendering on any region of the first three-dimensional facial model according to the mapping relationship between the distance and the color table to obtain a heat map model.
  • the contour visualization module 40 may include:
  • a height map calculation unit which may be configured to calculate a first height map of the first facial three-dimensional model and a second height map of the second facial three-dimensional model;
  • the first two-dimensional contour calculation unit may be configured to calculate the first two-dimensional contour of the first facial three-dimensional model according to the first height map;
  • the second two-dimensional contour calculation unit may be configured to calculate the second two-dimensional contour of the second facial three-dimensional model according to the second height map;
  • a conversion unit may be configured to convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line;
  • the first contour line visualization unit may be configured to render the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
  • the second contour line visualization unit may be configured to render the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
  • the above modules may be one or more integrated circuits configured to implement the above method, for example: one or more specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), or, one or more microprocessors, or, One or more Field Programmable Gate Arrays (Field Programmable Gate Array, FPGA for short), etc.
  • ASIC Application Specific Integrated Circuit
  • microprocessors or, One or more Field Programmable Gate Arrays (Field Programmable Gate Array, FPGA for short)
  • FPGA Field Programmable Gate Array
  • the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, referred to as CPU) or other processors that can call program codes.
  • CPU central processing unit
  • these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC for short).
  • FIG. 9 is a schematic diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 100 may include: a processor 101 , a storage medium 102 and a bus.
  • the storage medium 102 stores program instructions executable by the processor 101.
  • the processor 101 communicates with the storage medium 102 through a bus, and the processor 101 executes the program instructions to implement the above method embodiments.
  • the specific implementation manner and technical effect are similar, and will not be repeated here.
  • the present application further provides a program product, such as a computer-readable storage medium, which may include a program, and the program is used to execute the above-mentioned method embodiments when executed by a processor.
  • a program product such as a computer-readable storage medium, which may include a program, and the program is used to execute the above-mentioned method embodiments when executed by a processor.
  • the disclosed devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software functional units.
  • the above-mentioned integrated units implemented in the form of software functional units may be stored in a computer-readable storage medium.
  • the above-mentioned software functional units are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) or a processor (English: processor) to execute the functions described in various embodiments of the present application. part of the method.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), magnetic disk or optical disc, etc.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • magnetic disk or optical disc etc.
  • the present application provides a method, device, electronic equipment and storage medium for visualizing a three-dimensional facial model.
  • the method includes: obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are in the form of triangular patches; The distance between the coordinate points in the first 3D model and the second facial 3D model; render the first facial 3D model according to the distance to obtain a heat map model; calculate the 3D Contour, get the first contour model and the second contour model.
  • the facial three-dimensional model visualization method, device, electronic equipment and storage medium of the present application are reproducible and can be used in various industrial applications.
  • the facial three-dimensional model visualization method, device, electronic equipment and storage medium of the present application can be used in the technical field of three-dimensional models.

Abstract

The present application relates to the technical field of three-dimensional models, and provides a facial three-dimensional model visualization method and apparatus, an electronic device, and a storage medium. The method comprises: obtaining a first facial three-dimensional model and a second facial three-dimensional model of a tested person at two different moments, the first facial three-dimensional model and the second facial three-dimensional model being triangular patch formats; calculating the distance between coordinate points of the first facial three-dimensional model and the second facial three-dimensional model; rendering the first facial three-dimensional model according to the distance to obtain a thermodynamic diagram model; and respectively calculating three-dimensional contour lines according to the first facial three-dimensional model and the second facial three-dimensional model to obtain a first contour line model and a second contour line model. According to the present application, the change in the face can be visually displayed.

Description

面部三维模型可视化方法、装置、电子设备及存储介质Facial three-dimensional model visualization method, device, electronic equipment and storage medium
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年06月18日提交中国专利局的申请号为2021106824522、名称为“面部三维模型可视化方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 2021106824522 and titled "Facial 3D Model Visualization Method, Device, Electronic Equipment, and Storage Medium" filed with the China Patent Office on June 18, 2021, the entire contents of which are incorporated by reference incorporated in this application.
技术领域technical field
本申请涉及三维模型技术领域,具体而言,涉及一种面部三维模型可视化方法、装置、电子设备及存储介质。The present application relates to the technical field of three-dimensional models, and in particular, relates to a visualization method, device, electronic equipment and storage medium of a three-dimensional facial model.
背景技术Background technique
在医疗美容行业,面部三维模型的精确测量、对比及可视化对评价治疗效果,并使患者直观的观察自身治疗前后的变化具有十分重要的作用。In the medical aesthetics industry, accurate measurement, comparison and visualization of facial 3D models play a very important role in evaluating treatment effects and allowing patients to intuitively observe their own changes before and after treatment.
现有的面部三维建模及测量方案中,主要是针对单个面部三维模型进行测量,以通过数据对比分析面部的变化情况,如眼宽、鼻子高度、鼻梁角度等。In the existing 3D facial modeling and measurement schemes, it is mainly to measure a single 3D facial model, so as to analyze the changes of the face through data comparison, such as eye width, nose height, nose bridge angle, etc.
但是,数据的对比分析不能直观的使患者观察治疗前后的变化,且一些医疗美容项目只有一些微小的形变,数据可能根本无法体现出差异。However, the comparative analysis of data cannot intuitively allow patients to observe the changes before and after treatment, and some medical cosmetic items only have some small deformations, and the data may not reflect the difference at all.
发明内容Contents of the invention
本申请提供了一种面部三维模型可视化方法、装置、电子设备及存储介质,以便直观地展示面部的变化,从而解决上述现有技术中的不足。The present application provides a method, device, electronic device and storage medium for visualizing a three-dimensional facial model, so as to intuitively display changes in the face, thereby solving the above-mentioned deficiencies in the prior art.
本申请的一些实施例提供了一种面部三维模型可视化方法,可以包括:Some embodiments of the present application provide a method for visualizing a three-dimensional facial model, which may include:
获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;所述第一面部三维模型和所述第二面部三维模型为三角面片格式;Obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are in triangular patch format;
计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离;calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型;Rendering the first facial three-dimensional model according to the distance to obtain a heat map model;
根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。The three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
可选的,所述获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型,包括:Optionally, the acquisition of the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments includes:
获取所述被测者在所述两个不同时刻的第一初始面部三维模型和所述第二面部三维模型;Obtaining the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments;
计算所述第一初始面部三维模型与所述第二面部三维模型的姿态变换矩阵;calculating a pose transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model;
根据所述姿态变换矩阵将所述第一初始面部三维模型对齐到所述第二面部三维模型,得到所述第一面部三维模型。Aligning the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
可选的,所述计算所述第一初始面部三维模型与所述第二面部三维模型的姿态变换矩阵,可以包括:Optionally, the calculating the pose transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model may include:
以所述第一初始面部三维模型的鼻尖位置为球心,以预设半径对所述第一初始面部三维模型进行截取,得到所述第一初始面部三维模型对应的第一球体截取模型;Taking the position of the tip of the nose of the first initial facial three-dimensional model as the center of the sphere, intercepting the first initial three-dimensional facial model with a preset radius to obtain a first sphere interception model corresponding to the first initial three-dimensional facial model;
以所述第二面部三维模型的鼻尖位置为球心,以所述预设半径对所述第二面部三维模型进行截取,得到所述第二面部三维模型对应的第二球体截取模型;Taking the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, intercepting the second facial three-dimensional model with the preset radius, to obtain a second sphere interception model corresponding to the second facial three-dimensional model;
采用预设变换矩阵计算方法、以及所述第一球体截取模型和所述第二球体截取模型, 计算获取所述姿态变换矩阵。The attitude transformation matrix is calculated and acquired by using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
可选的,所述计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离,可以包括:Optionally, the calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model may include:
根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。According to the coordinates of each vertex in the first 3D facial model, calculate and acquire the distance from each vertex in the 1st 3D facial model to the closest triangular patch of the second 3D facial model.
可选的,所述根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离,可以包括:Optionally, according to the coordinates of each vertex in the first three-dimensional facial model, calculate and acquire the distance between each vertex in the first three-dimensional facial model and the nearest triangle surface of the second three-dimensional facial model distance, which can include:
计算所述第一面部三维模型和所述第二面部三维模型的最小公共正方体包围盒;Calculating the minimum common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
针对所述第一面部三维模型的最小公共正方体包围盒建立八叉树结构;Establishing an octree structure for the minimum common cube bounding box of the first facial three-dimensional model;
以所述八叉树结构的深度对所述第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体;Divide the minimum common cube bounding box of the second facial three-dimensional model equally with the depth of the octree structure to obtain a preset number of small cubes;
将所述第二面部三维模型的三角面片与所述小正方体关联;Associating the triangular patch of the second facial three-dimensional model with the small cube;
根据所述第一面部三维模型的顶点坐标与所述小正方体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联;According to the index relationship between the vertex coordinates of the first facial three-dimensional model and the small cube, associate the vertices of the first facial three-dimensional model with the triangular patches in the small cube;
根据所述顶点坐标与关联的三角面片的距离,获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。According to the distance between the vertex coordinates and the associated triangular patch, the distance from each vertex in the first facial 3D model to the closest triangular patch of the second facial 3D model is obtained.
可选的,所述根据所述第一面部三维模型的顶点坐标与所述小正方体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联,可以包括:Optionally, according to the index relationship between the vertex coordinates of the first three-dimensional facial model and the small cube, associating the vertices of the first three-dimensional facial model with the triangular patches in the small cube, Can include:
根据所述八叉树结构计算所述第一面部三维模型的顶点编码;calculating the vertex codes of the first facial three-dimensional model according to the octree structure;
根据所述顶点编码和所述小正方体的索引关系,确定若所述顶点所关联的小正方体中的三角面片不为空集,则将所述顶点与所述小正方体中的三角面片关联。According to the vertex code and the index relationship of the small cube, determine if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the triangle patch in the small cube .
可选的,所述方法还可以包括:Optionally, the method may also include:
若所述顶点所关联的小正方体中的三角面片为空集,则以所述小正方体为中心,判断所述小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集;If the triangular faces in the small cube associated with the vertex are an empty set, take the small cube as the center, and judge whether the triangular faces in other small cubes in the neighborhood of the preset radius of the small cube are empty set;
若所述其他小正方体中的三角面片不为空集,则将所述顶点与所述其他小正方体中的三角面片关联。If the triangle faces in the other small cubes are not an empty set, associate the vertex with the triangle faces in the other small cubes.
可选的,所述根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型,可以包括:Optionally, rendering the first facial three-dimensional model according to the distance to obtain a heat map model may include:
根据所述距离与颜色表的映射关系,对所述第一面部三维模型的任意区域进行颜色渲染,得到所述热力图模型。Perform color rendering on any region of the first facial three-dimensional model according to the mapping relationship between the distance and the color table to obtain the heat map model.
可选的,所述根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型,可以包括:Optionally, the calculating the three-dimensional contours respectively according to the first facial three-dimensional model and the second facial three-dimensional model to obtain the first contour model and the second contour model may include:
计算所述第一面部三维模型的第一高度图和所述第二面部三维模型的第二高度图;calculating a first height map of the first facial 3D model and a second height map of the second facial 3D model;
根据所述第一高度图计算所述第一面部三维模型的第一二维等高线;calculating a first two-dimensional contour line of the first facial three-dimensional model according to the first height map;
根据所述第二高度图计算所述第二面部三维模型的第二二维等高线;calculating a second two-dimensional contour line of the second facial three-dimensional model according to the second height map;
将所述第一二维等高线转换为第一三维等高线、所述第二二维等高线转换为第二三维等高线;converting the first two-dimensional contour to a first three-dimensional contour, and converting the second two-dimensional contour to a second three-dimensional contour;
根据所述第一三维等高线对所述第一面部三维模型进行渲染,得到所述第一等高线模型;Rendering the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
根据所述第二三维等高线对所述第二面部三维模型进行渲染,得到所述第二等高线模 型。The second facial three-dimensional model is rendered according to the second three-dimensional contour line to obtain the second contour line model.
本申请的另一些实施例还提供了一种面部三维模型可视化装置,该面部三维模型可视化装置可以包括:Other embodiments of the present application also provide a three-dimensional facial model visualization device, and the three-dimensional facial model visualization device may include:
三维模型获取模块,可以配置成用于获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;所述第一面部三维模型和所述第二面部三维模型为三角面片格式;The three-dimensional model acquisition module can be configured to acquire the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are Triangular patch format;
距离计算模块,可以配置成用于计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离;A distance calculation module, which may be configured to calculate the distance between coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
热力图可视化模块,可以配置成用于根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型;The heat map visualization module may be configured to render the first facial three-dimensional model according to the distance to obtain a heat map model;
等高线可视化模块,可以配置成用于根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。The contour line visualization module may be configured to calculate three-dimensional contour lines respectively according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
可选的,所述三维模型获取模块可以包括:Optionally, the 3D model acquisition module may include:
三维模型获取单元,可以配置成用于获取所述被测者在所述两个不同时刻的第一初始面部三维模型和所述第二面部三维模型;A three-dimensional model acquisition unit may be configured to acquire the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments;
姿态变换矩阵计算单元,可以配置成用于计算所述第一初始面部三维模型与所述第二面部三维模型的姿态变换矩阵;A pose transformation matrix calculation unit may be configured to calculate a pose transformation matrix between the first initial three-dimensional facial model and the second three-dimensional facial model;
对齐单元,可以配置成用于根据所述姿态变换矩阵将所述第一初始面部三维模型对齐到所述第二面部三维模型,得到所述第一面部三维模型。The alignment unit may be configured to align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
可选的,所述姿态变换矩阵计算单元,可以包括:Optionally, the attitude transformation matrix calculation unit may include:
第一球体截取子单元,可以配置成用于以所述第一初始面部三维模型的鼻尖位置为球心,以预设半径对所述第一初始面部三维模型进行截取,得到所述第一初始面部三维模型对应的第一球体截取模型;The first sphere interception subunit may be configured to intercept the first initial facial three-dimensional model with a preset radius with the nose tip position of the first initial facial three-dimensional model as the center of the sphere, to obtain the first initial A first sphere interception model corresponding to the facial three-dimensional model;
第二球体截取子单元,可以配置成用于以所述第二面部三维模型的鼻尖位置为球心,以所述预设半径对所述第二面部三维模型进行截取,得到所述第二面部三维模型对应的第二球体截取模型;The second sphere intercepting subunit can be configured to use the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, and intercept the second facial three-dimensional model with the preset radius to obtain the second facial A second sphere interception model corresponding to the three-dimensional model;
姿态变换矩阵计算子单元,可以配置成用于采用预设变换矩阵计算方法、以及所述第一球体截取模型和所述第二球体截取模型,计算获取所述姿态变换矩阵。The attitude transformation matrix calculation subunit may be configured to calculate and obtain the attitude transformation matrix by using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
可选的,所述距离计算模块,可以配置成用于根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。Optionally, the distance calculation module may be configured to calculate and obtain the distance from each vertex in the first 3D facial model to the second vertex according to the coordinates of each vertex in the first 3D facial model. The distance of the nearest triangle of the facial 3D model.
可选的,所述距离计算模块,可以包括:Optionally, the distance calculation module may include:
包围盒计算单元,可以配置成用于计算所述第一面部三维模型和所述第二面部三维模型的最小公共正方体包围盒;A bounding box calculation unit may be configured to calculate the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
八叉树建立单元,可以配置成用于针对所述第一面部三维模型的最小公共正方体包围盒建立八叉树结构;An octree building unit may be configured to build an octree structure for the minimum common cube bounding box of the first facial three-dimensional model;
均分单元,可以配置成用于以所述八叉树结构的深度对所述第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体;The equalizing unit may be configured to equally divide the minimum common cube bounding box of the second facial three-dimensional model with the depth of the octree structure to obtain a preset number of small cubes;
第一关联单元,可以配置成用于将所述第二面部三维模型的三角面片与所述小正方体关联;The first associating unit may be configured to associate the triangular patch of the second facial three-dimensional model with the small cube;
第二关联单元,可以配置成用于根据所述第一面部三维模型的顶点坐标与所述小正方 体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联;The second associating unit may be configured to associate the vertices of the first three-dimensional facial model with the triangles in the small cube according to the index relationship between the coordinates of the vertices of the first three-dimensional facial model and the small cube. patch association;
距离计算单元,可以配置成用于根据所述顶点坐标与关联的三角面片的距离,获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。The distance calculation unit may be configured to obtain the distance between each vertex in the first facial three-dimensional model and the nearest triangle surface of the second facial three-dimensional model according to the distance between the vertex coordinates and the associated triangle surface. distance.
可选的,所述第二关联单元,可以包括:Optionally, the second association unit may include:
编码计算子单元,可以配置成用于根据所述八叉树结构计算所述第一面部三维模型的顶点编码;The encoding calculation subunit may be configured to calculate the vertex encoding of the first facial three-dimensional model according to the octree structure;
第二关联子单元,可以配置成根据所述顶点编码和所述小正方体的索引关系,确定若所述顶点所关联的小正方体中的三角面片不为空集,则将所述顶点与所述小正方体中的三角面片关联。The second associating subunit can be configured to, according to the vertex code and the index relationship of the small cube, determine that if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the Describe the association of triangular patches in the small cube.
可选的,所述装置还可以包括:Optionally, the device may also include:
邻域判断单元,可以配置成:若所述顶点所关联的小正方体中的三角面片为空集,则以所述小正方体为中心,判断所述小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集;The neighborhood judging unit may be configured to: if the triangular patch in the small cube associated with the vertex is an empty set, then use the small cube as the center to judge other small cubes in the neighborhood of the preset radius of the small cube Whether the triangles in the cube are an empty set;
第三关联子单元,可以配置成:若所述其他小正方体中的三角面片不为空集,则将所述顶点与所述其他小正方体中的三角面片关联。The third associating subunit may be configured to: if the triangle faces in the other small cubes are not an empty set, associate the vertex with the triangle faces in the other small cubes.
可选的,所述热力图可视化模块,可以配置成用于根据所述距离与颜色表的映射关系,对所述第一面部三维模型的任意区域进行颜色渲染,得到所述热力图模型。Optionally, the heat map visualization module may be configured to perform color rendering on any region of the first facial three-dimensional model according to the mapping relationship between the distance and the color table, to obtain the heat map model.
可选的,所述等高线可视化模块,可以包括:Optionally, the contour visualization module may include:
高度图计算单元,可以配置成用于计算所述第一面部三维模型的第一高度图和所述第二面部三维模型的第二高度图;a height map calculation unit configured to calculate a first height map of the first facial three-dimensional model and a second height map of the second facial three-dimensional model;
第一二维等高线计算单元,可以配置成用于根据所述第一高度图计算所述第一面部三维模型的第一二维等高线;A first two-dimensional contour calculation unit may be configured to calculate a first two-dimensional contour of the first facial three-dimensional model according to the first height map;
第二二维等高线计算单元,可以配置成用于根据所述第二高度图计算所述第二面部三维模型的第二二维等高线;A second two-dimensional contour calculation unit may be configured to calculate a second two-dimensional contour of the second facial three-dimensional model according to the second height map;
转换单元,可以配置成用于将所述第一二维等高线转换为第一三维等高线、所述第二二维等高线转换为第二三维等高线;The conversion unit may be configured to convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line;
第一等高线可视化单元,可以配置成用于根据所述第一三维等高线对所述第一面部三维模型进行渲染,得到所述第一等高线模型;The first contour line visualization unit may be configured to render the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
第二等高线可视化单元,可以配置成用于根据所述第二三维等高线对所述第二面部三维模型进行渲染,得到所述第二等高线模型。The second contour line visualization unit may be configured to render the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
本申请的又一些实施例还提供了一种电子设备,该电子设备可以包括:处理器、存储介质和总线,所述存储介质存储有所述处理器可执行的程序指令,当所述电子设备运行时,所述处理器与所述存储介质之间通过总线通信,所述处理器执行所述程序指令,以执行上述实施例任一所述的面部三维模型可视化方法的步骤。Some other embodiments of the present application also provide an electronic device, which may include: a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device During operation, the processor communicates with the storage medium through a bus, and the processor executes the program instructions to execute the steps of the facial three-dimensional model visualization method described in any one of the above embodiments.
本申请的再一些实施例还提供了一种计算机可读存储介质,所述存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行如上述实施例任一所述的面部三维模型可视化方法的步骤。Further embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, the facial three-dimensional model as described in any one of the above-mentioned embodiments is executed. Steps of the visualization method.
本申请的有益效果至少是:The beneficial effects of the application are at least:
本申请提供了一种面部三维模型可视化方法、装置、电子设备及存储介质,通过获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;第一面部三维模型和第 二面部三维模型为三角面片格式;计算第一面部三维模型与第二面部三维模型中坐标点之间的距离;根据距离对第一面部三维模型进行渲染,得到热力图模型;根据第一面部三维模型和第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。通过本申请提供的方案,可根据第一面部三维模型和第二面部三维模型的坐标点之间的距离表征第一面部三维模型相对于第二面部三维模型的面部凹陷或凸起,并通过热力图模型直观的展示两个模型面部凹陷或凸起的差异,通过第一等高线模型和第二等高线模型直观的了解被测者面部的形变和移动情况,以实现对面部变化的可视化。The present application provides a method, device, electronic device and storage medium for visualizing a three-dimensional facial model, by obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second facial three-dimensional model in triangular patch format; calculating the distance between the coordinate points in the first facial three-dimensional model and the second facial three-dimensional model; rendering the first facial three-dimensional model according to the distance to obtain a heat map model; The three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model. Through the scheme provided by this application, the facial depression or protrusion of the first three-dimensional facial model relative to the second three-dimensional facial model can be characterized according to the distance between the coordinate points of the first three-dimensional facial model and the second three-dimensional facial model, and Through the heat map model, the difference between the two models' facial depressions or protrusions can be intuitively displayed, and the deformation and movement of the subject's face can be intuitively understood through the first contour model and the second contour model, so as to realize facial changes visualization.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, so It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.
图1为本申请实施例提供的第一种面部三维模型可视化方法的流程示意图;Fig. 1 is a schematic flow chart of the first facial three-dimensional model visualization method provided by the embodiment of the present application;
图2为本申请实施例提供的第二种面部三维模型可视化方法的流程示意图;FIG. 2 is a schematic flow diagram of a second facial three-dimensional model visualization method provided by an embodiment of the present application;
图3为本申请实施例提供的第三种面部三维模型可视化方法的流程示意图;FIG. 3 is a schematic flow diagram of a third facial three-dimensional model visualization method provided in an embodiment of the present application;
图4为本申请实施例提供的第四种面部三维模型可视化方法的流程示意图;FIG. 4 is a schematic flow diagram of a fourth facial three-dimensional model visualization method provided in an embodiment of the present application;
图5为本申请实施例提供的第五种面部三维模型可视化方法的流程示意图;FIG. 5 is a schematic flow diagram of a fifth facial three-dimensional model visualization method provided in an embodiment of the present application;
图6为本申请实施例提供的一种邻域小正方体的结构示意图;FIG. 6 is a schematic structural diagram of a neighborhood small cube provided by an embodiment of the present application;
图7为本申请实施例提供的第六种面部三维模型可视化方法的流程示意图;FIG. 7 is a schematic flow diagram of a sixth facial three-dimensional model visualization method provided by the embodiment of the present application;
图8为本申请实施例提供的一种面部三维模型可视化装置的结构示意图;FIG. 8 is a schematic structural diagram of a facial three-dimensional model visualization device provided by an embodiment of the present application;
图9为本申请实施例提供的电子设备的示意图。FIG. 9 is a schematic diagram of an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of this application, not all of them.
因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。Accordingly, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the application. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
在本申请的描述中,需要说明的是,若出现术语“上”、“下”、等指示的方位或位置关系为基于附图所示的方位或位置关系,或者是该申请产品使用时惯常摆放的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请的限制。In the description of this application, it should be noted that if the orientation or positional relationship indicated by the terms "upper", "lower", etc. appear, it is based on the orientation or positional relationship shown in the drawings, or is the usual practice when using the product of this application. The orientation or positional relationship of placement is only for the convenience of describing the application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be interpreted as a reference to this application. limits.
此外,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。In addition, the terms "first", "second" and the like in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
需要说明的是,在不冲突的情况下,本申请的实施例中的特征可以相互结合。It should be noted that, in the case of no conflict, the features in the embodiments of the present application may be combined with each other.
本申请实施例提供的面部三维模型可视化方法,其执行主体为具有面部三维模型可视化功能的电子设备,该电子设备可以集成于具有面部三维模型建模功能的建模设备,也可以为与建模设备通信连接的电子设备,接收建模设备发送的面部三维模型。该电子设备可以为美容仪,也可以是智能手机、平板电脑、服务器、台式电脑、笔记本电脑等,在此不做限制。The facial three-dimensional model visualization method provided by the embodiment of the present application is executed by an electronic device with a facial three-dimensional model visualization function. The electronic device connected by device communication receives the facial three-dimensional model sent by the modeling device. The electronic device may be a beauty instrument, or may be a smart phone, a tablet computer, a server, a desktop computer, a notebook computer, etc., which is not limited here.
图1为本申请实施例提供的第一种面部三维模型可视化方法的流程示意图;如图1所示,该方法可以包括:Fig. 1 is a schematic flow chart of the first facial three-dimensional model visualization method provided by the embodiment of the present application; as shown in Fig. 1, the method may include:
S10:获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型。S10: Acquiring the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments.
具体的,第一面部三维模型和第二面部三维模型为同一被测者在两个不同时刻的面部三维模型,第一面部三维模型和第二面部三维模型均可以通过三维扫描设备获取。更进一步地,第一面部三维模型为通过三维扫描模型获取的,第二面部三维模型为专业人员,例如整形医生,对第一面部三维模型进行整形模拟,通过调整第一面部三维模型的面部结构而得到的。为便于后续计算,需要保证第一面部三维模型和第二面部三维模型为三角面片格式,三角面片格式表示面部三维模型是由多个三角面构成的。Specifically, the first three-dimensional facial model and the second three-dimensional facial model are facial three-dimensional models of the same subject at two different moments, and both the first three-dimensional facial model and the second three-dimensional facial model can be acquired by a three-dimensional scanning device. Furthermore, the first three-dimensional facial model is obtained through a three-dimensional scanning model, and the second three-dimensional facial model is a professional, such as a plastic surgeon, who simulates plastic surgery on the first three-dimensional facial model. By adjusting the first three-dimensional facial model derived from the facial structure. To facilitate subsequent calculations, it is necessary to ensure that the first facial 3D model and the second facial 3D model are in the triangular patch format, which means that the facial 3D model is composed of multiple triangular surfaces.
需要说明的是,第一面部三维模型和第二面部三维模型为高精度、高分辨率、带纹理贴图的三维模型。It should be noted that the first three-dimensional facial model and the second three-dimensional facial model are high-precision, high-resolution three-dimensional models with texture maps.
S20:计算第一面部三维模型与第二面部三维模型中坐标点之间的距离。S20: Calculate the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model.
具体的,计算第一面部三维模型与第二面部三维模型中坐标点之间的距离可以包括:计算第一面部三维模型的顶点到第二面部三维模型的距离和计算第二面部三维模型的顶点到第一面部三维模型的距离。Specifically, calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model may include: calculating the distance from the vertices of the first three-dimensional facial model to the second three-dimensional facial model and calculating the second three-dimensional facial model The distance from the vertices of to the first facial 3D model.
以计算第一面部三维模型的顶点到第二面部三维模型的距离为例进行说明:Take the calculation of the distance from the vertices of the first facial 3D model to the second facial 3D model as an example:
第一面部三维模型的顶点为建立第一面部三维模型的关键点,或者第一面部三维模型中三角面片的三角顶点,计算第一面部三维模型的顶点到第二面部三维模型的距离的过程为:计算第一面部三维模型的顶点到第二面部三维模型的最近距离,在一种可选的计算方式中,可以计算第一面部三维模型的每个顶点到第二面部三维模型的所有顶点的距离,以确定最近距离。The vertices of the first facial three-dimensional model are the key points for establishing the first facial three-dimensional model, or the triangle vertices of the triangular patch in the first facial three-dimensional model, and the vertices of the first facial three-dimensional model are calculated to the second facial three-dimensional model The process of the distance is: calculate the shortest distance from the vertex of the first facial 3D model to the second facial 3D model. In an optional calculation method, you can calculate the distance from each vertex of the first facial 3D model to the second The distance of all vertices of the face 3D model to determine the closest distance.
在一种可选实施方式中,根据第一面部三维模型中每个顶点的坐标,计算获取第一面部三维模型中每个顶点到第二面部三维模型最近的三角面片的距离。In an optional implementation manner, according to the coordinates of each vertex in the first three-dimensional facial model, the distance from each vertex in the first three-dimensional facial model to the nearest triangle patch of the second three-dimensional facial model is calculated and acquired.
具体的,由于第一面部三维模型和第二面部三维模型均为高精度模型的顶点数量十分庞大,因此可以选择计算第一面部三维模型中顶点到第二面部三维模型最近的三角面片的距离。其中,可以通过计算每个顶点到所有三角面片的距离,从而确定与顶点最近的三角面片的距离作为第一距离,点到面的距离计算方法在此不做详细说明。Specifically, since the first facial 3D model and the second facial 3D model are high-precision models with a very large number of vertices, it is possible to choose to calculate the nearest triangle surface from the vertices in the first facial 3D model to the second facial 3D model distance. Wherein, by calculating the distance from each vertex to all triangular patches, the distance to the nearest triangular patch to the vertex can be determined as the first distance, and the calculation method of the point-to-surface distance will not be described in detail here.
S30:根据距离对第一面部三维模型进行渲染,得到热力图模型。S30: Render the first facial three-dimensional model according to the distance to obtain a heat map model.
具体的,热力图模型用于展示被测者面部任意区域的肌肉情况,根据第一面部三维模型和第二面部三维模型的坐标点之间的有向距离,该有向距离为正,表示第一面部三维模型在该坐标点处相对为第二面部三维模型凸起,该有向距离为负,表示第一面部三维模型在该坐标点处相对于第二面部三维模型凹陷,计算每个坐标点在第一面部三维模型中所在区域的颜色值,根据该颜色值对第一面部三维模型进行渲染得到热力图模型。Specifically, the heat map model is used to display the muscle condition of any region of the subject's face. According to the directed distance between the coordinate points of the first three-dimensional facial model and the second three-dimensional facial model, the directed distance is positive, indicating that The first three-dimensional facial model is convex relative to the second three-dimensional facial model at this coordinate point, and the directional distance is negative, indicating that the first three-dimensional facial model is concave relative to the second three-dimensional facial model at this coordinate point, and the calculation The color value of each coordinate point in the area where the first facial three-dimensional model is located, and the first facial three-dimensional model is rendered according to the color value to obtain a heat map model.
S40:根据第一面部三维模型和第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。S40: Calculating three-dimensional contour lines respectively according to the first three-dimensional facial model and the second three-dimensional facial model, to obtain a first contour line model and a second contour line model.
具体的,等高线模型用于展示被测者面部任意区域的走向,根据第一面部三维模型的每个顶点在预设高度方向的高度值确定第一面部三维模型的三维等高线,将第一面部三维模型的三维等高线渲染在第一面部三维模型上,得到第一等高线模型。Specifically, the contour line model is used to show the trend of any area of the subject's face, and the three-dimensional contour line of the first three-dimensional face model is determined according to the height value of each vertex of the first three-dimensional face model in the preset height direction , rendering the 3D contour line of the first facial 3D model on the first facial 3D model to obtain the first contour line model.
第二等高线模型的计算过程与第一等高线模型相同,在此不做赘述。The calculation process of the second contour model is the same as that of the first contour model, and will not be repeated here.
本申请实施例提供的面部三维模型可视化方法通过获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;第一面部三维模型和第二面部三维模型为三角面片格式;计算第一面部三维模型与第二面部三维模型中坐标点之间的距离;根据距离对第一面部三维模型进行渲染,得到热力图模型;根据第一面部三维模型和第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。通过本申请实施例提供的方法,可根据第一面部三维模型和第二面部三维模型的坐标点之间的距离表征第一面部三维模型相对于第二面部三维模型的面部凹陷或凸起,并通过热力图模型直观的展示两个模型面部凹陷或凸起的差异,通过第一等高线模型和第二等高线模型直观的了解被测者面部的形变和移动情况,以实现对面部变化的可视化。The facial three-dimensional model visualization method provided in the embodiment of the present application obtains the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are triangular surfaces slice format; calculate the distance between the coordinate points in the first facial three-dimensional model and the second facial three-dimensional model; render the first facial three-dimensional model according to the distance, and obtain a heat map model; according to the first facial three-dimensional model and the second facial three-dimensional model The three-dimensional contour lines of the two facial 3D models are calculated respectively to obtain the first contour line model and the second contour line model. Through the method provided by the embodiment of the present application, the facial depression or protrusion of the first 3D facial model relative to the second 3D facial model can be characterized according to the distance between the coordinate points of the first 3D facial model and the second 3D facial model , and intuitively display the difference between the two models' facial depression or protrusion through the heat map model, and intuitively understand the deformation and movement of the subject's face through the first contour model and the second contour model, so as to realize the Visualization of facial changes.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,图2为本申请实施例提供的第二种面部三维模型可视化方法的流程示意图,如图2所示,上述S10可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model. FIG. 2 is a schematic flow chart of the second method for visualizing a three-dimensional facial model provided in the embodiment of the present application. As shown in FIG. 2 , The above S10 may include:
S11:获取被测者在所述两个不同时刻的第一初始面部三维模型和第二面部三维模型。S11: Acquire the first initial three-dimensional facial model and the second three-dimensional facial model of the subject at the two different moments.
具体的,第一初始面部三维模型和第二面部三维模型的获取方法如上述S10,在此不做具体赘述,由于不同时刻获取的面部三维模型之间的角度、面部动作存在差异,因此需要对其中一个面部三维模型进行矫正,本申请实施例的方案为对第一初始面部三维模型进行矫正。Specifically, the acquisition method of the first initial facial three-dimensional model and the second facial three-dimensional model is as described above in S10, and will not be described in detail here. Since the angles and facial movements of the facial three-dimensional models acquired at different times are different, it is necessary to One of the three-dimensional facial models is corrected, and the solution of the embodiment of the present application is to correct the first initial three-dimensional facial model.
S12:计算第一初始面部三维模型与第二面部三维模型的姿态变换矩阵。S12: Calculate a pose transformation matrix of the first initial three-dimensional facial model and the second three-dimensional facial model.
具体的,对第一初始面部三维模型进行旋转和平移变换,使第一初始面部三维模型对齐到第二面部三维模型,采用预设的变换方法,计算用于进行旋转和平移变换的姿态变换矩阵
Figure PCTCN2021132548-appb-000001
Specifically, perform rotation and translation transformation on the first initial facial 3D model, align the first initial facial 3D model to the second facial 3D model, and use a preset transformation method to calculate the attitude transformation matrix for rotation and translation transformation
Figure PCTCN2021132548-appb-000001
S13:根据姿态变换矩阵将第一初始面部三维模型对齐到第二面部三维模型,得到第一面部三维模型。S13: Align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix, to obtain the first facial three-dimensional model.
具体的,姿态变换矩阵
Figure PCTCN2021132548-appb-000002
可以对第一初始面部三维模型进行矫正,以将第一初始面部三维模型对齐到第二面部三维模型所在的坐标系内,得到矫正后的第一面部三维模型。示例的,对齐公式为:
Figure PCTCN2021132548-appb-000003
Specifically, the attitude transformation matrix
Figure PCTCN2021132548-appb-000002
Correction may be performed on the first initial three-dimensional facial model, so as to align the first initial three-dimensional facial model in the coordinate system where the second three-dimensional facial model is located, to obtain a corrected first three-dimensional facial model. For example, the alignment formula is:
Figure PCTCN2021132548-appb-000003
本申请实施例提供的面部三维模型可视化方法,获取被测者在所述两个不同时刻的第一初始面部三维模型和第二面部三维模型,计算第一初始面部三维模型与第二面部三维模型的姿态变换矩阵,根据姿态变换矩阵将第一初始面部三维模型对齐到第二面部三维模型,得到第一面部三维模型。通过本申请实施例提供的方法,可将第一初始面部三维模型与第二面部三维模型进行对齐,避免由于不同时刻的面部三维模型之间存在倾斜偏差,导致通过热力图模型和等高线模型进行可视化对比时结果出现偏差,提高对比结果的准确性。The facial three-dimensional model visualization method provided in the embodiment of the present application obtains the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments, and calculates the first initial facial three-dimensional model and the second facial three-dimensional model The attitude transformation matrix of the first facial three-dimensional model is aligned to the second facial three-dimensional model according to the attitude transformation matrix to obtain the first facial three-dimensional model. Through the method provided in the embodiment of the present application, the first initial facial 3D model can be aligned with the second facial 3D model, avoiding the inclination deviation between the facial 3D models at different times, resulting in the thermal map model and the contour model When the visual comparison is performed, there is a deviation in the result, which improves the accuracy of the comparison result.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,图3为本申请实施例提供的第三种面部三维模型可视化方法的流程示意图,如图3所示,上述S12可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model. FIG. 3 is a schematic flowchart of the third method for visualizing a three-dimensional facial model provided in the embodiment of the present application. As shown in FIG. 3 , The above S12 may include:
S121:以第一初始面部三维模型的鼻尖位置为球心,以预设半径对第一初始面部三维 模型进行截取,得到第一初始面部三维模型对应的第一球体截取模型。S121: Taking the position of the tip of the nose of the first initial facial three-dimensional model as the center of the sphere, intercepting the first initial three-dimensional facial model with a preset radius to obtain a first sphere interception model corresponding to the first initial three-dimensional facial model.
具体的,由于面部三维模型的两侧脸颊区域对计算姿态变换矩阵的贡献度较小,为减少计算量,提高计算效率,可以鼻尖位置为球心,以预设半径对第一初始面部三维模型进行截取得到第一球体截取模型。Specifically, since the cheek regions on both sides of the facial 3D model contribute little to the calculation of the pose transformation matrix, in order to reduce the amount of calculation and improve the calculation efficiency, the position of the tip of the nose can be used as the center of the sphere, and the first initial facial 3D model can be calculated with a preset radius Perform interception to obtain the first sphere interception model.
S122:以第二面部三维模型的鼻尖位置为球心,以预设半径对第二面部三维模型进行截取,得到第二面部三维模型对应的第二球体截取模型。S122: Take the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, intercept the second facial three-dimensional model with a preset radius, and obtain a second spherical intercepting model corresponding to the second facial three-dimensional model.
具体的,对第二面部三维模型进行截取到的第二球体截取模型的过程与第一初始面部三维模型的过程相同,在此不做赘述。Specifically, the process of intercepting the second 3D facial model to obtain the second sphere interception model is the same as the process of the first initial facial 3D model, and will not be repeated here.
S123:采用预设变换矩阵计算方法、以及第一球体截取模型和第二球体截取模型,计算获取姿态变换矩阵。S123: Using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model, to calculate and obtain an attitude transformation matrix.
具体的,采用预设变换矩阵计算方法,计算将第一球体截取模型对齐到第二球体截取模型的姿态变换矩阵
Figure PCTCN2021132548-appb-000004
示例的,预设变换矩阵计算方法可以为迭代最近点(Iterative Closest Point,ICP)算法。
Specifically, the preset transformation matrix calculation method is used to calculate the attitude transformation matrix that aligns the first sphere interception model to the second sphere interception model
Figure PCTCN2021132548-appb-000004
Exemplarily, the preset transformation matrix calculation method may be an iterative closest point (Iterative Closest Point, ICP) algorithm.
本申请实施例提供的面部三维模型可视化方法,以第一初始面部三维模型的鼻尖位置为球心,以预设半径对第一初始面部三维模型进行截取,得到第一初始面部三维模型对应的第一球体截取模型,以第二面部三维模型的鼻尖位置为球心,以预设半径对第二面部三维模型进行截取,得到第二面部三维模型对应的第二球体截取模型,采用预设变换矩阵计算方法、以及第一球体截取模型和第二球体截取模型,计算获取姿态变换矩阵。通过本申请实施例提供的方法,通过对第一初始面部三维模型和第二面部三维模型分别进行球体截取,以将对计算姿态变换矩阵的贡献度较小的两侧脸颊区域省略,得到第一球体截取模型和第二球体截取模型,使得采用预设变换矩阵计算方法计算姿态变换矩阵时减少计算量,提高计算效率。The facial 3D model visualization method provided in the embodiment of the present application takes the position of the tip of the nose of the first initial facial 3D model as the center of the sphere, intercepts the first initial facial 3D model with a preset radius, and obtains the first initial facial 3D model corresponding to the first A sphere interception model, taking the position of the tip of the nose of the second facial 3D model as the center of the sphere, and intercepting the second facial 3D model with a preset radius to obtain a second sphere interception model corresponding to the second facial 3D model, using a preset transformation matrix The calculation method, as well as the first sphere interception model and the second sphere interception model, calculate and obtain the attitude transformation matrix. Through the method provided in the embodiment of the present application, the first initial facial 3D model and the second facial 3D model are respectively sphere intercepted to omit the cheek regions on both sides that contribute less to the calculation of the pose transformation matrix, and the first The sphere interception model and the second sphere interception model reduce the calculation amount and improve the calculation efficiency when the attitude transformation matrix is calculated using the preset transformation matrix calculation method.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,图4为本申请实施例提供的第四种面部三维模型可视化方法的流程示意图,如图4所示,上述S20可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model. FIG. 4 is a schematic flowchart of the fourth method for visualizing a three-dimensional facial model provided in the embodiment of the present application. As shown in FIG. 4 , The above S20 may include:
S21:计算第一面部三维模型和第二面部三维模型的最小公共正方体包围盒。S21: Calculate the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model.
具体的,根据第一面部三维模型的长宽高、第二面部三维模型的长宽高,从第一面部三维模型的长宽高、第二面部三维模型的长宽高中获取最大的长、宽、高,并根据该最大的长、宽、高建立第一面部三维模型和第二面部三维模型的最小公共正方体包围盒,最小公共正方体包围盒分别可以完整的包围第一面部三维模型和第二面部三维模型。Specifically, according to the length, width and height of the first 3D facial model and the length, width and height of the second 3D facial model, the maximum length is obtained from the length, width and height of the first 3D facial model and the length, width and height of the second 3D facial model. , width, and height, and according to the maximum length, width, and height, establish the minimum common cube bounding boxes of the first facial three-dimensional model and the second facial three-dimensional model, and the minimum common cube bounding boxes can completely surround the first facial three-dimensional respectively model and a second facial 3D model.
S22:针对第一面部三维模型的最小公共正方体包围盒建立八叉树结构。S22: Establish an octree structure for the minimum common cube bounding box of the first facial three-dimensional model.
具体的,八叉树结构(Octree)是一种用于描述三维空间的树状数据结构,通过对最小公共正方体包围盒进行切分,得到2*2*2=8个小正方体,每个小正方体中存储有第一面部三维模型的多个顶点,再依次对存储有多个顶点的小正方体进行切分,切分的深度N用于表示对小正方体进行切分的次数,切分的深度可根据需求确定,在达到切分的深度之前,若小正方体中已经不存在顶点,则提前停止切分。八叉树结构的深度为对第一面部三维模型的最小公共正方体包围盒进行切分的次数加一,即切分一次,八叉树结构的深度为2。Specifically, the octree structure (Octree) is a tree-like data structure used to describe a three-dimensional space. By segmenting the bounding box of the smallest common cube, 2*2*2=8 small cubes are obtained, and each small cube The cube stores multiple vertices of the 3D model of the first face, and then sequentially splits the small cubes stored with multiple vertices. The depth N of the split is used to indicate the number of times the small cube is split. The depth can be determined according to the requirements. Before reaching the depth of segmentation, if there is no vertex in the small cube, the segmentation will be stopped in advance. The depth of the octree structure is the number of times the minimum common cube bounding box of the first facial three-dimensional model is segmented plus one, that is, once divided, the depth of the octree structure is 2.
S23:以八叉树结构的深度对第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体。S23: Divide the minimum common cube bounding box of the second facial three-dimensional model equally with the depth of the octree structure to obtain a preset number of small cubes.
具体地,根据上述S22中八叉树结构的深度,将第二面部三维模型的最小公共正方体 包围盒均分为N3个小正方体。Specifically, according to the depth of the octree structure in the above-mentioned S22, the minimum common cube bounding box of the second facial three-dimensional model is equally divided into N3 small cubes.
S24:将第二面部三维模型的三角面片与小正方体关联。S24: Associating the triangular patch of the second facial three-dimensional model with the small cube.
具体的,对每个小正方体与第二面部三维模型中所有三角面片做相交测试,若小正方体和所有三角面片的交集不为空集,则将相交的三角面片加入对应的小正方体的关联面片序列。Specifically, do an intersection test on each small cube and all the triangular faces in the 3D model of the second face, if the intersection of the small cube and all the triangular faces is not an empty set, then add the intersecting triangular faces to the corresponding small cube The associated patch sequence of .
S25:根据第一面部三维模型的顶点坐标与小正方体的索引关系,将第一面部三维模型的顶点与小正方体中的三角面片关联。S25: According to the index relationship between the vertex coordinates of the first three-dimensional facial model and the small cube, associate the vertices of the first three-dimensional facial model with the triangular patches in the small cube.
具体地,对小正方体按照预设规则编码,根据第一面部三维模型的顶点坐标在八叉树结构中的位置,确定第一面部三维模型的顶点坐标与第二面部三维模型的小正方体的索引关系,根据该索引关系,将第一面部三维模型的顶点与所对应的小正方体中的三角面片关联。Specifically, the small cube is coded according to preset rules, and the vertex coordinates of the first three-dimensional facial model and the small cube of the second three-dimensional facial model are determined according to the position of the vertex coordinates of the first three-dimensional facial model in the octree structure. According to the index relationship, the vertices of the first facial three-dimensional model are associated with the corresponding triangular faces in the small cube.
S26:根据顶点坐标与关联的三角面片的距离,获取第一面部三维模型中每个顶点到第二面部三维模型最近的三角面片的距离。S26: Obtain the distance from each vertex in the first 3D facial model to the closest triangular patch of the second 3D facial model according to the distance between the vertex coordinates and the associated triangular patch.
具体的,由于每个小正方体中包含多个三角面片,则根据该顶点的顶点坐标计算该顶点与每个三角面片的距离,从而确定该顶点与最近的三角面片的距离。Specifically, since each small cube contains multiple triangular faces, the distance between the vertex and each triangular face is calculated according to the vertex coordinates of the vertex, so as to determine the distance between the vertex and the nearest triangular face.
本申请实施例提供的面部三维模型可视化方法,计算第一面部三维模型和第二面部三维模型的最小公共正方体包围盒,针对第一面部三维模型的最小公共正方体包围盒建立八叉树结构,以八叉树结构的深度对第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体,根据第一面部三维模型的顶点坐标与小正方体的索引关系,将第一面部三维模型的顶点与小正方体中的三角面片关联,根据顶点坐标与关联的三角面片的距离,获取第一面部三维模型中每个顶点到第二面部三维模型最近的三角面片的距离。本申请实施例提供的方法,通过建立第一面部三维模型的顶点与第二面部三维模型的三角面片的关联关系,计算顶点与所关联的三角面片的距离从而确定最近的距离,以避免计算顶点与所有三角面片的距离,减少减少计算量,提高计算效率。The facial three-dimensional model visualization method provided in the embodiment of the present application calculates the smallest common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model, and establishes an octree structure for the smallest common cube bounding box of the first facial three-dimensional model , with the depth of the octree structure, the minimum common cube bounding box of the second facial 3D model is equally divided to obtain a preset number of small cubes. According to the index relationship between the vertex coordinates of the first facial 3D model and the small cubes, the The vertices of the first facial 3D model are associated with the triangular patches in the small cube, and according to the distance between the vertex coordinates and the associated triangular patches, the nearest triangle from each vertex in the first facial 3D model to the second facial 3D model is obtained The patch distance. The method provided in the embodiment of the present application calculates the distance between the vertices and the associated triangles by establishing the association relationship between the vertices of the first three-dimensional facial model and the triangular patches of the second facial three-dimensional model, so as to determine the shortest distance. Avoid calculating the distance between vertices and all triangular faces, reduce the amount of calculation, and improve calculation efficiency.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,图5为本申请实施例提供的第五种面部三维模型可视化方法的流程示意图,如图5所示,上述S25可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model. FIG. 5 is a schematic flow chart of the fifth method for visualizing a three-dimensional facial model provided in the embodiment of the present application. As shown in FIG. 5 , The above S25 may include:
S251:根据八叉树结构计算第一面部三维模型的顶点编码。S251: Calculate the vertex codes of the first facial three-dimensional model according to the octree structure.
具体的,顶点编码为二进制编码,具体的编码过程以下述示例进行说明:Specifically, the vertex encoding is binary encoding, and the specific encoding process is illustrated with the following example:
设顶点P的三维坐标(x,y,z)=(13,5,4),第一面部三维模型的最小公共正方体包围盒的顶点坐标(x min,y min,z min,x max,y max,z max)=(0,0,0,16,16,16)。 Assuming the three-dimensional coordinates (x, y, z) of the vertex P = (13,5,4), the vertex coordinates (x min , y min , z min , x max , y max , z max )=(0,0,0,16,16,16).
顶点编码采用莫顿(Morton)编码,计算顶点P的索引值(i,j,k),具体的计算公式为:The vertex encoding adopts Morton encoding, and the index value (i, j, k) of the vertex P is calculated. The specific calculation formula is:
Figure PCTCN2021132548-appb-000005
Figure PCTCN2021132548-appb-000005
Figure PCTCN2021132548-appb-000006
Figure PCTCN2021132548-appb-000006
Figure PCTCN2021132548-appb-000007
Figure PCTCN2021132548-appb-000007
其中,
Figure PCTCN2021132548-appb-000008
为向下取整符号,(i,j,k)=(6,2,2),将顶点P的索引值转换为二进制编码: (i 1i 2i 3,j 1j 2j 3,k 1k 2k 3)=(110,010,010)。
in,
Figure PCTCN2021132548-appb-000008
For the symbol of rounding down, (i,j,k)=(6,2,2), convert the index value of vertex P into binary code: (i 1 i 2 i 3 ,j 1 j 2 j 3 ,k 1 k 2 k 3 ) = (110,010,010).
S252:根据顶点编码和小正方体的索引关系,确定若顶点所关联的小正方体中的三角面片不为空集,则将顶点与小正方体中的三角面片关联。S252: According to the vertex code and the index relationship of the small cube, determine if the triangle patch in the small cube associated with the vertex is not an empty set, associate the vertex with the triangle patch in the small cube.
具体的,根据顶点编码和小正方体的索引关系,确定顶点所关联的小正方体,确定该小正方体的关联面片序列是否为空集。Specifically, according to the vertex code and the index relationship of the small cube, determine the small cube associated with the vertex, and determine whether the associated patch sequence of the small cube is an empty set.
若顶点所关联的小正方体的关联面片序列中的三角面片不为空集,则将该顶点与该小正方体的关联面片序列中的所有三角面片进行关联。If the triangular patches in the associated patch sequence of the small cube associated with the vertex are not an empty set, then associate the vertex with all the triangular patches in the associated patch sequence of the small cube.
在一种可选实施方式中,顶点编码和小正方体的索引关系可通过下述公式表示:In an optional implementation, the index relationship between the vertex code and the small cube can be expressed by the following formula:
Q=q 1q 2…q l Q=q 1 q 2 …q l
其中,Q表示小正方体的索引编码,q l=4i l+2j l+k lWherein, Q represents the index code of the small cube, q l =4i l +2j l +k l .
示例的,上述二进制编码(i 1i 2i 3,j 1j 2j 3,k 1k 2k 3)=(110,010,010)对应的小正方体的索引编码为:Q=470。 For example, the index code of the small cube corresponding to the above binary code (i 1 i 2 i 3 , j 1 j 2 j 3 , k 1 k 2 k 3 )=(110,010,010) is: Q=470.
本申请实施例提供的面部三维模型可视化方法,根据八叉树结构计算第一面部三维模型的顶点编码,根据顶点编码和小正方体的索引关系,确定若顶点所关联的小正方体中的三角面片不为空集,则将顶点与小正方体中的三角面片关联。通过本申请实施例提供的方法,可通过计算将顶点与小正方体中的三角面片关联,以便减少顶点与三角面片之间距离的计算数量,提高计算效率。The facial three-dimensional model visualization method provided by the embodiment of the present application calculates the vertex code of the first facial three-dimensional model according to the octree structure, and determines the triangular surface in the small cube associated with the vertex according to the index relationship between the vertex code and the small cube Piece is not the empty set, associate the vertices with the triangular patches in the cuboid. Through the method provided by the embodiment of the present application, the vertices can be associated with the triangular patches in the small cube through calculation, so as to reduce the number of calculations for the distance between the vertices and the triangular patches, and improve the calculation efficiency.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,如图5所示,上述方法还可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model, as shown in FIG. 5, the above-mentioned method may also include:
S253:若顶点所关联的小正方体中的三角面片为空集,则以小正方体为中心,判断小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集。S253: If the triangle patch in the small cube associated with the vertex is an empty set, then judge whether the triangle patches in other small cubes in the neighborhood of the preset radius of the small cube are empty sets with the small cube as the center.
具体的,若与顶点关联的小正方体的三角面片序列中的三角面片为空集,即该小正方体中不包含三角面片,则以该小正方体为中心,确定预设半径所对应的邻域的其他小正方体,初始的,设定预设半径为2,则该小正方体半径2所对应的邻域内包含8个小正方体,图6为本申请实施例提供的一种邻域小正方体的结构示意图,如图6所示,左侧小正方体的半径为1,以左侧小正方体为中心,预设半径为2,得到的领域内的小正方体如右侧所示。判断该预设半径邻域内的其他小正方体的三角面片序列中的三角面片中是否为空集。Specifically, if the triangular facets in the triangular facet sequence of the small cube associated with the vertex are an empty set, that is, the small cube does not contain a triangular facet, then use the small cube as the center to determine the corresponding For other small cubes in the neighborhood, initially, the preset radius is set to 2, and the neighborhood corresponding to the radius of the small cube 2 contains 8 small cubes. Figure 6 is a small cube in the neighborhood provided by the embodiment of the present application As shown in Figure 6, the radius of the small cube on the left is 1, centered on the small cube on the left, and the preset radius is 2. The resulting small cube in the domain is shown on the right. It is judged whether the triangular patches in the triangular patch sequences of other small cubes in the neighborhood of the preset radius are empty sets.
S254:若其他小正方体中的三角面片不为空集,则将顶点与其他小正方体中的三角面片关联。S254: If the triangular faces in other small cubes are not an empty set, associate the vertices with the triangular faces in other small cubes.
具体地,若其他小正方体中存在三角面片序列中的三角面片不为空集,则将顶点与对应小正方体的三角面片序列中的所有三角面片关联,若存在多个其他小正方体中三角面片序列中的三角面片不为空集,则将顶点与所有不为空集的其他小正方体的三角面片序列中的所有三角面片关联。Specifically, if the triangular patches in the triangular patch sequence in other small cubes are not empty sets, associate the vertices with all the triangular patches in the triangular patch sequence of the corresponding small cube, if there are multiple other small cubes If the triangles in the sequence of triangles in the middle triangle are not an empty set, associate the vertices with all the triangles in the triangles of other small cubes that are not empty sets.
在一种可选实施方式中,若其他小正方体中的三角面片为空集,则将预设半径增加1,继续执行S253-S254。In an optional implementation manner, if the triangular faces in other small cubes are an empty set, the preset radius is increased by 1, and S253-S254 is continued.
本申请实施例提供的面部三维模型可视化方法,若顶点所关联的小正方体中的三角面片为空集,则以小正方体为中心,判断小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集,若其他小正方体中的三角面片不为空集,则将顶点与其他小正方体中的三角面片关联。本申请实施例提供的方法,可以保证每个顶点都具有所关联的三角面片,以保证在计算热力图和等高线时保证结果的准确性。In the facial three-dimensional model visualization method provided by the embodiment of the present application, if the triangular faces in the small cube associated with the vertices are an empty set, then the small cube is used as the center to judge the triangular faces in other small cubes in the neighborhood of the preset radius of the small cube. Whether the triangle face is an empty set, if the triangle face in other small cubes is not an empty set, associate the vertex with the triangle face in other small cubes. The method provided in the embodiment of the present application can ensure that each vertex has an associated triangular surface, so as to ensure the accuracy of the results when calculating the heat map and contour lines.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,上述S30可以包括:On the basis of the above embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model, and the above S30 may include:
根据距离与颜色表的映射关系,对第一面部三维模型的任意区域进行颜色渲染,得到热力图模型。According to the mapping relationship between the distance and the color table, color rendering is performed on any area of the first facial 3D model to obtain a heat map model.
具体的,颜色表是一条按照“蓝-青-绿-黄-橙-红”渐变的条带,其中总共含有N C种颜色,颜色表中的第k(0≤k≤N C)种颜色用C(k)表示。 Specifically, the color table is a strip that changes gradually according to "blue-cyan-green-yellow-orange-red", which contains a total of N C colors, and the kth (0≤k≤N C ) color in the color table Expressed by C(k).
建立距离与颜色表的映射关系,区间[a,b]内的距离与颜色的映射关系为:
Figure PCTCN2021132548-appb-000009
若x<a,C x=C(0),若x>b,C x=C(255)。
Establish the mapping relationship between the distance and the color table, the mapping relationship between the distance and the color in the interval [a, b] is:
Figure PCTCN2021132548-appb-000009
If x<a, C x =C(0), if x>b, C x =C(255).
其中,a,b分别代表映射区间的边界,a<b。Among them, a and b respectively represent the boundary of the mapping interval, and a<b.
根据每个顶点到最近的三角面片的距离,确定该顶点的预设范围对应的颜色值,并对该顶点的预设范围进行颜色渲染,通过计算第一面部三维模型的任意区域的多种颜色值,以对任意区域进行颜色渲染,得到热力图模型。According to the distance from each vertex to the nearest triangular surface, determine the color value corresponding to the preset range of the vertex, and perform color rendering on the preset range of the vertex, by calculating the multiplicity of any region of the first facial three-dimensional model A color value can be used to color render any region to obtain a heat map model.
统计该任意区域内多种颜色的出现次数,绘制第一面部三维模型的颜色条形统计图,在用户界面进行展示时,可同时显示热力图模型、颜色条形统计图、颜色表、距离和颜色表的映射关系。Count the number of occurrences of multiple colors in the arbitrary area, draw the color bar chart of the first facial 3D model, and display the heat map model, color bar chart, color table, and distance at the same time when displaying on the user interface The mapping relationship with the color table.
本申请实施例提供的面部三维模型可视化方法,根据距离与颜色表的映射关系,对第一面部三维模型的任意区域进行颜色渲染,得到热力图模型。通过本申请实施例提供的方法,可通过热力图模型对面部肌肉的差异变化进行可视化显示,若第二面部三维模型为专业人员制作的模拟方法,则可根据面部差异决定整形过程中所需药剂量,便于术前的方案设计。The method for visualizing a 3D facial model provided in the embodiment of the present application performs color rendering on any region of the first 3D facial model according to the mapping relationship between distance and color table, to obtain a heat map model. Through the method provided in the embodiment of this application, the difference in facial muscle changes can be visualized through the thermal map model. If the second facial three-dimensional model is a simulation method made by professionals, the required medicine in the plastic surgery process can be determined according to the facial differences. Dosage is convenient for preoperative program design.
需要说明的是,本申请实施例提供的热力图模型是在第一面部三维模型上进行渲染得到的,也可以通过计算第二面部三维模型的顶点到第一面部三维模型最近的三角面片的距离,并根据距离和颜色表的映射关系,对第二面部三维模型的任意区域进行渲染,得到热力图模型,本申请对此不做限制。It should be noted that the heat map model provided in the embodiment of the present application is obtained by rendering on the first 3D facial model, or by calculating the nearest triangular surface from the vertices of the second 3D facial model to the first 3D facial model The distance of the slice, and according to the mapping relationship between the distance and the color table, render any area of the 3D model of the second face to obtain a heat map model, which is not limited in this application.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化方法,图7为本申请实施例提供的第六种面部三维模型可视化方法的流程示意图,如图7所示,上述S40可以包括:On the basis of the above-mentioned embodiments, the embodiment of the present application also provides a method for visualizing a three-dimensional facial model. FIG. 7 is a schematic flowchart of the sixth method for visualizing a three-dimensional facial model provided in the embodiment of the present application. As shown in FIG. 7 , The above S40 may include:
S41:计算第一面部三维模型的第一高度图和第二面部三维模型的第二高度图。S41: Calculate a first height map of the first three-dimensional facial model and a second height map of the second three-dimensional facial model.
具体的,以第一面部三维模型为例进行说明,计算第一高度图的方法可以为:Specifically, taking the first facial three-dimensional model as an example for illustration, the method for calculating the first height map may be:
依据三维笛卡尔坐标系将第一面部三维模型摆正,具体的摆正方法为:使第一面部三维模型的眼睛中心点与三维笛卡尔坐标系的X轴平行,使第一面部三维模型的头部中轴与三维笛卡尔坐标系的Y轴平行,使三维笛卡尔坐标系的Z轴穿过第一面部三维模型的鼻尖,且使鼻尖位于Z轴的预设坐标点。示例的,鼻尖与Z轴原点的距离为150mm。Straighten the 3D model of the first face according to the 3D Cartesian coordinate system. The specific straightening method is: make the center point of the eyes of the 3D model of the first face parallel to the X-axis of the 3D Cartesian coordinate system, and make the 3D model of the first face The central axis of the head of the 3D model is parallel to the Y axis of the 3D Cartesian coordinate system, so that the Z axis of the 3D Cartesian coordinate system passes through the nose tip of the first facial 3D model, and the nose tip is located at a preset coordinate point of the Z axis. For example, the distance between the tip of the nose and the origin of the Z axis is 150mm.
采用预设展开方法将第一面部三维模型展开到二维平面内,得到第一面部三维模型顶点的三维坐标(x,y,z)与二维坐标(x,y)的对应关系。建立第一面部三维模型的坐标图,坐标图中,顶点的二维坐标(x,y)位置存储有顶点的三维坐标(x,y,z)。Expanding the first facial three-dimensional model into a two-dimensional plane by using a preset unfolding method to obtain the corresponding relationship between the three-dimensional coordinates (x, y, z) and the two-dimensional coordinates (x, y) of the vertices of the first facial three-dimensional model. A coordinate map of the first three-dimensional facial model is established. In the coordinate map, the two-dimensional coordinates (x, y) of the vertices store the three-dimensional coordinates (x, y, z) of the vertices.
定义二维坐标系下的高度方向hn,根据定义的高度方向hn,计算每个顶点在该高度方向hn的高度值h,建立第一面部三维模型的第一高度图,在第一高度图中,顶点的二维坐标(x,y)位置存储有顶点的高度值h。Define the height direction hn in the two-dimensional coordinate system, calculate the height value h of each vertex in the height direction hn according to the defined height direction hn, and establish the first height map of the first facial three-dimensional model, in the first height map In , the two-dimensional coordinate (x, y) position of the vertex stores the height value h of the vertex.
示例的,高度值h的计算方法为:根据二维坐标(x,y)在二维平面内的像素P(x,y),对该 像素P(x,y)和高度方向hn做内积计算,具体计算公式为:D(x,y)=innerProduct(P(x,y),hn)。For example, the calculation method of the height value h is: according to the pixel P(x,y) of the two-dimensional coordinates (x,y) in the two-dimensional plane, the inner product of the pixel P(x,y) and the height direction hn Calculation, the specific calculation formula is: D(x,y)=innerProduct(P(x,y),hn).
第二高度图的计算方式与上述第一高度图的计算方式相同,在此不做赘述。The calculation method of the second height map is the same as that of the above first height map, and will not be repeated here.
S42:根据第一高度图计算第一面部三维模型的第一二维等高线。S42: Calculate the first two-dimensional contour line of the first facial three-dimensional model according to the first height map.
具体的,使用预设的等高线计算方法,分别对第一面部三维模型的第一高度图进行计算,得到第一面部三维模型的第一二维等高线。示例的,预设的等高线计算方法为MarchingSquares算法。Specifically, a preset contour line calculation method is used to calculate the first height map of the first three-dimensional facial model to obtain the first two-dimensional contour line of the first three-dimensional facial model. For example, the preset contour calculation method is the MarchingSquares algorithm.
S43:根据第二高度图计算第二面部三维模型的第二二维等高线。S43: Calculate a second two-dimensional contour line of the second facial three-dimensional model according to the second height map.
具体的,第二二维等高线的计算方式与上述S42中第一二维等高线的计算方式相同,在此不做赘述。Specifically, the calculation method of the second two-dimensional contour line is the same as the calculation method of the first two-dimensional contour line in S42 above, which will not be repeated here.
S44:将第一二维等高线转换为第一三维等高线、第二二维等高线转换为第二三维等高线。S44: Convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line.
具体的,根据第一面部三维模型的坐标图和第一二维等高线,将第一二维等高线的顶点转化为三维坐标,得到第一面部三维模型的第一三维等高线;根据第二面部三维模型的坐标图和第二二维等高线,将第二二维等高线的顶点转化为三维坐标,得到第二面部三维模型的第二三维等高线。Specifically, according to the coordinate map of the first 3D facial model and the first 2D contour line, the vertices of the first 2D contour line are converted into 3D coordinates to obtain the first 3D contour of the first 3D facial model line; according to the coordinate map of the second facial three-dimensional model and the second two-dimensional contour line, the vertices of the second two-dimensional contour line are converted into three-dimensional coordinates, and the second three-dimensional contour line of the second facial three-dimensional model is obtained.
S45:根据第一三维等高线对第一面部三维模型进行渲染,得到第一等高线模型。S45: Render the first facial three-dimensional model according to the first three-dimensional contour line to obtain a first contour line model.
具体的,根据第一三维等高线的顶点的三维坐标,在第一面部三维模型中根据顶点的三维坐标渲染第一三维等高线,得到第一等高线模型。Specifically, according to the three-dimensional coordinates of the vertices of the first three-dimensional contour line, the first three-dimensional contour line is rendered in the first facial three-dimensional model according to the three-dimensional coordinates of the vertices to obtain the first contour line model.
在一种可选实施方式中,根据第一三维等高线的高度差和颜色表的映射关系,为第一三维等高线着色。In an optional implementation manner, the first three-dimensional contour line is colored according to a mapping relationship between a height difference of the first three-dimensional contour line and a color table.
具体的,根据第一三维等高线和高度差的映射关系、高度差和颜色表的映射关系,确定第一三维等高线和颜色表的映射关系,根据该映射关系为第一三维等高线着色,得到着色后的第一等高线模型。高度差和颜色表的映射关系可根据需求自行定义,在此不做限制。Specifically, according to the mapping relationship between the first three-dimensional contour line and the height difference, and the mapping relationship between the height difference and the color table, the mapping relationship between the first three-dimensional contour line and the color table is determined, and according to the mapping relationship, the first three-dimensional contour line Line coloring to obtain the first contour line model after coloring. The mapping relationship between the height difference and the color table can be defined according to the requirements, and there is no limitation here.
示例的,第一三维等高线和高度差的映射关系为:高度差=第一三维等高线的高度值-最大高度值,第一三维等高线的高度值可以根据第一三维等高线的三维坐标,从坐标图中确定对应的二维坐标,再从高度图中确定二维坐标对应的高度值。For example, the mapping relationship between the first three-dimensional contour line and the height difference is: height difference=height value of the first three-dimensional contour line-maximum height value, and the height value of the first three-dimensional contour line can be based on the first three-dimensional contour line The three-dimensional coordinates of the line, determine the corresponding two-dimensional coordinates from the coordinate map, and then determine the height value corresponding to the two-dimensional coordinates from the height map.
S46:根据第二三维等高线对第二面部三维模型进行渲染,得到第二等高线模型。S46: Render the second facial three-dimensional model according to the second three-dimensional contour line to obtain a second contour line model.
具体的,具体渲染方法与上述S45相同,在此不做赘述。Specifically, the specific rendering method is the same as the above-mentioned S45, and will not be repeated here.
在一种可选实施方式中,根据第二三维等高线的高度差和颜色表的映射关系,为第二三维等高线着色,第二三维等高线的高度差的计算方式与第一三维等高线的高度差的计算方式相同,在此不做赘述。In an optional implementation manner, the second three-dimensional contour line is colored according to the mapping relationship between the height difference of the second three-dimensional contour line and the color table, and the calculation method of the height difference of the second three-dimensional contour line is the same as that of the first three-dimensional contour line. The calculation method of the height difference of the three-dimensional contour line is the same, and will not be repeated here.
着色后的第一等高线模型和第二等高线模型中,与各自最高点的高度差相同的点的颜色相同,可通过比较等高线的颜色,了解等高线区域的面部变化情况。In the first contour model and the second contour model after coloring, the points with the same height difference as their respective highest points have the same color. By comparing the colors of the contour lines, we can understand the facial changes in the contour area .
本申请实施例提供的面部三维模型可视化方法,计算第一面部三维模型的第一高度图和第二面部三维模型的第二高度图,根据第一高度图计算第一面部三维模型的第一二维等高线,根据第二高度图计算第二面部三维模型的第二二维等高线,将第一二维等高线转换为第一三维等高线、第二二维等高线转换为第二三维等高线,根据第一三维等高线对第一面部三维模型进行渲染,得到第一等高线模型,根据第二三维等高线对第二面部三维模型进行渲染,得到第二等高线模型。通过本申请实施例提供的方法,通过第一等高线模型与第二等高线模型,可以直观的了解被测者面部的形变和移动情况,以实现对面部变化的可 视化。The facial three-dimensional model visualization method provided in the embodiment of the present application calculates the first height map of the first facial three-dimensional model and the second height map of the second facial three-dimensional model, and calculates the second height map of the first facial three-dimensional model according to the first height map A two-dimensional contour line, calculate the second two-dimensional contour line of the second facial three-dimensional model according to the second height map, convert the first two-dimensional contour line into the first three-dimensional contour line, the second two-dimensional contour line Convert the line to the second 3D contour line, render the first 3D facial model according to the first 3D contour line, obtain the first contour line model, and render the second 3D facial model according to the second 3D contour line , to get the second contour model. Through the method provided in the embodiment of the present application, through the first contour model and the second contour model, the deformation and movement of the subject's face can be intuitively understood, so as to realize the visualization of facial changes.
在上述实施例的基础上,本申请实施例还提供了一种面部三维模型可视化装置,图8为本申请实施例提供的一种面部三维模型可视化装置的结构示意图,如图8所示,该面部三维模型可视化装置可以包括:On the basis of the above embodiments, the embodiment of the present application also provides a three-dimensional facial model visualization device. FIG. 8 is a schematic structural diagram of a three-dimensional facial model visualization device provided by the embodiment of the present application. As shown in FIG. 8, the The facial three-dimensional model visualization device may include:
三维模型获取模块10,可以配置成用于获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;第一面部三维模型和第二面部三维模型为三角面片格式;The three-dimensional model acquisition module 10 can be configured to obtain the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are triangle faces Format;
距离计算模块20,可以配置成用于计算第一面部三维模型与第二面部三维模型中坐标点之间的距离;The distance calculation module 20 may be configured to calculate the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
热力图可视化模块30,可以配置成用于根据距离对第一面部三维模型进行渲染,得到热力图模型;The thermal map visualization module 30 may be configured to render the first facial three-dimensional model according to the distance to obtain a thermal map model;
等高线可视化模块40,可以配置成用于根据第一面部三维模型和第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。The contour line visualization module 40 may be configured to calculate the three-dimensional contour line according to the first three-dimensional facial model and the second three-dimensional facial model, respectively, to obtain the first contour line model and the second contour line model.
可选的,三维模型获取模块10可以包括:Optionally, the three-dimensional model acquisition module 10 may include:
三维模型获取单元,可以配置成用于获取被测者在两个不同时刻的第一初始面部三维模型和第二面部三维模型;The three-dimensional model acquisition unit may be configured to acquire the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at two different moments;
姿态变换矩阵计算单元,可以配置成用于计算第一初始面部三维模型与第二面部三维模型的姿态变换矩阵;A posture transformation matrix calculation unit may be configured to calculate the posture transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model;
对齐单元,可以配置成用于根据姿态变换矩阵将第一初始面部三维模型对齐到第二面部三维模型,得到第一面部三维模型。The alignment unit may be configured to align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
可选的,姿态变换矩阵计算单元,可以包括:Optionally, the attitude transformation matrix calculation unit may include:
第一球体截取子单元,可以配置成用于以第一初始面部三维模型的鼻尖位置为球心,以预设半径对第一初始面部三维模型进行截取,得到第一初始面部三维模型对应的第一球体截取模型;The first sphere intercepting subunit can be configured to use the nose tip position of the first initial facial three-dimensional model as the center of the sphere, and intercept the first initial three-dimensional facial model with a preset radius to obtain the first initial three-dimensional facial model corresponding to the first three-dimensional facial model. A sphere intercept model;
第二球体截取子单元,可以配置成用于以第二面部三维模型的鼻尖位置为球心,以预设半径对第二面部三维模型进行截取,得到第二面部三维模型对应的第二球体截取模型;The second sphere intercepting subunit can be configured to use the nose tip position of the second facial three-dimensional model as the center of the sphere, and intercept the second facial three-dimensional model with a preset radius to obtain a second spherical intercept corresponding to the second facial three-dimensional model Model;
姿态变换矩阵计算子单元,可以配置成用于采用预设变换矩阵计算方法、以及第一球体截取模型和第二球体截取模型,计算获取姿态变换矩阵。The attitude transformation matrix calculation subunit can be configured to calculate and obtain the attitude transformation matrix by adopting a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
可选的,距离计算模块20,可以配置成用于根据第一面部三维模型中每个顶点的坐标,计算获取第一面部三维模型中每个顶点到第二面部三维模型最近的三角面片的距离。Optionally, the distance calculation module 20 may be configured to calculate and obtain the closest triangular surface from each vertex in the first three-dimensional facial model to the second three-dimensional facial model according to the coordinates of each vertex in the first three-dimensional facial model slice distance.
可选的,距离计算模块20,可以包括:Optionally, the distance calculation module 20 may include:
包围盒计算单元,可以配置成用于计算第一面部三维模型和第二面部三维模型的最小公共正方体包围盒;A bounding box calculation unit may be configured to calculate the minimum common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
八叉树建立单元,可以配置成用于针对第一面部三维模型的最小公共正方体包围盒建立八叉树结构;An octree building unit, which can be configured to build an octree structure for the minimum common cube bounding box of the first facial three-dimensional model;
均分单元,可以配置成用于以八叉树结构的深度对第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体;The equalizing unit can be configured to equally divide the minimum common cube bounding box of the second facial three-dimensional model with the depth of the octree structure to obtain a preset number of small cubes;
第一关联单元,可以配置成用于将第二面部三维模型的三角面片与小正方体关联;The first associating unit may be configured to associate the triangular patch of the second facial three-dimensional model with the small cube;
第二关联单元,可以配置成用于根据第一面部三维模型的顶点坐标与小正方体的索引关系,将第一面部三维模型的顶点与小正方体中的三角面片关联;The second associating unit may be configured to associate the vertices of the first three-dimensional facial model with the triangular patches in the small cube according to the index relationship between the coordinates of the vertices of the first three-dimensional facial model and the small cube;
距离计算单元,可以配置成用于根据顶点坐标与关联的三角面片的距离,获取第一面 部三维模型中每个顶点到第二面部三维模型最近的三角面片的距离。The distance calculation unit may be configured to obtain the distance from each vertex in the first three-dimensional facial model to the nearest triangle surface of the second three-dimensional facial model according to the distance between the vertex coordinates and the associated triangle surface.
可选的,第二关联单元,可以包括:Optionally, the second association unit may include:
编码计算子单元,可以配置成用于根据八叉树结构计算第一面部三维模型的顶点编码;The encoding calculation subunit can be configured to calculate the vertex encoding of the first facial three-dimensional model according to the octree structure;
第二关联子单元,可以配置成:根据顶点编码和小正方体的索引关系,确定若顶点所关联的小正方体中的三角面片不为空集,则将顶点与小正方体中的三角面片关联。The second association subunit can be configured to: according to the vertex code and the index relationship of the small cube, determine if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the triangle patch in the small cube .
可选的,该装置还可以包括:Optionally, the device may also include:
邻域判断单元,可以配置成:若顶点所关联的小正方体中的三角面片为空集,则以小正方体为中心,判断小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集;The neighborhood judging unit can be configured as follows: if the triangular patch in the small cube associated with the vertex is an empty set, then use the small cube as the center to judge the triangular patches in other small cubes in the neighborhood of the small cube’s preset radius Is it an empty set;
第三关联子单元,可以配置成:若其他小正方体中的三角面片不为空集,则将顶点与其他小正方体中的三角面片关联。The third associating subunit may be configured as: if the triangular faces in other small cubes are not an empty set, associate the vertices with the triangular faces in other small cubes.
可选的,热力图可视化模块30,还可以配置成用于根据距离与颜色表的映射关系,对第一面部三维模型的任意区域进行颜色渲染,得到热力图模型。Optionally, the heat map visualization module 30 may also be configured to perform color rendering on any region of the first three-dimensional facial model according to the mapping relationship between the distance and the color table to obtain a heat map model.
可选的,等高线可视化模块40,可以包括:Optionally, the contour visualization module 40 may include:
高度图计算单元,可以配置成用于计算第一面部三维模型的第一高度图和第二面部三维模型的第二高度图;a height map calculation unit, which may be configured to calculate a first height map of the first facial three-dimensional model and a second height map of the second facial three-dimensional model;
第一二维等高线计算单元,可以配置成用于根据第一高度图计算第一面部三维模型的第一二维等高线;The first two-dimensional contour calculation unit may be configured to calculate the first two-dimensional contour of the first facial three-dimensional model according to the first height map;
第二二维等高线计算单元,可以配置成用于根据第二高度图计算第二面部三维模型的第二二维等高线;The second two-dimensional contour calculation unit may be configured to calculate the second two-dimensional contour of the second facial three-dimensional model according to the second height map;
转换单元,可以配置成用于将第一二维等高线转换为第一三维等高线、第二二维等高线转换为第二三维等高线;A conversion unit may be configured to convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line;
第一等高线可视化单元,可以配置成用于根据第一三维等高线对第一面部三维模型进行渲染,得到第一等高线模型;The first contour line visualization unit may be configured to render the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
第二等高线可视化单元,可以配置成用于根据第二三维等高线对第二面部三维模型进行渲染,得到第二等高线模型。The second contour line visualization unit may be configured to render the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
上述装置用于执行前述实施例提供的方法,其实现原理和技术效果类似,在此不再赘述。The above-mentioned apparatus is used to execute the methods provided in the foregoing embodiments, and its implementation principles and technical effects are similar, and details are not repeated here.
以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(Application Specific Integrated Circuit,简称ASIC),或,一个或多个微处理器,或,一个或者多个现场可编程门阵列(Field Programmable Gate Array,简称FPGA)等。再如,当以上某个模块通过处理元件调度程序代码的形式实现时,该处理元件可以是通用处理器,例如中央处理器(Central Processing Unit,简称CPU)或其它可以调用程序代码的处理器。再如,这些模块可以集成在一起,以片上系统(system-on-a-chip,简称SOC)的形式实现。The above modules may be one or more integrated circuits configured to implement the above method, for example: one or more specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), or, one or more microprocessors, or, One or more Field Programmable Gate Arrays (Field Programmable Gate Array, FPGA for short), etc. For another example, when one of the above modules is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, referred to as CPU) or other processors that can call program codes. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC for short).
图9为本申请实施例提供的电子设备的示意图,该电子设备100可以包括:处理器101、存储介质102和总线。FIG. 9 is a schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device 100 may include: a processor 101 , a storage medium 102 and a bus.
存储介质102存储有处理器101可执行的程序指令,当电子设备100运行时,处理器101与存储介质102之间通过总线通信,处理器101执行程序指令,以执行上述方法实施例。具体实现方式和技术效果类似,这里不再赘述。The storage medium 102 stores program instructions executable by the processor 101. When the electronic device 100 is running, the processor 101 communicates with the storage medium 102 through a bus, and the processor 101 executes the program instructions to implement the above method embodiments. The specific implementation manner and technical effect are similar, and will not be repeated here.
可选地,本申请还提供一种程序产品,例如计算机可读存储介质,可以包括程序,该 程序在被处理器执行时用于执行上述方法实施例。Optionally, the present application further provides a program product, such as a computer-readable storage medium, which may include a program, and the program is used to execute the above-mentioned method embodiments when executed by a processor.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本申请各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取存储器(英文:Random Access Memory,简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated units implemented in the form of software functional units may be stored in a computer-readable storage medium. The above-mentioned software functional units are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) or a processor (English: processor) to execute the functions described in various embodiments of the present application. part of the method. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), magnetic disk or optical disc, etc. Various media that can store program code.
上仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the application, but the scope of protection of the application is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the application, and should be covered in Within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
工业实用性Industrial Applicability
本申请提供一种面部三维模型可视化方法、装置、电子设备及存储介质。该方法包括:通过获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;第一面部三维模型和第二面部三维模型为三角面片格式;计算第一面部三维模型与第二面部三维模型中坐标点之间的距离;根据距离对第一面部三维模型进行渲染,得到热力图模型;根据第一面部三维模型和第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。通过本申请可以直观地展示面部的变化。The present application provides a method, device, electronic equipment and storage medium for visualizing a three-dimensional facial model. The method includes: obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are in the form of triangular patches; The distance between the coordinate points in the first 3D model and the second facial 3D model; render the first facial 3D model according to the distance to obtain a heat map model; calculate the 3D Contour, get the first contour model and the second contour model. Through this application, the changes of the face can be displayed intuitively.
此外,可以理解的是,本申请的面部三维模型可视化方法、装置、电子设备及存储介质是可以重现的,并且可以用在多种工业应用中。例如,本申请的面部三维模型可视化方法、装置、电子设备及存储介质可以用于三维模型的技术领域。In addition, it can be understood that the facial three-dimensional model visualization method, device, electronic equipment and storage medium of the present application are reproducible and can be used in various industrial applications. For example, the facial three-dimensional model visualization method, device, electronic equipment and storage medium of the present application can be used in the technical field of three-dimensional models.

Claims (20)

  1. 一种面部三维模型可视化方法,其特征在于,包括:A method for visualizing a three-dimensional facial model, comprising:
    获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;所述第一面部三维模型和所述第二面部三维模型为三角面片格式;Obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are in triangular patch format;
    计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离;calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
    根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型;Rendering the first facial three-dimensional model according to the distance to obtain a heat map model;
    根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。The three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain a first contour line model and a second contour line model.
  2. 根据权利要求1所述的方法,其特征在于,所述获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型,包括:The method according to claim 1, wherein said obtaining the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments comprises:
    获取所述被测者在所述两个不同时刻的第一初始面部三维模型和所述第二面部三维模型;Obtaining the first initial facial three-dimensional model and the second facial three-dimensional model of the subject at the two different moments;
    计算所述第一初始面部三维模型与所述第二面部三维模型的姿态变换矩阵;calculating a pose transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model;
    根据所述姿态变换矩阵将所述第一初始面部三维模型对齐到所述第二面部三维模型,得到所述第一面部三维模型。Aligning the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain the first facial three-dimensional model.
  3. 根据权利要求2所述的方法,其特征在于,所述计算所述第一初始面部三维模型与所述第二面部三维模型的姿态变换矩阵,包括:The method according to claim 2, wherein the calculating the pose transformation matrix of the first initial facial three-dimensional model and the second facial three-dimensional model comprises:
    以所述第一初始面部三维模型的鼻尖位置为球心,以预设半径对所述第一初始面部三维模型进行截取,得到所述第一初始面部三维模型对应的第一球体截取模型;Taking the position of the tip of the nose of the first initial facial three-dimensional model as the center of the sphere, intercepting the first initial three-dimensional facial model with a preset radius to obtain a first sphere interception model corresponding to the first initial three-dimensional facial model;
    以所述第二面部三维模型的鼻尖位置为球心,以所述预设半径对所述第二面部三维模型进行截取,得到所述第二面部三维模型对应的第二球体截取模型;Taking the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere, intercepting the second facial three-dimensional model with the preset radius, to obtain a second spherical intercepting model corresponding to the second facial three-dimensional model;
    采用预设变换矩阵计算方法、以及所述第一球体截取模型和所述第二球体截取模型,计算获取所述姿态变换矩阵。The attitude transformation matrix is calculated and obtained by using a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离,包括:The method according to any one of claims 1 to 3, wherein the calculating the distance between the coordinate points in the first three-dimensional facial model and the second three-dimensional facial model comprises:
    根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。According to the coordinates of each vertex in the first 3D facial model, calculate and acquire the distance from each vertex in the 1st 3D facial model to the closest triangular patch of the second 3D facial model.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离,包括:The method according to claim 4, characterized in that, according to the coordinates of each vertex in the first facial three-dimensional model, calculating and obtaining the coordinates of each vertex in the first facial three-dimensional model to the second The distance of the nearest triangular patch of the facial 3D model, including:
    计算所述第一面部三维模型和所述第二面部三维模型的最小公共正方体包围盒;Calculating the minimum common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
    针对所述第一面部三维模型的最小公共正方体包围盒建立八叉树结构;Establishing an octree structure for the minimum common cube bounding box of the first facial three-dimensional model;
    以所述八叉树结构的深度对所述第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体;Divide the minimum common cube bounding box of the second facial three-dimensional model equally with the depth of the octree structure to obtain a preset number of small cubes;
    将所述第二面部三维模型的三角面片与所述小正方体关联;Associating the triangular patch of the second facial three-dimensional model with the small cube;
    根据所述第一面部三维模型的顶点坐标与所述小正方体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联;According to the index relationship between the vertex coordinates of the first facial three-dimensional model and the small cube, associate the vertices of the first facial three-dimensional model with the triangular patches in the small cube;
    根据所述顶点坐标与关联的三角面片的距离,获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。According to the distance between the vertex coordinates and the associated triangular patch, the distance from each vertex in the first facial 3D model to the closest triangular patch of the second facial 3D model is acquired.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述第一面部三维模型的顶点 坐标与所述小正方体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联,包括:The method according to claim 5, wherein, according to the index relationship between the vertex coordinates of the first three-dimensional facial model and the small cube, the vertices of the first three-dimensional facial model and the Triangular patch association in small cubes, including:
    根据所述八叉树结构计算所述第一面部三维模型的顶点编码;calculating the vertex codes of the first facial three-dimensional model according to the octree structure;
    根据所述顶点编码和所述小正方体的索引关系,确定若所述顶点所关联的小正方体中的三角面片不为空集,则将所述顶点与所述小正方体中的三角面片关联。According to the vertex code and the index relationship of the small cube, determine if the triangle patch in the small cube associated with the vertex is not an empty set, then associate the vertex with the triangle patch in the small cube .
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, further comprising:
    若所述顶点所关联的小正方体中的三角面片为空集,则以所述小正方体为中心,判断所述小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集;If the triangular faces in the small cube associated with the vertex are an empty set, take the small cube as the center, and judge whether the triangular faces in other small cubes in the neighborhood of the preset radius of the small cube are empty set;
    若所述其他小正方体中的三角面片不为空集,则将所述顶点与所述其他小正方体中的三角面片关联。If the triangle faces in the other small cubes are not an empty set, associate the vertex with the triangle faces in the other small cubes.
  8. 根据权利要求1至7中的任一项所述的方法,其特征在于,所述根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型,包括:The method according to any one of claims 1 to 7, wherein the rendering of the first facial three-dimensional model according to the distance to obtain a heat map model includes:
    根据所述距离与颜色表的映射关系,对所述第一面部三维模型的任意区域进行颜色渲染,得到所述热力图模型。Perform color rendering on any region of the first facial three-dimensional model according to the mapping relationship between the distance and the color table to obtain the heat map model.
  9. 根据权利要求1至8中的任一项所述的方法,其特征在于,所述根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型,包括:The method according to any one of claims 1 to 8, wherein the three-dimensional contour lines are respectively calculated according to the first three-dimensional facial model and the second three-dimensional facial model to obtain the first contour line Highline models and second contour models, including:
    计算所述第一面部三维模型的第一高度图和所述第二面部三维模型的第二高度图;calculating a first height map of the first facial 3D model and a second height map of the second facial 3D model;
    根据所述第一高度图计算所述第一面部三维模型的第一二维等高线;calculating a first two-dimensional contour line of the first facial three-dimensional model according to the first height map;
    根据所述第二高度图计算所述第二面部三维模型的第二二维等高线;calculating a second two-dimensional contour line of the second facial three-dimensional model according to the second height map;
    将所述第一二维等高线转换为第一三维等高线、所述第二二维等高线转换为第二三维等高线;converting the first two-dimensional contour to a first three-dimensional contour, and converting the second two-dimensional contour to a second three-dimensional contour;
    根据所述第一三维等高线对所述第一面部三维模型进行渲染,得到所述第一等高线模型;Rendering the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
    根据所述第二三维等高线对所述第二面部三维模型进行渲染,得到所述第二等高线模型。Rendering the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
  10. 一种面部三维模型可视化装置,其特征在于,包括:A facial three-dimensional model visualization device is characterized in that it comprises:
    三维模型获取模块,配置成用于获取被测者在两个不同时刻的第一面部三维模型和第二面部三维模型;所述第一面部三维模型和所述第二面部三维模型为三角面片格式;A three-dimensional model acquisition module configured to acquire the first three-dimensional facial model and the second three-dimensional facial model of the subject at two different moments; the first three-dimensional facial model and the second three-dimensional facial model are triangular patch format;
    距离计算模块,配置成用于计算所述第一面部三维模型与所述第二面部三维模型中坐标点之间的距离;a distance calculation module configured to calculate the distance between coordinate points in the first three-dimensional facial model and the second three-dimensional facial model;
    热力图可视化模块,配置成用于根据所述距离对所述第一面部三维模型进行渲染,得到热力图模型;A heat map visualization module configured to render the first facial three-dimensional model according to the distance to obtain a heat map model;
    等高线可视化模块,用于根据所述第一面部三维模型和所述第二面部三维模型分别计算三维等高线,得到第一等高线模型和第二等高线模型。The contour visualization module is used to calculate the three-dimensional contours respectively according to the first three-dimensional facial model and the second three-dimensional facial model, so as to obtain the first contour model and the second contour model.
  11. 根据权利要求10所述的面部三维模型可视化装置,其特征在于,所述三维模型获取模块包括三维模型获取单元、姿态变换矩阵计算单元和对齐单元,其中,The facial three-dimensional model visualization device according to claim 10, wherein the three-dimensional model acquisition module includes a three-dimensional model acquisition unit, a pose transformation matrix calculation unit and an alignment unit, wherein,
    所述三维模型获取单元配置成用于获取所述被测者在所述两个不同时刻的所述第一初始面部三维模型和所述第二面部三维模型;The 3D model acquiring unit is configured to acquire the first initial facial 3D model and the second facial 3D model of the subject at the two different moments;
    所述姿态变换矩阵计算单元配置成用于计算所述第一初始面部三维模型与所述第二面 部三维模型的姿态变换矩阵;The posture transformation matrix calculation unit is configured to calculate the posture transformation matrix of the first initial three-dimensional facial model and the second three-dimensional facial model;
    所述对齐单元配置成用于根据所述姿态变换矩阵将所述第一初始面部三维模型对齐到所述第二面部三维模型,得到第一面部三维模型。The aligning unit is configured to align the first initial facial three-dimensional model to the second facial three-dimensional model according to the pose transformation matrix to obtain a first facial three-dimensional model.
  12. 根据权利要求11所述的面部三维模型可视化装置,其特征在于,所述姿态变换矩阵计算单元包括第一球体截取子单元、第二球体截取子单元和姿态变换矩阵计算子单元,其中,The facial three-dimensional model visualization device according to claim 11, wherein the posture transformation matrix calculation unit includes a first sphere interception subunit, a second sphere interception subunit and a posture transformation matrix calculation subunit, wherein,
    所述第一球体截取子单元配置成用于以所述第一初始面部三维模型的鼻尖位置为球心,以预设半径对所述第一初始面部三维模型进行截取,得到所述第一初始面部三维模型对应的第一球体截取模型;The first sphere interception subunit is configured to intercept the first initial facial three-dimensional model with a preset radius, taking the position of the tip of the nose of the first initial facial three-dimensional model as the center of the sphere, to obtain the first initial facial three-dimensional model. A first sphere interception model corresponding to the facial three-dimensional model;
    所述第二球体截取子单元配置成用于以所述第二面部三维模型的鼻尖位置为球心,以所述预设半径对所述第二面部三维模型进行截取,得到所述第二面部三维模型对应的第二球体截取模型;The second sphere interception subunit is configured to intercept the second facial three-dimensional model with the preset radius using the position of the tip of the nose of the second facial three-dimensional model as the center of the sphere to obtain the second facial A second sphere interception model corresponding to the three-dimensional model;
    所述姿态变换矩阵计算子单元配置成采用预设变换矩阵计算方法、以及所述第一球体截取模型和所述第二球体截取模型,计算获取所述姿态变换矩阵。The attitude transformation matrix calculation subunit is configured to use a preset transformation matrix calculation method, and the first sphere interception model and the second sphere interception model to calculate and obtain the attitude transformation matrix.
  13. 根据权利要求10至12中的任一项所述的面部三维模型可视化装置,其特征在于,The facial three-dimensional model visualization device according to any one of claims 10 to 12, characterized in that,
    所述距离计算模块还配置成用于根据所述第一面部三维模型中每个顶点的坐标,计算获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。The distance calculation module is also configured to calculate and obtain the closest distance from each vertex in the first 3D facial model to the second 3D facial model according to the coordinates of each vertex in the first 3D facial model. The distance of the triangles.
  14. 根据权利要求10至12中的任一项所述的面部三维模型可视化装置,其特征在于,所述距离计算模块包括包围盒计算单元、八叉树建立单元、均分单元、第一关联单元、第二关联单元和距离计算单元,其中,The facial three-dimensional model visualization device according to any one of claims 10 to 12, wherein the distance calculation module includes a bounding box calculation unit, an octree establishment unit, an equal division unit, a first association unit, The second association unit and the distance calculation unit, wherein,
    所述包围盒计算单元配置成计算所述第一面部三维模型和所述第二面部三维模型的最小公共正方体包围盒;The bounding box calculation unit is configured to calculate the minimum common cube bounding box of the first facial three-dimensional model and the second facial three-dimensional model;
    所述八叉树建立单元配置成针对所述第一面部三维模型的最小公共正方体包围盒建立八叉树结构;The octree building unit is configured to build an octree structure for the minimum common cube bounding box of the first facial three-dimensional model;
    所述均分单元配置成以所述八叉树结构的深度对所述第二面部三维模型的最小公共正方体包围盒进行均分,得到预设数量的小正方体;The equalizing unit is configured to equally divide the minimum common cube bounding box of the second facial three-dimensional model with the depth of the octree structure to obtain a preset number of small cubes;
    所述第一关联单元配置成将所述第二面部三维模型的三角面片与所述小正方体关联;The first association unit is configured to associate the triangular patch of the second facial three-dimensional model with the small cube;
    所述第二关联单元配置成根据所述第一面部三维模型的顶点坐标与所述小正方体的索引关系,将所述第一面部三维模型的顶点与所述小正方体中的三角面片关联;The second associating unit is configured to associate the vertices of the first three-dimensional facial model with the triangle faces in the small cube according to the index relationship between the vertex coordinates of the first three-dimensional facial model and the small cube association;
    所述距离计算单元配置成根据所述顶点坐标与关联的三角面片的距离,获取所述第一面部三维模型中每个顶点到所述第二面部三维模型最近的三角面片的距离。The distance calculation unit is configured to obtain the distance from each vertex in the first three-dimensional facial model to the nearest triangle surface of the second three-dimensional facial model according to the distance between the vertex coordinates and the associated triangle surface.
  15. 根据权利要求14所述的面部三维模型可视化装置,其特征在于,所述第二关联单元包括编码计算子单元和第二关联子单元,其中,The facial three-dimensional model visualization device according to claim 14, wherein the second association unit includes an encoding calculation subunit and a second association subunit, wherein,
    所述编码计算子单元配置成根据所述八叉树结构计算所述第一面部三维模型的顶点编码;The encoding calculation subunit is configured to calculate the vertex encoding of the first facial three-dimensional model according to the octree structure;
    第二关联子单元配置成根据所述顶点编码和所述小正方体的索引关系,确定若所述顶点所关联的小正方体中的三角面片不为空集,则将所述顶点与所述小正方体中的三角面片关联。The second associating subunit is configured to, according to the vertex code and the index relationship of the small cube, determine that if the triangle facet in the small cube associated with the vertex is not an empty set, associate the vertex with the small cube Triangular patch association in a cube.
  16. 根据权利要求14或15所述的面部三维模型可视化装置,其特征在于,所述面部三维模型可视化装置还包括邻域判断单元和第三关联子单元,其中,The three-dimensional facial model visualization device according to claim 14 or 15, wherein the three-dimensional facial model visualization device further comprises a neighborhood judging unit and a third association subunit, wherein,
    所述邻域判断单元配置成:若所述顶点所关联的小正方体中的三角面片为空集,则以所述小正方体为中心,判断所述小正方体的预设半径邻域内的其他小正方体中的三角面片是否为空集;The neighborhood judging unit is configured to: if the triangular patch in the small cube associated with the vertex is an empty set, take the small cube as the center and judge other small cubes in the neighborhood of the preset radius of the small cube. Whether the triangles in the cube are an empty set;
    所述第三关联子单元配置成:若所述其他小正方体中的三角面片不为空集,则将所述顶点与所述其他小正方体中的三角面片关联。The third associating subunit is configured to associate the vertex with the triangle faces in the other small cubes if the triangle faces in the other small cubes are not an empty set.
  17. 根据权利要求10至16中的任一项所述的面部三维模型可视化装置,其特征在于,所述热力图可视化模块还配置成:根据所述距离与颜色表的映射关系,对所述第一面部三维模型的任意区域进行颜色渲染,得到所述热力图模型。The facial three-dimensional model visualization device according to any one of claims 10 to 16, wherein the thermal map visualization module is further configured to: according to the mapping relationship between the distance and the color table, the first Color rendering is performed on any region of the three-dimensional face model to obtain the heat map model.
  18. 根据权利要求10至17中的任一项所述的面部三维模型可视化装置,其特征在于,The facial three-dimensional model visualization device according to any one of claims 10 to 17, wherein:
    所述等高线可视化模块包括高度图计算单元、第一二维等高线计算单元、第二二维等高线计算单元、转换单元、第一等高线可视化单元和第二等高线可视化单元,其中,The contour visualization module includes a height map calculation unit, a first two-dimensional contour calculation unit, a second two-dimensional contour calculation unit, a conversion unit, a first contour visualization unit and a second contour visualization unit, where
    所述高度图计算单元配置成计算所述第一面部三维模型的第一高度图和所述第二面部三维模型的第二高度图;The height map calculation unit is configured to calculate a first height map of the first facial three-dimensional model and a second height map of the second facial three-dimensional model;
    所述第一二维等高线计算单元配置成根据所述第一高度图计算所述第一面部三维模型的第一二维等高线;The first two-dimensional contour calculation unit is configured to calculate a first two-dimensional contour of the first facial three-dimensional model according to the first height map;
    所述第二二维等高线计算单元配置成根据所述第二高度图计算所述第二面部三维模型的第二二维等高线;The second two-dimensional contour calculation unit is configured to calculate a second two-dimensional contour of the second facial three-dimensional model according to the second height map;
    所述转换单元配置成将所述第一二维等高线转换为第一三维等高线、所述第二二维等高线转换为第二三维等高线;The conversion unit is configured to convert the first two-dimensional contour line into a first three-dimensional contour line, and convert the second two-dimensional contour line into a second three-dimensional contour line;
    所述第一等高线可视化单元配置成根据所述第一三维等高线对所述第一面部三维模型进行渲染,得到所述第一等高线模型;The first contour line visualization unit is configured to render the first facial three-dimensional model according to the first three-dimensional contour line to obtain the first contour line model;
    所述第二等高线可视化单元配置成根据所述第二三维等高线对所述第二面部三维模型进行渲染,得到所述第二等高线模型。The second contour line visualization unit is configured to render the second facial three-dimensional model according to the second three-dimensional contour line to obtain the second contour line model.
  19. 一种电子设备,其特征在于,包括:处理器、存储介质和总线,所述存储介质存储有所述处理器可执行的程序指令,当所述电子设备运行时,所述处理器与所述存储介质之间通过总线通信,所述处理器执行所述程序指令,以执行如权利要求1至9任一所述的面部三维模型可视化方法的步骤。An electronic device, characterized in that it includes: a processor, a storage medium and a bus, the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor and the The storage media communicate through the bus, and the processor executes the program instructions to execute the steps of the facial three-dimensional model visualization method according to any one of claims 1 to 9.
  20. 一种计算机可读存储介质,其特征在于,所述存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行如权利要求1至9任一所述的面部三维模型可视化方法的步骤。A computer-readable storage medium, characterized in that, a computer program is stored on the storage medium, and when the computer program is run by a processor, the steps of the facial three-dimensional model visualization method according to any one of claims 1 to 9 are executed .
PCT/CN2021/132548 2021-06-18 2021-11-23 Facial three-dimensional model visualization method and apparatus, electronic device, and storage medium WO2022262201A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2022540757A JP7433444B2 (en) 2021-06-18 2021-11-23 Facial three-dimensional model visualization method, device, electronic device, and recording medium
KR1020227022198A KR102622215B1 (en) 2021-06-18 2021-11-23 Facial three-dimensional model visualization method, device, electronic equipment, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110682452.2 2021-06-18
CN202110682452.2A CN113345079B (en) 2021-06-18 2021-06-18 Face three-dimensional model visualization method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022262201A1 true WO2022262201A1 (en) 2022-12-22

Family

ID=77477805

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132548 WO2022262201A1 (en) 2021-06-18 2021-11-23 Facial three-dimensional model visualization method and apparatus, electronic device, and storage medium

Country Status (4)

Country Link
JP (1) JP7433444B2 (en)
KR (1) KR102622215B1 (en)
CN (1) CN113345079B (en)
WO (1) WO2022262201A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113345079B (en) * 2021-06-18 2024-02-27 厦门美图宜肤科技有限公司 Face three-dimensional model visualization method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10095916B1 (en) * 2014-12-30 2018-10-09 Morphotrust Usa, Llc Facial recognition using fractal features
CN108647242A (en) * 2018-04-10 2018-10-12 北京天正聚合科技有限公司 A kind of generation method and system of thermodynamic chart
CN109118581A (en) * 2018-08-22 2019-01-01 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer readable storage medium
CN112906607A (en) * 2021-03-05 2021-06-04 上海红阵信息科技有限公司 Contour method based face image processing method
CN113345079A (en) * 2021-06-18 2021-09-03 厦门美图之家科技有限公司 Face three-dimensional model visualization method and device, electronic equipment and storage medium

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001000421A (en) 1999-06-22 2001-01-09 Pola Chem Ind Inc Countenance simulation method
JP2003057017A (en) * 2001-08-10 2003-02-26 Kao Corp Three-dimensional matter measuring instrument
CN101894254B (en) * 2010-06-13 2013-01-09 南开大学 Contouring method-based three-dimensional face recognition method
WO2019023402A1 (en) 2017-07-26 2019-01-31 Canfield Scientific, Incorporated Method and apparatus to generate and track standardized anatomical regions automatically
CN107392984B (en) * 2017-07-26 2020-09-15 厦门美图之家科技有限公司 Method for generating animation based on face image and computing equipment
CN108256505A (en) * 2018-02-12 2018-07-06 腾讯科技(深圳)有限公司 Image processing method and device
CN110020600B (en) * 2019-03-05 2021-04-16 厦门美图之家科技有限公司 Method for generating a data set for training a face alignment model
CN110084884B (en) * 2019-04-28 2023-04-28 叠境数字科技(上海)有限公司 Human body model face area reconstruction method
CN110827336A (en) * 2019-11-01 2020-02-21 厦门美图之家科技有限公司 Image alignment method, device, equipment and storage medium
CN111145326B (en) * 2019-12-26 2023-12-19 网易(杭州)网络有限公司 Processing method of three-dimensional virtual cloud model, storage medium, processor and electronic device
CN111369657B (en) * 2020-03-09 2022-07-29 腾讯科技(深圳)有限公司 Three-dimensional thermodynamic diagram generation method and device, computer equipment and storage medium
CN111563959B (en) * 2020-05-06 2023-04-28 厦门美图之家科技有限公司 Updating method, device, equipment and medium of three-dimensional deformable model of human face
CN112365572B (en) * 2020-09-30 2023-10-03 深圳市为汉科技有限公司 Rendering method based on surface subdivision and related products thereof
CN112347546A (en) * 2020-11-30 2021-02-09 久瓴(江苏)数字智能科技有限公司 BIM rendering method, device and computer-readable storage medium based on lightweight device
CN112784469A (en) * 2021-02-25 2021-05-11 广州虎牙科技有限公司 Model parameter generation method and device, electronic equipment and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10095916B1 (en) * 2014-12-30 2018-10-09 Morphotrust Usa, Llc Facial recognition using fractal features
CN108647242A (en) * 2018-04-10 2018-10-12 北京天正聚合科技有限公司 A kind of generation method and system of thermodynamic chart
CN109118581A (en) * 2018-08-22 2019-01-01 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer readable storage medium
CN112906607A (en) * 2021-03-05 2021-06-04 上海红阵信息科技有限公司 Contour method based face image processing method
CN113345079A (en) * 2021-06-18 2021-09-03 厦门美图之家科技有限公司 Face three-dimensional model visualization method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
JP7433444B2 (en) 2024-02-19
KR102622215B1 (en) 2024-01-05
JP2023534327A (en) 2023-08-09
CN113345079A (en) 2021-09-03
KR20220169471A (en) 2022-12-27
CN113345079B (en) 2024-02-27

Similar Documents

Publication Publication Date Title
JP6585838B2 (en) Image distortion processing method and apparatus, and computer storage medium
AU2019432052B2 (en) Three-dimensional image measurement method, electronic device, storage medium, and program product
US6434278B1 (en) Generating three-dimensional models of objects defined by two-dimensional image data
CN109859305B (en) Three-dimensional face modeling and recognizing method and device based on multi-angle two-dimensional face
US10192003B2 (en) Method of aligning intra-oral digital 3D models
CN106203400A (en) A kind of face identification method and device
WO2020034785A1 (en) Method and device for processing three-dimensional model
Yuan et al. 3D point cloud matching based on principal component analysis and iterative closest point algorithm
CN107452049B (en) Three-dimensional head modeling method and device
CN111563959B (en) Updating method, device, equipment and medium of three-dimensional deformable model of human face
JP5873362B2 (en) Gaze error correction apparatus, program thereof, and method thereof
CN108921148A (en) Determine the method and device of positive face tilt angle
EP3430595B1 (en) Determining the relative position between a point cloud generating camera and another camera
WO2022262201A1 (en) Facial three-dimensional model visualization method and apparatus, electronic device, and storage medium
CN108257210A (en) A kind of method that human face three-dimensional model is generated by single photo
CN111460910A (en) Face type classification method and device, terminal equipment and storage medium
Wagemans et al. Measuring 3D point configurations in pictorial space
Castelán et al. Acquiring height data from a single image of a face using local shape indicators
CN111460937B (en) Facial feature point positioning method and device, terminal equipment and storage medium
CN113822994B (en) Three-dimensional model construction method and device and storage medium
CN113343879A (en) Method and device for manufacturing panoramic facial image, electronic equipment and storage medium
WO2018137454A1 (en) Method of adjusting object shape, and adjustment device
CN112381952A (en) Face contour point cloud model reconstruction method and device based on multiple cameras
Dias et al. A new approach for 3D craniometric measurements using 3D skull models
Yuan et al. Example-guided 3d human face reconstruction from sparse landmarks

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2022540757

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21945778

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE