A 3D model correction method and terminal device

By using 2D images to match virtual photography and actual shooting images in the 3D model correction method, combined with affine transformation and posture transformation, the problems of high equipment cost and low accuracy in the existing technology are solved, and the problem of high equipment cost and low accuracy is achieved on low-cost equipment. Get accurate 3D models, suitable for home use.

CN116758124BActive Publication Date: 2024-09-24BEIJING CODE SPACE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310720903.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2024-09-24
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

Among the existing 3D human body reconstruction stereoscopic modeling technologies, equipment based on infrared technology and lidar technology are high in cost and occupy a large area, making them difficult to use at home. 3D models based on ordinary cameras are not accurate enough and cannot accurately reflect the true state of the human body.

Method used

Provide a 3D model correction method, by obtaining the 2D image of the target object, setting the photographing parameters, matching the virtual photograph and the actual photographed image, iteratively correcting the 3D model, and using affine transformation and posture transformation to optimize the model until the accuracy requirements are met. .

Benefits of technology

It is possible to obtain a more accurate 3D model on low-cost devices (such as smartphones or ordinary cameras), avoiding differences with the real state, lowering the technical entry barrier, making it usable in daily life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116758124B
    Figure CN116758124B
Patent Text Reader

Abstract

The present application provides a 3D model correction method and terminal device, the method comprising: S10. Obtaining a 3D model to be corrected of a target object; S20. Obtaining a second 2D image of the target object; S30. Setting the photographing parameters of the 3D model to be corrected, taking a virtual photograph of the 3D model to be corrected, and obtaining a virtual image; S40. Correcting the 3D model to be corrected, and calculating at least one of the following correction parameters: position matching parameters of at least some key points of the target object of the virtual image and the second 2D image; matching parameters of the outer contour of the target object of the virtual image and the second 2D image; the proportion of the key points of the target object of the second 2D image located within the outer contour of the target object of the virtual image; S50. Repeating steps S30-S40 until the repetition steps reach a set number of times or the convergence condition is triggered. The present application can obtain a relatively accurate final 3D model of the target object, avoiding large differences from the actual state of the target object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of 3D model correction, and in particular to a 3D model correction method and terminal device. Background Art

[0002] At present, there are three main technical routes for 3D human body reconstruction and stereoscopic modeling: the first is based on infrared technology, the second is based on laser radar technology, and the third is based on computer vision; among them, the technical route for 3D human body reconstruction and stereoscopic modeling based on computer vision includes the following two situations: the first is based on photos taken by depth cameras, which have depth information, and the second is based on photos taken by ordinary cameras, which have no depth information, and mainly use artificial intelligence posture capture technology to reproduce the 3D model of the human body. The price of equipment based on infrared technology, laser radar technology and industrial depth cameras is relatively high, and most of them are large equipment with large land area. They are generally used in high-end 2B scenes and are difficult to enter families and daily life; and the 3D human body model obtained by 3D human body reconstruction and stereoscopic modeling based on ordinary visual photos is not accurate enough, and there is a big difference between it and the real state of the human body when taking pictures. To this end, this application proposes a 3D model correction method and terminal device. Summary of the invention

[0003] The purpose of this application is to provide a 3D model correction method and terminal device to address the above problems.

[0004] In a first aspect, the present application provides a 3D model correction method, the method comprising the following steps:

[0005] S10. Obtaining the 3D model of the target object to be corrected;

[0006] S20. Acquire a second 2D image of the target object, where the second 2D image may be one, two or more images at different angles;

[0007] S30. Setting the photographing parameters of the 3D model to be corrected, taking a virtual photograph of the 3D model to be corrected, and obtaining a virtual image, wherein the photographing parameters are obtained based on the second 2D image;

[0008] S40. Correct the 3D model to be corrected, and calculate at least one of the following correction parameters:

[0009] a. Position matching parameters of at least some key points of the target object of the virtual image and the second 2D image;

[0010] b. matching parameters of the outer contour of the target object of the virtual image and the second 2D image;

[0011] c. the proportion of the target object key points of the second 2D image within the outer contour of the target object in the virtual image;

[0012] S50. Repeat steps S30-S40 until the steps are repeated a set number of times or a convergence condition is triggered.

[0013] According to the technical solutions provided in some embodiments of the present application, setting the photographing parameters of the 3D model to be corrected includes at least one of the following steps:

[0014] Setting the photographing parameters based on the photographing parameters of the second 2D image;

[0015] The photographing parameters are iterated so that the virtual image matches at least some key point positions of the second 2D image.

[0016] According to the technical solution provided by some embodiments of the present application, the position matching parameter of at least some key points of the target object of the virtual image and the second 2D image is a function value of a loss function, and the function value of the loss function is the distance between the first data set and the second data set calculated according to a set algorithm;

[0017] The first data set is: a set of position information of at least some key points of the target object in the virtual image;

[0018] The second data set is: a set of position information of at least part of key points of the target object in the second 2D image;

[0019] The setting algorithm is at least one of the following algorithms:

[0020] The sum A of the distances between the corresponding points in the first data set and the second data set;

[0021] The sum B of the squares of the distances between the first data set and the second data set;

[0022] A weighted sum C of distances between corresponding points in the first data set and the second data set;

