Summary of the invention
The objective of the invention is to overcome the deficiencies in the prior art, a kind of method of reconstructing three-dimensional surface model is provided, this method can be rebuild the 3 d surface model of the object with part mirror material or the translucent material characteristic of part.
In addition, the present invention also provides a kind of method of reconstructing three-dimensional surface model parameter, and this method can merge mirror material part or the translucent material part of considering object, and then synthesizes the resultant image with specular reflectance characteristics and subsurface reflection characteristic.
For achieving the above object, the present invention proposes a kind of method of reconstructing three-dimensional surface model, its step comprises:
(1) the 3 D stereo position of obtaining object with the three-dimensional structure photosystem and a plurality of reflection parameters corresponding to described object;
(2) set up resultant image according to described 3 D stereo position and described a plurality of reflection parameters;
(3) adjust reflection parameters to adjust described resultant image, up to the optimization parameter less than default value.
Wherein, described optimization parameter is corresponding to the difference of the brightness of a plurality of pixels in the brightness (intensity) of a plurality of pixels of correspondence position in the adjusted described resultant image and the actual image.
In an embodiment of the present invention, above-mentioned optimization parameter comprises one first and one second, described first corresponding to the difference of the brightness of the brightness of the pixel in the described resultant image and the respective pixel in the actual image square, the difference of described second estimating depth (depth) and the degree of depth of corresponding a plurality of surrounding pixels corresponding to each pixel in the described resultant image.
In an embodiment of the present invention, the equation of above-mentioned optimization parameter is expressed as follows:
Wherein, the described optimization parameter of C (Z) expression; S
iRepresent the brightness of the pixel in the described resultant image; R
iRepresent the brightness of pixel in the described actual image; Z
iThe degree of depth of representing the pixel in the described resultant image; r
jExpression is corresponding to Z
iThe degree of depth of pixel of surrounding pixel; N represents the sum of all pixels in the described resultant image; M represents the sum of a plurality of surrounding pixels; I represents the index value of the pixel in the described resultant image; J represents the index value of described a plurality of surrounding pixels; W is second weights (proportion) in the optimization parameter.
In an embodiment of the present invention, in step (1), more comprise and utilize Lambertian reflection model and shadow reconstructed surface technology to obtain the 3 D stereo position of object and the initial value of a plurality of reflection parameters.
In an embodiment of the present invention, above-mentioned reflection parameters comprise scattering coefficient and normal vector at least one of them.
In an embodiment of the present invention, in step (2), more comprise and utilize a mirror material model and described a plurality of reflection parameters to set up described resultant image.Wherein reflection parameters comprises scattering coefficient, mirror coefficient and gloss coefficient (shiness).
In an embodiment of the present invention, above-mentioned mirror material model is the Phong model, and its equation is expressed as:
S
i=k
d*N
l·L+k
s*(F
i·V)
α
Wherein, S
iBrightness for pixel; k
dBe scattering coefficient (diffuse coefficient); k
sBe mirror coefficient (specularcoefficient); N
iBe described some surface normal, can be by contiguous z
iSlope obtain; L is the incident light vector; F
iBe complete mirror reflection vector, can be by N
i, L obtains; V is the visual angle vector; α is gloss coefficient (shine coefficient).
In an embodiment of the present invention, in step (2), more comprise and utilize half transparent material model and described a plurality of reflection parameters to set up described resultant image.Wherein reflection parameters comprises dispersion coefficient, absorption coefficient and refractive index.
In an embodiment of the present invention, above-mentioned translucent material model is two-way Subsurface Scattering reflection distribution function model, and its equation is as follows:
Wherein, S
dBrightness for pixel; F
tBe the Fresnel transfer function; x
iEnter the incoming position of object for light; x
oThe refraction position of leaving object for light;
Be incident angle;
Be refraction angle; P
dScattered quantum varied curve letter formula for object.
In an embodiment of the present invention, in step (3), more comprise according to adjusted resultant image and recomputate the optimization parameter to readjust reflection parameters.
In an embodiment of the present invention, the method for above-mentioned reconstructing three-dimensional surface model more comprises, adjusts the depth parameter (depth) of 3 D stereo position according to adjusted reflection parameters, up to the optimization parameter less than default value.
In an embodiment of the present invention, the method for above-mentioned reconstructing three-dimensional surface model more comprises, repeats to adjust reflection parameters and 3 D stereo position, up to the difference of resultant image and actual image less than default value.
The invention allows for the method for another kind of reconstructing three-dimensional surface model, may further comprise the steps:
(1) obtains the 3 D stereo position of object with the three-dimensional structure photosystem;
(2) according to 3 D stereo position and Phong modelling resultant image;
(3) adjust a plurality of first reflection parameters in the Phong model to adjust resultant image, up to the optimization parameter less than first default value;
(4) adjust depth parameter in the 3 D stereo position according to adjusted first reflection parameters, up to the optimization parameter less than second default value;
(5) adjust resultant image according to adjusted 3 D stereo position and two-way Subsurface Scattering reflection distribution function model;
(6) adjust second reflection parameters in the described two-way Subsurface Scattering reflection distribution function model to adjust resultant image, up to the optimization parameter less than the 3rd default value;
(7) adjust depth parameter in the 3 D stereo position according to adjusted second reflection parameters, up to the optimization parameter less than the 4th default value.
Wherein, the optimization parameter comprises first and second, wherein the difference of the brightness of the brightness of the pixel in first corresponding resultant image and the pixel in the actual image square, and second difference corresponding to the degree of depth of the degree of depth of each pixel in the resultant image and corresponding a plurality of surrounding pixels.All the other details of the method for above-mentioned another kind of reconstructing three-dimensional surface model do not repeat them here as above-mentioned.
The invention has the beneficial effects as follows and proposed new optimization equation, and utilize Phong model and BSSRDF model to carry out image reconstruction, consider the character of object scattering mirror and sub-surface scattering (sub-surface scattering) respectively, therefore the present invention does not need before scanning the object surfaces branch painted or uses in addition coverture surface of lime, do not need expensive instrument yet, and can obtain non-lambert (Non-lambertian) and the more correct geological information of sub-surface scatterer.
The present invention is described in further detail below in conjunction with drawings and the specific embodiments.
Embodiment
First embodiment
Fig. 1 is the method flow diagram of the reconstructing three-dimensional surface model of one embodiment of the invention.Please refer to Fig. 1, at first, utilize three-dimensional structure photosystem (structure light system) to obtain the initial 3 D stereo position of object, and obtain shadow information, camera position and the light position of object in real scene as described in the step S110.Then as described in the step S120, the technology and the Lambertian reflection model (lambertain reflectance model) that see through shadow reconstructed surface (shape from shading) are obtained the synthetic 3 D stereo position and the initial value of reflection parameters, and the above-mentioned reflection parameters that obtains can be the position of the picture element reflect parameter value preliminary with it (for example scattering coefficient and its surface normal), brightness (intensity) or image depth parameters such as (image depth).
Next the object material characteristic partly that then will synthesize according to the user decides and utilizes the model that is fit to come resultant image.For example among the step S130, the Phong material model that is utilized is applicable to as this object that has the mirror composition of silver plate, and above-mentioned Phong material model comprises lambert (lamertian model) and mirror model (specular).In addition, if translucent object (translucent materials), for example be rice, bread, marble and skin, then need to set up resultant image as the described translucent material model of step S140, following elder generation is example with tool mirror (specular) with scattering (diffuse) material model, narrates the process of setting up resultant image and image optimumization.Then can adopt wherein a kind of image model (as mirror material model) to carry out optimization earlier if mix the object of unlike material, and then utilize another kind of image model (as translucent material model) to carry out the optimization of local image.
As described in step 130, utilize mirror material model and reflection parameters to set up resultant image, in the present embodiment, we utilize the Phong model (about the Phong model, to please refer to B.T.Phong, Illumination for computer generated pictures, Communications of the ACM, v18, n8, p311-317,1975) mirror material model comes resultant image.The equation of Phong model is expressed as follows:
S
i=k
d*N
l·L+k
s*(F
i·V)
α
Wherein, S
iBrightness for picture element; k
dBe scattering coefficient (diffuse coefficient); k
sBe mirror coefficient (specularcoefficient); N
iBe described some surface normal, can be by contiguous z
iSlope obtain; z
iThe degree of depth of pixel in the expression resultant image; L is the incident light vector; F
iBe complete mirror reflection vector, can be by N
i, L obtains; V is the visual angle vector; α is gloss coefficient (shinenesscoefficient).
And scattering coefficient k
d, the mirror coefficient k
sBe the reflection parameters P of Phong Model with brightness α
M, therefore by scattering coefficient k
dWith the mirror coefficient k
sJust can clearly understand the Phong model is that a kind of scattering and mirror characteristic with object considered into non-lambert (non-lambertina) model that synthesizes 3-dimensional image, so synthetic 3-dimensional image that utilizes Phong Model to simulate out, the specular reflectance characteristics of the trickle part of its image can present, and therefore more can improve the true property of plan of synthetic 3-dimensional image.And by the image that the Phong model is synthesized, can be expressed as:
S wherein
iBe the brightness of the pixel of resultant image, S
iValue can be relevant to the reflection parameters P of reflection model
M, just be relevant to scattering coefficient k
d, the mirror coefficient k
sWith brightness α, x, y represent level and vertical coordinate, can be used to indicate the location of pixels in the image, and i represents the index value of picture element.
After obtaining resultant image, suppose that actual image is O
i, it can be expressed as:
R wherein
iBrightness for the pixel of actual image.Then just can define optimization parameters C (Z), the equation of optimization parameters C (Z) can be expressed as:
Error (T wherein
i, O
i) be resultant image T
iWith the difference of actual image Oi, so error (T
i, O
i) also can be expressed as the difference e rror (T of brightness of the pixel of two images
i, O
i)=(S
i-R
i).So optimization parameters C (Z) can be expressed as in addition:
In addition, for the resultant image that makes object has more continuity, so optimization parameters C (Z) is added level and smooth (smoothterm):
Therefore, optimization parameters C (Z) comprises first and second, and wherein first is the brightness S corresponding to a plurality of pixels of resultant image
iWith actual image O
iThe brightness R of a plurality of pixels
iBetween difference square, and second difference corresponding to the degree of depth of the degree of depth of each pixel of resultant image and corresponding a plurality of surrounding pixels.
Above-mentioned optimization parameters C (Z), wherein Z
iRepresent the degree of depth in the described resultant image; r
jExpression is corresponding to Z
iThe degree of depth of plural surrounding pixel; N represents the sum of all pixels in the described resultant image; M represents the sum of described a plurality of surrounding pixels; I is corresponding to the pixel in the described resultant image; J is corresponding to described a plurality of surrounding pixels.
Next, in step S132, adjust reflection parameters P
M, comprise scattering coefficient k
d, the mirror coefficient k
sWith brightness α, to adjust resultant image and optimization parameters C (Z).Then, whether judge optimization parameters C (Z) less than first default value (step S134), greater than first default value, then repeating step S132 continues to adjust reflection parameters P as if optimization parameters C (Z)
MIf optimization parameters C (Z) less than first default value, is then determined described reflection parameters P
MFor the best, then enter step S136, according to the reflection parameters P of described the best
MAdjust 3 D stereo depth parameter and optimization parameters C (Z).Then in step S318, whether judge the optimization parameter less than second default value, if not, then repeating step S136 continues to adjust depth parameter; If determine that then described depth parameter is best.Then, enter step S139, whether the difference of judging resultant image and actual image is less than the 3rd default value, if then expression obtains the object resultant image (step S150) of best mirror material; If not, then get back to step S132, repeat to adjust steps such as the reflection coefficient in the Phong model and the picture element degree of depth till the difference of resultant image and actual image is less than the 3rd default value.
In addition, in the above-mentioned steps, obtain best reflection parameters P
MWith the adjustment process of depth parameter, the adjustment notion of its optimization parameters C (Z) is by adjusting reflection parameters P
MWith depth parameter, make resultant image can more approach the entity image, the value of therefore just wishing C (Z) can be the smaller the better, but the true property of the plan of resultant image is high more, the relative meeting of its needed adjustment time is long more, therefore the user of association area of the present invention can intend the speed that requires degree and resultant image of true property to resultant image according to the individual, sets first default value and second default value and the 3rd default value.
At optimization reflection parameters P
MWith the depth parameter aspect, can utilize Broyden-Fletcher-Goldfarb-Shanno (BFGS) method to obtain optimized the separating of C (Z), the BFGS method is a kind of quasi-Newton method (quasi-Newton Method) and is the most frequently used a kind of variable-metric method (variable metric method).The BFGS method mainly is divided into several steps, at first, get initial point and initial matrix, then objective matrix is carried out partial differential to obtain gradient vector, if its result then can stop to calculate less than default accuracy requirement, it is separated is optimum solution, if not, then calculates and searches direction to obtain optimum solution one by one.Algorithm details about the BFGS method please refer to Applied Optimization with MATLAB Programming, P.Venkataraman, WileyInterScience.
Utilize the method for BFGS, present embodiment can carry out C (Z) the reflection parameters P of the optimum solution that partial differential extrapolates earlier
MWith depth parameter, its calculation equation is:
Obtain to meet the reflection parameters P that the user requires whereby
MWith depth parameter, and then the object resultant image of the mirror material of acquisition the best.It should be noted that the present invention not only can come calculating optimum to separate by BFGS, other all can be applicable to this problem as conjugate gradient methods such as (conjugategradient).
In addition, if the part of synthetic body is translucent material, then can select translucent material model to come image is carried out optimization, promptly step S140~S160 at first, utilizes translucent model to set up resultant image T
i(step S140):
The translucent model of present embodiment can be two-way Subsurface Scattering reflection distribution function (Bidirectional surfacescattering distribution function, BSSRDF) model (please refer to H.Jensen about the BSSRDF model, S.Marschner, M.Levoy, and P.Hanrahan, " A Practical Model for Subsurface Light Transport ", Proceedings of SIGGRAPH, pages 511-518,2001), the equation of wherein two-way Subsurface Scattering reflection distribution function model is as follows:
S wherein
dBe the brightness of pixel, F
tBe Fresnel transmittance; x
iEnter the incoming position of object for light; x
oThe refraction position of leaving object for light;
Be incident angle;
Be refraction angle; P
dScattered quantum varied curve letter formula for object.We are with reference to H.W.Jensen in the present embodiment, S.R.Marschner, M.Levoy and P.Hanrahan is at " A PracticalModel for Subsurface Light Transport ", and the notion of the diffusion dipole (Rd) that Proceedings of ACM SIGGRAPH ' 01 this piece paper is proposed is similar to P
dThis letter formula is to reduce computing time.
Wherein
Be effective transfer coefficient (effective transport coefficient),
Be impairment coefficient (reduced extinction coefficient), σ
aWith
Be respectively absorption coefficient (absorption coefficient) and dispersion coefficient (scattering coefficient); R=‖ x
o-x
i‖;
With
Be subjected to the influence power of two magnetic poles for the point of giving surface magnetic force;
Be the positive correlation coefficient of true light source (positive pole) to body surface; Z
v=Z
r+ 4AD is the negative correlation coefficient of virtual light source (negative pole) to body surface,
Be scattering constant, and definition A=(1+F
Dr)/(1-F
Dr) F wherein
DrBe the Fresnel light reflected value (diffuse Fresnel reflectance) of scattered portion, we remove approximate F with following formula
Dr
Wherein η is the refraction ratio (index of refraction) of object material.At last, in the BSSRDF model, we can summarize the pixel depth S of synthetic translucent material object
iNeeded reflection parameters P
MFor: σ
a(absorption coefficient), σ
s(dispersion coefficient) and η (the refraction ratio of material).Therefore by above-mentioned response parameter P
M, can clearer understanding by translucent model, for example be two-way Subsurface Scattering reflection distribution function model, can be so that the translucent portion of resultant image more approaches the entity image.
Ensuing optimization procedures step S142~S149, then similar in appearance to step 132~139 of synthesizing mirror material model, its main difference be employed model difference with and the reflection parameters difference adjusted, then similar as for optimized process to step 132~139 to algorithm principle, do not add at this and to give unnecessary details, after via optimization procedures, just can obtain the resultant image (step S160) of best translucent material.
In addition, it should be noted that, ((the optimization step of step S132~S139) can repeat the Phong model, utilizes littler default value or stricter standard to come the optimization image, makes the more approaching actual image of its image for step S132~S139) and BSSRDF model.It should be noted that, adopt Phong model or BSSRDF model to set up resultant image no matter be, all can compare the poor of resultant image and actual image, then can carry out optimized process again to set up resultant image comparatively true to nature if both differ by more than default value.In addition, for having the various material object of (comprising mirror material and translucent material), then can use two kinds of models to carry out optimization in regular turn, adopt the Phong model to carry out optimization earlier, and then use the BSSRDF model to carry out optimization, vice versa, and present embodiment does not limit its optimization order.Further instruction please refer to second embodiment.
Second embodiment
Fig. 2 is the method flow diagram that the 3 d surface model of the object of another embodiment of the present invention is rebuild.Because actual object has mirror part and translucent portion usually simultaneously, therefore compared to first embodiment, second embodiment does optimized adjustment for the object of wanting resultant image in regular turn for considering the mirror material part and translucent material part of object simultaneously.It should be noted that owing in different models, be used for describing the reflected by objects parameter and may represent different parameters, therefore be the differentiation reflection parameters that desire is adjusted in different models.In the following description, present embodiment reflection parameters that desire in the Phong model is adjusted is (as scattering coefficient k
d, the mirror coefficient k
sWith brightness α) be called first reflection parameters, with reflection parameters (as the absorption coefficient) σ of desire adjustment in the BSSRDF model
a, dispersion coefficient
And the refraction ratio η of material) is referred to as with second reflection parameters.
At first, as described in step S210, use the three-dimensional structure photosystem to obtain the initial 3 D stereo position of object, in step S220, the technology and the Lambertian reflection model that see through the shadow reconstructed surface are obtained the synthetic 3 D stereo position and the initial value of reflection parameters, next as described in the step S230, come synthetic body mirror material part according to 3 D stereo position and Phong model, to set up resultant image.By resultant image and actual image, can define the optimization parameter and be:
This optimization parameter is same as first embodiment, and its detail section does not add tired stating at this.Then, in step 240, adjust first reflection parameters and the optimization parameters C (Z) of Phong model, above-mentioned first reflection parameters then for example is scattering coefficient k
d, the mirror coefficient k
sWith brightness α.Next, in step S250, whether judge optimization parameters C (Z) less than first default value, if not, then repeating step S240 continues to adjust first reflection parameters; If, determine that then described first reflection parameters is best, then enter step S260, adjust the depth parameter and the optimization parameters C (Z) of 3 D stereo position according to first reflection parameters in the Phong model after the optimization.Then, in step S270, judge that the optimization parameter whether less than second default value, if not, then gets back to step S260, continue to adjust depth parameter; If, determine that then described depth parameter is best, and according to obtaining the resultant image (step S280) that best reflection parameters and optimum depth parameter obtain mirror material object in the above-mentioned adjustment process.
In the mirror part back of adjusting object (is step S210~S280), then will adjust the translucent portion of object.In step S231, be casually arranged with distribution function model adjustment resultant image according to 3 D stereo position that has the mirror characteristic after adjusting and two-way subsurface.Then, in step S241, adjust the reflection parameters in the BSSRDF model, to adjust resultant image and optimization parameter, the reflection parameters in the BSSRDF model then for example is σ
a(absorption coefficient),
(dispersion coefficient) and η (the refraction ratio of material).
Next, in step S251, whether judge optimization parameters C (Z) less than the 3rd default value, if not, then repeating step S250 continues to adjust the reflection parameters in the BSSRDF model; If, determine that then described second reflection parameters is best, then enter step S261, adjust 3 D stereo depth parameter and optimization parameters C (Z) according to second reflection parameters of the best.Then, in step S271, whether judge the optimization parameter less than the 4th default value, if not, then repeating step S261 continues to adjust depth parameter; If, then enter among the step S281, determine that then described depth parameter is best, whether the difference of further judging resultant image and actual image is less than the 5th default value.If then enter step S282, according to obtaining best second reflection parameters and optimum depth parameter, the object resultant image that obtains to have mirror material characteristic and translucent material characteristic in the above-mentioned adjustment process.
The above-mentioned first, second, third and the 4th default value mainly is corresponding to the demand of user for the resultant image degree of verisimilitude, and its setting value can be decided according to the needed specification of user, and present embodiment is not limited.
In sum, the present invention's geometric data of bodies that the structured light positioning system is obtained is combined with the resulting meticulous geological information of the technology of shadow reconstruction method, and utilizes mirror model and translucent model to solve known tool part mirror and translucent object 3 d surface model that can't accurate reconstruction.Except rebuilding the three-dimensional model of object, the present invention also can obtain the optimized reflection parameters characteristic of object, for the development in science and technology of entity object digitizing and computer vision sizable help is arranged.Simultaneously, utilize optimization parameter of the present invention can shorten the time of image optimumization and obtain the object model and the image of high degree of verisimilitude.
More than be preferred embodiment of the present invention, all changes of doing according to technical solution of the present invention when the function that is produced does not exceed the scope of technical solution of the present invention, all belong to protection scope of the present invention.