Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiment of the present invention is described further in detail below in conjunction with accompanying drawing.
Embodiment 1
As shown in Figure 1, the embodiment of the invention provides a kind of binocular vision sensor, comprises binocular camera 1 and control circuit board 2 two parts:
Binocular camera 1 links to each other with control circuit board 2, and 1 pair of same object of binocular camera is taken, and obtains two width of cloth images.Control circuit board 2 obtains image from binocular camera 1, and the image that obtains is carried out three-dimensional measurement, can also demarcate binocular camera 1 according to the image that obtains.
Wherein, binocular camera 1 comprises left video camera 11 and right video camera 12, and left video camera 11 and right video camera 12 take same object simultaneously, and wherein, left video camera 11 and right video camera 12 photograph analog picture signal separately.
Wherein, be embedded in AD conversion unit 21, AD conversion unit 22, field programmable gate array unit 23, digital signal processing unit 24 and storage unit 25 at control circuit board 2.AD conversion unit 21 links to each other with the left video camera 11 that binocular camera 1 comprises, AD conversion unit 22 links to each other with the right video camera 12 that binocular camera 1 comprises, and AD conversion unit 21 all links to each other with field programmable gate array unit 23 with 22, field programmable gate array unit 23 links to each other with digital signal processing unit 24, and digital signal processing unit 24 links to each other with storage unit 25 again.
AD conversion unit 21 and AD conversion unit 22 are obtained analog picture signal respectively from left video camera 11 and right video camera 12, convert the analog picture signal that obtains separately to two width of cloth digital pictures.
Field programmable gate array unit 23 obtains two width of cloth digital pictures from AD conversion unit 21 and AD conversion unit 22, move the image preprocessor of self two width of cloth digital pictures are carried out filtering, filter out the part noise in two width of cloth digital pictures, give digital signal processing unit 24 two width of cloth Digital Image Transmission of filtering.
Two width of cloth digital pictures of digital signal processing unit 24 receiving filtrations, from storage unit 25, obtain the binocular vision 3 D measurement algorithm, according to left video camera matrix and right shooting matrix, the binocular vision 3 D measurement algorithm that operation is obtained carries out three-dimensional measurement to the target in two width of cloth images.
The data that storage unit 25 is used to store binocular vision 3 D measurement algorithm, system configuration information, generate during by digital signal processing unit 24 working procedures.
Further, control circuit board 2 also comprises digital I/O unit 26, and wherein, digital I/O unit 26 links to each other with digital signal processing unit 24, is used to import outside switching value.Can carry out the data communication of switching value with the outside by digital I/O unit.
Further, control circuit board 2 also comprises network communication unit 27, and wherein, network communication unit 27 links to each other with digital signal processing unit 24, is used for communicating by letter with outer net, can make binocular sensor and outer net carry out data interaction.
Further, control circuit board 2 also comprises display unit 28, and wherein, display unit 28 links to each other with digital signal processing unit 24, is used to show image, duty, the result of demarcation and the result of three-dimensional measurement of collection.
Further, control circuit board 2 also comprises serial communication unit 29, and wherein, serial communication unit 29 links to each other with digital signal processing unit, is used for communicating by letter with host computer, makes binocular vision sensor and host computer carry out data interaction.
Further, storage unit 25 also is used to store calibrating procedure;
Correspondingly, digital signal processing unit 24 also is used for obtaining calibrating procedure from storage unit 25, by the operation calibrating procedure binocular camera 1 is demarcated, and obtains left video camera matrix and right video camera matrix.
Be illustrated in figure 2 as the annexation figure of binocular camera 1 and AD conversion unit 21 and AD conversion unit 22.AD conversion unit 21 links to each other with right video camera 12 with the left video camera 11 of binocular camera 1 respectively with AD conversion unit 22.
AD conversion unit 21 is obtained PAL/NTSC (Phase Alternating Line/National Television System Committee from left video camera 11, inverted image quadrature amplitude balance system/quadrature amplitude balance system line by line) analog picture signal of standard, and convert this analog picture signal to digital picture.AD conversion unit 21 is at video control clock line F_VP0C[0:3] in the effect of clock signal under, by video data line F_VP0D[0:9] give field programmable gate array unit 23 with Digital Image Transmission, wherein, video control clock line F_VP0C[0:3] clock signal provide by field programmable gate array unit 23.
AD conversion unit 22 is obtained the analog picture signal of PAL/NTSC standard from right video camera 12, and converts this analog picture signal to digital picture.AD conversion unit 22 is at video control clock line F_VP1C[0:3] in the effect of clock signal under, by video data line F_VP1D[0:9] give field programmable gate array unit 23 with Digital Image Transmission, wherein, video control clock line F_VP1C[0:3] clock signal provide by field programmable gate array unit 23.
Wherein, AD conversion unit comprises modulus conversion chip or picture decoding chip etc., and AD conversion unit 21 and 22 all needs power supply to power and crystal oscillator provides clock, and power supply can provide 1.8v and two kinds of voltages of 3.3v.
Be illustrated in figure 3 as field programmable gate array unit 23 synoptic diagram in the control circuit board 2 that present embodiment provides.Field programmable gate array unit 23 comprises online download jtag2 interface, in-circuit emulation jtag1 interface, gate array configuration flash memory E2PROM, high speed signal processing unit configuration flash memory E2PROM, four way word output interface FPGA_OUT[1:4] and four way word input interface FPGA_IN[1:4].
Wherein, online download jtag2 interface is used for the download images preprocessor, and program burn writing is disposed flash memory E2PROM to gate array, and wherein, this gate array configuration flash memory E2PROM can preserve the image preprocessor under the situation of outage.
In-circuit emulation jtag1 interface is used for the image preprocessor is carried out on-line debugging.
Field programmable gate array configuration flash memory E2PROM is used to store the image preprocessor that online download jiag2 interface is downloaded.
High speed signal processing unit configuration flash memory E2PROM is used for storage system configuration information.
Field programmable gate array unit 23 is by video control clock line F_VP0C[0:3] and video data line F_VP0D[0:9] from AD conversion unit 21, obtain digital picture, by video control clock line F_VP1C[0:3] and video data line F_VP1D[0:9] from AD conversion unit 22, obtain digital picture, the reading images preprocessor is carried out filtering to two width of cloth digital pictures of obtaining from gate array configuration flash memory E2PROM, filter out the part noise, again by video control line VP0C[0:4] and VP0C[0:4] and video data line VP0D[0:9] and VP0D[0:9] digital signal processing unit 24 given with filtered two width of cloth Digital Image Transmission.
The detailed process that field programmable gate array unit 23 carries out filtering by the operation image preprocessor to two width of cloth digital pictures is: because the processing procedure that two width of cloth digital pictures are handled is identical, for convenience of explanation, only the processing procedure at wherein a width of cloth digital picture describes, its processing procedure is specially: from this digital picture is divided into several squares, by FPGA (Field Programmable Gate Array, field programmable gate array) hardware programming produces CPU (the Central Processing Unit of respective amount, central authorities handle junior unit), concurrently each square is carried out filtering, filter out the part noise in the square, the square that filters is assembled into filtered image, wherein, another width of cloth digital picture is also carried out filtering by above-mentioned same method, and field programmable gate array unit 23 is simultaneously two width of cloth digital pictures to be carried out filtering.
Wherein, field programmable gate array unit 23 filters out the part noise in two width of cloth digital pictures, can share the part work of high-speed digital signal processing unit 24, improves the speed that the binocular vision 3 D measurement sensor carries out three-dimensional measurement.
Data in the field programmable gate array unit 23 also can be passed through data bus AED[0:31], address bus AEA[3:22], byte gate bus ABE[0:3] visited by digital signal processing unit 24.
Field programmable gate array unit 23 has disposed four way word output interface FPGA_OUT[1:4] and four way word input interface FPGA_IN[1:4], be used to realize that field programmable gate array unit 23 is mutual with the switching value data of external unit, then through data bus AED[0:31], address bus AEA[3:22] and byte gate bus ABE[0:3] visited by digital signal processing unit 24.
Field programmable gate array unit 23 needs power supply power supply and crystal oscillator that clock is provided.
The connection diagram of the digital signal processing unit 24 in the control circuit board 2 that Fig. 4 provides for the embodiment of the invention, network communication unit 27, display unit 28.
Digital signal processing unit 24 comprises that three video ports are respectively 0 video port, 1 video port and 2 video ports, online download and emulation interface jtag, universal I/O port GP0[4:15].
Wherein, online download and emulation interface jtag are used to download calibrating procedure and binocular vision 3 D measurement algorithm, and the program of downloading is carried out on-line debugging.
0 video port is by video control signal line VP0C[0:4] and video data line VP0D[0:9] link to each other with field programmable gate array unit 23, be used to transmit a filtered digital picture.
1 video port is by video control signal line VP1C[0:4] and video data line VP1D[0:9] link to each other with field programmable gate array unit 23, be used to transmit another filtered digital picture.
2 video ports are by video control signal line VP2C[0:4] and video data line VP2D[0:9] link to each other with display unit 28, be used for the result that digital signal processing unit 24 produces is shown.
Universal I/O port GP0[4:15], in FPGA, decipher the generation chip selection signal.Among Fig. 4, provide clock at crystal oscillator, power supply provides under required 3.3V of work and the effect of 1.4V voltage, digital signal processing unit 24 is by address bus AEA[3:22], data bus AED[0:63], byte enable bus ABE[0:7] and universal I/O port GP0[4:15] the outer peripheral hardware resource of visit sheet, for example the field programmable gate array unit 24, storage unit 28 and serial communication unit 29.Wherein, supply voltage is by watch dog monitoring, in case power supply occurs unusual or when powering on, the house dog reset pin that will set out makes digital signal processing unit 24 enter reset mode, and is normal up to power up.
Digital signal processing unit 24 links to each other with network communication unit 27 by the network data control line, thereby can realize and outside network service.
Network communication unit 27 comprises network physical interface chip and RJ45 joint, be used to realize high-speed digital signal processing unit 24 and outside network service, the network layer communication agreement is TCP/IP (Transmission Control Protocol/Internet Protocol, a transmission control protocol/the Internet interconnection protocol).
Display unit 28 comprises video coding chip and VGA interface.Video coding chip is by video control line VP2C[0:4] and video data line VP2D[0:9] link to each other with 2 video ports of digital signal processing unit 24, be used for converting analog picture signal to, and pass through the demonstration of VGA interface handling an image result.
In addition, digital signal processing unit also needs the outer storage unit 25 of sheet.Storage unit 25 comprises FLASH (flash memory space of program and data during inoperative), RAM (the random-access memory space of program and data during operation).
The structural representation of the FLASH that provides for present embodiment as shown in Figure 5.Flash capacity among Fig. 5 is the 32Mb capacity, by 8 position datawire AED[0:7], address bus AEA[3:22], chip selection signal CE1 links to each other with digital signal processing unit 24.Wherein, FLASH is used to store binocular vision 3 D measurement algorithm and calibrating procedure.
The structural representation of the RAM that provides for present embodiment as shown in Figure 6.RAM capacity among Fig. 6 is formed 32MB by RAM1 and the RAM2 of two 16MB, by 64 position datawire AED[0:63], address bus AEA[3:22], chip selection signal CE0, and byte enable signal ABE[0:7] link to each other with digital signal processing unit 24.The RAM type is SDRAM, and required clock is provided by digital signal processing unit 24.
In addition, digital signal processing unit 24 also links to each other with serial communication unit 29.The structural representation of the serial communication unit 29 that provides for present embodiment as Fig. 7.Serial communication unit 29 is by address bus AEA[3:5] with address sum AEA[0:7] communicate by letter with digital signal processing unit.Serial communication unit 29 adopts and changes serial connection mouthful chip realization and string conversion, and the serial signal of the Transistor-Transistor Logic level after the conversion converts RS485/RS232 form level to by two 485/322 physical interface chip, realizes serial communication.The serial ports chip selection signal of field programmable gate array unit 23 links to each other with the choosing of the serial ports sheet of serial communication unit 29, the serial ports that is used for gating serial communication unit 29. serial communication unit 29 interrupts linking to each other with the serial ports look-at-me of field programmable gate array unit 23, sends the look-at-me of serial communication to field programmable gate array unit 23.
In embodiments of the present invention, AD conversion unit 21 and 22, field programmable gate array unit 23, digital signal processing unit 24 and storage unit 25 all are embedded in the control circuit board 2, make the volume of binocular vision sensor become very little, reduced power consumption and price; Digital signal processing unit 24 computing powers are powerful, do not need the support of operating system, can directly move the binocular vision 3 D measurement algorithm, improved the speed of three-dimensional measurement; Adopt the 23 pairs of images in field programmable gate array unit to carry out parallel filtering, further improve the speed of three-dimensional measurement.
Embodiment 2
As shown in Figure 8, the sensor of the binocular vision 3 D measurement that provides based on embodiment 1, the embodiment of the invention provides a kind of method of binocular vision 3 D measurement, comprising:
Step 101: collect the two-way analog picture signal about 1 pair of same object of binocular camera carries out;
Particularly, left video camera 11 and right video camera 12 that binocular camera 1 comprises are gathered same object simultaneously, obtain analog picture signal separately.
For example, utilize left video camera 11 that binocular camera 1 comprises and right video camera 12 simultaneously as shown in Figure 9 square objects A to be gathered, obtain two-way analog picture signal S1 and S2.
Step 102: the AD conversion unit 21 and 22 in the control circuit board 2 is obtained the two-way analog picture signal respectively from left video camera 11 and right video camera 12, and the analog picture signal that will obtain separately respectively converts two width of cloth digital pictures to, is transferred to field programmable gate array unit 23;
Wherein, AD conversion unit 21 is at video control clock line F_VP0C[0:3] in the effect of clock signal under, by video data line F_VP0D[0:9] give field programmable gate array unit 23 with Digital Image Transmission, wherein, video control clock line F_VP0C[0:3] clock signal provide by field programmable gate array unit 23; AD conversion unit 22 is at video control clock line F_VP1C[0:3] in the effect of clock signal under, by video data line F_VP1D[0:9] give field programmable gate array unit 23 with Digital Image Transmission, wherein, video control clock line F_VP1C[0:3] clock signal provide by field programmable gate array unit 23.
For example, AD conversion unit 21 and 22 in the control circuit board 2 is obtained analog picture signal S1 and S2 respectively from left video camera 11 and right video camera 12, and convert analog picture signal S1 and S2 to digital picture D1 and D2 respectively, simultaneously digital picture D1 and D2 are transferred out field programmable gate array unit 23.
Step 103: field programmable gate array unit 23 receives two width of cloth digital pictures, and digital picture is carried out filtering, gives digital signal processing unit 24 with filtered two width of cloth Digital Image Transmission;
Particularly, field programmable gate array unit 23 receives two width of cloth digital pictures from AD conversion unit 21 and 22 transmission, at a width of cloth digital picture wherein, the square that this digital picture is divided into some, field programmable gate array unit 23 generates the CPU identical with square quantity by hardware programming, parallel carries out filtering to each square, filters out the part noise in the square, and the square with filtering is reassembled into filtered digital picture again.Field programmable gate array unit 23 also carries out filtering in the same way to another width of cloth digital picture, and simultaneously two width of cloth digital pictures is carried out filtering.
For example, field programmable gate array unit 23 receives digital picture A1 and the A2 from AD conversion unit 21 and 22 transmission, shown in image 10, respectively A1 and A2 are divided into a plurality of squares, each square is carried out filtering, filter out the part noise in the square, again the square of filtering is reformulated filtered digital picture A1 and A2, and filtered digital picture A1 and A2 are transferred to digital signal processing unit 24.
In addition, at this moment, the digital signal processing unit 24 of control circuit board 2 obtains the binocular vision 3 D measurement algorithm from storage unit 25, begins to carry out following steps this two width of cloth image is carried out three-dimensional measurement.
Step 104: digital signal processing unit 24 receives two width of cloth digital pictures;
For example, digital signal processing unit 24 receptions are from two width of cloth digital picture A1 and A2 of field programmable gate array unit 23.
Step 105: digital signal processing unit 24 obtains angle point in all that the target in every width of cloth digital picture comprises respectively from two width of cloth digital pictures;
Wherein, interior angle point is the intersection point on many limits in the digital picture, and particularly, the scanning digital image is determined in the target intersection point on all two or more limit, with the intersection point determined as interior angle point.Wherein, a real intersection point in all corresponding object of angle point in each.
For example, hypothetical target is square objects A, scanning two width of cloth digital picture A1 and A2 as shown in figure 10, all interior angle points that obtain the target in the A1 image are respectively the E1 of B1, C1, D1, and all interior angle points that obtain the target in the A2 image are respectively the E2 of B2, C2, D2.Wherein, the corresponding real intersection points B of interior angle point B1 and B2, the corresponding real intersection point C of interior angle point C1 and C2, the corresponding real intersection point D of interior angle point D1 and D2, the corresponding real intersection point E of interior angle point E1 and E2.
Step 106: digital signal processing unit 24 adopts existing matching algorithm, to about interior angle point in two width of cloth digital pictures mate, corners Matching is right in obtaining;
Wherein, matching algorithm is according to the gradient feature around the interior angle point, to about interior angle point in two width of cloth images mate, coupling is to the same intersection point in two interior angle point homologue bodies that comprise.
For example, adopt matching algorithm that two width of cloth images shown in 10 figure are mated, the interior corners Matching that obtains is to being respectively<B1 B2 〉,<C1, C2 〉,<D1, D2〉and<E1, E2 〉, and<B1, B2 〉,<C1, C2 〉,<D1, D2〉and<E1, E2〉intersection points B, C, D and the E among counterparty's shaped object A respectively.
Step 107: to the image coordinate that comprises angle point in each, left video camera matrix and right video camera matrix, obtain real intersection point the world coordinates in world coordinate system of this coupling to correspondence according to coupling.
Particularly, with the image coordinate m that mates the two interior angle points that comprise
1And m
r, and left and right cameras matrix P
1And P
rBe brought into formula (1), calculate the world coordinates M of coupling the real intersection point of correspondence.
Wherein, in step 107, obtain each coupling the world coordinates of the real intersection point of correspondence is the three-dimensional information that finally obtains.In addition, video camera is just set up an image coordinate system for the image of each video camera when images acquired, and therefore, each pixel in the image all has an image coordinate in image coordinate system.
For example, for the right<B1 of coupling, B2 〉, according to the image coordinate of interior angle point B1 and B2, left video camera matrix and right video camera matrix are by formula (1) acquisitions<B1, B2〉world coordinates of true intersection points B of correspondence.
In embodiments of the present invention, digital signal processing unit 24 does not need the support of operating system, can directly move the binocular vision 3 D measurement algorithm, has improved the speed of three-dimensional measurement; Adopt the 23 pairs of images in field programmable gate array unit to carry out filtering, can improve the speed of three-dimensional measurement.
Embodiment 3
As shown in figure 11, the embodiment of the invention provides a kind of method of demarcation, and wherein, left video camera matrix among the embodiment 2 and right video camera matrix are that the scaling method that provides by present embodiment is in advance demarcated binocular camera 1 and obtained, and this method comprises:
Step 201: digital signal processing unit 24 is determined the world coordinates in the alive boundary of the angle point coordinate system in each in the scaling board according to the scaling board parameter;
Scaling board as shown in figure 12 is made up of the black and white grid, and the scaling board parameter comprises the position of each grid on the directions X, the position of each grid on the Y direction and the grid length of side.The summit of each grid is interior angle point.According to the length of side of grid, and the position of this grid on position on the directions X and Y direction, determine the world coordinates of four interior angle points that this grid comprises.
Step 202: utilize left video camera 11 to gather several scaling board images from different perspectives, digital signal processing unit 24 scans every width of cloth images and read the image coordinate of angle point in all from every width of cloth image;
Wherein, left video camera has the coordinate system of self, and this coordinate system is based upon in the image of collection, and making all has an image coordinate system in the image of gathering, and makes that so each point in the image all has image coordinate.So far, obtain a world coordinates and the image coordinate of angle point in each.
Step 203: digital signal processing unit 24 by the Levenberg-Marquardt iterative algorithm, obtains the intrinsic parameter matrix A of left video camera according to the world coordinates and the image coordinate of angle point in each
1
Wherein, directly obtain the intrinsic parameter of left video camera, comprise the focal distance f of left video camera at directions X by the Levenberg-Marquardt iterative algorithm
X1, the focal distance f of left video camera on the Y direction
Y1, left video camera the coordinate (cx of photocentre in image coordinate system
1, cy
1), again these intrinsic parameters are formed the intrinsic parameter matrix A of left video camera
1, as shown in Equation (2).
So far, finished the demarcation of machine that a left side is taken the photograph.
Step 204: utilize right video camera to gather several scaling board images from different perspectives, digital signal processing unit 24 every width of cloth images of scanning and the image coordinate of angle point in all in the reading images from image;
Wherein, right video camera has the coordinate system of self, and this coordinate system is based upon in the image of collection, and making all has an image coordinate system in the image of gathering, and makes that so each point in the image all has image coordinate.So far, obtain a world coordinates and the image coordinate of angle point in each.
Step 205: digital signal processing unit 24 according to obtain from step 204 each in the world coordinates and the image coordinate of angle point, by the Levenberg-Marquardt iterative algorithm, obtain the intrinsic parameter matrix A of right video camera
r
Wherein, directly obtain the intrinsic parameter of right video camera, comprise the focal distance f of right video camera at directions X by the Levenberg-Marquardt iterative algorithm
Xr, the focal distance f of right video camera on the Y direction
Yr, the coordinate (cx in the coordinate system of the photocentre of right video camera in himself
r, cy
r), again these intrinsic parameters are formed right video camera matrix A
r, as shown in Equation (3).
So far, finished right Camera calibration.Wherein, can also demarcate right video camera earlier in the present embodiment, more left video camera be demarcated.
Step 206: two width of cloth scaling board images about utilizing left video camera 11 and right video camera 12 to gather respectively simultaneously, two width of cloth images about digital signal processing unit 24 scanning obtain the image coordinate of angle points in all that left image comprises and the image coordinate of right image comprises in all angle points;
Step 207: digital signal processing unit 24 is according to the world coordinates and the image coordinate of angle point in the scaling board all, by the Levenberg-Marquardt iterative algorithm, the outer parameter rotation matrix R and the translation matrix t of two video cameras about acquisition, as shown in Equation (4);
Step 208: digital signal processing unit 24 is according to the intrinsic parameter matrix A 1 of left video camera, the intrinsic parameter matrix A r of right video camera, and the outer parameter rotation matrix R and the translation matrix t of left and right cameras set up left video camera matrix P
1With right video camera matrix P
r
Particularly, the coordinate of regulation left side video camera is a world coordinate system, the left video camera matrix P of foundation
1With right video camera matrix P
r, as shown in Equation (5):
Or the coordinate of the right video camera of regulation is a world coordinate system, the left video camera matrix P of foundation
1With right video camera matrix P
r, as shown in Equation (6):
Wherein,
All or part of content in the technical scheme that above embodiment provides can realize that its software program is stored in the storage medium that can read by software programming, storage medium for example: the hard disk in the computing machine, CD or floppy disk.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.