[0023] The weighted sum D of the squared distances of the corresponding points in the first data set and the second data set.

[0024] According to the technical solutions provided in some embodiments of the present application, the distance between corresponding points in the first data set and the second data set is any one of the following:

[0025] Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, standardized Euclidean distance, Mahalanobis distance, angle cosine, Hamming distance, correlation coefficient, correlation distance, information entropy.

[0026] According to the technical solutions provided in some embodiments of the present application, the target object outer contour matching parameter of the virtual image and the second 2D image is the area ratio of the target object in the virtual image within the target object outer contour of the second 2D image.

[0027] According to the technical solutions provided in some embodiments of the present application, the number of the second 2D image is one;

[0028] When at least two correction parameters are calculated in step S40, the convergence condition is: each correction parameter reaches a corresponding threshold, or the judgment parameter reaches a set threshold;

[0029] The judgment parameter is the weighted sum of the correction parameters;

[0030] The weights of the correction parameters can be set to the same or different values ​​in each correction step.

[0031] According to the technical solutions provided in some embodiments of the present application, the number of the second 2D images is multiple;

[0032] When at least two correction parameters are calculated in step S40, the convergence condition is: each comprehensive correction parameter reaches a corresponding threshold value, or the judgment parameter reaches a set threshold value;

[0033] The comprehensive correction parameter is a weighted sum of correction parameters corresponding to a plurality of the second 2D images;

[0034] The judgment parameter is the weighted sum of the comprehensive correction parameters;

[0035] The weights of the correction parameters or the comprehensive correction parameters may be set to the same or different values ​​in each correction step.

[0036] According to the technical solutions provided by certain embodiments of the present application, the shooting parameters include at least one of the focal length of the shooting device and the relative position information between the shooting device and the target object.

[0037] According to the technical solutions provided in some embodiments of the present application, the correction of the 3D model to be corrected is achieved by affine transformation or posture transformation;

[0038] The affine transformation includes: translation transformation, rotation transformation, scaling transformation, shear transformation, mirror transformation, and any combination of the above transformations;

[0039] The posture conversion includes: basic morphological transformation based on linear matrix, local morphological transformation, and skin transformation formed by relative joint movement.

[0040] According to the technical solutions provided in some embodiments of the present application, the 3D model to be corrected is generated based on a first 2D image; the first 2D image and the second 2D image are acquired at the same time.

[0041] In a second aspect, the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the 3D model correction method as described above are implemented.

[0042] Compared with the prior art, the beneficial effects of the present application are as follows: the 3D model correction method provided by the present application is used to iteratively correct the 3D model to be corrected of the target object to obtain a more accurate 3D model. After each correction, the photographing parameters are set based on the second 2D image of the target object to virtually photograph the 3D model to be corrected of the target object to obtain a virtual image, and the virtual image is compared with the second 2D image to calculate the correction parameters, and then the 3D model after this correction is verified with the correction parameters, and whether further correction is required is determined based on the verification results; the 3D model correction method can obtain a more accurate final 3D model of the target object, avoiding large differences from the actual state of the target object, and the second 2D image used in the correction method can be obtained using a smartphone or an ordinary camera, which is low in cost and acceptable to ordinary families and can be integrated into daily life. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of the structure of the 3D model correction method provided in Example 1 of the present application;

[0044] Figure 2 Imaging principle diagram for virtual photography;

[0045] Figure 3 A schematic diagram of a 3D human body model and the distribution of bone nodes thereon;

[0046] Figure 4 A schematic diagram of a computer system of an electronic device provided by the present invention.

[0047] The text annotations in the figure represent:

[0048] 400. Computer system; 401. CPU; 402. ROM; 403. RAM; 404. Bus; 405. I / O interface; 406. Input part; 407. Output part; 408. Storage part; 409. Communication part; 410. Drive; 411. Removable media. DETAILED DESCRIPTION

[0049] In order to enable those skilled in the art to better understand the technical solution of the present application, the present application is described in detail below in conjunction with the accompanying drawings. The description in this section is only exemplary and explanatory and should not have any limiting effect on the scope of protection of the present application.

[0050] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0051] Example 1

[0052] This embodiment provides a 3D model correction method. Figure 1 The flowchart of the 3D model correction method is shown in FIG. 1 , wherein the method comprises the following steps:

[0053] S10. Obtaining the 3D model of the target object to be corrected;

[0054] The target object's posture may change over time, such as a human body, an animal body, etc. The target object's posture may not change over time, such as a handicraft, etc. In this embodiment, the selected target object is a human body whose posture changes over time.

[0055] The 3D model to be corrected, i.e., the 3D model established by using artificial intelligence technology, specifically refers to a 3D model of the human body established by using body shape and posture capture technology based on the first 2D image of the human body, and the established 3D model of the human body includes bone nodes of the human skeleton; wherein the first 2D image is a photo of the human body at a certain moment captured by a smart mobile terminal (such as a mobile phone), which may be one, two, or more photos of the human body at any angle at the same moment, and the photos at any angle may be side photos, front photos, back photos, or photos from other angles;

[0056] It should be noted that the 3D model to be corrected may be an unadjusted 3D model directly established based on the first 2D image using artificial intelligence technology, or may be a 3D model established based on the first 2D image and after certain adjustments.

[0057] S20. Acquire a second 2D image of the target object, where the second 2D image may be one, two or more images at different angles;

[0058] When the target object is an object whose posture does not change with time, the time when the first 2D image and the second 2D image are acquired may be different; and in the present embodiment, because the target object is an object whose posture changes with time, the first 2D image and the second 2D image are 2D images of the human body acquired at the same time; the same time refers to a time range in which the movement and deformation of the human body can be ignored; the second 2D image is also a human body photo collected by a smart mobile terminal (such as a mobile phone), which may be one, two, or more photos of the human body at any angle at the same time, and each photo records shooting parameters, based on which the shooting environment of the second 2D image can be simulated; the shooting parameters include at least one of the focal length of the shooting device and the relative position information of the shooting device and the target object; wherein the relative position information of the shooting device and the target object includes the distance between the shooting device and the target object, the shooting angle, etc., and the shooting angle refers to the azimuth angle at which the shooting device shoots the target object.

[0059] In this embodiment, only one second 2D image is acquired.

[0060] It should be noted that the second 2D image and the first 2D image may be the same photo or different photos. In this embodiment, the second 2D image and the first 2D image are collected at the same time, but are different photos.

[0061] S30. Setting the photographing parameters of the 3D model to be corrected, taking a virtual photograph of the 3D model to be corrected, and obtaining a virtual image, wherein the photographing parameters are obtained based on the second 2D image;

[0062] Preferably, setting the photographing parameters of the 3D model to be corrected comprises at least one of the following steps:

[0063] Setting the photographing parameters based on the photographing parameters of the second 2D image;

[0064] The photographing parameters are iterated so that the virtual image matches at least some key point positions of the second 2D image.

[0065] There are two specific cases of the recorded shooting parameters of the second 2D image:

[0066] The first type is that the shooting parameters are relatively accurate and complete, which include the focal length of the shooting device, the distance between the shooting device and the target object, the shooting angle, etc.

[0067] The second is that the shooting parameters are not accurate and complete enough, for example, they do not include the distance between the shooting device and the target object, or only give an approximate shooting angle (such as the right front of the target object).

[0068] For the first case, the shooting parameters of the second 2D image can be directly used as the shooting parameters of the virtual photography; for the second case, multiple subtle adaptation adjustments can be made based on the shooting parameters of the second 2D image to make the virtual image obtained after the virtual photography match at least some of the key point positions of the target object of the second 2D image, wherein the number of selected partial key points can be determined according to actual needs. The higher the requirement for accuracy, the larger the number of selected key points, and the lower the requirement for accuracy, the smaller the number of selected key points; generally, for the human body, four key points (such as two at the hips and two at the shoulders) can be selected; the key point position matching will be described in detail below, so it will not be repeated here.

[0069] Virtual photography refers to simulating the imaging of the 3D human body model to be corrected on the physical imaging plane on a computer to obtain a virtual image. The imaging principle diagram is as follows: Figure 2 shown.

[0070] S40. Correct the 3D model to be corrected, and calculate at least one of the following correction parameters:

[0071] a. Position matching parameters of at least some key points of the target object of the virtual image and the second 2D image;

[0072] b. matching parameters of the outer contour of the target object of the virtual image and the second 2D image;

[0073] c. the proportion of the target object key points of the second 2D image within the outer contour of the target object in the virtual image;

[0074] Wherein, the correction of the 3D model to be corrected is achieved by affine transformation or posture transformation;

[0075] The affine transformation includes: translation transformation, rotation transformation, scaling transformation, shear transformation, mirror transformation, and any combination of the above transformations; the posture conversion includes: basic morphological transformation based on linear matrix, local morphological transformation, and skin transformation formed by relative joint movement. The three posture conversions are specifically explained as follows:

[0076] (1) Basic morphological transformation

[0077] In actual operation, a vector is used to represent the basic shape of the target object, such as height, fatness, etc., and the vector is linearly transformed based on the learned parameter matrix to form a basic shape transformation matrix, which is used to achieve the basic shape transformation of the target object's 3D model.

[0078] (2) Local morphological transformation

[0079] In actual operation, a vector is used to represent the local morphology of the target object, and the vector is linearly transformed based on the learned parameter matrix to form a local morphology transformation matrix, which is used to achieve the local morphology transformation of the target object's 3D model. The difference between the local morphology transformation and the basic morphology transformation is that the basic morphology transformation matrix transforms the global coordinate information of the target object's 3D model, while the local morphology transformation matrix only transforms the local coordinate information of the target object's 3D model.

[0080] (3) Skin transformation caused by relative joint movement

[0081] When the human skeleton points move, the skin will change with the movement of the joints. When the skin is associated with multiple joints, the final transformation of the skin is equal to the weighted sum of its transformation relative to each joint.

[0082] Next, three different types of correction parameters, a, b, and c, are described in detail.

[0083] Type a: the correction parameters are at least some key point position matching parameters of the target object of the virtual image and the second 2D image; wherein the key points refer to the bone nodes in the human skeleton, Figure 3 These are multiple bone nodes distributed on a 3D human body model. The figure contains 24 bone nodes in total.

[0084] The correction parameters characterize the position matching relationship between at least some of the key points of the human body on the virtual image and the corresponding key points of the human body on the second 2D image. In this embodiment, the position matching parameters of at least some of the key points of the target object of the virtual image and the second 2D image are the values ​​of the loss function, that is, the correction parameters are the function values ​​of the loss function.

[0085] The function value of the loss function is the distance between the first data set and the second data set calculated according to the set algorithm;

[0086] The first data set is: a set of position information of at least some key points of the target object in the virtual image;

[0087] The second data set is: a set of position information of at least part of key points of the target object in the second 2D image.

[0088] In this embodiment, the first data set is a collection of position information of at least part of the skeletal nodes of the human body in the virtual image. The number of skeletal node position information contained here can be determined according to actual needs. The higher the requirement for accuracy, the greater the number of key points selected, and the lower the requirement for accuracy, the smaller the number of key points selected. Generally, for the human body, four key points can be selected; the second data set is a collection of position information of at least part of the skeletal nodes of the human body in the second 2D image. The number of skeletal node position information contained here is consistent with the number in the first data set, and the positions of each skeletal node contained in the first data set and the second data set are corresponding. For example, the first data set contains the position information of eight skeletal nodes on the two arms of the human body, and the second data set should also contain the position information of eight skeletal nodes on the two arms of the human body.

[0089] Furthermore, the setting algorithm is at least one of the following algorithms:

[0090] The first type: the distance and A of each corresponding point in the first data set and the second data set, the specific formula is:

[0091]

[0092] Where n is the number of corresponding key points in the first and second data sets, A i is the distance between the i-th corresponding key point in the first data set and the second data set;

[0093] The second type: the sum of the squares of the distances between the first data set and the second data set is B, and the specific formula is:

[0094]

[0095] The third method is to calculate the weighted sum C of the distances between the first data set and the corresponding points in the second data set. The specific formula is:

[0096]

[0097] Among them, a i is the weight of the i-th corresponding key point in the first data set and the second data set, and the weights of the corresponding key points can be set to the same value or different values;

[0098] Fourth type: the weighted sum D of the squared distances of the corresponding points in the first data set and the second data set, the specific formula is:

[0099]

[0100] Preferably, the distance between corresponding points in the first data set and the second data set is any one of the following:

[0101] Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, standardized Euclidean distance, Mahalanobis distance, angle cosine, Hamming distance, correlation coefficient, correlation distance, information entropy.

[0102] Type b: the correction parameter is a matching parameter of the outer contour of the target object of the virtual image and the second 2D image.

[0103] The correction parameter characterizes the matching relationship between the outer contour of the human body on the virtual image and the outer contour of the human body on the second 2D image. Because the second 2D image is obtained by directly photographing the human body, and the human body in the second 2D image is wearing clothes, theoretically, the outer contour of the human body on the second 2D image is larger than the outer contour of the human body on the virtual image corresponding to the 3D model to be corrected. Therefore, the optimal correction result is that the outer contour of the human body in the virtual image is completely within the outer contour of the human body in the second 2D image.

[0104] Preferably, the outer contour matching parameter of the target object in the virtual image and the second 2D image is an area ratio R1 of the target object in the virtual image within the outer contour of the target object in the second 2D image, which can be specifically expressed by the following formula:

[0105]

[0106] Wherein, S1 is the area of ​​the target object in the virtual image within the outer contour of the target object in the second 2D image, and S0 is the total area of ​​the target object in the virtual image.

[0107] Type c: the proportion of the key points of the target object in the second 2D image that are within the outer contour of the target object in the virtual image.

[0108] The correction parameters characterize the position matching relationship between the key points of the human body on the virtual image and the outer contour of the human body on the second 2D image. Because the second 2D image is obtained by directly photographing the human body, and the human body in the second 2D image is wearing clothes, theoretically, the optimal correction result is that all the key points of the human body on the virtual image are located within the outer contour of the human body in the second 2D image.

[0109] Specifically, the ratio R2 of the key points of the target object in the second 2D image being located within the outer contour of the target object in the virtual image can be expressed by the following formula:

[0110]

[0111] Wherein, N1 is the number of key points of the target object on the virtual image that are located within the outer contour of the target object in the second 2D image, and N0 is the total number of key points of the target object on the virtual image.

[0112] In this embodiment, each time the correction of the 3D model to be corrected is completed, only one of the three different types of correction parameters a, b, and c is calculated. Because the number of the second 2D image in this embodiment is one, a correction parameter will be calculated after each correction is completed.

[0113] S50. Repeat steps S30-S40 until the steps are repeated a set number of times or a convergence condition is triggered.

[0114] The set number of times is an artificially set number of repetitions, for example, it can be set to 500 times. When the number of repetitions of steps S30-S40 has reached the set number of times but the convergence condition is still not met, the repetitions will not continue, and the 3D model after the last correction will be used as the final 3D model; wherein reaching the set number of times means that the current number of repetitions of steps S30-S40 is equal to the set number of times.

[0115] In this embodiment, the convergence condition is that the correction parameter calculated in step S40 reaches a corresponding threshold value, and the value of the corresponding threshold value varies according to the type of correction parameter used, as follows:

