Background technology
When optical grating projection was to body surface, periodically the phase place of grating just was subjected to the modulation of body surface height profile, formed deformed grating, and deformed grating promptly has the three-dimensional information of object.Accurately obtain being subjected to the phase information after the object height modulation, the line phase of going forward side by side launches, and is the core of bar graph automatic analysis technology, plays a part crucial for the three-dimensional information that finally obtains object.And the sine of projection grating waveform and accurate phase shift are the principal elements that influences the three-dimensional information reconstruction accuracy.The present invention mainly relates to carry out the self-tuning method of projection grating by linear phase position.
Reverse-engineering (Reverse Engineering, RE) technology is the later stage eighties 20th century to appear at the new technology in the advanced manufacturing field, it generally comprises four basic links: three-dimensional body detects and conversion (acquisition of physical data), data pre-service (put cloud processing, identification, look splicing more), the foundation of cad model (surface reconstruction), the moulding of CAM product.Great majority mainly concentrate in the reverse reconstruct in kind about the research of reverse-engineering, and promptly the cad model reconstruct of product material object and the manufacture view of final products are called " reverse-engineering in kind ".Its basic flow sheet as shown in Figure 1.
Three-D profile detects and reconfiguration technique is a branch of computer image processing technology, be that computer vision and computer graphic image are handled a research direction that combines, it all has a wide range of applications in fields such as the production automation, robot vision, CAD, virtual reality and the diagnosis of medical science reflection.
The optical grating projection method is a kind of in the reverse Engineering Technology in kind, has the complete noncontact of testing process, data space resolution height, disposable moment projection and realizes that directly the three dimensions body form detects and obtain the characteristics of three-dimensional information.Have multiple advantages such as low, with low cost to environmental requirement, that use is easy to operate in actual applications.
Three-dimensional measurement based on optical grating projection projects to raster pattern the measured object surface exactly, obtains the grating picture of distortion by video camera, and determines the elevation information of profile phase to reference planes by the deformation quantity and the relation of height.According to the different describing methods of deformation quantity and height relationships and different to the disposal route of grating fringe, optical grating projection can be measured and roughly be divided into two classes: directly trigonometry and phase measurement.The trigonometry principle is clear, and real-time is better, but the density of measurement point is not high, if adopt thinner striped to carry out projection, and the difficulty that striped is looked in increasing, so we have adopted phase method to handle.When optical grating projection was to body surface, periodically the phase place of grating just was subjected to the modulation of body surface height profile, formed deformed grating, and deformed grating promptly has the three-dimensional information of object.Accurately obtain being subjected to the phase information after the object height modulation, the line phase of going forward side by side launches, and is the core of bar graph automatic analysis technology, plays a part crucial for the three-dimensional information that finally obtains object.
In grating fringe figure, add known or unknown Chang Xiangwei by giving the field of behaviour to be asked, obtain new bar graph, promptly increase solving condition.Thisly increase some constant phase and obtain several bar graphs, be called phase-shift method in order to find the solution the method for the field of behaviour by the bar graph field of behaviour being carried out phase shift.Phase-shift method has the ground unrest of being subjected to influences advantages such as little, that measurement range is big, the more important thing is that it does not have the ambiguity problem of phase symbol.This is because several phase shifts figure provides more information than single width figure.Phase shift method can provide than the more high-precision result of additive method, thereby is used for phase demodulating in a large number.The basic demand of optical grating projection three-dimensional measurement is that projection grating has certain distribution (distributing as standard sine), but in fact because the existence of various errors and disturbance factor, the grating fringe that CCD collects not is the Sine distribution of standard, makes grating waveform phase shift out of true and non-sinusoidal become the key factor that influences measuring accuracy.
Summary of the invention
At existing in prior technology shortcoming and restriction, the object of the present invention is to provide in a kind of 3 D scanning system that can improve the measuring system precision self-correcting method for optical grating based on linear phase position.
The present invention designs that Gray code combines with phase-shift method in a kind of 3 D scanning system, self-correcting method for optical grating by the linear phase position correction, the method is taken all factors into consideration the raster phase distributed model that comprises error and disturbance factor, raster phase is carried out self-correcting make it satisfy Sine distribution.The present invention adopts following technical scheme:
In a kind of 3 D scanning system based on the self-correcting method for optical grating of linear phase position, obtain four width of cloth phase shift figure with phase-shift method after, step is as follows:
Step 1: four width of cloth phase shift figure to gained carry out the linear phase position conversion, linear phase position is carried out the least-squares line match obtain the fitting a straight line phase place, the phase point that will depart from the fitting a straight line phase place is adjusted to and is obtained adjusting phase point on the fitting a straight line phase place, then according to adjusting phase point, carry out inverse transformation with phase-shift method, obtain four new width of cloth phase shift figure
The above-mentioned method that the phase point that departs from the fitting a straight line phase place is adjusted is:
Suppose to be with least square fitting gained straight-line equation:
Wherein ((x, y) (a, b are the parameters of straight-line equation to the remarked pixel point to Φ to x remarked pixel point for x, linear phase position value y), so can obtain for x, horizontal ordinate y)
The difference of corresponding point on the ordinate direction is the phase compensation value of this pixel on phase value that definition each point pixel is original and the fitting a straight line phase place, then pixel (x, offset y) is:
Be that new adjustment phase point phase value is
Above-mentioned method of carrying out inverse transformation with phase-shift method is:
Phase value according to adjusting phase point utilizes the phase-shift method formula
As can be known, the acquisition of phase value is only relevant with four width of cloth phase shift figure, the gray-scale value I ' of i width of cloth figure among four width of cloth phase shift figure after supposing to compensate
i(x, y), then this four width of cloth figure has the bar graph that pi/2 differs, and they still satisfy the phase-shift method formula
Obtain:
α wherein
1=-3 π/4, α
2=-π/4, α
3=π/4, α
4=3 π/4,
And then obtain four new width of cloth phase shift figure,
Step 2: four new width of cloth phase shift figure and former four width of cloth phase shift figure being compared, obtain throwing grating to the transport function of gathering between the grating, is to proofread and correct majorized function with the transport function, and this correction majorized function adopts following method to obtain:
The first step: ask for gray value differences Δ I (x, y): owing to just exist pi/2 to differ between four width of cloth phase shift figure, as long as and know wherein arbitrary width of cloth phase shift figure, the phase shift that can pass through obtains its excess-three width of cloth phase shift figure, therefore, for simple and Convenient Calculation, only get wherein that first width of cloth figure compares among the phase shift figure, so:
Second step: ask for projection grating to the contraction coefficient of collection between the grating: the definition of this contraction coefficient is:
λ (x, y)=128/ (I
0(x, y) * γ (x, y)), wherein I
0(x, y), γ (x y) can obtain by following method:
By four original width of cloth phase shift figure:
Wherein, α
1=-3 π/4, α
2=-π/4, α
3=π/4, α
4=3 π/4,
Try to achieve pixel (x, y) the maximum gradation value I in the grating cycle at place
IMAX(x is y) with minimum gradation value I
IMIN(x, y), then:
Above-mentioned I
i(x is background value I in formula y)
0(x, y) and the product of cosine function, according to
, can be in the hope of the modulate intensity function:
The 3rd the step: ask for transport function G (x, y):
G (x, y)=λ (x, y) * Δ I (x y), serves as to proofread and correct majorized function with this transport function,
Step 3: with proofreading and correct majorized function former four width of cloth phase shift figure are proofreaied and correct, this bearing calibration is:
The correction majorized function G that obtains with step 2 (x, y) come the individual element correcting computer generate grating gray (x, y), obtain new computing machine generate grating gray ' (x, y):
Step 4: circulation execution in step 1~3, if G (x, y)=0 or cycle index equal 100, then loop ends, at this moment the computing machine that step 3 is obtained generates grating gray ' (x y) as the grating after the self-correcting, has so just realized the self-correcting of grating.
Compared with prior art, the present invention has following advantage:
The present invention is mainly used in sine and the accurately phase shift that improves the grating waveform, with raising phase-shift method precision, and then the precision of raising whole measuring system.
In three-dimensional information reconstruct, select for use the projection grating method to have and be subjected to ground unrest to influence the advantage little, that measurement range is big, though the digital projection system that adopts improved projection grating precision, obtain accurate phase shift, but also brought electronic interferences, systematic errors such as lens distortion make actual projection grating have non-sinusoidal and aperiodicity.The sine of projection grating waveform and accurate phase shift are the principal elements that influences the phase-shift method measuring accuracy.
At above situation, we have designed the automatic correcting method based on anti-phase-shift method, set up the raster phase distributed model that comprises the error disturbance factor, also will consider raster phase is carried out rectification building-out simultaneously, make it satisfy standard sine and distribute.Can improve the robustness of grating waveform like this, also can improve the phase shift precision, and then improve the measuring accuracy of system.
Embodiment
Show below in conjunction with accompanying drawing the specific embodiment of the present invention is further described.According to said method, in Windows operating system, realized the self-tuning operation of grating with the C++ programming by the VC++6.0 platform.
At first each factor is analyzed, and proposed the measure of improving one's methods and improving precision targetedly, for final self-correcting method for optical grating provides foundation from influencing grating sine, accurately phase shift, periodic angle; And in optical grating projection was measured, the subject matter that influences measuring accuracy was shadow casting technique, and the projection during optical grating projection is measured requires to have high contrast, intensity and good light intensity pattern.So we can from the sine of acquisition projection grating waveform and periodically the angle of quality estimate the height of the precision that the phase-shift method optical grating projection measures, with four width of cloth phase-shift methods sine wave of resulting projection grating is converted to linear phase position, with least square method linear phase position is carried out match again, the error size of match has also just reflected the quality of projection grating waveform, so just simplified the time of finding the solution greatly, solved the difficult problem of sinusoidal wave least square fitting, also the linear phase position correction for the back provides theoretical foundation.We use the automatic correcting method based on anti-phase-shift method more then: four width of cloth phase shift figure to gained carry out the linear phase position conversion, linear phase position is carried out the least-squares line match obtain the fitting a straight line phase place, the phase point that will depart from the fitting a straight line phase place is adjusted to and is obtained adjusting phase point on the fitting a straight line phase place, then according to adjusting phase point, carry out inverse transformation with phase-shift method, obtain four new width of cloth phase shift figure, by comparing with original four width of cloth phase shift figure, obtain throwing grating to the correction majorized function of gathering between the grating, finish the self-correcting of projection grating phase place.
This method mainly may further comprise the steps:
Step 1: select for use the digital projection system programming to generate grating, overcome traditional mechanical phase-shifting technique and be difficult to accomplish that the shortcoming of accurate phase shift obtains the more accurate projection grating of phase shift; Digital projection system is compared with traditional Phase Shifting System and mainly contained following two outstanding advantages: (1) projection grating waveform is realized by computer software programming, suppose not consider the influence of the factor such as non-linear, electronic noise, thermal effect of optical projection system, which type of waveform what promptly computing machine generated which type of waveform projection obtains in the ideal case is exactly.And to adopt phase-shift method primary to obtain sinusoidal grating exactly.(2) system's phase displacement error has been compared with classic method significantly and has been reduced.Therefore, digital micromirror adopts special projector can obtain the most accurate projection grating striped as instrument; Native system utilizes computer software control, and the phase shift of electrical grating can be accomplished very accurate.
The digital projection system programming realizes that the process that generates grating is: allow grating be vertical bar shape period profile, and each cycle 16 pixel wide, the gray-scale value of the same pixel that lists is identical; On with delegation, in the one-period gray-scale value of each pixel be from the cycle be 16 pixels, amplitude interval [0,255], initial phase is on 0 the periodic wave, at 16 phase points
Carry out obtaining from value, because gray-scale value is necessary for integer, if income value is not an integer, then the value that rounds automatically rounding up is as the gray-scale value of this pixel.With the sine wave is example, programming generation grating mid point (x, y) gray-scale value can be obtained by following formula:
" [] " represents rounding operation in the formula; Promptly when x was 16 multiple, gray-scale value was 255, and (1+cos (x* π/8) rounds and obtains otherwise gray-scale value is by formula 128*.
Step 2: ask for to comprise and eliminate projection error and acyclic grating parameter light intensity function, to obtain the raster phase of programmed and the phase transfer function between the actual phase place that obtains more accurately; Phase-shift method can obtain absolute phase values φ in conjunction with Gray code, because the interference of various extraneous factors in the measuring process causes the bigger difference of existence between phase measurement and the phase place actual value.In order to find the solution more accurate projection grating object phase value φ, the object that concerns between the actual value θ that must determine to express phase place and the phase measurement φ is transport function mutually, at fringe projection system ideally, and φ (θ)=0
Influencing another factor that phase transfer function finds the solution is periodically, and the phase transfer function of object has only and is only periodic function in the ideal case.And the non-linear and lens distortion of the alignment error of projection grating, digital projection system all makes the phase transfer function cycle that variation has taken place, in order to reduce acyclic influence, the phase value of more being optimized, adopt the more phase transfer function of complicated model calculating object, and in light intensity function, will consider object phase value φ and grating parameter
Just can eliminate these errors, the relation of two parameters is as follows:
N
pIt is grating pitch.Therefore, consider the alignment error of eliminating grating and the periodic factor φ of influence function and
, the model of the light intensity function that is improved is:
Under the light intensity function of this improvement, and the discretize influence between utilization sampling thheorem analysis CCD and projector, just can obtain accurate phase transfer function, and then improve precision.
Step 3: the phase transfer function that applying step 2 obtains is optimized the generation grating waveform of digital projection system, eliminates projection grating waveform aperiodicity;
Step 4: experimental study light intensity pattern is to the influence of grating waveform.As everyone knows, only in desirable projection grating system, could really accomplish: computing machine generates the projection of standard sine waveform and goes out, just can obtain desirable sinusoidal waveform, and can not obtain in the reality, so generate waveform with the artificial change computing machine of reverse thinking, electronic noise, the system that adds projector is non-linear, after the factors such as distortion of camera lens, if can accomplish projection gained waveform is sinusoidal waveform just, this has reached the purpose that obtains precise phase too.
According to the phase-shift method formula
The standard sine waveform is converted into the linear phase position value as can be known, should be straight line, and the value of gained linear phase position is carried out the least square line match, and AME and mean of variance are more little, illustrates that the sine of gained projection waveform is good more.Therefore various common waveforms are experimentized under different light intensity, experimental data sees Table 1.
Three kinds of waveforms of table 1 under different light intensity, phase place fitting a straight line error information
Generate the grating waveform |
The fitting a straight line AME |
The fitting a straight line mean of variance |
Trapezoidal wave light intensity 100 |
0.0142735 |
0.000103435 |
Cosine wave (CW) light intensity 100 |
0.0119914 |
0.000218207 |
Triangular wave light intensity 100 |
0.0072835 |
2.07023e-005 |
Trapezoidal wave light intensity 80 |
0.00547147 |
1.38708e-005 |
Triangular wave light intensity 80 |
0.0416861 |
0.00143287 |
Cosine wave (CW) light intensity 80 |
0.0135341 |
0.000121239 |
Trapezoidal wave light intensity 60 |
0.00961065 |
5.01802e-005 |
Triangular wave light intensity 60 |
0.0285122 |
0.000765628 |
Cosine wave (CW) light intensity 60 |
0.011759 |
8.28686e-005 |
Can obtain as drawing a conclusion according to above data:
1. when light intensity is strong, the phase place fitting a straight line mean value and the variance of triangular wave, trapezoidal wave are all little than sine wave, illustrate that the thinking that the artificial change projection grating that adopts reverse thinking remedies the error that factors such as electronic noise, the system of optical projection system is non-linear, lens distortion cause is correct.
2. along with the dying down of projection light intensity, contrast reduces, all to a certain degree the increases of the error of fitting of several waveforms, and explanation will improve the optical grating projection measuring accuracy needs good light intensity pattern and contrast.
3. in light intensity lower or background light darker in, triangular wave, cosine wave (CW) are because crest is narrower, be subjected to the interference and the diffraction influence of grating, can't near crest, obtain stronger gray-scale value, increased waveform sine error, so can adopt bigger trapezoidal of upper bottom surface, even square wave improves the pixel gray-scale value that goes out at the grating crest.
Above description of test: the projection during optical grating projection is measured requires to have good light intensity pattern.
Step 5: the research contrast is to the influence of grating waveform, with the triangular wave is that the experimental data analogous diagram of example under different contrast seen accompanying drawing 4~6, as seen from the figure, though the error of fitting of linear phase position is little, can obtain good sinusoidal waveform, but along with the weakening of light intensity, contrast reduces, gray scale difference in the gained projected image between pixel diminishes, and less contrast is easy to generate wrong phase place.Therefore projection grating requires to have good contrast.
Step 6: utilize step 4~5 experiment conclusion, projection is through the improved grating waveform in step 1~3 under the external environment of selecting good contrast, intensity and light intensity pattern for use;
Step 7: to the grating waveform of step 6 projection, gather preservation with CCD and obtain the first amplitude grating figure, control computer allows generation grating waveform integral body be offset 1/4,2/4,3/4 cycle respectively left and throws successively then, gather with CCD again and preserve this 3rd amplitude grating figure, constitute four width of cloth phase shift figure with first width of cloth of original collection, this four width of cloth figure has the bar graph that pi/2 differs.Order differs α
1=-3 π/4, α
2=-π/4, α
3=π/4, α
4=3 π/4, each figure can be expressed as
Wherein, I
i(x y) is the gray-scale value of i width of cloth figure, I
0(x y) is the background value of bar graph, γ (x y) is the modulate intensity function,
Be the field of behaviour to be asked.Suppose 4 width of cloth images in same light field, background gray levels is identical, according to triangle formula
With I
i(x, y) the substitution following formula gets
To following formula negate tan, just obtained the main value field of behaviour:
Following formula is exactly the fundamental formular with 4 width of cloth figure phase-shift methods of 90 ° of phase shifts.According to above formula as can be known, be under standard sine, 90 ° the prerequisite situation of phase shift satisfying projection grating for strictness, can obtain wrapped phase value accurately, and the linear distribution of the phase value in each cycle.
Step 8: four width of cloth phase shift figure that obtain are carried out the linear phase position conversion according to the phase-shift method formula, linear phase position is carried out the least-squares line match obtain the fitting a straight line phase place, the phase point that will depart from the fitting a straight line phase place is adjusted to and is obtained adjusting phase point on the fitting a straight line phase place, and main process is: suppose with least square fitting gained straight-line equation to be:
, wherein ((x, y) (a, b are the parameters of straight-line equation to the remarked pixel point to Φ to x remarked pixel point for x, linear phase position value y), so can obtain for x, horizontal ordinate y)
The difference of corresponding point on the ordinate direction is the phase compensation value of this pixel on phase value that definition each point pixel is original and the fitting a straight line phase place, then pixel (x, offset y) is:
Be that new adjustment phase point phase value is
Step 9: obtain new phase value by step 8, utilize the phase-shift method formula to carry out inverse transformation, just can obtain four new width of cloth phase shift figure.The process of asking for is: by in the step 7 with the fundamental formular of 4 width of cloth figure phase-shift methods of 90 ° of phase shifts as can be known, the acquisition of phase value is only relevant with four width of cloth phase shift figure, the gray-scale value I ' of i width of cloth figure among four width of cloth phase shift figure after suppose to compensate
i(x, y), then they still satisfy the phase-shift method formula
Therefore, obtain:
α wherein
1=-3 π/4, α
2=-π/4, α
3=π/4, α
4=3 π/4,
And then obtain four new width of cloth phase shift figure,
Step 10: four width of cloth phase shift figure that utilize four new width of cloth phase shift figure that step 9 obtains and original step 7 to obtain compare and obtain throwing grating to the transport function of gathering between the grating, we are defined as the correction majorized function to it, and this correction majorized function adopts following method to obtain:
The first step: ask for gray value differences Δ I (x, y): owing to just exist pi/2 to differ between four width of cloth phase shift figure, as long as and know wherein arbitrary width of cloth phase shift figure, the phase shift that can pass through obtains its excess-three width of cloth phase shift figure, therefore, for simple and Convenient Calculation, only get wherein that first width of cloth figure compares among the phase shift figure, so:
Second step: ask for projection grating to the contraction coefficient of collection between the grating: the definition of this contraction coefficient is:
λ (x, y)=128/ (I
0(x, y) * γ (x, y)), wherein I
0(x, y), γ (x y) can obtain by following method:
By four original width of cloth phase shift figure:
Wherein, α
1=-3 π/4,
2=-π/4, α
3=π/4, α
4=3 π/4,
Try to achieve pixel (x, y) the maximum gradation value I in the grating cycle at place
IMAX(x is y) with minimum gradation value I
IMIN(x, y), then:
Above-mentioned I
i(x is background value I in formula y)
0(x, y) and the product of cosine function, according to
Can be in the hope of the modulate intensity function:
The 3rd the step: ask for transport function G (x, y):
G (x, y)=λ (x, y) * Δ I (x y), serves as to proofread and correct majorized function with this transport function,
Step 11: former four width of cloth phase shift figure are proofreaied and correct with proofreading and correct majorized function, this bearing calibration is: the correction majorized function G that obtains with step 10 (x, y) come the individual element correcting computer generate grating gray (x, y), obtain new computing machine generate grating gray ' (x, y):
Step 12: circulation execution in step 1~11, if G (x, y)=0 or cycle index equal 100, then loop ends, at this moment the computing machine that step 11 is obtained generates grating gray ' (x y) as the grating after the self-correcting, has so just realized the self-correcting of grating.
We are referred to as the solution procedure of step 8~12 automatic correcting method of anti-phase-shift method in addition.
By the feedback compensation of linear phase position, use anti-phase-shift method like this, just realized the grating self-correcting.