CN101476882B - Three-dimensional detection method of structured light based on homography matrix - Google Patents
Three-dimensional detection method of structured light based on homography matrix Download PDFInfo
- Publication number
- CN101476882B CN101476882B CN2009100450106A CN200910045010A CN101476882B CN 101476882 B CN101476882 B CN 101476882B CN 2009100450106 A CN2009100450106 A CN 2009100450106A CN 200910045010 A CN200910045010 A CN 200910045010A CN 101476882 B CN101476882 B CN 101476882B
- Authority
- CN
- China
- Prior art keywords
- plane
- homography matrix
- camera
- matrix
- point
- 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
- Length Measuring Devices By Optical Means (AREA)
Abstract
一种计算机视觉技术领域的基于单应性矩阵的结构光三维检测方法,本发明中,利用棋盘格图案中的特征点获取相机成像面分别与平面P1和P2对应的单应性矩阵,同时在平面P1和P2上分别测定投影仪投影面和相机成像面对应的单应性矩阵,给定投影面上某条光栅的直线方程,根据单应性矩阵获得成像面和世界坐标系下的平面,并建立成像面和世界坐标系下平面之间的关系,并通过变换关系得到每条光栅在世界坐标系下的位置,从而获取三维信息。本发明可以简便的测量世界坐标,并避免了设备相关性问题,本发明在保证精度的条件下简化了三维检测的操作。
A homography matrix-based structured light three-dimensional detection method in the field of computer vision technology. In the present invention, the feature points in the checkerboard pattern are used to obtain the homography matrices corresponding to the camera imaging planes and planes P1 and P2 respectively, At the same time, the homography matrices corresponding to the projection plane of the projector and the imaging plane of the camera are measured on the planes P 1 and P 2 respectively, given the straight line equation of a certain grating on the projection plane, the imaging plane and the world coordinates are obtained according to the homography matrix The plane under the world coordinate system is established, and the relationship between the imaging surface and the plane under the world coordinate system is established, and the position of each grating in the world coordinate system is obtained through the transformation relationship, so as to obtain three-dimensional information. The invention can easily measure the world coordinates and avoid the problem of equipment correlation. The invention simplifies the operation of three-dimensional detection under the condition of ensuring the accuracy.
Description
技术领域technical field
本发明涉及一种计量技术领域的检测方法,具体是一种基于单应性矩阵的结构光三维检测方法。The invention relates to a detection method in the technical field of metrology, in particular to a three-dimensional detection method of structured light based on a homography matrix.
背景技术Background technique
物体的三维检测是计算机视觉研究的一个重要方向,它的目标就是获得目标物体表面几何形状的精确描述。结构光三维检测以其使用简单、测量精确、无破坏性的优点而获得了广泛的应用。结构光三维检测方法主要分为两个部分,第一部分是投影结构光并拍摄获得结构光图像,然后进行结构光解码得到结构光的图像二维信息;第二部分是根据投影仪、相机和目标物体的相对位置把结构光的图像二维信息转化为目标物体的三维信息。The three-dimensional detection of objects is an important direction of computer vision research, and its goal is to obtain an accurate description of the surface geometry of the target object. Structured light three-dimensional inspection has been widely used for its advantages of simple use, accurate measurement, and non-destructive. The three-dimensional detection method of structured light is mainly divided into two parts. The first part is to project the structured light and take pictures to obtain the structured light image, and then decode the structured light to obtain the two-dimensional information of the structured light image; the second part is based on the projector, camera and target. The relative position of the object converts the two-dimensional information of the structured light image into the three-dimensional information of the target object.
经对现有技术文献检索发现,Tsai R Y于在IEEE Journal of Robotics andAutomation(IEEE机器人与自动化杂志)(1987年)中一篇文章“A versatilecamera calibration technique for high-accuracy 3D machine visionmetrology using off-the-shelf TV cameras and lenses”(一种采用现货摄像头并在高精度3D机器视觉测量方面应用通用的摄像机标定技术)提出了一种结构光三维测量中第二部分的方法,主要是先对投影仪和相机进行标定,确定投影仪和相机焦点的位置,再根据三角测量的关系来计算得出目标物体的三维信息。这一方法在投影仪的标定时需要测量不规则特征点的世界坐标;需要厂商提供投影仪和相机相邻两个像素(横向和纵向)之间的实际距离;在投影仪和相机的标定时都要考虑投影仪和相机的焦距,而且计算的步骤比较多;在准备工作都完成后,由相片上某点(位于光栅上的点)的像素坐标得出其对应的物点的世界坐标的计算上比较繁杂,先要通过一个矩阵乘法得到这点的世界坐标,再求解这点和相机确定的直线方程,最后联立已经准备好的投影仪与光栅确定的平面方程,组成一个三元一次方程组,解这个方程组即可得到物点的世界坐标。After searching the prior art documents, it was found that Tsai R Y wrote an article "A versatile camera calibration technique for high-accuracy 3D machine vision metrology using off-the- -shelf TV cameras and lenses" (a common camera calibration technology using spot cameras and applying general-purpose camera calibration technology in high-precision 3D machine vision measurement) proposes a method for the second part of structured light 3D measurement, which is mainly to first test the projector Calibrate with the camera, determine the focus position of the projector and the camera, and then calculate the three-dimensional information of the target object according to the relationship of triangulation. This method needs to measure the world coordinates of irregular feature points when the projector is calibrated; the manufacturer needs to provide the actual distance between two adjacent pixels (horizontal and vertical) between the projector and the camera; when the projector and the camera are calibrated The focal length of the projector and the camera must be considered, and there are many calculation steps; after the preparations are completed, the pixel coordinates of a point on the photo (a point on the grating) can be used to obtain the world coordinates of the corresponding object point. The calculation is relatively complicated. First, the world coordinates of this point must be obtained through a matrix multiplication, and then the linear equation determined by this point and the camera is solved. Finally, the prepared projector and the plane equation determined by the grating are combined to form a ternary once Equations, solve this equations to get the world coordinates of the object point.
发明内容Contents of the invention
本发明是针对上述现有技术的不足,提出了一种基于单应性矩阵的结构光三维检测方法,使其将单应性矩阵运用到确定投影仪、相机和目标物体的相对位置的确定上,由相片上某点(位于光栅上的点)的像素坐标仅通过一个矩阵乘法即可得到物点的世界坐标,本发明在保证精度的条件下简化了三维检测的操作。The present invention aims at the deficiencies of the above-mentioned prior art, and proposes a three-dimensional detection method of structured light based on a homography matrix, so that it uses the homography matrix to determine the relative positions of projectors, cameras, and target objects , the world coordinates of the object point can be obtained from the pixel coordinates of a certain point on the photo (the point on the grating) only through a matrix multiplication, and the present invention simplifies the operation of three-dimensional detection under the condition of ensuring accuracy.
本发明是通过如下技术方案实现的,本发明包括如下步骤:The present invention is achieved through the following technical solutions, and the present invention comprises the following steps:
步骤一,在投影仪和摄像机之间设置互相平行的两个平面P1和P2,两个平面P1和P2在下述步骤中用于放置获取单应性矩阵的棋盘格图案,投影仪和平面P2之间设有带有光栅的投影面,投影仪和投影面上的一条光栅确定一个光平面;Step 1, two planes P 1 and P 2 parallel to each other are set between the projector and the camera, the two planes P 1 and P 2 are used to place the checkerboard pattern for obtaining the homography matrix in the following steps, the projector A projection surface with a grating is provided between the plane P2 , and a grating on the projector and the projection surface determines a light plane;
步骤二,利用棋盘格图案中的特征点获取相机成像面分别与平面P1和P2对应的单应性矩阵HCQ1和HCQ2,具体如下:Step 2, use the feature points in the checkerboard pattern to obtain the homography matrices H CQ1 and H CQ2 corresponding to the camera imaging plane and the planes P 1 and P 2 respectively, as follows:
首先,将棋盘格图案分别摆放在平面P1和P2上,然后用相机拍照,分别获得两幅图像;First, place the checkerboard pattern on the planes P 1 and P 2 respectively, and then take pictures with a camera to obtain two images respectively;
然后,测出棋盘格图像中的特征点的相对位置,取其中一个特征点作为世界坐标系的原点,其他特征点的坐标也就确定了,同时测出平面P1和P2之间的距离,即特征点在Z方向上的距离;Then, the relative position of the feature points in the checkerboard image is measured, and one of the feature points is taken as the origin of the world coordinate system, and the coordinates of other feature points are determined, and the distance between the planes P 1 and P 2 is measured at the same time , that is, the distance of the feature point in the Z direction;
最后,根据棋盘格图像中的特征点的像素坐标,获得相机成像面分别与平面P1和P2对应的单应性矩阵HCQ1和HCQ2,单应性矩阵使得平面P1或P2上任意一个点(x,y)在相机上成像的坐标(X,Y)满足如下关系:Finally, according to the pixel coordinates of the feature points in the checkerboard image, the homography matrices H CQ1 and H CQ2 corresponding to the camera imaging surface and the planes P 1 and P 2 are obtained respectively. The homography matrix makes the plane P 1 or P 2 The coordinates (X, Y) of any point (x, y) imaged on the camera satisfy the following relationship:
其中,(X,Y)为成像面中特征点的像素坐标,(x,y)为平面P1或P2中特征点的世界坐标。Among them, (X, Y) is the pixel coordinate of the feature point in the imaging plane, and (x, y) is the world coordinate of the feature point in the plane P1 or P2 .
所述将棋盘格图案分别摆放在平面P1和P2上,具体为:棋盘格图案在两个平面上的特征点在X和Y方向上的坐标相同,实现取其中一个特征点作为世界坐标系的原点,同时就能确定其他特征点的坐标,以方便测量。The checkerboard pattern is placed on the planes P1 and P2 respectively, specifically: the coordinates of the feature points of the checkerboard pattern on the two planes in the X and Y directions are the same, and one of the feature points is taken as the world At the same time, the coordinates of other feature points can be determined to facilitate measurement.
步骤三,利用棋盘格图案中的特征点在平面P1和P2上分别测定投影仪投影面和相机成像面对应的单应性矩阵HPC1和HPC2,具体如下:Step 3, use the feature points in the checkerboard pattern to measure the homography matrices H PC1 and H PC2 corresponding to the projection plane of the projector and the imaging plane of the camera on the planes P 1 and P 2 respectively, as follows:
首先,把棋盘格图像分别投影到平面P1和P2上,由相机拍照,分别获得两幅图像;First, project the checkerboard images onto the planes P 1 and P 2 respectively, take pictures with the camera, and obtain two images respectively;
然后,测量投影棋盘格图像和拍摄到的两幅图像上的棋盘格的特征点的像素坐标;Then, measure the pixel coordinates of the feature points of the checkerboard on the projected checkerboard image and the captured two images;
最后,采用与步骤二中相同形式的单应性矩阵,获得在平面P1和P2上投影仪投影面和相机成像面对应的单应性矩阵HPC1和HPC2。Finally, using the homography matrix in the same form as in step 2, the homography matrices HP PC1 and HP PC2 corresponding to the projection plane of the projector and the imaging plane of the camera on the planes P 1 and P 2 are obtained.
步骤四,给定投影面上某条光栅的直线方程,根据步骤三中的单应性矩阵HPC1、矩阵HPC2获得直线C11C12和直线C21C22,由直线C11C12和C21C22获得成像面C11C12C22C21;Step 4, given the straight line equation of a certain grating on the projection surface, according to the homography matrix H PC1 and matrix H PC2 in step 3, the straight line C 11 C 12 and the straight line C 21 C 22 are obtained, and the straight line C 11 C 12 and C 21 C 22 obtains the imaging plane C 11 C 12 C 22 C 21 ;
步骤五,根据步骤四求得的直线C11C12、直线C21C22和步骤二中的单应性矩阵HCQ1、矩阵HCQ2获得直线Q11Q12和直线Q21Q22,由直线Q11Q12和Q21Q22确定世界坐标系下的平面Q11Q12Q22Q21,平面Q11Q12Q22Q21是在三维空间的平面;Step 5, obtain straight line Q 11 Q 12 and straight line Q 21 Q 22 according to the straight line C 11 C 12 , straight line C 21 C 22 obtained in step 4 and the homography matrix H CQ1 and matrix H CQ2 in step 2. Q 11 Q 12 and Q 21 Q 22 determine the plane Q 11 Q 12 Q 22 Q 21 in the world coordinate system, and the plane Q 11 Q 12 Q 22 Q 21 is a plane in three-dimensional space;
步骤六,建立成像面C11C12C22C21和世界坐标系下平面Q11Q12Q22Q21之间的关系:(X,Y,1)T=R(Xw,Yw,Zw)T+T,其中,(X,Y)为成像面C11C12C22C21中的坐标,(Xw,Yw,Zw)为世界坐标系下平面Q11Q12Q22Q21中的坐标,R为旋转矩阵,T为平移向量,则步骤二中的公式(1)变换为:Step six, establish the relationship between the imaging plane C 11 C 12 C 22 C 21 and the plane Q 11 Q 12 Q 22 Q 21 in the world coordinate system: (X, Y, 1) T = R(X w , Y w , Z w ) T +T, where (X, Y) is the coordinates in the imaging plane C 11 C 12 C 22 C 21 , (X w , Y w , Z w ) is the plane Q 11 Q 12 Q in the world coordinate system 22 The coordinates in Q 21 , R is the rotation matrix, and T is the translation vector, then the formula (1) in step 2 is transformed into:
可见公式(2)中的3×4矩阵表示出两个面的变换关系。利用两个面上足够多的对应的特征点即可求得该3×4矩阵。It can be seen that the 3×4 matrix in formula (2) represents the transformation relationship between the two surfaces. The 3×4 matrix can be obtained by using enough corresponding feature points on the two surfaces.
步骤七,把目标物体放在平面P2上,投影结构光,拍摄得到含有结构光的一组图像,然后对结构光进行解码,区分出光栅的数目,获得光栅在有目标物体影响下在相机成像面上的位置;Step 7: Put the target object on the plane P2 , project the structured light, take a set of images containing structured light, and then decode the structured light to distinguish the number of gratings, and obtain the grating under the influence of the target object. The position on the imaging surface of the camera;
步骤八,在步骤七获得光栅在有物体影响下在相机成像面上的位置的基础上,获得到每条光栅各自确定的平面C11C12C22C21和Q11Q12Q22Q21,以及由平面C11C12C22C21(相机成像面坐标系)到平面Q11Q12Q22Q21(世界坐标系)映射的3×4矩阵,通过步骤六中的变换关系得到每条光栅在世界坐标系下的位置,从而获取三维信息。Step eight, on the basis of obtaining the position of the grating on the imaging plane of the camera under the influence of the object in step seven, obtain the planes C 11 C 12 C 22 C 21 and Q 11 Q 12 Q 22 Q 21 respectively determined by each grating , and the 3×4 matrix mapped from the plane C 11 C 12 C 22 C 21 (camera imaging surface coordinate system) to the plane Q 11 Q 12 Q 22 Q 21 (world coordinate system), and each The position of the raster in the world coordinate system to obtain three-dimensional information.
本发明中,投影仪和某条光栅确定的光平面和上述步骤五获得的平面Q11Q12Q22Q21完全重合,利用此特性,求出了平面Q11Q12Q22Q21就得到了投影仪和某条光栅确定的光平面,其中平面P2是将要摆放物品的目标平面,平面P1和P2平行,直线Q11Q12是平面P1和光平面的交线,直线Q21Q22是平面P2和光平面的交线。直线Q11Q12在相机上的成像是直线C11C12,直线Q21Q22在相机上的成像是直线C21C22。设平面Q11Q12Q22Q21上的弧线是光栅投影在某物品上形成的,则这条弧线在相机上的成像必为平面C11C12C22C21上的某条弧线。由上述描述可知存在一个3×4的矩阵使得平面C11C12C22C21和Q11Q12Q22Q21上的点一一对应,那么这个矩阵必能使得两平面上两条弧线上的点一一对应。也就是说,当这个的3×4矩阵已知时,指定虚弧线上一点(像素坐标),就能得到对应的实弧线上一点(世界坐标),这就达到了三维测量的目的。In the present invention, the optical plane determined by the projector and a certain grating completely coincides with the plane Q 11 Q 12 Q 22 Q 21 obtained in the above step 5. Using this characteristic, the plane Q 11 Q 12 Q 22 Q 21 is calculated and obtained The light plane determined by the projector and a certain grating, where the plane P 2 is the target plane where the items will be placed, the plane P 1 and P 2 are parallel, the straight line Q 11 Q 12 is the intersection line between the plane P 1 and the light plane, and the straight line Q 21 Q 22 is the intersection of the plane P 2 and the light plane. The imaging of the straight line Q 11 Q 12 on the camera is the straight line C 11 C 12 , and the imaging of the straight line Q 21 Q 22 on the camera is the straight line C 21 C 22 . Suppose the arc on the plane Q 11 Q 12 Q 22 Q 21 is formed by grating projection on an object, then the image of this arc on the camera must be an arc on the plane C 11 C 12 C 22 C 21 Wire. It can be seen from the above description that there is a 3×4 matrix that makes the points on the plane C 11 C 12 C 22 C 21 and Q 11 Q 12 Q 22 Q 21 one-to-one correspondence, then this matrix must be able to make two arcs on the two planes The points above correspond one by one. That is to say, when the 3×4 matrix is known, specifying a point (pixel coordinate) on the imaginary arc can get the corresponding point (world coordinate) on the real arc, which achieves the purpose of three-dimensional measurement.
与现有技术相比,本发明具有如下有益效果:Compared with the prior art, the present invention has the following beneficial effects:
1、本发明可以简便的测量世界坐标,现有技术方法在投影仪的标定时需要测量不规则特征点的世界坐标,而本发明方法只要测量规则特征点的世界坐标,例如使用的特征点是7×5=35个,现有技术方法需要测量35个特征点,而本发明方法只需测出2个后,再推算得到其他的特征点;1. The present invention can easily measure the world coordinates. The prior art method needs to measure the world coordinates of irregular feature points when the projector is calibrated, but the method of the present invention only needs to measure the world coordinates of regular feature points. For example, the feature points used are 7 * 5=35, the prior art method needs to measure 35 feature points, and after the method of the present invention only needs to measure 2, calculate and obtain other feature points again;
2、本发明不需要厂商提供投影仪和相机相邻两个像素(横向和纵向)之间的实际距离,即现有技术中的方法是与设备相关的,而本发明方法在这一方面避免了设备相关性问题;2. The present invention does not require the manufacturer to provide the actual distance between the two adjacent pixels (horizontal and vertical) of the projector and the camera, that is, the method in the prior art is related to equipment, and the method of the present invention avoids in this respect Fixed device dependency issues;
3、本发明省略了投影仪和相机焦距的繁杂运算过程,从而在这一方面也避免了设备相关性问题;3. The present invention omits the complicated calculation process of the focal length of the projector and the camera, thereby also avoiding the problem of device correlation in this aspect;
4、本发明中由相片上某点(位于光栅上的点)的像素坐标获得其对应的物点的世界坐标更为便捷,仅通过一个矩阵乘法即可得到物点的世界坐标,而现有技术方法先要通过一个矩阵乘法得到这点的世界坐标,再求解这点和相机确定的直线方程,最后联立已经准备好的投影仪与光栅确定的平面方程,组成一个三元一次方程组,解这个方程组即可得到物点的世界坐标。4. In the present invention, it is more convenient to obtain the world coordinates of the corresponding object point from the pixel coordinates of a certain point on the photo (the point on the grating), and the world coordinates of the object point can be obtained only by a matrix multiplication, while the existing The technical method first obtains the world coordinates of this point through a matrix multiplication, then solves the line equation determined by this point and the camera, and finally combines the prepared projector and the plane equation determined by the grating to form a ternary linear equation group. The world coordinates of the object point can be obtained by solving this system of equations.
附图说明Description of drawings
图1是本发明的工作原理示意图。Fig. 1 is a schematic diagram of the working principle of the present invention.
图2是本发明使用的真实的棋盘格;Fig. 2 is the real chessboard that the present invention uses;
图中,(a)是相机拍摄到的在P1平面上的真实的棋盘格,(b)是相机拍摄到的在P2平面上的真实的棋盘格。In the figure, (a) is the real checkerboard on the P 1 plane captured by the camera, and (b) is the real checkerboard on the P 2 plane captured by the camera.
图3是本发明中投影的棋盘格;Fig. 3 is the checkerboard of projection among the present invention;
图中,(a)是相机拍摄到的在P1平面上的投影棋盘格,(b)是相机拍摄到的在P2平面上的投影棋盘格。In the figure, (a) is the projection checkerboard on the P 1 plane captured by the camera, and (b) is the projection checkerboard on the P 2 plane captured by the camera.
图4是本发明中目标物体在结构光下的图像;Fig. 4 is the image of target object under structured light in the present invention;
图中,(a)是相机拍摄到的在P2平面上的在第一帧结构光影响下的物体,(b)是相机拍摄到的在P2平面上的在第二帧结构光影响下的物体,(c)是相机拍摄到的在P2平面上的在第三帧结构光影响下的物体,(d)是相机拍摄到的在P2平面上的在第四帧结构光影响下的物体,(e)是相机拍摄到的在P2平面上的在第五帧结构光影响下的物体,(f)是相机拍摄到的在P2平面上的在第六帧结构光影响下的物体,(g)是相机拍摄到的在P2平面上的在第七帧结构光影响下的物体。In the figure, (a) is the object captured by the camera under the influence of the first frame of structured light on the P2 plane, and (b) is the object captured by the camera on the P2 plane under the influence of the second frame of structured light (c) is the object captured by the camera on the P 2 plane under the influence of the third frame of structured light, (d) is the object captured by the camera on the P 2 plane under the influence of the fourth frame of structured light (e) is the object captured by the camera on the P 2 plane under the influence of the fifth frame of structured light, (f) is the object captured by the camera on the P 2 plane under the influence of the sixth frame of structured light (g) is the object captured by the camera on the P 2 plane under the influence of the structured light in the seventh frame.
图5是本发明中目标物体的三维轮廓;Fig. 5 is the three-dimensional outline of target object among the present invention;
图中,(a)是某个角度下目标物体的三维轮廓,(b)是另一角度下目标物体的三维轮廓。In the figure, (a) is the three-dimensional outline of the target object at a certain angle, and (b) is the three-dimensional outline of the target object at another angle.
具体实施方式Detailed ways
下面结合附图对本发明的实施例作详细说明:本实施例在以本发明技术方案为前提下进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings: this embodiment is implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operating procedures are provided, but the protection scope of the present invention is not limited to the following the described embodiment.
如图1所示,本实施例包括如下步骤:As shown in Figure 1, this embodiment includes the following steps:
步骤一,在投影仪和摄像机之间设置互相平行的两个平面P1和P2,两个平面P1和P2在下述步骤中用于放置获取单应性矩阵的棋盘格图案,投影仪和平面P2之间设有带有光栅的投影面,投影仪和投影面上的一条光栅确定一个光平面;Step 1, two planes P 1 and P 2 parallel to each other are set between the projector and the camera, the two planes P 1 and P 2 are used to place the checkerboard pattern for obtaining the homography matrix in the following steps, the projector A projection surface with a grating is provided between the plane P2 , and a grating on the projector and the projection surface determines a light plane;
步骤二,利用棋盘格图案中的特征点获取相机成像面分别与平面P1和P2对应的单应性矩阵HCQ1和HCQ2,具体如下:Step 2, use the feature points in the checkerboard pattern to obtain the homography matrices H CQ1 and H CQ2 corresponding to the camera imaging plane and the planes P 1 and P 2 respectively, as follows:
首先,将棋盘格图案分别摆放在平面P1和P2上,然后用相机拍照,分别获得两幅图像,如图2所示;First, place the checkerboard pattern on the planes P 1 and P 2 respectively, and then take pictures with a camera to obtain two images respectively, as shown in Figure 2;
然后,测出棋盘格图像中的特征点的相对位置,取其中一个特征点作为世界坐标系的原点,其他特征点的坐标也就确定了,同时测出平面P1和P2之间的距离,即特征点在Z方向上的距离;Then, the relative position of the feature points in the checkerboard image is measured, and one of the feature points is taken as the origin of the world coordinate system, and the coordinates of other feature points are determined, and the distance between the planes P 1 and P 2 is measured at the same time , that is, the distance of the feature point in the Z direction;
最后,根据棋盘格图像中的特征点的像素坐标,获得相机成像面分别与平面P1和P2对应的单应性矩阵HCQ1和HCQ2,单应性矩阵使得平面P1或P2上任意一个点(x,y)在相机上成像的坐标(X,Y)满足如下关系:Finally, according to the pixel coordinates of the feature points in the checkerboard image, the homography matrices H CQ1 and H CQ2 corresponding to the camera imaging surface and the planes P 1 and P 2 are obtained respectively. The homography matrix makes the plane P 1 or P 2 The coordinates (X, Y) of any point (x, y) imaged on the camera satisfy the following relationship:
其中,(X,Y)为成像面中特征点的像素坐标,(x,y)为平面P1或P2中特征点的世界坐标。Among them, (X, Y) is the pixel coordinate of the feature point in the imaging plane, and (x, y) is the world coordinate of the feature point in the plane P1 or P2 .
所述将棋盘格图案分别摆放在平面P1和P2上,具体为:棋盘格图案在两个平面上的特征点在X和Y方向上的坐标相同,实现取其中一个特征点作为世界坐标系的原点,同时就能确定其他特征点的坐标,以方便测量。The checkerboard pattern is placed on the planes P1 and P2 respectively, specifically: the coordinates of the feature points of the checkerboard pattern on the two planes in the X and Y directions are the same, and one of the feature points is taken as the world At the same time, the coordinates of other feature points can be determined to facilitate measurement.
步骤三,利用棋盘格图案中的特征点在平面P1和P2上分别测定投影仪投影面和相机成像面对应的单应性矩阵HPC1和HPC2,具体如下:Step 3, use the feature points in the checkerboard pattern to measure the homography matrices H PC1 and H PC2 corresponding to the projection plane of the projector and the imaging plane of the camera on the planes P 1 and P 2 respectively, as follows:
首先,把棋盘格图像分别投影到平面P1和P2上,由相机拍照,分别获得两幅图像,如图3所示;First, the checkerboard images are projected onto the planes P 1 and P 2 respectively, and the camera takes pictures to obtain two images respectively, as shown in Figure 3;
然后,测量投影棋盘格图像和拍摄到的两幅图像上的棋盘格的特征点的像素坐标,投影棋盘格图像和拍摄到的两幅图像上的棋盘格的特征点的像素坐标均能比较容易测得(可以电脑自动测得,也可以人工利用Photoshop之类的图像软件找出);Then, measure the pixel coordinates of the feature points of the checkerboard on the projected checkerboard image and the two images captured, and the pixel coordinates of the feature points of the checkerboard on the projected checkerboard image and the two images captured can be relatively easy Measured (it can be automatically measured by computer, or can be manually found out by using image software such as Photoshop);
最后,采用与步骤二中相同形式的单应性矩阵,获得在平面P1和P2上投影仪投影面和相机成像面对应的单应性矩阵HPC1和HPC2。Finally, using the homography matrix in the same form as in step 2, the homography matrices HP PC1 and HP PC2 corresponding to the projection plane of the projector and the imaging plane of the camera on the planes P 1 and P 2 are obtained.
步骤四,给定投影面上某条光栅的直线方程,根据步骤三中的单应性矩阵HPC1、矩阵HPC2获得直线C11C12和直线C21C22,由直线C11C12和C21C22获得成像面C11C12C22C21;Step 4, given the straight line equation of a certain grating on the projection surface, according to the homography matrix H PC1 and matrix H PC2 in step 3, the straight line C 11 C 12 and the straight line C 21 C 22 are obtained, and the straight line C 11 C 12 and C 21 C 22 obtains the imaging plane C 11 C 12 C 22 C 21 ;
步骤五,根据步骤四求得的直线C11C12、直线C21C22和步骤二中的单应性矩阵HCQ1、矩阵HCQ2获得直线Q11Q12和直线Q21Q22,由直线Q11Q12和Q21Q22确定世界坐标系下的平面Q11Q12Q22Q21,平面Q11Q12Q22Q21是在三维空间的平面;Step 5, obtain straight line Q 11 Q 12 and straight line Q 21 Q 22 according to the straight line C 11 C 12 , straight line C 21 C 22 obtained in step 4 and the homography matrix H CQ1 and matrix H CQ2 in step 2. Q 11 Q 12 and Q 21 Q 22 determine the plane Q 11 Q 12 Q 22 Q 21 in the world coordinate system, and the plane Q 11 Q 12 Q 22 Q 21 is a plane in three-dimensional space;
步骤六,建立成像面C11C12C22C21和世界坐标系下平面Q11Q12Q22Q21之间的关系:(X,Y,1)T=R(Xw,Yw,Zw)T+T,其中,(X,Y)为成像面C11C12C22C21中的坐标,(Xw,Yw,Zw)为世界坐标系下平面Q11Q12Q22Q21中的坐标,R为旋转矩阵,T为平移向量,则步骤二中的公式(1)变换为:Step six, establish the relationship between the imaging plane C 11 C 12 C 22 C 21 and the plane Q 11 Q 12 Q 22 Q 21 in the world coordinate system: (X, Y, 1) T = R(X w , Y w , Z w ) T +T, where (X, Y) is the coordinates in the imaging plane C 11 C 12 C 22 C 21 , (X w , Y w , Z w ) is the plane Q 11 Q 12 Q in the world coordinate system 22 The coordinates in Q 21 , R is the rotation matrix, and T is the translation vector, then the formula (1) in step 2 is transformed into:
可见公式(2)中的3×4矩阵表示出两个面的变换关系。利用两个面上足够多的对应的特征点即可求得该3×4矩阵。It can be seen that the 3×4 matrix in formula (2) represents the transformation relationship between the two surfaces. The 3×4 matrix can be obtained by using enough corresponding feature points on the two surfaces.
步骤七,把目标物体放在平面P2上,投影结构光,拍摄得到含有结构光的一组图像(如图4所示),然后对结构光进行解码,区分出光栅的数目,本实施例中共有27条光栅,获得光栅在有目标物体影响下在相机成像面上的位置;Step 7, put the target object on the plane P2 , project the structured light, take a group of images containing structured light (as shown in Figure 4), and then decode the structured light to distinguish the number of gratings. This implementation In the example, there are 27 gratings in total, and the position of the grating on the imaging surface of the camera under the influence of the target object is obtained;
所述对结构光进行解码,具体为:根据图像的数目设定相应位数的二进制数,图像中的任意点区域设置相应的二进制数字,该数字表示它属于哪个光栅,比如:图4(a)(b)两幅图,第一幅图只有两个区域黑和白,第二幅图有四个黑白区域,可以用两位的二进制数表示并且区分这4个区域——(00,01,10,11),0表示黑色,1表示白色,第一位表示第一幅图,第二位表示第二幅图(区域01第一位是0表示这个区域在第一幅图里是黑色,第二位是1表示这个区域在第二幅图里是白色)。图4中共有7幅图,所以,则要选用7位的二进制数。The decoding of the structured light is specifically: according to the number of images, the binary number of the corresponding number of digits is set, and the corresponding binary number is set in any point area in the image, and the number indicates which grating it belongs to, such as: Figure 4 (a )(b) Two pictures, the first picture has only two areas black and white, the second picture has four black and white areas, which can be represented by two-digit binary numbers and distinguish these 4 areas——(00, 01 , 10, 11), 0 means black, 1 means white, the first bit means the first picture, and the second bit means the second picture (the first bit of area 01 is 0 means that this area is black in the first picture , the second bit is 1, indicating that this area is white in the second picture). There are 7 pictures in Fig. 4, therefore, a 7-bit binary number should be selected.
步骤八,在步骤七获得光栅在有物体影响下在相机成像面上的位置的基础上,获得到每条光栅各自确定的平面C11C12C22C21和Q11Q12Q22Q21,以及由平面C11C12C22C21(相机成像面坐标系)到平面Q11Q12Q22Q21(世界坐标系)映射的3×4矩阵,通过步骤六中的变换关系得到每条光栅在世界坐标系下的位置,从而获取三维信息。Step eight, on the basis of obtaining the position of the grating on the imaging plane of the camera under the influence of the object in step seven, obtain the planes C 11 C 12 C 22 C 21 and Q 11 Q 12 Q 22 Q 21 respectively determined by each grating , and the 3×4 matrix mapped from the plane C 11 C 12 C 22 C 21 (camera imaging surface coordinate system) to the plane Q 11 Q 12 Q 22 Q 21 (world coordinate system), and each The position of the raster in the world coordinate system to obtain three-dimensional information.
如图5所示,是分别从两个角度看过去的效果,一条白线就是一条光栅,由所有的光栅形成的白线就能构建出目标物体的三维轮廓。As shown in Figure 5, it is the effect of looking at the past from two angles. A white line is a grating, and the white line formed by all the gratings can construct the three-dimensional outline of the target object.
本实施例方法可以简便的测量世界坐标,并避免了设备相关性问题,在保证精度的条件下简化了三维检测的操作。The method of this embodiment can easily measure the world coordinates, avoid the problem of device correlation, and simplify the operation of three-dimensional detection under the condition of ensuring accuracy.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100450106A CN101476882B (en) | 2009-01-08 | 2009-01-08 | Three-dimensional detection method of structured light based on homography matrix |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100450106A CN101476882B (en) | 2009-01-08 | 2009-01-08 | Three-dimensional detection method of structured light based on homography matrix |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101476882A CN101476882A (en) | 2009-07-08 |
CN101476882B true CN101476882B (en) | 2010-07-28 |
Family
ID=40837629
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009100450106A Expired - Fee Related CN101476882B (en) | 2009-01-08 | 2009-01-08 | Three-dimensional detection method of structured light based on homography matrix |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101476882B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103697811B (en) * | 2013-12-18 | 2016-08-17 | 同济大学 | A kind of camera is combined the method obtaining contour of object three-dimensional coordinate with structure light source |
EP3236286B1 (en) * | 2016-04-18 | 2023-01-25 | Otis Elevator Company | Auto commissioning system and method |
CN109443245B (en) * | 2018-11-09 | 2020-05-26 | 扬州市职业大学 | Multi-line structured light vision measurement method based on homography matrix |
CN109443209B (en) * | 2018-12-04 | 2019-12-31 | 四川大学 | A Calibration Method of Line Structured Light System Based on Homography Matrix |
CN109827521B (en) * | 2019-03-11 | 2020-08-07 | 烟台大学 | A fast multi-line structured light vision measurement system calibration method |
CN112050751B (en) * | 2020-07-17 | 2022-07-22 | 深圳大学 | Projector calibration method, intelligent terminal and storage medium |
CN112050752B (en) * | 2020-09-02 | 2022-03-18 | 苏州东方克洛托光电技术有限公司 | Projector calibration method based on secondary projection |
CN112630469B (en) * | 2020-12-07 | 2023-04-25 | 清华大学深圳国际研究生院 | Three-dimensional detection method based on structured light and multiple light field cameras |
-
2009
- 2009-01-08 CN CN2009100450106A patent/CN101476882B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101476882A (en) | 2009-07-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101476882B (en) | Three-dimensional detection method of structured light based on homography matrix | |
CN111750806B (en) | A multi-view three-dimensional measurement system and method | |
Anwar et al. | Projector calibration for 3D scanning using virtual target images | |
CN106056587B (en) | Full view line laser structured light three-dimensional imaging caliberating device and method | |
CN104376558B (en) | Cuboid-based intrinsic parameter calibration method for Kinect depth camera | |
Niola et al. | A method for the calibration of a 3-D laser scanner | |
CN106408556B (en) | A Calibration Method for Small Object Measurement System Based on General Imaging Model | |
CN103115613B (en) | Three-dimensional space positioning method | |
Song et al. | Use of LCD panel for calibrating structured-light-based range sensing system | |
CN105180841B (en) | A kind of new micro element three-dimension measuring system and its measuring method | |
Bouguet et al. | Camera calibration from points and lines in dual-space geometry | |
CN106643563B (en) | A kind of Table top type wide view-field three-D scanning means and method | |
JP2009139246A (en) | Device, method and program for processing image, position detecting device and moving body equipped with this | |
CN103530880A (en) | Camera calibration method based on projected Gaussian grid pattern | |
KR101589167B1 (en) | System and Method for Correcting Perspective Distortion Image Using Depth Information | |
CN102538708A (en) | Measurement system for three-dimensional shape of optional surface | |
CN102878948A (en) | Visual measuring device and visual measuring method for coordinates of surface of target based on round light spot marks | |
CN107167118A (en) | It is a kind of based on the parallel multi-thread stable real time laser measuring method of non-coding | |
CN115082538A (en) | 3D reconstruction system and method of multi-vision gimbal parts surface based on line structured light projection | |
JP2017098859A (en) | Calibration device of image and calibration method | |
CA2956319A1 (en) | Calibration for 3d imaging with a single-pixel camera | |
Zheng et al. | Calibration of linear structured light system by planar checkerboard | |
KR20200046789A (en) | Method and apparatus for generating 3-dimensional data of moving object | |
CN118397108B (en) | A calibration method for combining underwater acoustic and optical information | |
Garcia et al. | Geometric calibration for a multi-camera-projector system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20100728 Termination date: 20160108 |