[0116] When the ath correction parameter is calculated in step S40, the corresponding threshold is the threshold of the position matching parameter of at least some key points of the target object of the virtual image and the second 2D image. The specific value varies according to the setting algorithm and is also related to actual needs. The higher the requirement for accuracy, the smaller the value of the corresponding threshold, and the lower the requirement for accuracy, the larger the value of the corresponding threshold. For this type of correction parameter, the corresponding trigger convergence condition refers to the value of the correction parameter being less than or equal to the corresponding threshold.

[0117] When the b-th correction parameter is calculated in step S40, the corresponding threshold is the threshold of the target object outer contour matching parameter of the virtual image and the second 2D image, and its specific value is related to actual needs. The higher the requirement for accuracy, the larger the value of the corresponding threshold, and the lower the requirement for accuracy, the smaller the value of the corresponding threshold. For this type of correction parameter, the corresponding trigger convergence condition refers to the value of the correction parameter being greater than or equal to the corresponding threshold.

[0118] When the cth correction parameter is calculated in step S40, the corresponding threshold is the ratio threshold of the target object key point of the second 2D image within the outer contour of the target object of the virtual image. The specific value is related to actual needs. The higher the requirement for accuracy, the larger the value of the corresponding threshold, and the lower the requirement for accuracy, the smaller the value of the corresponding threshold. For this type of correction parameter, the corresponding trigger convergence condition refers to the value of the correction parameter being greater than or equal to the corresponding threshold.

[0119] In step S40, a correction parameter is calculated each time the correction of the 3D model to be corrected is completed. After the correction parameter is obtained, it is determined whether the convergence condition is met, that is, whether the value of the correction parameter reaches the corresponding threshold. If so, steps S30-S40 are not repeated, and the 3D model after the last correction is used as the final 3D model. If not, steps S30-S40 are repeated. In addition, while repeating steps S30-S40, the number of repetitions is recorded, and the number of records needs to be updated each time the correction process is completed. It is also determined whether the current number is equal to the set number of repetitions. If so, regardless of whether the value of the correction parameter calculated after this correction reaches the corresponding threshold, steps S30-S40 are not repeated, and the 3D model after this correction is used as the final 3D model.

[0120] The 3D model correction method provided in this embodiment can be used to iteratively correct the 3D model to be corrected of the target object to obtain a more accurate 3D model. After each correction, a photographing parameter is set based on a second 2D image of the target object to virtually photograph the 3D model to be corrected of the target object to obtain a virtual image, and a correction parameter is calculated by comparing the virtual image with the target object of the second 2D image to verify the 3D model after this correction, and whether further correction is required is determined based on the verification result. The 3D model correction method can obtain a more accurate final 3D model of the target object to avoid a large difference from the actual state of the target object, and the second 2D image used in the correction method can be obtained by using a smart phone or an ordinary camera, which is low in cost and acceptable to ordinary families and can be integrated into daily life.

[0121] Example 2

[0122] The present embodiment provides a 3D model correction method. The similarities between the present embodiment and the embodiment 1 are not repeated here. The difference lies in that: in the embodiment 1, each time the correction of the 3D model to be corrected is completed, only one of the three different types of correction parameters a, b, and c is calculated; while in the present embodiment, each time the correction of the 3D model to be corrected is completed, at least two of the three different types of correction parameters a, b, and c are calculated, that is, only a and b, a and c, b and c may be calculated, or all three correction parameters a, b, and c may be calculated.

[0123] When at least two correction parameters are calculated in step S40, the convergence condition is: each correction parameter reaches a corresponding threshold, or the judgment parameter reaches a set threshold;

[0124] The judgment parameter is the weighted sum of the correction parameters;

[0125] The weights of the correction parameters can be set to the same or different values ​​in each correction step.

[0126] Specifically, because the number of the second 2D images in this embodiment is one, after each correction is completed, the number of correction parameters of the same type will be calculated to be one, that is, at least two different types of correction parameters will be obtained, and each type of correction parameter has a corresponding threshold value corresponding to it; in step S50, when judging whether the convergence condition is triggered, the convergence condition can be whether each correction parameter reaches the corresponding threshold value.

[0127] Furthermore, after each correction is completed and at least two types of correction parameters are calculated, the weighted sum of the correction parameters is calculated to obtain a judgment parameter, and the convergence condition may also be that the judgment parameter reaches a set threshold.

[0128] In this embodiment, each time the correction of the 3D model to be corrected is completed, no matter whether two types of correction parameters or three types of correction parameters are calculated, a judgment parameter can be calculated; when two types of correction parameters are calculated, the judgment parameter is the weighted sum of the two correction parameters; when three types of correction parameters are calculated, the judgment parameter is the weighted sum of the three correction parameters; the type and number of correction parameters involved in calculating the judgment parameter are different, and the corresponding set thresholds can be the same or different, and can be set according to actual needs.

[0129] It should be noted that when performing weighted summation on correction parameters of different types, dimensional unification processing is required. Dimensional unification processing can be reflected in the correction parameters, that is, pre-processing the correction parameters before weighted summation. Dimensional unification processing can also be reflected in the weight coefficients. If necessary, positive and negative weight coefficients can be set.

[0130] It should also be noted that when performing weighted summation on each correction parameter, the weight of each correction parameter can be set to the same value or to different values; in addition, in different correction steps, the weight of the same correction parameter can be set to the same value or to different values.

[0131] In order to enable those skilled in the art to better understand the technical solution of this embodiment, examples are given below.

