CN117110642A - Glass plane speed measuring method based on binocular telecentric lens - Google Patents
Glass plane speed measuring method based on binocular telecentric lens Download PDFInfo
- Publication number
- CN117110642A CN117110642A CN202311077473.7A CN202311077473A CN117110642A CN 117110642 A CN117110642 A CN 117110642A CN 202311077473 A CN202311077473 A CN 202311077473A CN 117110642 A CN117110642 A CN 117110642A
- Authority
- CN
- China
- Prior art keywords
- glass
- distance
- value
- telecentric lens
- binocular
- 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.)
- Pending
Links
- 239000011521 glass Substances 0.000 title claims abstract description 120
- 238000000034 method Methods 0.000 title claims description 19
- 238000000691 measurement method Methods 0.000 claims abstract description 17
- 238000012545 processing Methods 0.000 claims abstract description 9
- 239000011159 matrix material Substances 0.000 claims description 13
- 238000001514 detection method Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 claims description 6
- 238000004364 calculation method Methods 0.000 claims description 5
- 230000008859 change Effects 0.000 claims description 4
- 238000007781 pre-processing Methods 0.000 claims description 2
- 238000006243 chemical reaction Methods 0.000 claims 1
- 238000005259 measurement Methods 0.000 abstract description 15
- 230000007613 environmental effect Effects 0.000 abstract description 6
- 230000000007 visual effect Effects 0.000 abstract description 2
- 238000003384 imaging method Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012634 optical imaging Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01P—MEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
- G01P3/00—Measuring linear or angular speed; Measuring differences of linear or angular speeds
- G01P3/36—Devices characterised by the use of optical means, e.g. using infrared, visible, or ultraviolet light
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Electromagnetism (AREA)
- Power Engineering (AREA)
- General Physics & Mathematics (AREA)
- Length Measuring Devices By Optical Means (AREA)
Abstract
Description
技术领域Technical field
本发明涉及机器视觉技术领域,具体指一种基于双目远心镜头的玻璃平面测速方法。The invention relates to the field of machine vision technology, and specifically refers to a glass plane speed measurement method based on a binocular telecentric lens.
背景技术Background technique
实际工业场景中需要测量玻璃等透明物体的移动速度,常见测量速度会使用双目视觉、激光测距等方式进行距离测量,统计形成所需的时间,进而计算得到速度。双目测距主要通过两个固定距离的单目普通镜头,计算两张画面的中同一物体的视野差进而进行距离估计。而玻璃一类的透明物体的边缘往往不够明显,双目视觉中两张图片的视野差很弱,难以计算。为加强玻璃的边缘特征,可使用辅助光源对玻璃进行打光增加亮度,但成像结果与环境光照相关。玻璃位置发生改变后,不能维持最佳光照下的成像效果,因此可供测量的移动区间小、难度大。激光测距主要是通过测量激光、超声波等接触到物体表面后返回源点的全程所需时间进行距离测量,其精度非常高。但在工业场景下,生产线上的玻璃一般具有300摄氏度左右的高温,且环境湿度大。上述的环境因素会影响激光、超声波的反射,使得基于物体表面反射光的测距方案无法应用在工业场景下。上述两种方案均对于玻璃一类透明物体在环境条件恶劣的工业场景不能保证测量结果的持续稳定,且对环境要求较高,不具有泛用性。远心镜头是一种具有特殊光学设计的相机镜头,其主要特点是在一定物距范围内,使得到的图像放大倍率不会变化。无透视误差、近乎零失真度的远心镜头技术特点,使得视觉测量检测可以达到高精度。In actual industrial scenarios, it is necessary to measure the moving speed of transparent objects such as glass. Common speed measurement methods use binocular vision, laser ranging, etc. to measure distance, count the time required for formation, and then calculate the speed. Binocular ranging mainly uses two fixed-distance monocular ordinary lenses to calculate the difference in field of view of the same object in two pictures and then estimate the distance. The edges of transparent objects such as glass are often not obvious enough, and the field of view difference between the two pictures in binocular vision is very weak and difficult to calculate. In order to enhance the edge characteristics of the glass, an auxiliary light source can be used to illuminate the glass to increase the brightness, but the imaging results are related to the ambient lighting. After the glass position changes, the imaging effect under optimal lighting cannot be maintained, so the movement range available for measurement is small and difficult. Laser ranging mainly measures distance by measuring the time it takes for laser, ultrasonic, etc. to return to the source point after contacting the surface of the object. Its accuracy is very high. However, in industrial scenarios, the glass on the production line generally has a high temperature of about 300 degrees Celsius, and the ambient humidity is high. The above-mentioned environmental factors will affect the reflection of laser and ultrasonic waves, making ranging solutions based on light reflected from the object surface unable to be applied in industrial scenarios. The above two solutions cannot guarantee the continuous stability of measurement results for transparent objects such as glass in industrial scenarios with harsh environmental conditions, and have high environmental requirements and are not versatile. A telecentric lens is a camera lens with a special optical design. Its main feature is that the magnification of the image obtained does not change within a certain object distance range. The technical characteristics of the telecentric lens with no perspective error and nearly zero distortion enable visual measurement and inspection to achieve high accuracy.
使用远心镜头对移动中的玻璃平面进行多次拍摄,测得玻璃下表面的位置后,通过计算图像的分辨率和远心镜头的视野范围,可以得到相邻两次拍摄之间玻璃的移动距离。远心镜头的超低畸变(最大像方畸变不超过0.1%)和高远心度,使得通过图像得到的测量结果仍保持高精度。然而远心镜头的视野范围相较普通镜头而言更小,如本发明使用的远心镜头视野大小约为5cm*3cm。对于移动速度较快和误差要求高的场景下,单独的一个远心镜头则达不到目标要求。Use a telecentric lens to take multiple shots of the moving glass plane. After measuring the position of the lower surface of the glass, the movement of the glass between two adjacent shots can be obtained by calculating the resolution of the image and the field of view of the telecentric lens. distance. The ultra-low distortion (maximum image square distortion does not exceed 0.1%) and high telecentricity of the telecentric lens ensure that the measurement results obtained through the image still maintain high accuracy. However, the field of view of the telecentric lens is smaller than that of an ordinary lens. For example, the field of view of the telecentric lens used in the present invention is about 5cm*3cm. For scenes with fast movement speed and high error requirements, a single telecentric lens cannot meet the target requirements.
本发明提出使用双目远心镜头的方案对玻璃平面进行速度测量。两个双目镜头之间的间隔可以自行设定为一固定值,该值取决于目标物体的移动速度和实际部署设备需要。通过加长两次拍摄之间的间隔时间,也使得测出的速度误差更小。The present invention proposes the solution of using a binocular telecentric lens to measure the velocity of a glass plane. The distance between the two binocular lenses can be set to a fixed value, which depends on the moving speed of the target object and the actual deployment equipment needs. By lengthening the interval between two shots, the measured speed error is also smaller.
发明内容Contents of the invention
针对现有技术所存在的上述技术问题,本发明提供了一种基于双目远心镜头的玻璃平面测速方法。相比一般的测距方案,本发明具有更高的测量精度,且对环境要求更低,能维持长时间的高精度测量。In view of the above technical problems existing in the prior art, the present invention provides a glass plane speed measurement method based on a binocular telecentric lens. Compared with general ranging solutions, the present invention has higher measurement accuracy, has lower environmental requirements, and can maintain high-precision measurements for a long time.
为了解决上述技术问题,本发明的技术方案为:In order to solve the above technical problems, the technical solution of the present invention is:
一种基于双目远心镜头的玻璃平面测速方法,包括如下步骤:A glass plane speed measurement method based on binocular telecentric lenses, including the following steps:
S1、搭建图像拍摄装置,所述图像拍摄装置包括两个相机,两个相机的远心镜头分别记为α和β,两个所述相机位于待测玻璃平面一侧,且两个相机的远心镜头垂直于待测玻璃平面的侧面;S1. Build an image capturing device. The image capturing device includes two cameras. The telecentric lenses of the two cameras are marked as α and β respectively. The two cameras are located on one side of the glass plane to be measured, and the telecentric lenses of the two cameras are located on one side of the glass plane to be measured. The center lens is perpendicular to the side of the glass plane to be tested;
S2、根据待测玻璃平面移动速度和两个相机之间的距离设定两个相机的拍摄时间间隔T,两个远心镜头之间的距离d为一固定已知值;S2. Set the shooting time interval T of the two cameras according to the moving speed of the glass plane to be measured and the distance between the two cameras. The distance d between the two telecentric lenses is a fixed known value;
S3、初始化两个相机,并设定采集参数;S3. Initialize the two cameras and set the acquisition parameters;
S4、令α拍摄一张图片Mα,并记录该照片对应的时间戳timeα,间隔时间T后,令β拍摄一张图片Mβ,并记录该照片对应的时间戳timeβ;S4. Let α take a picture M α and record the timestamp time α corresponding to the photo. After an interval of time T, let β take a picture M β and record the timestamp time β corresponding to the photo;
拍摄时,启动本装置,使得玻璃下边缘依次从上方的镜头和下方的镜头中出现。上方的镜头实时检测玻璃是否进入视野中,若进入视野中则按照固定的时间间隔,上下两个相机分别拍摄两张照片。When shooting, start the device so that the lower edge of the glass appears from the upper lens and the lower lens in sequence. The upper lens detects in real time whether the glass enters the field of view. If it enters the field of view, the upper and lower cameras take two photos respectively at fixed time intervals.
两个远心镜头之间的距离大小d设置应当结合物体的移动速度区间设置。如两镜头间隔1s拍摄,则应保证1s开始前的时刻物体出现在上方的镜头视野中,且1s结束的时刻物体出现在下方的镜头视野中。同时也应避免只有上方镜头中能获得物体,而下方镜头中没有拍摄到物体的情况发生。The distance d between the two telecentric lenses should be set in combination with the moving speed range of the object. If two shots are shot with an interval of 1s, it should be ensured that the object appears in the upper lens field of view at the moment before the start of 1s, and the object appears in the lower lens field of view at the end of 1s. At the same time, it should also be avoided that the object is captured in the upper lens but not in the lower lens.
作为优选,物方工作距的值与远心镜头的光学参数相关,应当结合具体使用的镜头进行调整。应尽可能保证物体-镜头的距离在该距离,且误差不应超过3mm。Preferably, the value of the object working distance is related to the optical parameters of the telecentric lens and should be adjusted based on the specific lens used. The distance between the object and the lens should be kept as close as possible, and the error should not exceed 3mm.
作为优选,在测量开始之前,应当保证玻璃的下边缘在上方镜头的上方,即玻璃平面的下边缘还未进入上方镜头的视野中。Preferably, before starting the measurement, it should be ensured that the lower edge of the glass is above the upper lens, that is, the lower edge of the glass plane has not yet entered the field of view of the upper lens.
S5、对两张图片进行玻璃下边缘的定位S5. Position the lower edge of the glass on the two pictures.
S5-1、首先对图片使用Sobel算子对横向上进行处理;S5-1. First, use the Sobel operator to process the image horizontally;
S5-2、对横向处理后的图片使用二值化处理;S5-2. Use binarization processing on the horizontally processed images;
S6、对玻璃下边缘进行定位后的图片进行边界的位置检测S6. Detect the boundary position of the picture after positioning the lower edge of the glass.
S6-1、对二值化处理后的图片dstw*h,对每一列上的所有点进行求和,得到一维向量Pw,其中向量中的每一个值的计算方式如下:S6-1. For the binarized image dst w*h , sum all the points in each column to obtain a one-dimensional vector P w . Each value in the vector is calculated as follows:
从前往后遍历向量中的值,若某点的值大于255*Thickness,即可认为该点的坐标为玻璃的下边缘的横坐标值xα,xβ,Traverse the values in the vector from front to back. If the value of a certain point is greater than 255*Thickness, the coordinates of the point can be considered to be the abscissa values x α and x β of the lower edge of the glass.
其中255为白色代表的像素点值,Thickness为玻璃厚度的像素长。Among them, 255 is the pixel value represented by white, and Thickness is the pixel length of the glass thickness.
S6-2、在图片dstw*h中,划出检测的下边缘直线;S6-2. In the picture dst w*h , draw the lower edge straight line for detection;
S7、根据两张照片对应的玻璃平面移动的时间间隔I以及玻璃移动的距离计算得到玻璃的平均移动速度。S7. Calculate the average moving speed of the glass based on the time interval I of the movement of the glass plane corresponding to the two photos and the distance of the glass movement.
作为优选,所述步骤S2的具体方法为:Preferably, the specific method of step S2 is:
预估目标玻璃平面的移动速度的变化区间[v0,v1],调整两远心镜头之间的距离d(mm),计算相邻拍摄时间间隔T:Estimate the change range of the moving speed of the target glass plane [v 0 , v 1 ], adjust the distance d (mm) between the two telecentric lenses, and calculate the adjacent shooting time interval T:
作为优选,所述步骤S2中还包括调整远心镜头距离玻璃侧面的距离。Preferably, step S2 also includes adjusting the distance between the telecentric lens and the side of the glass.
作为优选,所述远心镜头α和β以50Hz的拍摄帧率进行拍摄。Preferably, the telecentric lenses α and β shoot at a shooting frame rate of 50 Hz.
作为优选,所述步骤S4中还包括图片预处理:Preferably, the step S4 also includes image preprocessing:
将彩色RGB图转化为灰度图后继续进行检测:Convert the color RGB image into grayscale image and continue detection:
Gray=Red*0.3+Green*0.59+Blue*0.11Gray=Red*0.3+Green*0.59+Blue*0.11
得到的灰度二维的图片矩阵Mw*h,矩阵中每一个值代表该点处的灰度值,值的范围在[0,255],远心镜头的视野范围为相机在摆放时逆时针旋转了90度,以便获取更大的视野距离,对矩阵M的每一列上的所有点进行求和,得到一维向量Nw,其中向量中的每一个值的计算方式如下:The obtained grayscale two-dimensional picture matrix M w*h . Each value in the matrix represents the grayscale value at that point. The value range is [0, 255]. The field of view of the telecentric lens is when the camera is placed. Rotated 90 degrees counterclockwise to obtain a larger field of view, all points on each column of the matrix M are summed to obtain a one-dimensional vector N w , where each value in the vector is calculated as follows:
从后往前遍历向量中的值,若有一点的值超过预定宽度Thickness=40pixel,表明玻璃出现在视野中,这里40像素是指玻璃在图片上的厚度,Traverse the values in the vector from back to front. If the value at one point exceeds the predetermined width Thickness=40pixel, it indicates that the glass appears in the field of view. Here 40 pixels refers to the thickness of the glass on the picture.
若玻璃出现则进入下一步,若不出现,则重复步骤3。If the glass appears, go to the next step. If it does not, repeat step 3.
作为优选,所述步骤S5-1的具体方法为:Preferably, the specific method of step S5-1 is:
使用Sobel算子中X方向的矩阵对Mα,β进行卷积操作,得到初步的边缘位置:Use the matrix in the X direction of the Sobel operator to perform a convolution operation on M α, β to obtain the preliminary edge position:
作为优选,所述步骤S5-2的具体方法为:Preferably, the specific method of step S5-2 is:
使用二值化处理,加强边界的效果,得到二值化后的处理结果图dst。其中dst上的每一个像素点的值由SobelX上对应的点的值计算得到,故dst矩阵的尺寸也为w*h。dst中每个点的计算方式如下:Use binarization processing to enhance the effect of the boundary, and obtain the binarized processing result map dst. The value of each pixel on dst is calculated from the value of the corresponding point on SobelX, so the size of the dst matrix is also w*h. Each point in dst is calculated as follows:
作为优选,所述步骤S6的具体方法为:Preferably, the specific method of step S6 is:
下面对玻璃边界的位置进行检测。同样地,对二值化处理后的图片dst,对每一列上的所有点进行求和,得到一维向量P,向量共有h个值。其中向量中的每一个值的计算方式如下:Next, the position of the glass boundary is detected. Similarly, for the binarized image dst, sum all the points in each column to obtain a one-dimensional vector P, which has a total of h values. Each value in the vector is calculated as follows:
其中,i表示图片M中的第i列,也表示向量P中的第i个值,取值范围为[1,w]。j表示第几行,取值范围为[1,h]。Among them, i represents the i-th column in the picture M, and also represents the i-th value in the vector P, and the value range is [1, w]. j represents the row number, and the value range is [1, h].
从前往后遍历向量中的值,若某点的值大于255*Thickness,即可认为该点的坐标为玻璃的下边缘的横坐标值xα,xβ,其中255为白色代表的像素点值,Thickness为玻璃厚度的像素长。Traverse the values in the vector from front to back. If the value of a certain point is greater than 255*Thickness, the coordinates of the point can be considered to be the abscissa values x α and x β of the lower edge of the glass, where 255 is the pixel value represented by white. , Thickness is the pixel length of the glass thickness.
作为优选,所述步骤S7中,两张照片对应的玻璃平面移动的时间间隔I(ms)为:Preferably, in step S7, the time interval I (ms) for the movement of the glass plane corresponding to the two photos is:
I=(timeβ-timeα)/109,I=(time β -time α )/10 9 ,
玻璃移动的距离计算方法为:The distance the glass moves is calculated as:
玻璃的移动距离分为三个部分:Mα中的玻璃边缘距离α下边界的距离;Mβ中的玻璃边缘距离β上边界的距离;α下边界到β上边界的距离,即α,β两镜头之间的距离d,The moving distance of the glass is divided into three parts: the distance between the glass edge in M α and the lower boundary of α; the distance between the glass edge in M β and the upper boundary of β; the distance from the lower boundary of α to the upper boundary of β, that is, α, β The distance d between the two lenses,
则玻璃移动的距离为:Then the distance the glass moves is:
Distance=(xα+w-xβ)*K+dDistance=(x α +wx β )*K+d
其中,K为像素长度换算成实际长度的比例系数。Among them, K is the proportional coefficient that converts the pixel length into the actual length.
作为优选,所述比例系数K的计算如下:Preferably, the proportional coefficient K is calculated as follows:
其中lenw为远心镜头的横向视野,单位为mm。imagew为图片的横向分辨率,单位为像素。Where len w is the lateral field of view of the telecentric lens, in mm. image w is the horizontal resolution of the image, in pixels.
本发明具有以下的特点和有益效果:The invention has the following characteristics and beneficial effects:
采用上述技术方案,本发明提出使用双目远心镜头的方案对玻璃平面进行速度测量,部署和使用简单方便。不需要预设参数,可直接用于测量。通过调节相机之间的距离和检测的时间间隔,可以测量的速度范围广。本发明使用远心镜头和全局曝光相机的组合方案,对于高速运动的物体拍摄不会产生模糊的成像效果。拍摄物体使用远心镜头,其超低畸变的成像特点使得测距达到高精度。同时远心镜头对环境中的光线要求低,不需要额外对玻璃打光,只需避免光线直射远心镜头即可。整个装置对环境的要求低,可满足多种场合下的高精度透明物体测速要求。Adopting the above technical solution, the present invention proposes the solution of using a binocular telecentric lens to measure the speed of a glass plane, which is simple and convenient to deploy and use. No preset parameters are required and can be used directly for measurement. By adjusting the distance between cameras and the time interval between detections, a wide range of speeds can be measured. The present invention uses a combination scheme of a telecentric lens and a global exposure camera, which will not produce blurry imaging effects when shooting high-speed moving objects. A telecentric lens is used to capture objects, and its ultra-low distortion imaging characteristics enable high accuracy in distance measurement. At the same time, the telecentric lens has low requirements for the light in the environment. There is no need to additionally light the glass. You only need to avoid direct light from the telecentric lens. The entire device has low environmental requirements and can meet the requirements for high-precision speed measurement of transparent objects in a variety of situations.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting any creative effort.
图1为本发明实施例的流程图。Figure 1 is a flow chart of an embodiment of the present invention.
图2为本发明玻璃与相机的位置示意图Figure 2 is a schematic diagram of the positions of the glass and the camera according to the present invention.
图3为相机拍摄得到的灰度成像图。Figure 3 shows the grayscale image captured by the camera.
图4为使用Sobel算子进行处理后的结果图。Figure 4 shows the result after processing using the Sobel operator.
图5为使用二值化处理后的结果图。Figure 5 shows the result after binarization processing.
图6为画出检测的玻璃下边缘位置结果图。Figure 6 shows the results of the detected lower edge position of the glass.
具体实施方式Detailed ways
需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。It should be noted that, as long as there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
在本发明的描述中,需要理解的是,术语“中心”、“纵向”、“横向”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”等的特征可以明示或者隐含地包括一个或者更多个该特征。在本发明的描述中,除非另有说明,“多个”的含义是两个或两个以上。In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", " The orientations or positional relationships indicated by "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and The simplified description is not intended to indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, the terms “first”, “second”, etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Thus, features defined by "first," "second," etc. may explicitly or implicitly include one or more of such features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
在本发明的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以通过具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, it should be noted that, unless otherwise clearly stated and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense. For example, it can be a fixed connection or a detachable connection. Connection, or integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be an internal connection between two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood through specific situations.
下述步骤中,使用的远心镜头型号:大恒图像-ZXCM118-64H-AL,使用的相机型号:大恒图像-MER2-302-56U3M。本发明对远心镜头和相机的型号和品牌没有固定要求,需注意的是在实施方案时应结合具体的器材光学参数进行计算和实施。In the following steps, the telecentric lens model used is: Daheng Image-ZXCM118-64H-AL, and the camera model used: Daheng Image-MER2-302-56U3M. The present invention has no fixed requirements on the model and brand of the telecentric lens and camera. It should be noted that the calculation and implementation should be based on the specific optical parameters of the equipment when implementing the solution.
本发明提供了一种基于双目远心镜头的方案对玻璃平面进行速度测量,具体流程图参照图1,本发明基于双目远心镜头的玻璃平面测速方案包括以下步骤:The present invention provides a solution for measuring the speed of a glass plane based on a binocular telecentric lens. For a specific flow chart, refer to Figure 1. The present invention's solution for measuring the speed of a glass plane based on a binocular telecentric lens includes the following steps:
步骤1、令镜头垂直于玻璃平面的侧面。两镜头之间的连线即为平面移动的方向。预估目标玻璃平面的移动速度的变化区间[v0,v1],调整两远心镜头之间的距离d(mm)。计算相邻拍摄时间间隔T。Step 1. Make the lens perpendicular to the side of the glass plane. The line between the two lenses is the direction of plane movement. Estimate the change range of the moving speed of the target glass plane [v 0 , v 1 ], and adjust the distance d (mm) between the two telecentric lenses. Calculate the time interval T between adjacent shots.
目标移动速度在85mm/s~90mm/s之间,应尽量令计算得到的时间间隔T大于1秒,使得计算得到的速度误差更低。因此在目标移动速度区间固定的前提下,令d>v1*1s即可,这里取d=100mm,计算得到T≈1.14s,这里的间隔时间不需要十分精确,因此设为1.1s即可。The target moving speed is between 85mm/s and 90mm/s. Try to make the calculated time interval T greater than 1 second to make the calculated speed error lower. Therefore, under the premise that the target moving speed interval is fixed, let d>v 1 *1s. Here, take d=100mm and calculate T≈1.14s. The interval time here does not need to be very accurate, so it is set to 1.1s. .
步骤2、调整远心镜头距离玻璃平面的距离,即物方工作距在158mm±3mm区间内。需注意的是,物方工作距与远心镜头的光学参数相关,应根据具体使用的型号确定距离长度。装置和物体的相对位置信息可参考图2。Step 2. Adjust the distance between the telecentric lens and the glass plane, that is, the object working distance is within the range of 158mm±3mm. It should be noted that the object working distance is related to the optical parameters of the telecentric lens, and the distance length should be determined according to the specific model used. The relative position information of the device and the object can be referred to Figure 2.
步骤3、初始化两个相机,确保两个相机正常启动,并能获取到画面。设定对应的采集参数。本发明实施的具体参数如下表格所示:Step 3. Initialize the two cameras to ensure that the two cameras start normally and can obtain images. Set the corresponding collection parameters. The specific parameters for the implementation of the present invention are shown in the following table:
应结合具体实际应用场景设定,保证无物体时镜头中为全黑即可。需注意的是,曝光时间对拍照得到的照片的亮度影响大,曝光时间越长则亮度越强。但不宜过强,以免影响时间间隔的精度。远心镜头对视野范围内的物体捕捉能力强,在无额外补光增强的前提下,仍可以在视野中看到透明的玻璃表面。同时从侧面拍摄玻璃,可进一步增强透明玻璃的成像效果。It should be combined with the actual application scene settings to ensure that the lens is completely black when there are no objects. It should be noted that the exposure time has a great influence on the brightness of the photos taken. The longer the exposure time, the stronger the brightness. But it should not be too strong, so as not to affect the accuracy of the time interval. The telecentric lens has a strong ability to capture objects within the field of view, and the transparent glass surface can still be seen in the field of view without additional supplementary light enhancement. Shooting the glass from the side at the same time can further enhance the imaging effect of transparent glass.
步骤4、在玻璃进入视野之前,启动检测程序。令上方的远心镜头为α,下方的远心镜头为β。令α以50Hz的拍摄帧率进行拍摄检测。每获取一帧的图片,对其拍摄的内容进行检测。Step 4. Before the glass enters the field of view, start the detection process. Let the upper telecentric lens be α and the lower telecentric lens β. Let α perform shooting detection at a shooting frame rate of 50Hz. Each time a frame of picture is obtained, the captured content is detected.
若使用彩色相机拍摄,应当将彩色RGB图转化为灰度图后继续进行检测:If you use a color camera to shoot, you should convert the color RGB image into a grayscale image before continuing the detection:
Gray=Red*0.3+Green*0.59+Blue*0.11 (2)Gray=Red*0.3+Green*0.59+Blue*0.11 (2)
得到的灰度二维的图片矩阵Mw*h,如图3所示。矩阵中每一个值代表该点处的灰度值,值的范围在[0,255]。远心镜头的视野范围为相机在摆放时逆时针旋转了90度,以便获取更大的视野距离。因此从图片上看,玻璃是从右侧移动到左侧的。对矩阵M的每一列上的所有点进行求和,得到一维向量Nw,其中向量中的每一个值的计算方式如下:The obtained grayscale two-dimensional picture matrix M w*h is shown in Figure 3. Each value in the matrix represents the gray value at that point, and the value range is [0, 255]. The field of view of the telecentric lens is that the camera is rotated 90 degrees counterclockwise when placed to obtain a larger field of view. So from the picture, the glass is moving from the right to the left. Summing all the points on each column of the matrix M results in a one-dimensional vector N w , where each value in the vector is calculated as follows:
从后往前遍历向量中的值,若有一点的值超过预定宽度Thickness=40pixel,表明玻璃出现在视野中。这里40像素是指玻璃在图片上的厚度。Traverse the values in the vector from back to front. If the value at one point exceeds the predetermined width Thickness=40pixel, it indicates that the glass appears in the field of view. Here 40 pixels refers to the thickness of the glass on the picture.
若玻璃出现则进入下一步,若不出现,则重复步骤3。If the glass appears, go to the next step. If it does not, repeat step 3.
步骤5、令α拍摄一张照片Mα,并记录该照片对应的时间戳timeα。间隔时间T后,令β拍摄一张照片Mβ,并记录该照片对应的时间戳timeβ。其中时间戳为相机内部的时钟提供的,单位为纳秒。Step 5. Let α take a photo M α and record the timestamp time α corresponding to the photo. After an interval of time T, let β take a photo M β and record the timestamp time β corresponding to the photo. The timestamp is provided by the camera's internal clock, and the unit is nanoseconds.
对上述两张图片进行玻璃下边缘的定位。首先对图片使用Sobel算子对横向上进行处理,即使用Sobel算子中X方向的矩阵对Mα,β进行卷积操作,得到初步的边缘位置:Position the lower edge of the glass in the above two pictures. First, use the Sobel operator to process the image in the horizontal direction, that is, use the matrix in the X direction of the Sobel operator to perform a convolution operation on M α and β to obtain the preliminary edge position:
处理得到的结果如图4所示。The results obtained from the processing are shown in Figure 4.
使用二值化处理,加强边界的效果。其中图片上每个点的值的计算如下:Use binarization to enhance the effect of boundaries. The value of each point on the picture is calculated as follows:
其中threshold值应根据Sobel算子处理得到的亮度进行设置。本方法设置为175。二值化后得到的图片如图5所示。The threshold value should be set according to the brightness obtained by Sobel operator processing. This method is set to 175. The image obtained after binarization is shown in Figure 5.
下面对玻璃边界的位置进行检测。同样地,对二值化处理后的图片dstw*h,对每一列上的所有点进行求和,得到一维向量Pw,其中向量中的每一个值的计算方式如下:Next, the position of the glass boundary is detected. Similarly, for the binarized image dst w*h , all points on each column are summed to obtain a one-dimensional vector P w , where each value in the vector is calculated as follows:
从前往后遍历向量中的值,若某点的值大于255*Thickness,即可认为该点的坐标为玻璃的下边缘的横坐标值xα,xβ。其中255为白色代表的像素点值,Thickness为玻璃厚度的像素长。Traverse the values in the vector from front to back. If the value of a certain point is greater than 255*Thickness, the coordinates of the point can be considered to be the abscissa values x α and x β of the lower edge of the glass. Among them, 255 is the pixel value represented by white, and Thickness is the pixel length of the glass thickness.
在M中,划出检测的下边缘直线,如图6所示。对Mα,Mβ做同样的处理,可得到两张照片中玻璃边界所在的位置xα,xβ。In M, draw the lower edge straight line of the test, as shown in Figure 6. By doing the same process for M α and M β , the positions x α and x β of the glass boundary in the two photos can be obtained.
对于像素长度换算成实际长度的比例系数K的计算如下:The calculation of the proportion coefficient K for converting pixel length into actual length is as follows:
对于本专利使用的远心镜头和相机,计算可得K=0.02568359375mm/pixel。步骤6、由上述步骤所得到值,可得两张照片对应的玻璃平面移动的时间间隔I(ms)为:For the telecentric lens and camera used in this patent, K=0.02568359375mm/pixel can be calculated. Step 6. From the values obtained in the above steps, the time interval I (ms) of the movement of the glass plane corresponding to the two photos can be obtained as:
I=(timeβ-timeα)/109 (9)I=(time β -time α )/10 9 (9)
玻璃的移动距离分为三个部分:Mα中的玻璃边缘距离α下边界的距离;Mβ中的玻璃边缘距离β上边界的距离;α下边界到β上边界的距离,即α,β两镜头之间的距离d。The moving distance of the glass is divided into three parts: the distance between the glass edge in M α and the lower boundary of α; the distance between the glass edge in M β and the upper boundary of β; the distance from the lower boundary of α to the upper boundary of β, that is, α, β The distance d between the two lenses.
则玻璃移动的距离为:Then the distance the glass moves is:
Distance=(xα+w-xβ)*K+d (10)Distance=(x α +wx β )*K+d (10)
玻璃的平均移动速度为:The average moving speed of the glass is:
基于上述的步骤,多次实验并统计数据。使用机械臂保证玻璃以规定的速度移动。测得速度和速度误差保留4位小数,如下表所示:Based on the above steps, perform multiple experiments and collect statistical data. A robotic arm is used to ensure that the glass moves at a specified speed. The measured speed and speed error are kept to 4 decimal places, as shown in the following table:
从表中数据可以看出,本专利提供的测速方法具有较高的精度,在较快速度情况下仍能保证足够的高精度测速结果。It can be seen from the data in the table that the speed measurement method provided by this patent has high accuracy and can still ensure sufficient high-precision speed measurement results under relatively fast speed conditions.
本申请提供的上述方法与现有技术相比具有如下的优点:The above method provided by this application has the following advantages compared with the existing technology:
此算法基于双目远心镜头的玻璃平面测速方法,适用性强,可计算包括透明和高温物体在内的多种场景下的物体。不需要进行预设参数的计算,部署和使用方便。本算法的精度值取决于计算得到的K值,该值与远心镜头的视野大小和相机的成像元件相关,在上述实验中可达到约0.02mm/pixel的高精度级别,若选用更大视野的远心镜头和更高分辨率的相机,可进一步提升精度。对于玻璃移动的时间间隔I,因使用相机内置的时钟,精度可达到纳秒级。且计算时间间隔时使用的是相机返回的照片对应的时刻,其时间计算包括了曝光时间等光学成像过程的时间开销,时间间隔的计算足够精准。在玻璃的下边缘检测上,不同于常见的边缘检测算法,本方法与远心镜头的成像特点出发,不使用如高斯滤波等可能模糊成像内容的图片处理方法,尽可能保留了图像中玻璃的部分,使得测量的结果尽可能精准。从实验数据上看,本专利提出的方法具有广泛用性,高识别率和测量精度高的特点。This algorithm is based on the glass plane speed measurement method with binocular telecentric lenses. It has strong applicability and can calculate objects in a variety of scenarios, including transparent and high-temperature objects. There is no need to calculate preset parameters, and it is easy to deploy and use. The accuracy value of this algorithm depends on the calculated K value, which is related to the field of view of the telecentric lens and the imaging element of the camera. In the above experiment, a high accuracy level of about 0.02mm/pixel can be achieved. If a larger field of view is selected, Telecentric lenses and higher-resolution cameras further improve accuracy. For the time interval I of the glass movement, the accuracy can reach nanosecond level due to the use of the built-in clock of the camera. And when calculating the time interval, the time corresponding to the photo returned by the camera is used. The time calculation includes the time overhead of the optical imaging process such as exposure time, and the calculation of the time interval is accurate enough. In detecting the lower edge of the glass, unlike common edge detection algorithms, this method is based on the imaging characteristics of the telecentric lens. It does not use image processing methods such as Gaussian filtering that may blur the imaging content, and retains the texture of the glass in the image as much as possible. part to make the measurement results as accurate as possible. Judging from the experimental data, the method proposed in this patent has the characteristics of wide applicability, high recognition rate and high measurement accuracy.
上述的对实施例的描述是为便于本技术领域的普通技术人员能理解和应用本发明。熟悉本领域技术的人员显然可以容易地对上述实施例做出各种修改,并把在此说明的一般原理应用到其他实施例中而不必经过创造性的劳动。因此,本发明不限于上述实施例,本领域技术人员根据本发明的揭示,对于本发明做出的改进和修改都应该在本发明的保护范围之内。The above description of the embodiments is to facilitate those of ordinary skill in the art to understand and apply the present invention. It is obvious that those skilled in the art can easily make various modifications to the above-described embodiments and apply the general principles described here to other embodiments without going through any creative efforts. Therefore, the present invention is not limited to the above embodiments. Improvements and modifications made by those skilled in the art based on the disclosure of the present invention should be within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311077473.7A CN117110642A (en) | 2023-08-25 | 2023-08-25 | Glass plane speed measuring method based on binocular telecentric lens |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311077473.7A CN117110642A (en) | 2023-08-25 | 2023-08-25 | Glass plane speed measuring method based on binocular telecentric lens |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117110642A true CN117110642A (en) | 2023-11-24 |
Family
ID=88801619
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311077473.7A Pending CN117110642A (en) | 2023-08-25 | 2023-08-25 | Glass plane speed measuring method based on binocular telecentric lens |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117110642A (en) |
-
2023
- 2023-08-25 CN CN202311077473.7A patent/CN117110642A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108470356B (en) | A fast ranging method for target objects based on binocular vision | |
CN113744351B (en) | Underwater structure light measurement calibration method and system based on multi-medium refraction imaging | |
CN114838668B (en) | Tunnel displacement monitoring method and system | |
CN109862345B (en) | Method and system for testing field angle | |
CN108394789A (en) | Cage guide surface abrasion degree detecting method and device based on computer vision | |
CN115272256A (en) | Sub-pixel level sensing optical fiber path Gaussian extraction method and system | |
CN109859155A (en) | Image distortion detection method and system | |
CN115471777A (en) | Refined water flow velocity field acquisition method and system based on video identification | |
CN113155032A (en) | Building structure displacement measurement method based on dynamic vision sensor DVS | |
CN104749801B (en) | High Precision Automatic optical detecting method and system | |
CN114580559A (en) | Speed measuring method based on monocular vision system | |
JP2022013913A (en) | Wire measuring system for board and method for the same | |
CN111598177A (en) | An Adaptive Maximum Sliding Window Matching Method for Low Overlap Image Matching | |
TWI590196B (en) | Method for detecting of liquid | |
CN117110642A (en) | Glass plane speed measuring method based on binocular telecentric lens | |
JP2002310618A (en) | Size measurement device, size measurement method and inspection device for electronic component | |
CN118111915A (en) | A defect detection method, device, equipment and storage medium | |
CN206583440U (en) | A kind of projected image sighting distance detecting system | |
CN110794389B (en) | A non-contact distance measurement method based on image processing | |
CN108759720B (en) | Measurement method of smooth surface | |
CN115035071A (en) | Visual detection method for black spot defect of PAD light guide plate | |
CN100468456C (en) | A method for measuring dimensions by means of a digital camera | |
CN114286078B (en) | Camera module lens appearance inspection method and equipment | |
CN117422664A (en) | Processing and identifying unit, system and method for three-dimensional detection image of hot rolled strip steel edge wave | |
CN112229381A (en) | A Smartphone Ranging Method Using Arm Length and Camera |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |