[go: up one dir, main page]

CN102022983A - Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame - Google Patents

Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame Download PDF

Info

Publication number
CN102022983A
CN102022983A CN 200910190926 CN200910190926A CN102022983A CN 102022983 A CN102022983 A CN 102022983A CN 200910190926 CN200910190926 CN 200910190926 CN 200910190926 A CN200910190926 A CN 200910190926A CN 102022983 A CN102022983 A CN 102022983A
Authority
CN
China
Prior art keywords
frame
correlation
comparison window
pixel
matching
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.)
Granted
Application number
CN 200910190926
Other languages
Chinese (zh)
Other versions
CN102022983B (en
Inventor
曾艺
朱超平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Technology and Business University
Original Assignee
Chongqing Technology and Business University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Chongqing Technology and Business University filed Critical Chongqing Technology and Business University
Priority to CN 200910190926 priority Critical patent/CN102022983B/en
Publication of CN102022983A publication Critical patent/CN102022983A/en
Application granted granted Critical
Publication of CN102022983B publication Critical patent/CN102022983B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

以对比度为特征帧匹配测量二维位移的方法及装置,由一个计算机摄像头与一台普通的计算机组成;先在参考帧内提取一个轴向的边方向数据,作为被测物体反射图像的对比度特征,通过计算该边方向数据的自关联系数,查看被测物反射面的质地细节,选取合适的比较窗像素阵列;然后与取样帧进行边方向数据的交叉关联匹配计算,以交叉关联系数最大者作为最佳匹配者,获得二维位移以及速度;据此结果,调整比较窗的位置或更新参考帧,并调整交叉关联算子阵列的规模,保证了测量精度,减少了计算量,在一定程度上克服了环境光照变化对测量的影响。

Figure 200910190926

A method and device for measuring two-dimensional displacement with contrast as a characteristic frame matching, which is composed of a computer camera and an ordinary computer; firstly extract an axial side direction data in the reference frame as the contrast feature of the reflected image of the measured object , by calculating the self-correlation coefficient of the edge direction data, check the texture details of the reflective surface of the measured object, select the appropriate comparison window pixel array; As the best matcher, the two-dimensional displacement and velocity are obtained; according to the results, the position of the comparison window is adjusted or the reference frame is updated, and the scale of the cross-correlation operator array is adjusted to ensure the measurement accuracy and reduce the amount of calculation. To a certain extent It overcomes the influence of ambient light changes on the measurement.

Figure 200910190926

Description

以对比度为特征帧匹配测量二维位移的方法及装置 Method and device for measuring two-dimensional displacement using contrast as characteristic frame matching

技术领域technical field

本发明属于数字图像测量技术领域,特别是采用计算机摄像头测量物体的二维微小位移的方法及其装置。The invention belongs to the technical field of digital image measurement, in particular to a method and a device for measuring two-dimensional micro-displacement of an object by using a computer camera.

背景技术Background technique

计算机摄像头已经普及,其核心是光电传感单元阵列,为测量物体的运动奠定了物质基础。“使用计算机摄像头测量微小二维位移的方法及装置”(发明专利申请号:2009101042778)分析了国内有关“摄像”与“测量”的若干专利,参考了国外关于扫描仪和光学鼠标探测位移的一些专利,提出了一种使用计算机摄像头采用关联匹配技术测量物体微小位移的方法及装置。不过,该申请针对的只是图像帧光强,适合于照明情况以及物体反射面的光学图像相对稳定的情形。Computer cameras have become popular, and their core is an array of photoelectric sensing units, which lays the material foundation for measuring the motion of objects. "Method and device for measuring small two-dimensional displacement using computer camera" (invention patent application number: 2009101042778) analyzed several domestic patents related to "camera" and "measurement", and referred to some foreign patents on the detection of displacement by scanners and optical mice The patent proposes a method and device for measuring the tiny displacement of an object by using a computer camera and using correlation matching technology. However, this application is only aimed at the light intensity of the image frame, which is suitable for lighting conditions and the situation where the optical image of the reflective surface of the object is relatively stable.

发明内容Contents of the invention

为了充分发挥计算机摄像头的光电传感器阵列的功能,本发明提供一种以对比度为特征帧匹配测量二维位移的方法及装置,它以计算机摄像头为光电转换传感器,能够在照明状况发生一定的变化的环境中,测量物体在与摄像头的光轴相垂直的平面上的微小的二维位移矢量和速度矢量。In order to give full play to the function of the photoelectric sensor array of the computer camera, the present invention provides a method and device for measuring two-dimensional displacement with contrast as the characteristic frame matching. In the environment, measure the tiny two-dimensional displacement vector and velocity vector of the object on the plane perpendicular to the optical axis of the camera.

本发明解决其技术问题所采用的技术方案是:被测量的物体被计算机摄像头聚焦成像,该摄像头通过USB接口连接到一台普通的计算机,该计算机配置有USB接口、内存、CPU、硬盘、显示卡与显示器、键盘和鼠标、操作系统、摄像头驱动程序以及摄像头拍摄及边方向数据帧匹配测量位移程序;该程序体现了本发明以对比度为特征实施帧匹配测量物体微小二维位移的方法,包括:The technical solution adopted by the present invention to solve its technical problems is: the object to be measured is focused and imaged by a computer camera, and the camera is connected to an ordinary computer through a USB interface, and the computer is equipped with a USB interface, memory, CPU, hard disk, display Card and display, keyboard and mouse, operating system, camera driver, and camera shooting and edge direction data frame matching measurement displacement program; this program embodies the method of the present invention to implement frame matching to measure the tiny two-dimensional displacement of an object characterized by contrast, including :

步骤一、以位图(M×N,M,N∈正整数)的格式,拍摄一帧被测物体的图像,作为参考帧;Step 1. Taking a frame of an image of the object under test in the format of a bitmap (M×N, M, N∈ positive integer) as a reference frame;

以所述像素阵列其左上角的第一个像素的位置为原点,横向向右方向为x轴方向,垂直向下的方向为y轴方向;Taking the position of the first pixel in the upper left corner of the pixel array as the origin, the horizontal direction to the right is the x-axis direction, and the vertically downward direction is the y-axis direction;

在所述像素阵列的中央区域选取一个区域,大小为m0×n0,m0,n0∈正整数,称之为比较窗,所述比较窗分别距离所述像素阵列的水平方向和垂直方向的边缘像素各h和v个像素,即有:m0+2h=M,n0+2v=N,h,v ∈正整数;Select an area in the central area of the pixel array, the size of which is m 0 ×n 0 , m 0 , n 0 ∈ positive integer, called the comparison window, and the comparison window is respectively separated from the pixel array in the horizontal direction and vertical direction There are h and v pixels in each edge pixel in the direction, namely: m 0 +2h=M, n 0 +2v=N, h, v ∈ positive integer;

步骤二、对于上述参考帧之像素阵列,逐行导出沿X轴方向的边方向数据:Step 2. For the pixel array of the above reference frame, export the edge direction data along the X-axis row by row:

如果一个像素的光强值比其后面的第二个像素的光强值还要小一个误差容限值error,即如果I(X,Y)<I(X+2,Y)-error则定义这两个像素之间存在一个正边;If the light intensity value of a pixel is smaller than the light intensity value of the second pixel behind it by an error tolerance value error, that is, if I(X, Y)<I(X+2, Y)-error is defined There is a positive edge between these two pixels;

如果一个像素的光强值比其后面的第二个像素的光强值还要大一个误差容限值error,即如果I(X,Y)>I(X+2,Y)+error则定义这两个像素之间存在一个负边;If the light intensity value of a pixel is greater than the light intensity value of the second pixel behind it by an error tolerance value error, that is, if I(X, Y)>I(X+2, Y)+error is defined There is a negative edge between these two pixels;

如果一个像素的光强值与其后面的第二个像素相应的光强值接近,其差不超过一个误差容限值error,即如果I(X+2,Y)-error<I(X,Y)<I(X+2,Y)+error则认为这两个像素之间不存在“边”,或称之为第三类边;If the light intensity value of a pixel is close to the corresponding light intensity value of the second pixel behind it, the difference does not exceed an error tolerance value error, that is, if I(X+2, Y)-error<I(X, Y )<I(X+2, Y)+error, it is considered that there is no "edge" between these two pixels, or it is called the third type of edge;

上式中的误差容限值可以根据具体的光照情况,预置为一个小的数值,例如:error=10;如此获得的边位于该像素之后的第一个像素的位置,也即位于参与比较的两个像素的中间位置的那个像素(x,y)上;沿着X轴方向,所有的正边、负边以及第三类边组成该方向的边方向数据,分别以3bit的二进制数值001,010和100表示,记为reference(x,y),保存之;The error tolerance value in the above formula can be preset to a small value according to the specific lighting conditions, for example: error=10; the edge obtained in this way is located at the position of the first pixel after this pixel, that is, it is located at the position participating in the comparison On the pixel (x, y) in the middle of the two pixels; along the X-axis direction, all positive edges, negative edges, and third-type edges form the edge direction data of this direction, respectively in 3-bit binary value 001 , 010 and 100 represent, recorded as reference (x, y), save it;

步骤三、计算所述参考帧里比较窗的像素阵列的自关联匹配系数:Step 3, calculating the self-correlation matching coefficient of the pixel array of the comparison window in the reference frame:

autoauto __ correlationcorrelation (( aa ,, bb )) == &Sigma;&Sigma; ythe y == vv ++ 11 vv ++ 11 ++ nno &Sigma;&Sigma; xx == hh ++ 11 hh ++ 11 ++ mm [[ referencereference (( xx ,, ythe y )) &CenterDot;&Center Dot; referencereference (( xx ++ aa ,, ythe y ++ bb )) ]]

式中,x和y分别是比较窗内像素的坐标,运算符号·表示二进制逻辑与运算,其运算结果或为逻辑0或为逻辑1,中括号“[]”表示取其中的逻辑函数对应的数值,或为数值0,或为数值1,逐个像素计算,累加的结果作为本次自关联系数auto_correlation(a,b),取3×3关联匹配算子:a=-1,0,1,b=-1,0,1,因此,共产生9个自关联系数;In the formula, x and y are the coordinates of the pixels in the comparison window respectively, and the operation symbol · represents the binary logical AND operation, and the operation result is either logic 0 or logic 1, and the square brackets "[]" represent the value corresponding to the logic function in it. The value, or the value 0, or the value 1, is calculated pixel by pixel, and the accumulated result is used as this auto_correlation coefficient auto_correlation(a, b), and the 3×3 correlation matching operator is used: a=-1, 0, 1, b=-1, 0, 1, therefore, a total of 9 autocorrelation coefficients are generated;

步骤四、分析被观测物体表面的结构特征的精细程度,亦即分析最邻近像素之间的明暗对比度之可区分程度,进行检查:Step 4. Analyze the fineness of the structural features on the surface of the observed object, that is, analyze the distinguishability of the light and dark contrast between the nearest adjacent pixels, and check:

auto_correlation(a,b)≥auto_correlation(0,0)×similarityauto_correlation(a,b)≥auto_correlation(0,0)×similarity

式中,similarity描述了比较窗与其邻近相同规模的像素阵列的相似程度,例如取similarity=60%,可以预先设置,也可以根据光照情况以及被测物表面的质地进行调试和选择;In the formula, similarity describes the similarity between the comparison window and its neighboring pixel arrays of the same scale, for example, similarity=60%, which can be set in advance, or can be debugged and selected according to the lighting conditions and the texture of the surface of the measured object;

如果满足上述检查不等式的自关联匹配系数多于3个,需要逐步扩大比较窗的范围各step行和step列:令m=m0+step,n=n0+step,重新计算新的比较窗的自关联匹配系数,并再次进行邻近像素区分度分析,直到满足上述分析不等式的自关联系数不多于3个,结果有2h=M-m,2v=N-n,其中,step为步进参数,初始值为1,每次需要扩展比较窗的规模就增加1;如果超出帧内一个预定的范围,还没有找到合适的比较窗,则认为该物体这部分反射表面不适于本装置的测量工作,并给出提示警告;If there are more than 3 self-association matching coefficients satisfying the above checking inequality, it is necessary to gradually expand the scope of the comparison window for each step row and step column: let m=m 0 +step, n=n 0 +step, and recalculate the new comparison window The self-correlation matching coefficient of the adjacent pixel is analyzed again until the self-correlation coefficient satisfying the above analysis inequality is not more than 3, and the result is 2h=Mm, 2v=Nn, where step is a stepping parameter, the initial value is 1, the scale of the comparison window needs to be expanded by 1 each time; if it exceeds a predetermined range in the frame and no suitable comparison window has been found, it is considered that this part of the reflective surface of the object is not suitable for the measurement work of the device, and given Prompt warning;

如果满足上述检查不等式的自关联匹配系数不多于3个,说明被拍摄物体的表面的结构特征足够精细,最邻近像素之间的值可以区分,可以进一步尝试缩小所述比较窗的范围各step行和step列,以减少计算量:令m=m0-step,n=n0-step,重新计算比较窗的自关联匹配系数,并再次进行邻近像素区分度分析,直到所选比较窗区域满足上述检查不等式的自关联匹配系数的个数等于3,认为这时找到了在目前的物体表面状况以及照明状况下可以用于进行匹配比较的最佳比较窗像素阵列:m=m0-step,n=n0-step,2h=M-m,2v=N-n;If there are no more than 3 self-correlation matching coefficients satisfying the above checking inequality, it means that the surface structure features of the object to be photographed are fine enough, and the values between the nearest neighbor pixels can be distinguished, and further attempts can be made to narrow the range of the comparison window by each step Rows and step columns to reduce the amount of calculation: let m=m 0 -step, n=n 0 -step, recalculate the self-correlation matching coefficient of the comparison window, and conduct the adjacent pixel discrimination analysis again until the selected comparison window area The number of self-correlation matching coefficients satisfying the above check inequality is equal to 3, and it is considered that the optimal comparison window pixel array that can be used for matching comparison under the current object surface condition and lighting condition is found: m=m 0 -step , n=n 0 -step, 2h=Mm, 2v=Nn;

步骤五、上述拍摄以后,经过一段时间Δt,拍摄第二帧位图,作为取样帧;Step 5. After the above shooting, after a period of time Δt, take a second frame of bitmap as a sampling frame;

逐行确定该取样帧中像素沿X轴方向的边方向数据,分别以3bit的二进制数值001,010和100表示正边、负边以及第三类边,记为comparison(x,y),保存之;Determine the side direction data of the pixels in the sampling frame along the X-axis direction line by line, and use 3-bit binary values 001, 010, and 100 to represent the positive side, negative side, and the third type of side, which are recorded as comparison (x, y), and saved Of;

步骤六、把所述参考帧内比较窗里的像素阵列{reference(x,y)}在所述取样帧范围里{comparison(x,y)}按照9×9关联匹配阵列进行交叉关联匹配,具体算法是:Step 6. Perform cross-correlation matching with the pixel array {reference (x, y)} in the comparison window in the reference frame in the range of the sampling frame {comparison (x, y)} according to the 9×9 correlation matching array, The specific algorithm is:

crossthe cross __ correlationcorrelation (( aa ,, bb )) == &Sigma;&Sigma; ythe y == vv ++ 11 vv ++ 11 ++ nno &Sigma;&Sigma; xx == hh ++ 11 hh ++ 11 ++ mm [[ referencereference (( xx ,, ythe y )) &CenterDot;&Center Dot; comparisoncomparison (( xx ++ aa ,, ythe y ++ bb )) ]]

对应a=-4,-3,-2,-1,0,+1,+2,+3,+4和b=-4,-3,-2,-1,0,+1,+2,+3,+4组合,共产生81个交叉关联匹配系数cross_correlation(a,b),即所述参考帧之比较窗可能发生有81种移动情况;Corresponding to a=-4, -3, -2, -1, 0, +1, +2, +3, +4 and b=-4, -3, -2, -1, 0, +1, +2 , +3, +4 combination, a total of 81 cross-correlation matching coefficients cross_correlation (a, b) are generated, that is, there may be 81 kinds of movement situations in the comparison window of the reference frame;

步骤七、帧-帧关联程度最高的交叉关联系数最大:Step 7. The cross-correlation coefficient with the highest degree of frame-frame correlation is the largest:

cross_correlation(a,b)→auto_correlation(0,0)cross_correlation(a, b) → auto_correlation(0, 0)

因此获得所述取样帧相对所述参考帧移动的方向以及移动的幅度:Therefore, the direction in which the sampled frame moves relative to the reference frame and the magnitude of the movement are obtained:

Δx(i,j)=a,Δy(i,j)=b,Δx(i,j)=a, Δy(i,j)=b,

此即本次取样周期里物体发生的相对位移矢量,其中i表示测量拍摄的顺序计数,j表示所取参考帧的顺序计数;测量过程中,物体总的相对位移矢量是:This is the relative displacement vector of the object in this sampling period, where i represents the sequence count of the measurement and shooting, and j represents the sequence count of the reference frame taken; during the measurement process, the total relative displacement vector of the object is:

Δx0(i,j)=Δx0(i-1,j)+Δx(i,j),Δy0(i,j)=Δy0(i-1,j)+Δy(i,j),等式中右边的(Δx0(i-1,j),Δy0(i-1,j))是物体以前累积的相对位移矢量;Δx 0 (i,j)=Δx 0 (i-1,j)+Δx(i,j), Δy 0 (i,j)=Δy 0 (i-1,j)+Δy(i,j), The right side of the equation (Δx 0 (i-1, j), Δy 0 (i-1, j)) is the relative displacement vector accumulated by the object before;

步骤八、物体位移的速度矢量:Step 8. Velocity vector of object displacement:

Δvx(i,j)=Δx(i,j)/Δt,Δvy(i,j)=Δy(i,j)/Δt;Δv x (i, j) = Δx (i, j)/Δt, Δv y (i, j) = Δy (i, j)/Δt;

步骤九、如果|Δx0(i,j)-Δx0(k,j-1)|≥2m/5,或|Δy0(i,j)-Δy0(k,j-1)|≥2n/5,其中,k=max(i)|(j-1)表示在参考帧顺序计数为j-1的情况下最后一次拍摄的顺序计数值,即在所述参考帧没有发生变化的条件下,其中的比较窗发生的相对位移之累积已经超出该比较窗的幅度的2/5,这时,用最新的取样帧取代所述参考帧,其比较窗重新定位在新的参考帧的中央部位;Step 9. If |Δx 0 (i,j)-Δx 0 (k,j-1)|≥2m/5, or |Δy 0 (i,j)-Δy 0 (k,j-1)|≥2n /5, wherein, k=max(i)|(j-1) represents the sequence count value of the last shot when the sequence count of the reference frame is j-1, that is, under the condition that the reference frame does not change , where the accumulation of the relative displacement of the comparison window has exceeded 2/5 of the magnitude of the comparison window, at this time, replace the reference frame with the latest sampling frame, and its comparison window is repositioned at the center of the new reference frame ;

如果|Δx0(i,j)-Δx0(k,j-1)|<2m/5且|Δy0(i,j)-Δy0(k,j-1)|<2n/5,不更新所述参考帧,而是把所述参考帧里的比较窗发生相对位移Δx=a,Δy=b;If |Δx 0 (i,j)-Δx 0 (k,j-1)|<2m/5 and |Δy 0 (i,j)-Δy 0 (k,j-1)|<2n/5, do not Update the reference frame, but relatively shift the comparison window in the reference frame by Δx=a, Δy=b;

步骤十、如果更新了参考帧,仿步骤三计算所述新参考帧的自关联匹配系数,仿步骤四察看表面结构特征,重新决定其最佳比较窗的大小m×n;Step 10. If the reference frame is updated, calculate the self-correlation matching coefficient of the new reference frame as in step 3, check the surface structure features as in step 4, and re-determine the size of the optimal comparison window m×n;

如果没有更新参考帧,调整步骤六中所述交叉关联匹配算子阵列的大小:如果|a|<5且|b|<5,改取为7×7:a=-3,-2,-1,0,+1,+2,+3,b=-3,-2,-1,0,+1,+2,+3,如果|a|<3且|b|<3,改取为5×5:a=-2,-1,0,+1,+2,b=-2,-1,0,+1,+2,否则仍然取为9×9关联匹配算子阵列;If the reference frame is not updated, adjust the size of the cross-correlation matching operator array in step 6: if |a|<5 and |b|<5, change it to 7×7: a=-3, -2, - 1, 0, +1, +2, +3, b=-3, -2, -1, 0, +1, +2, +3, if |a|<3 and |b|<3, take Be 5*5: a=-2,-1,0,+1,+2, b=-2,-1,0,+1,+2, otherwise still take as 9*9 associative matching operator array;

步骤十一、上述拍摄以后,经过一段时间Δt,拍摄第三帧位图,作为新取样帧;Step 11. After the above-mentioned shooting, after a period of time Δt, take a third frame of bitmap as a new sampling frame;

逐行确定该取样帧中像素沿X轴方向的边方向数据,其中的正边、负边以及第三类边分别以3bit的二进制数值001,010和100表示,记为comparison(x,y),保存之;Determine the side direction data of the pixels in the sampling frame along the X-axis direction line by line, where the positive side, negative side and the third type of side are respectively represented by 3-bit binary values 001, 010 and 100, which are recorded as comparison(x, y) , save it;

步骤十二、按照步骤十中确定的交叉关联匹配算子阵列,把所述参考帧内比较窗里的像素阵列在所述取样帧范围里进行交叉关联匹配计算,具体算法同步骤六;Step 12, according to the cross-correlation matching operator array determined in step 10, perform cross-correlation matching calculation on the pixel array in the comparison window in the reference frame in the range of the sampling frame, the specific algorithm is the same as step 6;

步骤十三、跳转到步骤七,继续测量。Step 13, skip to step 7 and continue measuring.

实际测量过程中,还可以进一步实施测量定标,籍此获得直接的测量结果。In the actual measurement process, measurement calibration can be further implemented to obtain direct measurement results.

本发明的有益效果是,它提取边方向数据作为图像帧的像素阵列的对比度特征,有效地克服了环境光照变化对图像像素光强的影响;它采用自关联系数计算方法分析当前照明条件下被测物反射表面的质地特征,自动调整匹配区域的大小,以实现最小计算工作量;它根据计算获得的位移值,自动调整交叉关联算子的大小,实现最佳地搜索匹配区域;它自动适时地更新参考帧,没有需要干预程序的预设门槛值,有效地保证了测量精度。The beneficial effect of the present invention is that it extracts the edge direction data as the contrast feature of the pixel array of the image frame, which effectively overcomes the influence of ambient light changes on the light intensity of image pixels; Measure the texture characteristics of the reflective surface of the object, and automatically adjust the size of the matching area to achieve the minimum calculation workload; it automatically adjusts the size of the cross-correlation operator according to the calculated displacement value to achieve the best search for the matching area; it automatically and timely The reference frame is updated accurately, and there is no preset threshold value that needs to intervene in the program, effectively ensuring the measurement accuracy.

附图说明Description of drawings

图1是本发明的测量装置方框图。Fig. 1 is a block diagram of the measuring device of the present invention.

图2是光电传感器芯片进行光电转换后产生的像素阵列的示意图。FIG. 2 is a schematic diagram of a pixel array generated after the photoelectric sensor chip undergoes photoelectric conversion.

图1中,1.计算机摄像头,2.光学透镜,3.光电传感器芯片,4.USB接口,5.计算机系统,6.USB接口,7.CPU,8.内存,9.显示卡与显示器,10.硬盘,11.键盘和鼠标,12.操作系统,13.摄像头驱动程序,14.摄像头拍摄及边方向数据帧匹配测量位移程序,15.照明设备。In Figure 1, 1. Computer camera, 2. Optical lens, 3. Photoelectric sensor chip, 4. USB interface, 5. Computer system, 6. USB interface, 7. CPU, 8. Memory, 9. Display card and monitor, 10. Hard disk, 11. Keyboard and mouse, 12. Operating system, 13. Camera driver, 14. Camera shooting and edge direction data frame matching measurement displacement program, 15. Lighting equipment.

图2中,20.一帧像素阵列,21.比较窗,22.取样帧内关联匹配区域示意例,23.参考帧内比较窗可能发生的极限位置。In Fig. 2, 20. a frame of pixel array, 21. a comparison window, 22. a schematic example of an associated matching area in a sampling frame, and 23. a possible limit position of a comparison window in a reference frame.

具体实施方式Detailed ways

图1是本发明的测量装置的方框图。首先,在计算机系统(5)上运行随摄像头(1)配售的摄像头驱动程序(13),通过USB接口(4)和(6)连接摄像头(1)到计算机(5)。然后,让摄像头聚焦成像被测量物体。对于测量环境照明状况的基本要求是,被测量物体所成像的光强可以发生某些程度的变化,但是,不允许像的明暗对比度没有发生明显的改变。据此选择测量环境以及选用照明设备(15)。接着,运行摄像头拍摄及边方向数据帧匹配测量位移程序(14),实施实时测量。该程序(14)体现了以对比度为特征帧匹配测量二维位移的方法,具体见“发明内容”所描述,下面就其要点说明如下:Fig. 1 is a block diagram of the measuring device of the present invention. First, the camera driver (13) distributed with the camera (1) is run on the computer system (5), and the camera (1) is connected to the computer (5) through the USB interfaces (4) and (6). Then, let the camera focus and image the object to be measured. The basic requirement for measuring ambient lighting conditions is that the light intensity imaged by the object to be measured can change to some extent, but the contrast between light and dark of the image is not allowed to change significantly. Based on this, the measurement environment is selected and the lighting equipment (15) is selected. Then, run the camera shooting and edge direction data frame matching measurement displacement program (14) to implement real-time measurement. This program (14) embodies the method for measuring two-dimensional displacement with contrast as the feature frame matching, specifically see the description in "Summary of the Invention", and the main points are explained as follows below:

步骤一、五和十一中,以位图的格式拍摄一帧被测物体的图像,该位图帧的大小M×N,M,N∈正整数需要根据摄像头的具体型号进行选择,并且尽可能选择拍摄速度较快的帧率,保证拍摄速度快于被测物体的位移速度。In steps 1, 5 and 11, take a frame of the image of the measured object in bitmap format, the size of the bitmap frame is M×N, M, N∈ positive integer needs to be selected according to the specific model of the camera, and as far as possible It is possible to choose a frame rate with a faster shooting speed to ensure that the shooting speed is faster than the displacement speed of the measured object.

数码摄像头常见的分辨率有QSIF(160*120)、QCIF(176*144)、SIF(320*240)、CIF(352*288)和VGA(640*480),其实际拍摄速度分别对应:30fps(帧每秒),30fps,20-26fps,20-26fps和10fps。常见的分辨率有:QSIF(160*120)、QCIF(176*144)、SIF(320*240)、CIF(352*288)和VGA(640*480)等几种,拍摄的实际速度分别是:30fps(帧每秒),30fps,20-26fps,20-26fps和10fps,其视频信号属于数字信号方式,以USB接口输出。The common resolutions of digital cameras are QSIF(160*120), QCIF(176*144), SIF(320*240), CIF(352*288) and VGA(640*480), and the actual shooting speed corresponds to: 30fps (frames per second), 30fps, 20-26fps, 20-26fps and 10fps. Common resolutions are: QSIF(160*120), QCIF(176*144), SIF(320*240), CIF(352*288) and VGA(640*480), etc. The actual shooting speeds are : 30fps (frame per second), 30fps, 20-26fps, 20-26fps and 10fps, the video signal belongs to the digital signal mode and is output through the USB interface.

图2表示光电传感器芯片(3)进行光电转换后产生的相应的像素阵列(20)。该像素阵列(20)的大小为M×N,M,N∈整数,对应着位图格式,其中每一个小方格子即像素,其亮度数值为0-255。在图示坐标系中,每一个小方格子即像素都定位为一对坐标点(x,y),0≤x≤M,0≤y≤N,x,y∈整数。在图2中的中央区域开辟有一个比较窗(21),大小取为m×n,m,n∈整数,比较窗(21)与像素矩阵(20)的水平方向和垂直方向的边缘像素分别距离h和v个像素,即有:m+2h=M,n+2v=N,h,v∈正整数。因此,比较窗的左上角那第一个像素方格的坐标是:x=h+1,y=v+1。选取m,n与物体反射面的结构特征的精细程度有关,关系到(匹配)测量精度,决定着计算工作量,影响着测量装置的响应速率。对于上述分辨率与帧率指标,例如可以选取初始值:m0=80,n0=80。物体发生位移以后,参考帧内比较窗有可能移动到了取样帧内的某个地方,例如取样帧内关联匹配区域示意例22处,但是,不允许其移动超出参考帧内比较窗可能发生的极限位置23。Fig. 2 shows the corresponding pixel array (20) generated after photoelectric conversion by the photosensor chip (3). The size of the pixel array (20) is M×N, M, N∈ integer, corresponding to the bitmap format, wherein each small square grid is a pixel, and its brightness value is 0-255. In the illustrated coordinate system, each small square grid or pixel is positioned as a pair of coordinate points (x, y), 0≤x≤M, 0≤y≤N, x, y∈integer. A comparison window (21) is opened in the central area in Fig. 2, and the size is taken as m×n, m, n∈ integer, and the edge pixels of the comparison window (21) and the horizontal direction and the vertical direction of the pixel matrix (20) are respectively The distance between h and v pixels is: m+2h=M, n+2v=N, h, v∈positive integer. Therefore, the coordinates of the first pixel square in the upper left corner of the comparison window are: x=h+1, y=v+1. The selection of m and n is related to the fineness of the structural features of the object's reflective surface, which is related to (matching) measurement accuracy, determines the calculation workload, and affects the response rate of the measurement device. For the above resolution and frame rate indicators, for example, initial values may be selected: m 0 =80, n 0 =80. After the object is displaced, the comparison window in the reference frame may move to a certain place in the sampling frame, such as the example 22 of the associated matching area in the sampling frame, but it is not allowed to move beyond the possible limit of the comparison window in the reference frame position 23.

步骤二、五和十一中所述边方向数据反映了被测物体表面的明暗对比度特征,最近提交的发明专利申请“测量亚像素位移的峰谷运动探测方法及装置”对此给予了详细的说明。The edge direction data described in steps 2, 5 and 11 reflect the light and dark contrast characteristics of the surface of the measured object. The recently submitted invention patent application "Peak and Valley Motion Detection Method and Device for Measuring Sub-pixel Displacement" provides detailed information on this. illustrate.

步骤三、四和十是利用自关联系数分析被测量物体表面的结构特征的精细程度,看它在当前的光照环境下所成像帧能否呈现出足够多的细节,以适用于本测量方法。一方面,这通过分析各个自关联系数与比较窗本身的自关联系数是否接近来判断,另一方面,通过一个可以预先设置的参数similarity来表征。该参数描述了比较窗与其邻近相同规模的像素阵列的相似程度,可以根据光照情况以及被测物表面的质地进行调试和选择。综合为下述分析不等式:Steps 3, 4 and 10 are to use the autocorrelation coefficient to analyze the fineness of the structural features on the surface of the measured object to see if the imaged frame under the current lighting environment can show enough details to be suitable for this measurement method. On the one hand, this is judged by analyzing whether each autocorrelation coefficient is close to the self-correlation coefficient of the comparison window itself; on the other hand, it is characterized by a parameter similarity that can be set in advance. This parameter describes the similarity between the comparison window and its adjacent pixel array of the same size, which can be adjusted and selected according to the lighting conditions and the texture of the surface of the measured object. The synthesis is the following analytical inequality:

auto_correlation(a,b)≥auto_correlation(0,0)×similarityauto_correlation(a,b)≥auto_correlation(0,0)×similarity

当“满足上述分析不等式的自关联系数的个数等于3”的时候,认为找到了进行匹配比较的最佳比较窗像素阵列:m=m0-step,n=n0-step,2h=M-m,2v=N-n,否则,会自动扩大或缩小比较窗的规模,有利于减小计算工作量。极端的情况是,被测量物体表面的反射特征不够细致,比较窗规模的调整有可能超出参考帧范围,因此,要限定其调整的范围极限一旦比较窗的调整超出此极限,则认为该物体这部分反射表面不适于本方法及装置的测量工作,并给出提示警告。When "the number of autocorrelation coefficients satisfying the above analysis inequality is equal to 3", it is considered that the optimal comparison window pixel array for matching comparison has been found: m=m 0 -step, n=n 0 -step, 2h=Mm , 2v=Nn, otherwise, the scale of the comparison window will be enlarged or reduced automatically, which is beneficial to reduce the calculation workload. In extreme cases, the reflection characteristics of the surface of the measured object are not detailed enough, and the adjustment of the scale of the comparison window may exceed the range of the reference frame. Therefore, the adjustment range limit should be limited. Some reflective surfaces are not suitable for the measurement work of this method and device, and a warning will be given.

“满足上述分析不等式的自关联系数的个数”也不一定非得等于3,可以根据实际情况调整。"The number of autocorrelation coefficients satisfying the above analysis inequality" does not necessarily have to be equal to 3, and can be adjusted according to the actual situation.

步骤六、七和十二中的基本思想是,先采用较大规模的交叉关联匹配算子矩阵搜索与参考帧内比较帧最相匹配的区域,籍此确定像素帧发生的位移。然后,根据所获得的位移大小,调整交叉关联算子矩阵的规模,以求减少计算量。交叉关联算子矩阵的规模大于可能发生的位移范围。The basic idea in steps 6, 7 and 12 is to first use a large-scale cross-correlation matching operator matrix to search for the region that best matches the comparison frame in the reference frame, thereby determining the displacement of the pixel frame. Then, according to the displacement obtained, the size of the cross-correlation operator matrix is adjusted in order to reduce the amount of calculation. The size of the cross-correlation operator matrix is larger than the range of possible displacements.

步骤九中讲述了根据所获得的位移测量值或者移动参考帧内置比较窗的位置,或者更新参考帧的方法,其目的是为了保证所述参考帧内比较窗与取样帧内相应关联区域具有相当多的重叠区域,能够反映出小于一个像素单位的测量精度,而不会在多次拍摄测量之后累积测量误差。“使用计算机摄像头测量微小二维位移的方法及装置”(发明专利申请号:2009101042778)对此作了具体分析。至于“在所述参考帧没有发生变化的条件下,其中的比较窗发生的相对位移之累积已经超出该比较窗的幅度的2/5,这时,用最新的取样帧取代所述参考帧,”所述超幅2/5,可以根据比较窗的规模、被测运动速度等具体情况具体调整。Step 9 describes the method of moving the position of the built-in comparison window in the reference frame according to the obtained displacement measurement value, or updating the reference frame. There are many overlapping areas, which can reflect the measurement accuracy of less than one pixel unit, without accumulating measurement errors after multiple shooting measurements. "Method and device for measuring small two-dimensional displacement using computer camera" (invention patent application number: 2009101042778) made a specific analysis on this. As for "under the condition that the reference frame does not change, the accumulation of the relative displacement of the comparison window has exceeded 2/5 of the magnitude of the comparison window, at this time, replace the reference frame with the latest sampling frame, "The 2/5 overrun can be adjusted according to specific circumstances such as the size of the comparison window and the speed of the measured movement.

Claims (2)

1.以对比度为特征帧匹配测量二维位移的方法及装置,由一个计算机摄像头与一台普通的计算机组成,所述摄像头通过其USB接口连接到所述计算机,该计算机配置有USB接口、内存、CPU、硬盘、显示卡与显示器、键盘和鼠标、操作系统以及摄像头驱动程序,其特征在于,所述计算机系统还配置有摄像头拍摄及边方向数据帧匹配测量位移程序。1. The method and device for measuring two-dimensional displacement with contrast as characteristic frame matching, are made up of a computer camera and a common computer, and the camera is connected to the computer through its USB interface, and the computer is equipped with a USB interface, memory , CPU, hard disk, display card and display, keyboard and mouse, operating system and camera driver, it is characterized in that, described computer system is also equipped with camera shooting and edge direction data frame matching measurement displacement program. 2.根据权利要求1所述的以对比度为特征帧匹配测量二维位移的方法及装置,其特征在于,所述摄像头拍摄及边方向数据帧匹配测量位移程序提供了一种使用计算机摄像头实施以对比度为特征帧匹配测量二维位移的方法,包括:2. The method and device for measuring the two-dimensional displacement according to claim 1, wherein the contrast is characterized in that the camera shooting and edge direction data frame matching measurement displacement program provides a method for using a computer camera to implement Contrast measures two-dimensional displacement for feature frame matching, including: 步骤一、以位图(M×N,M,N∈正整数)的格式,拍摄一帧被测物体的图像,作为参考帧;Step 1. Taking a frame of an image of the measured object in the format of a bitmap (M×N, M, N∈ positive integer) as a reference frame; 以所述像素阵列其左上角的第一个像素的位置为原点,横向向右方向为x轴方向,垂直向下的方向为y轴方向;Taking the position of the first pixel in the upper left corner of the pixel array as the origin, the horizontal direction to the right is the x-axis direction, and the vertically downward direction is the y-axis direction; 在所述像素阵列的中央区域选取一个区域,大小为m0×n0,m0,n0∈正整数,称之为比较窗,所述比较窗分别距离所述像素阵列的水平方向和垂直方向的边缘像素各h和v个像素,即有:m0+2h=M,n0+2v=N,h,v∈正整数;Select an area in the central area of the pixel array, the size of which is m 0 ×n 0 , m 0 , n 0 ∈ positive integer, called the comparison window, and the comparison window is respectively separated from the pixel array in the horizontal direction and vertical direction Each h and v pixels of edge pixels in the direction have: m 0 +2h=M, n 0 +2v=N, h, v∈ positive integer; 步骤二、对于上述参考帧之像素阵列,逐行导出沿X轴方向的边方向数据:Step 2. For the pixel array of the above reference frame, export the edge direction data along the X-axis row by row: 如果一个像素的光强值比其后面的第二个像素的光强值还要小一个误差容限值error,即如果                 I(X,Y)<I(X+2,Y)-errorIf the light intensity value of a pixel is smaller than the light intensity value of the second pixel behind it by an error tolerance value error, that is, if I(X, Y)<I(X+2, Y)-error 则定义这两个像素之间存在一个正边;Then it is defined that there is a positive edge between these two pixels; 如果一个像素的光强值比其后面的第二个像素的光强值还要大一个误差容限值error,即如果                 I(X,Y)>I(X+2,Y)+errorIf the light intensity value of a pixel is greater than the light intensity value of the second pixel behind it by an error tolerance value error, that is, if I(X, Y) > I(X+2, Y)+error 则定义这两个像素之间存在一个负边;Then it is defined that there is a negative edge between these two pixels; 如果一个像素的光强值与其后面的第二个像素相应的光强值接近,其差不超过一个误差容限值error,即如果     I(X+2,Y)-error<I(X,Y)<I(X+2,Y)+errorIf the light intensity value of a pixel is close to the corresponding light intensity value of the second pixel behind it, the difference does not exceed an error tolerance value error, that is, if I(X+2, Y)-error<I(X, Y )<I(X+2,Y)+error 则认为这两个像素之间不存在“边”,或称之为第三类边;It is considered that there is no "edge" between these two pixels, or it is called the third type of edge; 上式中的误差容限值可以根据具体的光照情况,预置为一个小的数值,例如:error=10;如此获得的边位于该像素之后的第一个像素的位置,也即位于参与比较的两个像素的中间位置的那个像素(x,y)上;沿着X轴方向,所有的正边、负边以及第三类边组成该方向的边方向数据,分别以3bit的二进制数值001,010和100表示,记为reference(x,y),保存之;The error tolerance value in the above formula can be preset to a small value according to the specific lighting conditions, for example: error=10; the edge obtained in this way is located at the position of the first pixel after this pixel, that is, it is located at the position participating in the comparison On the pixel (x, y) in the middle of the two pixels; along the X-axis direction, all positive edges, negative edges, and third-type edges form the edge direction data of this direction, respectively in 3-bit binary value 001 , 010 and 100 represent, recorded as reference (x, y), save it; 步骤三、计算所述参考帧里比较窗的像素阵列的自关联匹配系数:Step 3, calculating the self-correlation matching coefficient of the pixel array of the comparison window in the reference frame: autoauto __ correlationcorrelation (( aa ,, bb )) == &Sigma;&Sigma; ythe y == vv ++ 11 vv ++ 11 ++ nno &Sigma;&Sigma; xx == hh ++ 11 hh ++ 11 ++ mm [[ referencereference (( xx ,, ythe y )) &CenterDot;&Center Dot; referencereference (( xx ++ aa ,, ythe y ++ bb )) ]] 式中,x和y分别是比较窗内像素的坐标,运算符号·表示二进制逻辑与运算,其运算结果或为逻辑0或为逻辑1,中括号“[]”表示取其中的逻辑函数对应的数值,或为数值0,或为数值1,逐个像素计算,累加的结果作为本次自关联系数auto_correlation(a,b),取3×3关联匹配算子:a=-1,0,1,b=-1,0,1,因此,共产生9个自关联系数;In the formula, x and y are the coordinates of the pixels in the comparison window respectively, and the operation symbol · represents the binary logical AND operation, and the operation result is either logic 0 or logic 1, and the square brackets "[]" represent the value corresponding to the logic function among them. The value, either the value 0 or the value 1, is calculated pixel by pixel, and the accumulated result is used as the auto_correlation coefficient auto_correlation(a, b) for this time, using a 3×3 correlation matching operator: a=-1, 0, 1, b=-1, 0, 1, therefore, a total of 9 autocorrelation coefficients are generated; 步骤四、分析被观测物体表面的结构特征的精细程度,亦即分析最邻近像素之间的明暗对比度之可区分程度,进行检查:Step 4. Analyze the fineness of the structural features on the surface of the observed object, that is, analyze the distinguishability of the light and dark contrast between the nearest adjacent pixels, and check: auto_correlation(a,b)≥auto_correlation(0,0)×similarityauto_correlation(a,b)≥auto_correlation(0,0)×similarity 式中,similarity描述了比较窗与其邻近相同规模的像素阵列的相似程度,例如取similarity=60%,可以预先设置,也可以根据光照情况以及被测物表面的质地进行调试和选择;In the formula, similarity describes the similarity between the comparison window and its neighboring pixel arrays of the same scale, for example, similarity=60%, which can be set in advance, or can be debugged and selected according to the lighting conditions and the texture of the surface of the measured object; 如果满足上述检查不等式的自关联匹配系数多于3个,需要逐步扩大比较窗的范围各step行和step列:令m=m0+step,n=n0+step,重新计算新的比较窗的自关联匹配系数,并再次进行邻近像素区分度分析,直到满足上述分析不等式的自关联系数不多于3个,结果有2h=M-m,2v=N-n,其中,step为步进参数,初始值为1,每次需要扩展比较窗的规模就增加1;如果超出帧内一个预定的范围,还没有找到合适的比较窗,则认为该物体这部分反射表面不适于本装置的测量工作,并给出提示警告;If there are more than 3 self-association matching coefficients satisfying the above checking inequality, it is necessary to gradually expand the scope of the comparison window for each step row and step column: let m=m 0 +step, n=n 0 +step, and recalculate the new comparison window The self-correlation matching coefficient of the adjacent pixel is analyzed again until the self-correlation coefficient satisfying the above analysis inequality is not more than 3, and the result is 2h=Mm, 2v=Nn, where step is a stepping parameter, the initial value is 1, the scale of the comparison window needs to be expanded by 1 each time; if it exceeds a predetermined range in the frame and no suitable comparison window has been found, it is considered that this part of the reflective surface of the object is not suitable for the measurement work of the device, and given Prompt warning; 如果满足上述检查不等式的自关联匹配系数不多于3个,说明被拍摄物体的表面的结构特征足够精细,最邻近像素之间的值可以区分,可以进一步尝试缩小所述比较窗的范围各step行和step列,以减少计算量:令m=m0-step,n=n0-step,重新计算比较窗的自关联匹配系数,并再次进行邻近像素区分度分析,直到所选比较窗区域满足上述检查不等式的自关联匹配系数的个数等于3,认为这时找到了在目前的物体表面状况以及照明状况下可以用于进行匹配比较的最佳比较窗像素阵列:m=m0-step,n=n0-step,2h=M-m,2v=N-n;If there are no more than 3 self-correlation matching coefficients satisfying the above checking inequality, it means that the surface structure features of the object to be photographed are fine enough, and the values between the nearest neighbor pixels can be distinguished, and further attempts can be made to narrow the range of the comparison window by each step Rows and step columns to reduce the amount of calculation: let m=m 0 -step, n=n 0 -step, recalculate the self-correlation matching coefficient of the comparison window, and conduct the adjacent pixel discrimination analysis again until the selected comparison window area The number of self-correlation matching coefficients satisfying the above check inequality is equal to 3, and it is considered that the optimal comparison window pixel array that can be used for matching comparison under the current object surface condition and lighting condition is found: m=m 0 -step , n=n 0 -step, 2h=Mm, 2v=Nn; 步骤五、上述拍摄以后,经过一段时间Δt,拍摄第二帧位图,作为取样帧;Step 5. After the above shooting, after a period of time Δt, take a second frame of bitmap as a sampling frame; 逐行确定该取样帧中像素沿X轴方向的边方向数据,分别以3bit的二进制数值001,010和100表示正边、负边以及第三类边,记为comparison(x,y),保存之;Determine the side direction data of the pixels in the sampling frame along the X-axis direction line by line, and use 3-bit binary values 001, 010, and 100 to represent the positive side, negative side, and the third type of side, which are recorded as comparison (x, y), and saved Of; 步骤六、把所述参考帧内比较窗里的像素阵列{reference(x,y)}在所述取样帧范围里{comparison(x,y)}按照9×9关联匹配阵列进行交叉关联匹配,具体算法是:Step 6. Carry out cross-correlation matching with the pixel array {reference(x, y)} in the comparison window in the reference frame in the range of the sampling frame {comparison(x, y)} according to the 9×9 correlation matching array, The specific algorithm is: crossthe cross __ correlationcorrelation (( aa ,, bb )) == &Sigma;&Sigma; ythe y == vv ++ 11 vv ++ 11 ++ nno &Sigma;&Sigma; xx == hh ++ 11 hh ++ 11 ++ mm [[ referencereference (( xx ,, ythe y )) &CenterDot;&Center Dot; comparisoncomparison (( xx ++ aa ,, ythe y ++ bb )) ]] 对应a=-4,-3,-2,-1,0,+1,+2,+3,+4和b=-4,-3,-2,-1,0,+1,+2,+3,+4组合,共产生81个交叉关联匹配系数cross_correlation(a,b),即所述参考帧之比较窗可能发生有81种移动情况;Corresponding to a=-4, -3, -2, -1, 0, +1, +2, +3, +4 and b=-4, -3, -2, -1, 0, +1, +2 , +3, +4 combination, a total of 81 cross-correlation matching coefficients cross_correlation (a, b) are generated, that is, there may be 81 kinds of movement situations in the comparison window of the reference frame; 步骤七、帧-帧关联程度最高的交叉关联系数最大:Step 7. The cross-correlation coefficient with the highest degree of frame-frame correlation is the largest: cross_correlation(a,b)→auto_correlation(0,0)cross_correlation(a, b) → auto_correlation(0, 0) 因此获得所述取样帧相对所述参考帧移动的方向以及移动的幅度:Therefore, the direction in which the sampled frame moves relative to the reference frame and the magnitude of the movement are obtained: Δx(i,j)=a,Δy(i,j)=b,Δx(i,j)=a, Δy(i,j)=b, 此即本次取样周期里物体发生的相对位移矢量,其中i表示测量拍摄的顺序计数,j表示所取参考帧的顺序计数;测量过程中,物体总的相对位移矢量是:This is the relative displacement vector of the object in this sampling period, where i represents the sequence count of the measurement and shooting, and j represents the sequence count of the reference frame taken; during the measurement process, the total relative displacement vector of the object is: Δx0(i,j)=Δx0(i-1,j)+Δx(i,j),Δy0(i,j)=Δy0(i-1,j)+Δy(i,j),Δx 0 (i,j)=Δx 0 (i-1,j)+Δx(i,j), Δy 0 (i,j)=Δy 0 (i-1,j)+Δy(i,j), 等式中右边的(Δx0(i-1,j),Δy0(i-1,j))是物体以前累积的相对位移矢量;The right side of the equation (Δx 0 (i-1, j), Δy 0 (i-1, j)) is the relative displacement vector accumulated by the object before; 步骤八、物体位移的速度矢量:Step 8. Velocity vector of object displacement: Δvx(i,j)=Δx(i,j)/Δt,Δvy(i,j)=Δy(i,j)/Δt;Δv x (i, j) = Δx (i, j)/Δt, Δv y (i, j) = Δy (i, j)/Δt; 步骤九、如果|Δx0(i,j)-Δx0(k,j-1)|≥2m/5,或|Δy0(i,j)-Δy0(k,j-1)|≥2n/5,其中,k=max(i)|(j-1)表示在参考帧顺序计数为j-1的情况下最后一次拍摄的顺序计数值,即在所述参考帧没有发生变化的条件下,其中的比较窗发生的相对位移之累积已经超出该比较窗的幅度的2/5,这时,用最新的取样帧取代所述参考帧,其比较窗重新定位在新的参考帧的中央部位;Step 9. If |Δx 0 (i,j)-Δx 0 (k,j-1)|≥2m/5, or |Δy 0 (i,j)-Δy 0 (k,j-1)|≥2n /5, wherein, k=max(i)|(j-1) represents the sequence count value of the last shot when the sequence count of the reference frame is j-1, that is, under the condition that the reference frame does not change , where the accumulation of the relative displacement of the comparison window has exceeded 2/5 of the magnitude of the comparison window, at this time, replace the reference frame with the latest sampling frame, and its comparison window is repositioned at the center of the new reference frame ; 如果|Δx0(i,j)-Δx0(k,j-1)|<2m/5且|Δy0(i,j)-Δy0(k,j-1)|<2n/5,不更新所述参考帧,而是把所述参考帧里的比较窗发生相对位移Δx=a,Δy=b;If |Δx 0 (i,j)-Δx 0 (k,j-1)|<2m/5 and |Δy 0 (i,j)-Δy 0 (k,j-1)|<2n/5, do not Update the reference frame, but relatively shift the comparison window in the reference frame by Δx=a, Δy=b; 步骤十、如果更新了参考帧,仿步骤三计算所述新参考帧的自关联匹配系数,仿步骤四察看表面结构特征,重新决定其最佳比较窗的大小m×n;Step 10. If the reference frame is updated, calculate the self-correlation matching coefficient of the new reference frame as in step 3, check the surface structure features as in step 4, and re-determine the size of the optimal comparison window m×n; 如果没有更新参考帧,调整步骤六中所述交叉关联匹配算子阵列的大小:如果|a|<5且|b|<5,改取为7×7:a=-3,-2,-1,0,+1,+2,+3,b=-3,-2,-1,0,+1,+2,+3,如果|a|<3且|b|<3,改取为5×5:a=-2,-1,0,+1,+2,b=-2,-1,0,+1,+2,否则仍然取为9×9关联匹配算子阵列;If the reference frame is not updated, adjust the size of the cross-correlation matching operator array in step 6: if |a|<5 and |b|<5, change it to 7×7: a=-3, -2, - 1, 0, +1, +2, +3, b=-3, -2, -1, 0, +1, +2, +3, if |a|<3 and |b|<3, take Be 5*5: a=-2,-1,0,+1,+2, b=-2,-1,0,+1,+2, otherwise still take as 9*9 associative matching operator array; 步骤十一、上述拍摄以后,经过一段时间Δt,拍摄第三帧位图,作为新取样帧;Step 11. After the above-mentioned shooting, after a period of time Δt, take a third frame of bitmap as a new sampling frame; 逐行确定该取样帧中像素沿X轴方向的边方向数据,其中的正边、负边以及第三类边分别以3bit的二进制数值001,010和100表示,记为comparison(x,y),保存之;Determine the side direction data of the pixels in the sampling frame along the X-axis direction line by line, where the positive side, negative side and the third type of side are respectively represented by 3-bit binary values 001, 010 and 100, which are recorded as comparison(x, y) , save it; 步骤十二、按照步骤十中确定的交叉关联匹配算子阵列,把所述参考帧内比较窗里的像素阵列在所述取样帧范围里进行交叉关联匹配计算,具体算法同步骤六;Step 12, according to the cross-correlation matching operator array determined in step 10, perform cross-correlation matching calculation on the pixel array in the comparison window in the reference frame in the range of the sampling frame, the specific algorithm is the same as step 6; 步骤十三、跳转到步骤七,继续测量。Step 13, skip to step 7 and continue measuring.
CN 200910190926 2009-09-22 2009-09-22 Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame Expired - Fee Related CN102022983B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200910190926 CN102022983B (en) 2009-09-22 2009-09-22 Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200910190926 CN102022983B (en) 2009-09-22 2009-09-22 Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame

Publications (2)

Publication Number Publication Date
CN102022983A true CN102022983A (en) 2011-04-20
CN102022983B CN102022983B (en) 2013-09-25

Family

ID=43864567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200910190926 Expired - Fee Related CN102022983B (en) 2009-09-22 2009-09-22 Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame

Country Status (1)

Country Link
CN (1) CN102022983B (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7519502B1 (en) * 2003-09-05 2009-04-14 The United States Of America As Represented By The Secretary Of The Navy Surface profile measurement processing method
CN100458359C (en) * 2006-03-02 2009-02-04 浣石 Small-displacement measuring system in long-distance plane

Also Published As

Publication number Publication date
CN102022983B (en) 2013-09-25

Similar Documents

Publication Publication Date Title
US7129926B2 (en) Navigation tool
JP5036949B2 (en) Pointer device
CN107238727B (en) Photoelectric type rotation speed sensor based on dynamic vision sensor chip and detection method
US20150062302A1 (en) Measurement device, measurement method, and computer program product
CN115493679A (en) A Dynamic Weighing System for Toll Station Vehicles Based on Multi-field Thermal Imaging Technology
CN114509018A (en) Full-field real-time bridge deflection measurement method
CN101943566B (en) Method and device for measuring tiny two-dimensional displacement by computer camera
CN106012778B (en) Digital image acquisition analysis method for express highway pavement strain measurement
CN113888604B (en) A target tracking method based on deep optical flow
KR20100095161A (en) Method and apparatus for detecting changes in background of images using multiple binary images thereof and hough transform
CN113095323A (en) SIFT-improvement-based digital image correlation method real-time detection method
CN102022983B (en) Method and device for measuring two-dimensional displacement by matching contrast serving as characteristic frame
TW201137792A (en) Displacement detecting device and displacement detecting method thereof
CN102022982B (en) Method and device for measuring displacement using two-dimensional contrast as feature frame matching
JP4628860B2 (en) Image sensor
TW202125204A (en) Gesture recognition system and gesture recognition method
TWI240214B (en) Optimized correlation matching method and system for determining track behavior
CN102052898B (en) Method for measuring small two-dimensional displacement by using three primary colors of computer camera
CN102116607B (en) Method and device for measuring axial displacement characterized by one-dimensional (1D) contrast ratio
CN102052901B (en) Displacement match-measuring method using two-dimensional trichromatic contrast ratio as characteristic frame
CN102052900B (en) Peak valley motion detection method and device for quickly measuring sub-pixel displacement
CN102052899B (en) Take trichromatic contrast ratio as method and the device of characteristic frame Matched measurement two-dimension displacement
CN102102981B (en) Method and device for measuring displacement using two-dimensional single primary color contrast as feature frame matching
CN102102982B (en) Method and device for measuring two-dimensional infinitesimal displacement with single primary color by using computer camera
CN102116606B (en) Method and device for measuring axial displacement by taking one-dimensional three-primary-color peak valley 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
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: 20130925

Termination date: 20140922

EXPY Termination of patent right or utility model