[0132] In the correction process of a certain human body 3D model, in a certain correction step, that is, after a certain repetition of steps S30-S40, only the two correction parameters of the ath and bth types after this correction are calculated, that is, the values ​​of the two correction parameters are obtained, which are recorded as m1 and m2 for the convenience of the following description. Then the convergence condition in step S50 can be: the value m1 of the ath correction parameter is less than or equal to the corresponding threshold M1, and the value m2 of the bth correction parameter is greater than or equal to the corresponding threshold M2; when both of the above two conditions are met, the triggering convergence condition is determined, that is, there is no need to repeat steps S30-S40, and the 3D model after this correction is used as the final 3D model; when only one of the values ​​of the above two correction parameters reaches the corresponding corresponding threshold, or the values ​​of the two correction parameters do not reach the corresponding corresponding threshold, then steps S30-S40 need to be repeated, that is, the next correction step is performed. After the correction, the same method as the previous step can be adopted. The same method as in the previous step can be used to determine whether it is necessary to end the correction, or a different method from the previous step can be used to determine. In this example, a different method from the previous correction step is used to determine. Specifically, the two correction parameters of the ath and bth types after this correction are first calculated, that is, the numerical values ​​m3 and m4 of the two correction parameters are obtained. Secondly, m3 and m4 are weighted and summed to calculate the judgment parameter m5. Since the dimensions of these two correction parameters are different, the dimension of the numerical value m3 is millimeters, and the dimension of the numerical value m4 is %, it is necessary to unify the dimensions. For example, the unification can be achieved by setting the weight coefficients of the two. Here, the dimension of the numerical value m3 can be adjusted to %, and the weight coefficient corresponding to the numerical value m4 needs to be set to a negative number. The convergence condition is: the judgment parameter m5 reaches the set threshold, specifically, is less than or equal to the corresponding threshold M3. Here, the specific value of M3 can be set according to actual needs.

[0133] The 3D model correction method provided in this embodiment calculates at least two correction parameters based on the virtual image and the target object in the second 2D image, and uses them to verify the corrected 3D model, and determines whether further correction is needed based on the verification result; the 3D model correction method can also obtain a more accurate final 3D model of the target object to avoid large differences from the actual state of the target object.

[0134] Example 3

[0135] The present embodiment provides a 3D model correction method. The similarities between the present embodiment and the embodiment 1 are not repeated here. The difference lies in that: in the embodiment 1, a second 2D image of the target object is obtained in step S20; while in the present embodiment, two or more second 2D images of the target object need to be obtained. Then, in step S30, shooting parameters of virtual shooting can be set respectively based on shooting parameters of the multiple second 2D images, and the 3D model to be corrected of the target object is virtually photographed to obtain multiple virtual images; and in step S40, each time the correction of the 3D model to be corrected is completed, only one correction parameter is calculated (that is, only one of the three different types of correction parameters a, b, and c is calculated). Corresponding to the multiple second 2D images and the multiple virtual images, multiple values ​​belonging to the same correction parameter will be obtained. The values ​​of these correction parameters are weighted and summed to obtain a comprehensive correction parameter. The convergence condition is that the comprehensive correction parameter reaches the corresponding threshold.

[0136] Among them, the detailed calculation method of the correction parameters corresponding to each second 2D image and the corresponding virtual image can be found in Example 1 and will not be repeated here; when calculating the comprehensive correction parameters, the weights of each correction parameter can be set to the same or different values ​​in each correction step.

[0137] Specifically, in step S40, each time the correction of the 3D model to be corrected is completed, multiple correction parameters are calculated, and a comprehensive correction parameter is calculated based on the multiple correction parameters. Then, it is determined whether the comprehensive correction parameter reaches the convergence condition, that is, whether the value of the comprehensive correction parameter reaches the corresponding threshold. If so, steps S30-S40 are not repeated, and the 3D model after the last correction is used as the final 3D model. If not, steps S30-S40 are repeated. In addition, while repeating steps S30-S40, the number of repetitions is recorded, and the number of records needs to be updated each time the correction process is completed. It is also determined whether the current number is equal to the set number of repetitions. If so, regardless of whether the value of the comprehensive correction parameter calculated after this correction reaches the corresponding threshold, steps S30-S40 are not repeated, and the 3D model after this correction is used as the final 3D model.

[0138] The 3D model correction method provided in the present embodiment can be used to iteratively correct the 3D model to be corrected of the target object to obtain a more accurate 3D model. After each correction, the photographing parameters are set based on the multiple second 2D images of the target object to virtually photograph the 3D model to be corrected of the target object to obtain multiple virtual images, and the multiple virtual images are calculated with the target object in the corresponding second 2D image to obtain multiple correction parameters. A weighted sum of the multiple correction parameters can be obtained to obtain a comprehensive correction parameter, and the comprehensive correction parameter is used to verify the 3D model after this correction, and whether further correction is required is determined according to the verification result. The 3D model correction method can obtain a more accurate final 3D model of the target object to avoid a large difference from the actual state of the target object, and the second 2D image used in the correction method can be obtained by using a smart phone or an ordinary camera, which is low in cost and acceptable to ordinary families and can be integrated into daily life.

[0139] Example 4

