CN102102983B - Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic - Google Patents
Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic Download PDFInfo
- Publication number
- CN102102983B CN102102983B CN 200910250927 CN200910250927A CN102102983B CN 102102983 B CN102102983 B CN 102102983B CN 200910250927 CN200910250927 CN 200910250927 CN 200910250927 A CN200910250927 A CN 200910250927A CN 102102983 B CN102102983 B CN 102102983B
- Authority
- CN
- China
- Prior art keywords
- forw
- along
- primary colours
- stepper motor
- frame
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention relates to a method and a device for measuring displacement along the direction of an optical axis by using single primary color peaks and valleys as the characteristic. The device consists of a computer and a camera thereof, a stepping motor, a stepping motor interface circuit and a camera axial displacement device, wherein the camera for shooting and a program for measuring axial displacement according to single primary color peak and valley data are arranged; the stepping motor is connected to an RS232C interface of the computer through the stepping motor interface circuit; and the camera is arranged on the camera axial displacement device. The method comprises the following steps of: automatically analyzing and selecting an optimal observation area by calculating an autocorrelation coefficient of pixel brightness of an image frame; and during measuring, analyzing and measuring the number of peaks and valleys of a primary color selected in the image frame along the directions of two coordinate axes, controlling the rotation of the stepping motor through the RS232C interface of the computer, operating the camera forwards or backwards, and taking a position at which the sum of the number of the peaks and valleys is the maximum as an optimal imaging focusing position so as to obtain axial relative displacement. By the method and the device, the influence of light with other wavelengths can be eliminated, and the measuring speed is improved.
Description
Technical field
The invention belongs to the digital picture field of measuring technique, particularly use the computing machine camera to measure method and the device thereof of object along the micro-displacement of its optic axis direction generation.
Background technology
The patent of invention of submitting to recently method and the device of the displacement of three primary colours peak valley as pattern measurement along optical axis direction " take " and method and the device of the displacement of peak valley as pattern measurement along optical axis direction " take " are all usingd the feature of picture contrast formed " peak, paddy " as image, judge the degree of image focal imaging by the number of counting peak and paddy, take this to use the photosensor arrays of computing machine camera to survey the micro-displacement occurred along the optic axis direction, these two kinds of measuring method novelties, facility.But, although the former has utilized the information of picture frame fully,, its analytic operation amount is larger, has affected the reaction velocity of measuring; And the latter can be subject to the irradiation impact of various wavelength in measurement environment for the brightness of picture frame.
Summary of the invention
The invention provides a kind of method and device of take the displacement of single primary colours peak valley as pattern measurement along optical axis direction, it utilizes the computing machine camera, can occur in the environment of certain variation at illuminating position, measure the micro-displacement vector that object occurs along the optical axis direction of camera.
The technical solution adopted for the present invention to solve the technical problems is: computing machine camera of allocation of computer that a Daepori is logical, it is on the axial displacement device that forms of core by the high-precision micro displacement stepper motor that this camera is installed in one, this stepper motor is connected to the RS232C interface of described computing machine by the stepper motor interface circuit, described allocation of computer has camera to take and according to single primary colours peak valley DATA REASONING axial displacement program, this program has embodied that to take a kind of peak or the paddy of primary colours of picture frame be the method for pattern measurement axial displacement, comprising:
Step 1, with the form of bitmap (M * N, M, N ∈ positive integer), take the image of a frame testee, as the reference frame; Take the position of first pixel in this frame pel array upper left corner is initial point, and the direction of take to the right is the x direction of principal axis, and vertical downward direction is the y direction of principal axis, the size that the unit of the coordinate system of getting is a pixel; Choose a zone at the middle section of described pel array, size is m
0* n
0, m
0, n
0the ∈ positive integer, be referred to as view window, and the horizontal direction of the described pel array of its distance and the edge pixel of vertical direction respectively have h and v pixel, have: m
0+ 2h=M, n
0+ 2v=N, h, v ∈ positive integer;
Step 3, for above-mentioned two frame edge direction data, calculate respectively the auto correlation matching factor of pel array in view window in described reference frame:
In formula, sign of operation means binary logic and computing, its operation result or be logical zero or for logical one, sign of operation " [] " means to get the corresponding numerical value of value of logical operation function wherein, or is numerical value 0, or is numerical value 1, parametric variable a, the combination of b has determined the scale of associated coupling operator array, if get 3 * 3 associated coupling operator array: a=-1,0,1, b=-1,0,1, therefore, along each change in coordinate axis direction, each will produce 9 self-correlation auto_correlation
x(a, b) and auto_correlation
y(a, b);
Step 4, according to auto correlation matching factor corresponding to above-mentioned two frame edge direction data, search for respectively and can carry out matching ratio optimal viewing window pel array under current body surface situation and illuminating position:
m
x=m
0±step,n
x=n
0±step,2h=M-m
x,2v=N-n
x
And m
y=m
0± step, n
y=n
0± step, 2h=M-m
y, 2v=N-n
y,
In formula, subscript x, y mean respectively its value corresponding along X-direction and Y direction, step is the stepped parameter in search procedure, the unlike signs of its front is determined by the direction of search; Get large person in this two class value and measure the scale of view window array used: m * n for this;
For view window zone wherein, use respectively the number of their corresponding peaks of accumulator count, paddy: N
cOLORX axle peak, N
cOLORX axle paddy, N
cOLORY axle peakand N
cOLORY axle paddy, wherein, N means number, the count results of cumulative above-mentioned totalizer is also preserved it, be expressed as: N (i, j=0, forw=0, back=0), wherein, i=1, 2, 3...... mean the sequential counting of captured reference frame, it is also the counting of measuring, j=0, 1, 2, 3, ..., the counting that means the sampling frame taken in the i time measuring process, variable forw (=0, 1, 2, ...) and back (=0, 1, 2, ...) mean that respectively stepper motor generation clockwise described in the i time measurement rotates and the corresponding step-by-step impulse counting of anticlockwise rotation, before this is measured and starts, have: i=1, j=0, forw=0, back=0,
For the pel array of above-mentioned sampling frame, derive line by line, by column respectively 1 * 2=2 frame edge direction the data along X-axis and the selected primary colours COLOR of Y direction; Accordingly, derive respectively along 1 * 2=2 frame limit reflection condition of these primary colours of X-axis and Y direction;
For view window zone wherein, use respectively the number of their corresponding peaks of accumulator count, paddy: N
cOLORX axle peak, N
cOLORX axle paddy, N
cOLORY axle peakand N
cOLORY axle paddy; The count results of cumulative above-mentioned totalizer is also preserved it, is expressed as: N (i, j=1, forw=1, back=0);
If: N (i, j=1, forw=1, back=0)<N (i, j=0, forw=0, back=0), described computing machine is exported back=1 digital pulse signal to described stepper motor interface circuit by an output control line BACKWARD of its RS232C interface, control the anticlockwise rotation backward of this stepper motor, get back to the initial position of this measurement, then, described computing machine continues output back (=2 by the output control line BACKWARD of its RS232C interface, 3, ...) individual digital pulse signal is to described stepper motor interface circuit, control the further anticlockwise rotation of this stepper motor, in this process, each anticlockwise rotation one step respectively samples all peaks of the interior selected primary colours along X-axis and Y direction of frame view window and the number sum N (i of paddy before and after all taking and analyze comparison, j=back+1, forw=1, back) and N (i, j=back, forw=1, back=back-1), should have: N (i, j=back+1, forw=1, back=back)>=N (i, j=back, forw=1, back=back-1), preserve it, so continue, until meet: N (i, j=back+1, forw=1, back)<N (i, j=back, forw=1, back-1), at this moment, record: (back)
mAX=back, simultaneously, described computing machine arrives described stepper motor interface circuit by another root output control line FORWARD digital pulse signal of output (forw=2) of its RS232C interface, control this stepper motor clockwise and rotate a step, at this moment, this measures the initial position before starting relatively, and the camera of this device i.e. best object imaging and focusing position in this is measured: FocusP=forw-(back)
mAX=2-(back)
mAXthe result of its calculating is negative value, the sense of rotation that means described stepper motor is anticlockwise, and all peaks of the interior selected primary colours along X-axis and Y direction of the sampling frame view window that this focal position is corresponding and the number sum of paddy are: N (i, j=((back)
mAX-1)+1=(back)
mAX, forw=1, back=(back)
mAXthe tale result of the sampling frame of-1), taking in measuring process is: j=forw+ (back)
mAX=2+ (back)
mAX,
Integrate, this measures the initial position before starting relatively, and the object that this measurement obtains along the displacement of the optic axis direction generation of described camera is: Δ z (i)=forw-back,
The value of above-mentioned calculating formula Counter forw and back is count results last in this measuring process, result of calculation has the symbol of plus or minus, the direction that the displacement that expression occurs is respectively advanced or retreated along optic axis, corresponding to the sense of rotation of described stepper motor (clockwise or anticlockwise), specifically by the arrangement of the axial displacement device of stepper motor, determined;
Total displacement is: Δ Z
0(i)=Δ Z
0(i-1)+Δ z (i)
Wherein, Δ Z
0(i-1) measure the axial displacement of accumulation before for this;
N(i,j=0,forw=0,back=0)=N(i,j=(forw)
MAX-1,forw=(forw)
MAX-1,back=0),
Or N (i, j=0, forw=0, back=0)=
N(i,j=((back)
MAX-1)+1=(back)
MAX,forw=1,back=(back)
MAX-1);
In the actual measurement process, by measurement, calibrate, can obtain direct measurement result.
Above-mentioned camera is taken and according to the definition of the edge direction data of described edge direction data or certain primary colours (red, green, blue) among single primary colours peak valley DATA REASONING axial displacement program is:
In pel array, along X-axis or along Y direction, if the intensity level of the intensity level of a pixel or its selected primary colours is than the also little error margin value error of second corresponding intensity level of pixel of its back, if
I (X, Y)<I (X+2, Y)-error or I (X, Y)<I (X, Y+2)-error,
Define between these two pixels and have one along this axial positive limit or the selected primary colours positive limit axial along this; If the intensity level of a pixel or the intensity level of its selected primary colours are than second corresponding intensity level of pixel of its back large error margin value error also, if
I (X, Y)>I (X+2, Y)+error or I (X, Y)>I (X, Y+2)+error
Define between these two pixels exist one axial marginal or that selected primary colours are axial along this is marginal along this; The limit so obtained is positioned at the position of first pixel after this pixel, also is positioned on that pixel in the centre position that participates in two pixels relatively; If second corresponding intensity level of pixel of the intensity level of a pixel or the intensity level of its selected primary colours and its back approaches, its value differs and is no more than an error margin value error, if:
I(X+2,Y)-error≤I(X,Y)≤I(X+2,Y)+error,
Or I (X, Y+2)-error≤I (X, Y)≤I (X, Y+2)+error,
Think and do not have corresponding " limit " or do not have selected primary colours " limit " axial along this along this direction of principal axis between these two pixels, also can be referred to as the 3rd class limit;
Along some change in coordinate axis direction, the all positive limit of corresponding pixel column or pixel column, marginal and the 3rd class limit form this row maybe these row along the edge direction data of this change in coordinate axis direction, perhaps, the positive limit of the selected primary colours that corresponding pixel column or pixel column are all, marginal and the 3rd class limit form this row, and maybe this is listed as the edge direction data of selected primary colours along this change in coordinate axis direction, and mean respectively positive limit wherein, marginal and the 3rd class limit with the binary numeral 001,010 and 100 of 3bit; Error margin value in above-listed formula can, according to concrete light conditions, be predisposed to a little numerical value, for example: error=10; There are not the edge direction data in four limits in pel array and the location of pixels on angle.
Above-mentioned camera is taken and is comprised according to the method for the optimal viewing of search described in the step 4 of single primary colours peak valley DATA REASONING axial displacement program window pel array:
View window and the associated coupling of k * k (k ∈ positive integer) operator array (a, b) for described pel array, can produce k * k auto correlation matching factor along certain change in coordinate axis direction, by following inequality, compares these auto correlation matching factors:
auto_correlation(a,b)≥auto_correlation(0,0)×similarity
In formula, similarity has described the similarity degree of view window with the pel array of its contiguous identical scale, for example gets similarity=60%, can set in advance, and also can be debugged and select according to the quality on light conditions and measured object surface;
If the self-correlation that meets above-mentioned inequality more than k * k *
1/
3individual, need to enlarge the capable and step row of each step of scope of view window: make m=m
0+ step, n=n
0+ step, recalculate the self-correlation of new view window, and carry out above-mentioned comparison, until meet the no more than k * k of auto correlation matching factor of above-mentioned inequality *
1/
3individual, at this moment, 2h=M-m, 2v=N-n, wherein, step is stepped parameter, initial value is 1, needs the scale of expansion view window just to increase by 1 at every turn; If exceed a predetermined scope in frame, also do not find suitable view window, think that the quality of this this part reflecting surface of object is unsuitable for the surveying work of this device, and provide the prompting warning;
If meet the no more than k * k of auto correlation matching factor of above-mentioned inequality *
1/
3individual, illustrate that the architectural feature on surface of subject is enough meticulous, the value between neighborhood pixels can be distinguished, and can further attempt dwindling the capable and step row of each step of scope of view window, to reduce amount of calculation: make m=m
0-step, n=n
0-step, recalculate the self-correlation of view window, and carry out above-mentioned comparison, and the parameter s of going forward one by one tep is each increases by 1, until selected view window zone meet the number of the self-correlation of above-mentioned inequality be not less than k * k *
1/
3, at this moment, think and searched optimal viewing window pel array.
Above-mentioned camera take and according to described in the step of single primary colours peak valley DATA REASONING axial displacement program along the limit reflection condition of three kinds of primary colours of X-axis and Y direction, it is defined as:
The redness of the pixel be listed as according to selected observation row and observation, green or blue edge direction data, along X-axis or along the Y direction of principal axis, if continuous two or more than the positive limit of certain primary colours of two, or continuous two or more than and then these primary colours marginal after the 3rd class limit of this primary colours of two, be referred to as the first kind limit reflection condition of these primary colours, think the peak that has these primary colours in this position; If continuous two or marginal more than certain primary colours of two, or continuous two or more than the and then positive limit of these primary colours after the 3rd class limit of this primary colours of two, be referred to as the Equations of The Second Kind limit reflection condition of these primary colours, think the paddy that has these primary colours in this position; Along X-axis or along Y direction, its all peak of one of three kinds of primary colours and these primary colours of paddy composition diagram picture frame are along the limit reflection condition of this change in coordinate axis direction.
Described camera axial displacement device comprises: described camera is arranged on a worktable, this worktable and a long tap turning axle are socketed with tap, this tap turning axle is arranged on a large worktable by two bracing frames, and, it and these two bracing frames are all that the mode with rotating shaft is socketed, and at the socket place with bracing frame, can rotate but displacement does not forward or backward occur; A fixing gear is arranged, the mutual interlock of gear above the rotating shaft of it and stepper motor on described tap turning axle.Described stepper motor also is arranged on described large worktable, and it is connected to the RS232C interface of computer system by the stepper motor interface circuit.
The present invention is usingd the peak of a kind of primary colours frame in picture frame and paddy data as the feature of testee image, and by the self-correlation of computed image pixel intensity, automatic analysis is also chosen the optimal viewing zone; The number of the characteristics of image by counting primary colours frame selected in this viewing area, the degree of judgment object imaging and focusing, thus measure according to the rotation situation of stepper motor the micro-displacement that object occurs in camera optic axis direction; Its advantage is, relatively aforementioned two applications for a patent for invention have both more advantageously utilized the information of photoelectric sensor, have reduced again the workload of analytic operation, improved measuring speed, and it have been avoided the irradiation of other wavelength and has changed the impact on measuring.
The accompanying drawing explanation
Further illustrate patent of the present invention below in conjunction with accompanying drawing.
Fig. 1 is computing machine of the present invention and camera measuring system block scheme thereof.
Fig. 2 be of the present invention by the high-precision micro displacement stepper motor, be the camera axial displacement device block scheme that core forms.
Fig. 3 is optical imagery during focusing schematic diagram of the present invention.
Fig. 4 is that the photoelectric sensor chip carries out the pel array and the view window area schematic thereof that produce after opto-electronic conversion.
Fig. 5 is the schematic diagram of a traveling optical signal and digitized signal, edge direction data and limit reflection condition.
In Fig. 1,1. computing machine camera, 2. optical lens, 3. photoelectric sensor chip, 4.USB interface, 5. computer system, 6.USB interface, 7.CPU, 8.RS232C interface, 9. display card and display, 10. internal memory and hard disk, 11. keyboards and mouse, 12. operating system, 13. the webcam driver program, 14. cameras are taken and according to single primary colours peak valley DATA REASONING axial displacement program, 15. light fixture.
In Fig. 2,30. the worktable of stepper motor and camera, 31. bracing frame, 32. bracing frame, the worktable of 33. cameras (1), 34. tap turning axles, 341. the gear on tap turning axle (34), 40. stepper motor, the turning axle of 41. stepper motors (40), the gear on the turning axle (41) of 42. stepper motors (40).
In Fig. 3,90.-96. object (circle hot spot) schematic diagram of different position imagings on optical axis, 97. optic axises.
In Fig. 5,21. 1 traveling optical signals, 22. digitized signals corresponding with light signal (21), 23. edge direction data corresponding with digitized signal (22), the limit reflection condition of 24. corresponding sides directional datas (23).
Embodiment
Patent of the present invention comprises two parts: shown in the computing machine shown in Fig. 1 and camera measuring system thereof, Fig. 2 is the camera axial displacement device that core forms by the high-precision micro displacement stepper motor.
The State selective measurements environment, do not allow illumination variation to affect significantly the light and shade contrast of object being measured imaging.Select light fixture (15) to contribute to enforcement of the present invention.The material of object being measured preferably has more careful surface reflection feature, avoids smooth reflecting surface material.
As shown in Figure 2, it is upper that camera (1) is arranged on worktable (33), with worktable, moves, and this worktable (33) is socketed with tap with a long tap turning axle (34).Tap turning axle (34) is arranged on a large worktable (30) by bracing frame (31) and (32), and, tap turning axle (34) and bracing frame (31) and (32) are all that the mode with rotating shaft is socketed, and tap turning axle (34) can rotate but displacement does not forward or backward occur at the socket place with bracing frame (31) and (32).A fixing gear (341) is arranged on tap turning axle (34), the interlock mutually of gear (42) above the rotating shaft (41) of it and stepper motor (40), when the rotating shaft (41) of stepper motor (40) is rotated, rotation meeting driven gear (341) rotation of gear (42), and then drive tap turning axle (34) rotation, impel camera (1) and worktable (33) thereof to be moved forward or backward together.Stepper motor (40) also is arranged on large worktable (30).
Choose two inner output signal lines of RS232C interface (8) of computer system (5), FORWARD as shown in the figure and BACKWARD, receive a stepper motor interface circuit (43) together with a ground wire GROUND, carry out power amplification at this, then, be connected to stepper motor (40), control step motor (40) is done clockwise rotation or anticlockwise rotation.
The property relationship of stepper motor (40) is to the measuring accuracy of patent of the present invention, should select that step-wise displacement is meticulous, precision is high, the motor of working stability,
The operation camera is taken and, according to single primary colours peak valley DATA REASONING axial displacement program (14), is measured in real time displacement.Concrete steps are shown in that " summary of the invention " describe.
Whether clear the principle of patent measurement optical shaft orientation micrometric displacement of the present invention is based on the testee focal imaging, and its judgment criterion is: when focusing on clearly, picture frame view window zone has the characteristics of image that number is maximum--the limit reflection condition, as shown in Figure 3.The definition of relevant characteristics of image and definite as shown in Fig. 5 (edge direction data, edge direction situation).
The described measuring method of patent of the present invention also is applicable to other picture pick-up device.
Claims (2)
1. take the method for the displacement of single primary colours peak valley as pattern measurement along optical axis direction for one kind, it measures by computing machine and camera thereof, camera axial displacement device, stepper motor and stepper motor interface circuit the displacement that subject occurs along the optical axis direction of camera, this camera is installed on the camera axial displacement device, and stepper motor is connected to the RS232C interface of computing machine by the stepper motor interface circuit, described camera axial displacement device comprises: camera (1) is arranged on the first worktable (33), the first worktable (33) is socketed with tap with a long tap turning axle (34), tap turning axle (34) is arranged on large second worktable (30) by the first bracing frame (31) and the second bracing frame (32), and, tap turning axle (34) and the first bracing frame (31) and the second bracing frame (32) are all that the mode with rotating shaft is socketed, tap turning axle (34) can rotate but displacement forward or backward not occur at the socket place with the first bracing frame (31) and the second bracing frame (32), fixing first gear (341) is arranged on tap turning axle (34), the interlock mutually of the second gear (42) above the rotating shaft (41) of this gear (341) and stepper motor (40), stepper motor (40) also is arranged on the second worktable (30), stepper motor (40) is connected to the RS232C interface (8) of computing machine (5) by stepper motor interface circuit (43), it is characterized in that, the micro-displacement that the method is taken by camera and occurred along the optical axis direction of described camera according to single primary colours peak valley DATA REASONING object, comprise the steps:
Step 1, take the image of a frame testee with the form of bitmap M * N, as the reference frame; Choose rectangular coordinate system on its frame pel array: take the position of first pixel in this frame pel array upper left corner is initial point, and the direction of take to the right is the x direction of principal axis, and vertical downward direction is the y direction of principal axis, the size that the unit of the coordinate system of getting is a pixel; And choose a zone in the central authorities of described pel array, size is m
0* n
0, being referred to as view window, the horizontal direction of the described pel array of its distance and the edge pixel of vertical direction respectively have h and v pixel, have: m
0+ 2h=M, n
0+ 2v=N, wherein, M, N, m
0, n
0, h, v ∈ positive integer;
Step 2, by pixel column, by pixel column derive described reference frame pel array about X-direction with about two frame edge direction data { reference of Y direction
x(x, y) } and { reference
y(x, y) }, wherein, subscript x or y mean respectively the direction of the coordinate axis on institute edge, symbol " { } " means to preserve these data along a set of the edge direction data that in the change in coordinate axis direction view window that wherein the function subscript indicates, all pixels (x, y) are located;
Step 3, for above-mentioned two frame edge direction data, calculate respectively the auto correlation matching factor of pel array in view window in described reference frame:
In formula, sign of operation means binary logic and computing, its operation result or be logical zero or for logical one, sign of operation " [] " means to get the corresponding numerical value of value of logical operation function wherein, or be numerical value 0, or be numerical value 1, the combination of parametric variable a, b has determined the scale of associated coupling operator array, if get 3 * 3 associated coupling operator array: a=-1,0,1, b=-1,0,1, therefore, along each change in coordinate axis direction, each will produce 9 auto correlation matching factor auto_correlation
x(a, b) and auto_correlation
y(a, b);
Step 4, according to auto correlation matching factor corresponding to above-mentioned two frame edge direction data, search for respectively and can carry out matching ratio optimal viewing window pel array under current body surface situation and illuminating position:
m
x=m
0±step,n
x=n
0±step,2h=M-m
x,2v=N-n
x
And m
y=m
0± step, n
y=n
0± step, 2h=M-m
y, 2v=N-n
y,
In formula, subscript x, y mean respectively its value corresponding along X-direction and Y direction, step is the stepped parameter in search procedure, the unlike signs of its front is determined by the direction of search; Get large person in this two class value and measure the scale of view window array used: m * n for this;
Step 5, for the pel array of above-mentioned reference frame, choose that three kinds of primary colours wherein are one of red, green and blue is expressed as COLOR, derive line by line, by column respectively along 1 * 2=2 frame edge direction data of these primary colours of X-axis and Y direction; Data, derive respectively along 1 * 2=2 frame limit reflection condition of these primary colours of X-axis and Y direction accordingly;
For view window zone wherein, use respectively the number of their corresponding peaks of accumulator count, paddy: N
cOLORX axle peak, N
cOLORX axle paddy, N
cOLORY axle peakand N
cOLORY axle paddy, wherein, N means number, the count results of cumulative above-mentioned totalizer is also preserved it, be expressed as: N (i, j=0, forw=0, back=0), wherein, i=1, 2, 3......, the sequential counting that means captured reference frame, it is also the counting of measuring, j=0, 1, 2, 3, ..., the counting that means the sampling frame taken in the i time measuring process, stepper motor generation clockwise rotation described in variable forw and back mean respectively to measure for the i time and the corresponding step-by-step impulse counting of anticlockwise rotation: forw=0, 1, 2, ..., back=0, 1, 2, ..., before this is measured and starts, have: i=1, j=0, forw=0, back=0,
Step 6, measurement start: described computing machine is exported forw=1 digital pulse signal to described stepper motor interface circuit by an output control line FORWARD of its RS232C interface, control this stepper motor clockwise and rotate a step, then, take j=1 frame sample framing bit figure;
For the pel array of above-mentioned sampling frame, derive line by line, by column respectively along 1 * 2=2 frame edge direction data of the selected primary colours of X-axis and Y direction; Accordingly, derive respectively along 1 * 2=2 frame limit reflection condition of these primary colours of X-axis and Y direction;
For view window zone wherein, use respectively the number of their corresponding peaks of accumulator count, paddy: N
cOLORX axle peak, N
cOLORX axle paddy, N
cOLORY axle peakand N
cOLORY axle paddy; The count results of cumulative above-mentioned totalizer is also preserved it, is expressed as: N (i, j=1, forw=1, back=0);
Step 7, if: N (i, j=1, forw=1, back=0)>=N (i, j=0, forw=0, back=0), described computing machine is exported forw digital pulse signal to described stepper motor interface circuit: forw=2 by an output control line FORWARD of its RS232C interface, 3, ..., control this stepper motor clockwise rotation progressive, each clockwise rotates a step and all takes and analyze before and after comparison and respectively sample in frame in view window along all peaks of the selected primary colours of X-axis and Y direction and the number sum N (i of paddy, j=forw-1, forw-1, back=0) and N (i, j=forw, forw, back=0), preserve it, in this process, should have: N (i, j=forw, forw, back=0)>=N (i, j=forw-1, forw-1, back=0), until meet: N (i, j=forw, forw, back=0)<N (i, j=forw-1, forw-1, back=0), at this moment, record (forw)
mAX=forw, simultaneously, described computing machine arrives described stepper motor interface circuit: back=1 by digital pulse signal of another root output control line BACKWARD output of its RS232C interface, control anticlockwise rotation one step of this stepper motor, at this moment, this measures the initial position before starting relatively, and the camera of this device i.e. best object imaging and focusing position in this is measured: FocusP=(forw)
mAX-back=(forw)
mAX-1, the result of its calculating is more than or equal to 0, the sense of rotation that means described stepper motor is in general clockwise, and all peaks of the interior selected primary colours along X-axis and Y direction of the sampling frame view window that this focal position is corresponding and the number sum of paddy are: N (i, j=(forw)
mAX-1, forw=(forw)
mAX-1, back=0), the tale result of the sampling frame of taking in measuring process is: j=(forw)
mAX+ back=(forw)
mAX+ 1,
If: N (i, j=1, forw=1, back=0)<N (i, j=0, forw=0, back=0), described computing machine is exported back=1 digital pulse signal to described stepper motor interface circuit by an output control line BACKWARD of its RS232C interface, control the anticlockwise rotation backward of this stepper motor, get back to the initial position of this measurement, then, described computing machine continues back digital pulse signal of output to described stepper motor interface circuit: back=2 by the output control line BACKWARD of its RS232C interface, 3, ..., control the further anticlockwise rotation of this stepper motor, in this process, each anticlockwise rotation one step respectively samples all peaks of the interior selected primary colours along X-axis and Y direction of frame view window and the number sum N (i of paddy before and after all taking and analyze comparison, j=back+1, forw=1, back) and N (i, j=back, forw=1, back=back-1), should have: N (i, j=back+1, forw=1, back=back)>=N (i, j=back, forw=1, back=back-1), preserve it, so continue, until meet: N (i, j=back+1, forw=1, back)<N (i, j=back, forw=1, back-1), at this moment, record: (back)
mAX=back, simultaneously, described computing machine arrives described stepper motor interface circuit: forw=2 by digital pulse signal of another root output control line FORWARD output of its RS232C interface, control this stepper motor clockwise and rotate a step, at this moment, this measures the initial position before starting relatively, and the camera of this device i.e. best object imaging and focusing position in this is measured: FocusP=forw-(back)
mAX=2-(back)
mAXthe result of its calculating is negative value, the sense of rotation that means described stepper motor is in general anticlockwise, and all peaks of the interior selected primary colours along X-axis and Y direction of the sampling frame view window that this focal position is corresponding and the number sum of paddy are: N (i, j=((back)
mAX-1)+1=(back)
mAX, forw=1, back=(back)
mAXthe tale result of the sampling frame of-1), taking in measuring process is: j=forw+ (back)
mAX=2+ (back)
mAX,
Integrate, this measures the initial position before starting relatively, and the object that this measurement obtains along the displacement of the optic axis direction generation of described camera is: Δ z (i)=forw-back,
The value of above-mentioned calculating formula Counter forw and back is count results last in this measuring process, result of calculation has the symbol of plus or minus, the direction that the displacement that expression occurs is respectively advanced or retreated along optic axis, corresponding to the sense of rotation of described stepper motor clockwise or anticlockwise, specifically by the arrangement of camera axial displacement device, determined; Total displacement is: Δ Z
0(i)=Δ Z
0(i-1)+Δ z (i),
Wherein, Δ Z
0(i-1) measure the axial displacement of accumulation before for this;
Step 8, prepare surveying work next time: measure time counter i=i+1, get and measure number sum that the corresponding object in best object imaging and focusing position of determining becomes all peaks of the interior selected primary colours along X-axis and Y direction of picture frame view window and paddy for the i time as new witness mark value:
N(i,j=0,forw=0,back=0)=N(i,j=(forw)
MAX-1,forw=(forw)
MAX-1,back=0),
Or N (i, j=0, forw=0, back=0)=
N(i,j=((back)
MAX-1)+1=(back)
MAX,forw=1,back=(back)
MAX-1);
Step 9, jump to step 6, continue to measure;
The definition of edge direction data described in above-mentioned steps two, step 5 and step 6 is:
In pel array, along X-axis or along Y direction, if the intensity level of the intensity level of a pixel or its selected primary colours is than the also little error margin value error of second corresponding intensity level of pixel of its back, if:
I (X, Y)<I (X+2, Y)-error or I (X, Y)<I (X, Y+2)-error,
Define between these two pixels and have one along this axial positive limit or the selected primary colours positive limit axial along this; If the intensity level of a pixel or the intensity level of its selected primary colours are than second corresponding intensity level of pixel of its back large error margin value error also, if:
I (X, Y)>I (X+2, Y)+error or I (X, Y)>I (X, Y+2)+error,
Define between these two pixels exist one axial marginal or that selected primary colours are axial along this is marginal along this; The limit so obtained is positioned at the position of first pixel after this pixel, also is positioned on that pixel in the centre position that participates in two pixels relatively; If second corresponding intensity level of pixel of the intensity level of a pixel or the intensity level of its selected primary colours and its back approaches, its value differs and is no more than an error margin value error, if:
I(X+2,Y)-error≤I(X,Y)≤I(X+2,Y)+error,
Or I (X, Y+2)-error≤I (X, Y)≤I (X, Y+2)+error,
Think and do not have corresponding " limit " or do not have selected primary colours " limit " axial along this along this direction of principal axis between these two pixels, also can be referred to as the 3rd class limit;
Along some change in coordinate axis direction, the all positive limit of corresponding pixel column or pixel column, marginal and the 3rd class limit form this row maybe these row along the edge direction data of this change in coordinate axis direction, perhaps, the positive limit of the selected primary colours that corresponding pixel column or pixel column are all, marginal and the 3rd class limit form this row, and maybe this is listed as the edge direction data of selected primary colours along this change in coordinate axis direction, and mean respectively positive limit wherein, marginal and the 3rd class limit with the binary numeral 001,010 and 100 of 3bit; According to concrete light conditions, the error margin value error in preset above-listed formula is a little numerical value; There are not the edge direction data in four limits in pel array and the location of pixels on angle;
Described in above-mentioned steps five, step 6, along the limit reflection condition of three kinds of primary colours of X-axis and Y direction, it is defined as:
The redness of the pixel be listed as according to selected observation row and observation, green or blue edge direction data, along X-axis or along Y direction, if continuous two or more than the positive limit of certain primary colours of two, or continuous two or more than and then these primary colours marginal after the 3rd class limit of this primary colours of two, be referred to as the first kind limit reflection condition of these primary colours, think the peak that has these primary colours in this position; If continuous two or marginal more than certain primary colours of two, or continuous two or more than the and then positive limit of these primary colours after the 3rd class limit of this primary colours of two, be referred to as the Equations of The Second Kind limit reflection condition of these primary colours, think the paddy that has these primary colours in this position; Along X-axis or along Y direction, three
Plant one of primary colours its all peak and these primary colours of paddy composition diagram picture frame limit reflection condition along this change in coordinate axis direction.
2. method of take the displacement of single primary colours peak valley as pattern measurement along optical axis direction according to claim 1, is characterized in that,
In described step 4, the method for search optimal viewing window pel array comprises:
For view window and the associated coupling of the k * k operator array (a, b) of described pel array, k ∈ positive integer, can produce k * k auto correlation matching factor along certain change in coordinate axis direction, by following inequality, compares these auto correlation matching factors:
auto_correlation(a,b)≥auto_correlation(0,0)×similarity
In formula, similarity has described the similarity degree of view window with the pel array of its contiguous identical scale, and similarity is set up in advance, or debugs selection according to light conditions and measured object surface texturisation;
If meet the auto correlation matching factor of above-mentioned inequality more than k * k * 1/3, need to enlarge the capable and step row of each step of scope of view window: make m=m
0+ step, n=n
0+ step, recalculate the auto correlation matching factor of new view window, and carry out above-mentioned comparison, until meet the no more than k * k of auto correlation matching factor of above-mentioned inequality * 1/3, at this moment, 2h=M-m, 2v=N-n, wherein, step is stepped parameter, initial value is 1, needs the scale of expansion view window just to increase by 1 at every turn; If exceed a predetermined scope in frame, also do not find suitable view window, think that the quality of this this part reflecting surface of object is unsuitable for the surveying work of this device, and provide the prompting warning;
If meet the no more than k * k of auto correlation matching factor of above-mentioned inequality * 1/3, the architectural feature on surface that subject is described is enough meticulous, value between neighborhood pixels can be distinguished, further attempt dwindling the capable and step row of each step of scope of view window, to reduce amount of calculation: make m=m
0-step, n=n
0-step, recalculate the auto correlation matching factor of view window, and carry out above-mentioned comparison, stepped parameter step is each increases by 1, until meeting the number of the auto correlation matching factor of above-mentioned inequality, selected view window zone is not less than k * k * 1/3, at this moment, think and searched optimal viewing window pel array.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200910250927 CN102102983B (en) | 2009-12-21 | 2009-12-21 | Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200910250927 CN102102983B (en) | 2009-12-21 | 2009-12-21 | Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102102983A CN102102983A (en) | 2011-06-22 |
CN102102983B true CN102102983B (en) | 2013-06-12 |
Family
ID=44155920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200910250927 Expired - Fee Related CN102102983B (en) | 2009-12-21 | 2009-12-21 | Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102102983B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1181497A (en) * | 1996-10-30 | 1998-05-13 | 山武·霍尼韦尔公司 | Distance measuring device and three-dinensional image measuring apparatus |
US6549648B1 (en) * | 1998-06-10 | 2003-04-15 | Leica Microsystems Wetzlar Gmbh | Method for determining a position of a structural element on a substrate |
CN102095374A (en) * | 2009-11-27 | 2011-06-15 | 曾艺 | Method and device for measuring displacement along optical axis direction by using peaks and valleys of three primary colors as characteristics |
-
2009
- 2009-12-21 CN CN 200910250927 patent/CN102102983B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1181497A (en) * | 1996-10-30 | 1998-05-13 | 山武·霍尼韦尔公司 | Distance measuring device and three-dinensional image measuring apparatus |
US6549648B1 (en) * | 1998-06-10 | 2003-04-15 | Leica Microsystems Wetzlar Gmbh | Method for determining a position of a structural element on a substrate |
CN102095374A (en) * | 2009-11-27 | 2011-06-15 | 曾艺 | Method and device for measuring displacement along optical axis direction by using peaks and valleys of three primary colors as characteristics |
Non-Patent Citations (4)
Title |
---|
JP特开2003-269931A 2003.09.25 |
JP特开2003-287405A 2003.10.10 |
潘兵等.数字图像相关中亚像素位移测量算法的研究.《力学学报》.2007,第39卷(第2期),第245-252页. * |
邵龙潭等.基于亚像素角点检测的试样变形图像测量方法.《岩土力学》.2008,第29卷(第5期),第1329-1333页. * |
Also Published As
Publication number | Publication date |
---|---|
CN102102983A (en) | 2011-06-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102360079B (en) | Laser range finder and working method thereof | |
CN110411346B (en) | Method for quickly positioning surface micro-defects of aspheric fused quartz element | |
CN103728315B (en) | Heavy-calibre element surface detection apparatus and damage accordingly method for rapidly positioning | |
CN101458072A (en) | Three-dimensional contour outline measuring set based on multi sensors and measuring method thereof | |
CN1115546C (en) | Surface three-dimensional appearance testing method and equipment | |
CN102607820B (en) | Method for measuring focal length of micro-lens array | |
CN104111485A (en) | Stereo imaging based observation method for raindrop size distribution and other rainfall micro physical characteristics | |
CN106873142B (en) | High-quality image acquisition device and method of tubercle bacillus detector | |
CN105783769A (en) | System and method for measuring gear 3D profile based on line laser scanning | |
CN107103604B (en) | A kind of particulate coloration auto-clustering analysis system | |
CN104181685A (en) | Automatic digital slide focusing device and method based on microscope | |
CN102095375B (en) | Method for measuring displacement along optical axis direction by using contrasts of three primary colors as characteristics | |
CN101458156B (en) | Measuring method of modulation transfer function value | |
CN202304767U (en) | Three-dimensional outline measurement device based on multiple sensors | |
CN102095374B (en) | Method and device for measuring displacement along optical axis direction by using peaks and valleys of three primary colors as characteristics | |
CN101865721A (en) | New method for automatically measuring weight of propeller blades | |
CN104515473A (en) | Online diameter detection method of varnished wires | |
CN104123728A (en) | Hough transform based round pipe detection method | |
CN102102983B (en) | Method and device for measuring displacement along direction of optical axis by using single primary color peaks and valleys as characteristic | |
CN108540723A (en) | More camera lenses for Active Imaging calculate synchronisation control means | |
CN102116606B (en) | Method and device for measuring axial displacement by taking one-dimensional three-primary-color peak valley as characteristic | |
CN102494640B (en) | Mounting precision detector of infrared product | |
CN107907049A (en) | A kind of measuring method of small gear | |
CN110310371B (en) | Method for constructing three-dimensional contour of object based on vehicle-mounted monocular focusing sequence image | |
CN102102980B (en) | Method and device for measuring axial displacement by using sing primary color contrast as characteristic |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C53 | Correction of patent for invention or patent application | ||
CB03 | Change of inventor or designer information |
Inventor after: Zeng Yi Inventor before: Zeng Yi Inventor before: Zhang Haiming Inventor before: Du Juan |
|
COR | Change of bibliographic data |
Free format text: CORRECT: INVENTOR; FROM: CENG YI ZHANG HAIMING DU JUAN TO: CENG YI |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20130612 Termination date: 20141221 |
|
EXPY | Termination of patent right or utility model |