[0140] The present embodiment provides a 3D model correction method. The similarities between the present embodiment and the embodiment 3 are not repeated here. The difference lies in that: in the embodiment 3, each time the correction of the 3D model to be corrected is completed, only multiple groups of values ​​of one type of correction parameters corresponding to the multiple second 2D images and the virtual image are calculated; while in the present embodiment, each time the correction of the 3D model to be corrected is completed, at least two types of correction parameters are calculated, that is, only a and b, a and c, b and c can be calculated, or all three correction parameters a, b, and c can be calculated.

[0141] When at least two correction parameters are calculated in step S40, the convergence condition is: each comprehensive correction parameter reaches a corresponding threshold value, or the judgment parameter reaches a set threshold value;

[0142] The comprehensive correction parameter is a weighted sum of correction parameters corresponding to a plurality of the second 2D images;

[0143] The judgment parameter is the weighted sum of the comprehensive correction parameters;

[0144] The weights of the correction parameters or the comprehensive correction parameters may be set to the same or different values ​​in each correction step.

[0145] Specifically, because there are multiple second 2D images in this embodiment, after each correction is completed, the number of correction parameters of the same type will be calculated to be multiple, that is, at least two different types of correction parameters will be obtained, and then the weighted sum of the multiple correction parameters belonging to the same type is performed to obtain the corresponding comprehensive correction parameters. In this embodiment, at least two comprehensive correction parameter values ​​are obtained, and each comprehensive correction parameter has a corresponding threshold value corresponding to it; in step S50, when judging whether the convergence condition is triggered, the convergence condition may be whether each comprehensive correction parameter reaches the corresponding threshold value.

[0146] Furthermore, after each correction is completed and at least two types of comprehensive correction parameters are calculated, the weighted sum of the comprehensive correction parameters is calculated to obtain a judgment parameter, and the convergence condition may also be that the judgment parameter reaches a set threshold.

[0147] In this embodiment, each time the correction of the 3D model to be corrected is completed, no matter whether two types of comprehensive correction parameters or three types of comprehensive correction parameters are calculated, a judgment parameter can be calculated; when two types of comprehensive correction parameters are calculated, the judgment parameter is the weighted sum of the two comprehensive correction parameters; when three types of comprehensive correction parameters are calculated, the judgment parameter is the weighted sum of the three comprehensive correction parameters; the type and number of comprehensive correction parameters involved in calculating the judgment parameter are different, and the corresponding set thresholds can be the same or different, and can be set according to actual needs.

[0148] It should be noted that when performing weighted summation on different types of comprehensive correction parameters, dimensional unification processing is required. Dimensional unification processing can be reflected in the comprehensive correction parameters, that is, pre-processing of the comprehensive correction parameters before weighted summation. Dimensional unification processing can also be reflected in the weight coefficients. If necessary, different positive and negative weight coefficients can be set.

[0149] It should also be noted that when performing weighted summation of each comprehensive correction parameter, the weight of each comprehensive correction parameter can be set to the same value or to different values; in addition, in different correction steps, the weight of the same comprehensive correction parameter can be set to the same value or to different values.

[0150] In order to enable those skilled in the art to better understand the technical solution of this embodiment, examples are given below.

[0151] In the process of correcting a certain human body 3D model, in a certain correction step, that is, after a certain repetition of steps S30-S40, only the two correction parameters of the ath and bth types after this correction are calculated, that is, two sets of correction parameter values ​​are obtained, which are recorded as the first set of correction parameters and the second set of correction parameters for the convenience of the following description. The two sets of correction parameters include a plurality of correction parameters of equal number, and the number of correction parameters in each group is equal to the number of virtual photographs. The weighted sum of each correction parameter in the two sets of correction parameters is calculated respectively to obtain two comprehensive correction parameters, which are recorded as the first comprehensive correction parameter and the second comprehensive correction parameter for the convenience of the following description. Then the convergence condition in step S50 can be: the first comprehensive correction parameter The value of the number is less than or equal to the corresponding threshold value Z1, and the value of the second comprehensive correction parameter is greater than or equal to the corresponding threshold value Z2; when the above two conditions are met, the trigger convergence condition is determined, that is, there is no need to repeat steps S30-S40, and the 3D model after this correction is used as the final 3D model; when only one of the values ​​of the above two comprehensive correction parameters reaches the corresponding corresponding threshold value, or the values ​​of the two comprehensive correction parameters do not reach the corresponding corresponding threshold value, it is necessary to repeat steps S30-S40, that is, perform the next correction step. After the correction, the same method as the previous step can be used to determine whether the correction needs to be ended, or a different method from the previous step can be used to determine.

[0152] In this example, a method different from that in the previous correction step is adopted for judgment. Specifically, the first comprehensive correction parameter and the second comprehensive correction parameter after this correction are first calculated, and then the weighted sum of the two comprehensive correction parameters is performed to obtain the corresponding judgment parameter value. Since the dimensions of the two comprehensive correction parameters are different, the dimension of the first comprehensive correction parameter is millimeters, and the dimension of the second comprehensive correction parameter is %, it is necessary to unify the dimensions. For example, the two can be unified by setting a weight coefficient. Here, the dimension of the first comprehensive correction parameter can be adjusted to % by setting the weight coefficient of the numerical value. In addition, the weight coefficient corresponding to the second comprehensive correction parameter needs to be set to a negative number. The convergence condition is: the judgment parameter reaches the set threshold, specifically, is less than or equal to the set threshold. The specific value of the set threshold here can be set according to actual needs.

[0153] The 3D model correction method provided in this embodiment calculates at least two correction parameters based on the virtual image and the target object in the second 2D image, and uses them to verify the corrected 3D model, and determines whether further correction is needed based on the verification result; the 3D model correction method can also obtain a more accurate final 3D model of the target object to avoid large differences from the actual state of the target object.

[0154] Example 5

[0155] This embodiment provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements: the steps of the 3D model correction method described in Example 1, or Example 2, or Example 3, or Example 4.

[0156] like Figure 4 As shown, the computer system 400 of the electronic device includes a CPU (central processing unit) 401, which can perform various appropriate actions and processes according to the program stored in the ROM (read-only memory) 402 or the program loaded from the storage part 408 to the RAM (random access memory) 403. In the RAM 403, various programs and data required for system operation are also stored. The CPU 401, ROM 402 and RAM 403 are connected to each other through a bus 404. An I / O (input / output) interface 405 is also connected to the bus 404.

[0157] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube, a liquid crystal display, etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.

[0158] In particular, according to an embodiment of the present invention, the process of the 3D model correction method described above with reference to Embodiment 1 can be implemented as a computer software program. For example, Embodiment 1 of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains program code for executing the 3D model correction method described in Embodiment 1. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 409, and / or installed from a removable medium 411. When the computer program is executed by the CPU 401, the above-mentioned functions defined in the present computer system 400 are executed.

[0159] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the scope of protection of this application.

Claims

1. A 3D model correction method, characterized in that: The method comprises the following steps: S10. Obtaining the 3D model of the target object to be corrected; S20. Acquire a second 2D image of the target object, where the second 2D image may be two or more images at different angles; S30. Setting the photographing parameters of the 3D model to be corrected, taking a virtual photograph of the 3D model to be corrected, and obtaining a virtual image, wherein the photographing parameters are obtained based on the second 2D image; S40. Correct the 3D model to be corrected, and calculate at least one of the following correction parameters: a. Position matching parameters of at least some key points of the target object of the virtual image and the second 2D image; b. matching parameters of the outer contour of the target object of the virtual image and the second 2D image; c. the proportion of the target object key points of the second 2D image within the outer contour of the target object in the virtual image; S50. Repeat steps S30-S40 until the repetition step reaches a set number of times or the convergence condition is triggered; The convergence condition is: each comprehensive correction parameter reaches the corresponding threshold value, or the judgment parameter reaches the set threshold value; The comprehensive correction parameter is a weighted sum of correction parameters corresponding to two or more of the second 2D images; The judgment parameter is the weighted sum of the comprehensive correction parameters; The weights of the correction parameters or the comprehensive correction parameters may be set to the same or different values ​​in each correction step.

2. The 3D model correction method according to claim 1, characterized in that: Setting the photographing parameters of the 3D model to be corrected comprises at least one of the following steps: Setting the photographing parameters based on the photographing parameters of the second 2D image; The photographing parameters are iterated so that the virtual image matches at least some key point positions of the second 2D image.

3. The 3D model correction method according to claim 1, characterized in that: The position matching parameter of at least some key points of the target object of the virtual image and the second 2D image is a function value of a loss function, and the function value of the loss function is a distance between the first data set and the second data set calculated according to a set algorithm; The first data set is: a set of position information of at least some key points of the target object in the virtual image; The second data set is: a set of position information of at least part of key points of the target object in the second 2D image; The setting algorithm is at least one of the following algorithms: The sum A of the distances between the corresponding points in the first data set and the second data set; The sum B of the squares of the distances between the first data set and the second data set; A weighted sum C of distances between corresponding points in the first data set and the second data set; The weighted sum D of the squared distances of the corresponding points in the first data set and the second data set.

4. The 3D model correction method according to claim 3, characterized in that: The distance between corresponding points in the first data set and the second data set is any one of the following: Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, standardized Euclidean distance, Mahalanobis distance, angle cosine, Hamming distance, correlation coefficient, correlation distance, information entropy.

5. The 3D model correction method according to claim 1, characterized in that: The outer contour matching parameter of the target object in the virtual image and the second 2D image is the area ratio of the target object in the virtual image within the outer contour of the target object in the second 2D image.

6. The 3D model correction method according to claim 1, characterized in that: In step S40, at least two correction parameters are calculated.

7. The 3D model correction method according to claim 1, characterized in that: The photographing parameters include at least one of the focal length of the photographing device and the relative position information between the photographing device and the target object.

8. The 3D model correction method according to claim 1, characterized in that: Correcting the 3D model to be corrected is achieved by affine transformation or posture transformation; The affine transformation includes: translation transformation, rotation transformation, scaling transformation, shear transformation, mirror transformation, and any combination of the above transformations; The posture conversion includes: basic morphological transformation based on linear matrix, local morphological transformation, and skin transformation formed by relative joint movement.

9. The 3D model correction method according to claim 1, characterized in that: The 3D model to be corrected is generated based on the first 2D image; The first 2D image and the second 2D image are acquired at the same time.

10. A terminal device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method implements the steps of the 3D model correction method according to any one of claims 1 to 9.