CN108876842A - A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle - Google Patents
A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle Download PDFInfo
- Publication number
- CN108876842A CN108876842A CN201810359329.5A CN201810359329A CN108876842A CN 108876842 A CN108876842 A CN 108876842A CN 201810359329 A CN201810359329 A CN 201810359329A CN 108876842 A CN108876842 A CN 108876842A
- Authority
- CN
- China
- Prior art keywords
- measured
- measurement
- sub
- edge
- region
- 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
- 238000000691 measurement method Methods 0.000 title claims abstract description 21
- 238000003860 storage Methods 0.000 title claims abstract description 10
- 238000005259 measurement Methods 0.000 claims abstract description 123
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 21
- 238000009826 distribution Methods 0.000 claims abstract description 19
- 239000000284 extract Substances 0.000 claims abstract description 11
- 238000000034 method Methods 0.000 claims description 42
- 238000005070 sampling Methods 0.000 claims description 15
- 230000011218 segmentation Effects 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 9
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims description 3
- 230000009466 transformation Effects 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 abstract description 8
- 238000003708 edge detection Methods 0.000 description 4
- 238000007689 inspection Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000011179 visual inspection Methods 0.000 description 3
- 230000007797 corrosion Effects 0.000 description 1
- 238000005260 corrosion Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000010339 dilation Effects 0.000 description 1
- 230000003628 erosive effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 235000020061 kirsch Nutrition 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012821 model calculation Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/26—Measuring arrangements characterised by the use of optical techniques for measuring angles or tapers; for testing the alignment of axes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20024—Filtering details
- G06T2207/20032—Median filtering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30164—Workpiece; Machine component
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
Description
技术领域technical field
本发明涉及视觉检测技术领域,特别是涉及一种亚像素边缘角度的测量方法、系统、设备及存储介质。The invention relates to the technical field of visual inspection, in particular to a method, system, device and storage medium for measuring sub-pixel edge angles.
背景技术Background technique
工业产品的尺寸测量是工业产品质检中的重要环节。在如今产品多样化、批量化的流水线生产模式中,人工检测已经无法满足产品质检在成本、效率和精度等方面的要求。视觉检测就是一种新型的产品检测技术,它是以图像处理技术为基础,并且具有很高的灵活性和准确性。The dimension measurement of industrial products is an important link in the quality inspection of industrial products. In today's diversified and mass-produced assembly line production mode, manual inspection can no longer meet the requirements of product quality inspection in terms of cost, efficiency, and accuracy. Visual inspection is a new type of product inspection technology, which is based on image processing technology and has high flexibility and accuracy.
视觉检测是通过相机等图像获取设备的图像信号,再传送给图像处理系统,根据像素分布和亮度、颜色等信息,对这些信息进行处理来提取特定的特征信息,最后根据处理的结果来控制设备的运动。它在检测缺陷等方面具有不可估量的价值。Visual inspection is to obtain image signals from image acquisition devices such as cameras, and then transmit them to the image processing system, process these information according to pixel distribution, brightness, color and other information to extract specific feature information, and finally control the device according to the processing results exercise. It is invaluable in detecting defects and more.
在一般的视觉检测中,对图像进行去燥,二值化,阈值分割等操作后,一般会选择一些边缘检测算法,例如一阶的有Roberts Cross算子,Prewitt算子,Sobel算子,Kirsch算子等,二阶的有Canny算子,Laplacian算子等。其中大部分算子所能检测到的边缘均为像素级别,但是随着工业技术的发展,传统的边缘检测方法已经不能满足实际需要,因此亚像素级的检测方法应运而生,它通常是对图像进行二值化分析,然后对于图像中逐渐发生过度变化的区域,通过插值、拟合等多种方法获取边缘点的亚像素位置,现在常见的方法有矩方法、插值法和拟合法。In general visual detection, after de-noising, binarization, threshold segmentation and other operations on the image, some edge detection algorithms are generally selected, such as the first-order Roberts Cross operator, Prewitt operator, Sobel operator, Kirsch Operators, etc., the second-order ones include Canny operators, Laplacian operators, etc. Most of the operators can detect the edge at the pixel level, but with the development of industrial technology, the traditional edge detection method can no longer meet the actual needs, so the sub-pixel level detection method emerges as the times require, it is usually for The image is binarized and analyzed, and then for the region that gradually changes excessively in the image, the sub-pixel position of the edge point is obtained by interpolation, fitting and other methods. Now the common methods include moment method, interpolation method and fitting method.
然而这些方法对于图像的噪声较为敏感,或者是对于模型的计算量较为复杂。例如在一般的边缘检测中,对图像进行二值化处理、阈值分割后,为了获取更加平滑的边缘线,通常会对其进行膨胀或者腐蚀运算,这就造成了零件检测的精度低、鲁棒性差的问题。However, these methods are more sensitive to the noise of the image, or the calculation amount of the model is more complicated. For example, in general edge detection, after binary processing and threshold segmentation are performed on the image, in order to obtain a smoother edge line, dilation or erosion operations are usually performed on it, which results in low accuracy and robustness of part detection. problem of poor sex.
因此,如何解决边缘检测中精度低、模型运算复杂的问题,是本领域技术人员亟待解决的技术问题。Therefore, how to solve the problems of low precision and complex model calculation in edge detection is a technical problem to be solved urgently by those skilled in the art.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种亚像素边缘角度的测量方法、系统、设备及存储介质,测量模型的设定简单,可以减少计算量,改善系统的鲁棒性,提高测量的精度和效率。其具体方案如下:In view of this, the object of the present invention is to provide a method, system, device and storage medium for measuring sub-pixel edge angles. The setting of the measurement model is simple, the amount of calculation can be reduced, the robustness of the system can be improved, and the accuracy of measurement can be improved. and efficiency. The specific plan is as follows:
一种亚像素边缘角度的测量方法,包括:A method for measuring sub-pixel edge angles, comprising:
采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;collecting the original image of the standard part, establishing a measurement model and adding the distribution parameters of the measurement area on the edge of the standard part in the original image;
采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;Collecting a target image of the part to be tested, and obtaining a region to be tested on the edge of the part to be tested in the target image;
将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;aligning the area to be measured with the measurement area, and extracting edge points of the area to be measured;
利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。The edge fitting of the area to be tested is carried out by using a random sampling consensus algorithm to obtain the sub-pixel edge angle of the part to be tested.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数,具体包括:Preferably, in the above-mentioned sub-pixel edge angle measurement method provided in the embodiment of the present invention, the original image of the standard part is collected, the measurement model is established and the distribution parameters of the measurement area of the edge of the standard part in the original image are added, specifically including:
通过工业相机采集标准零件的原始图像;Collect original images of standard parts through industrial cameras;
建立测量模型,并将两个相交的测量线对象添加至所述测量模型;Create a measurement model and add two intersecting measurement line objects to the measurement model;
根据两个所述测量线对象,确定所述原始图像中标准零件边缘的测量区域;determining the measurement area of the edge of the standard part in the original image according to the two measurement line objects;
对所述原始图像进行灰度化和中值滤波处理,得到原始灰度图像;performing grayscale and median filter processing on the original image to obtain an original grayscale image;
在所述原始灰度图像中通过阈值分割处理,获取所述测量区域的分布参数并添加至所述测量模型。In the original grayscale image, the distribution parameters of the measurement area are acquired and added to the measurement model through threshold segmentation processing.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,根据两个所述测量线对象,确定所述原始图像中标准零件边缘的测量区域,具体包括:Preferably, in the above-mentioned sub-pixel edge angle measurement method provided in the embodiment of the present invention, the measurement area of the edge of the standard part in the original image is determined according to the two measurement line objects, specifically including:
设置预先划定范围的测量矩形,所述测量矩形的中心为两个所述测量线对象的交点;Setting a measurement rectangle with a pre-defined range, the center of the measurement rectangle is the intersection of the two measurement line objects;
通过拉伸或收缩两个所述测量线对象,调整所述测量矩形的范围,以确定所述原始图像中标准零件边缘的测量区域。By stretching or contracting the two measuring line objects, the range of the measuring rectangle is adjusted to determine the measuring area of the edge of the standard part in the original image.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域,具体包括:Preferably, in the above-mentioned sub-pixel edge angle measurement method provided in the embodiment of the present invention, the target image of the part to be tested is collected, and the area to be measured on the edge of the part to be measured in the target image is acquired, specifically including:
通过工业相机采集待测零件的目标图像;Collect the target image of the part to be tested through the industrial camera;
对所述目标图像进行灰度化和中值滤波处理,得到待测灰度图像;performing grayscale and median filter processing on the target image to obtain a grayscale image to be measured;
在所述待测灰度图像中通过阈值分割处理,获取所述目标图像中待测零件边缘的待测区域。In the grayscale image to be tested, the region to be tested at the edge of the part to be tested in the target image is obtained through threshold segmentation processing.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,所述待测区域在所述测量矩形的预先划定范围内。Preferably, in the method for measuring the edge angle of the sub-pixel provided by the embodiment of the present invention, the region to be measured is within a predetermined range of the measurement rectangle.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点,具体包括:Preferably, in the above-mentioned method for measuring the edge angle of the sub-pixel provided in the embodiment of the present invention, the region to be measured is aligned with the measurement region, and edge points of the region to be measured are extracted, which specifically includes:
将所述测量区域的一个顶点作为参考点;using a vertex of said measurement area as a reference point;
根据所述参考点,将所述待测区域与所述测量区域进行形状或仿射变换对齐,确定所述待测区域的边缘位置,提取出所述待测区域的边缘点。performing shape or affine transformation alignment on the area to be measured and the measurement area according to the reference point, determining an edge position of the area to be measured, and extracting edge points of the area to be measured.
优选地,在本发明实施例提供的上述亚像素边缘角度的测量方法中,利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度,具体包括:Preferably, in the method for measuring the sub-pixel edge angle provided in the embodiment of the present invention, the random sampling consistency algorithm is used to perform edge fitting on the region to be measured to obtain the sub-pixel edge angle of the part to be measured, Specifically include:
利用随机抽样一致性算法对所述待测区域进行边缘拟合,获取所述待测零件的亚像素边缘轮廓;performing edge fitting on the area to be tested by using a random sampling consensus algorithm to obtain a sub-pixel edge profile of the part to be tested;
找出分布在所述亚像素边缘轮廓的两条相交直线,得出所述待测零件的亚像素边缘角度。Two intersecting straight lines distributed on the sub-pixel edge contour are found to obtain the sub-pixel edge angle of the part to be tested.
本发明实施例还提供了一种亚像素边缘角度的测量系统,包括:The embodiment of the present invention also provides a sub-pixel edge angle measurement system, including:
模型建立模块,用于采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;The model building module is used to collect the original image of the standard part, establish a measurement model and add the distribution parameters of the measurement area on the edge of the standard part in the original image;
区域获取模块,用于采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;An area acquisition module, configured to acquire a target image of the part to be tested, and acquire the area to be tested on the edge of the part to be tested in the target image;
区域对齐模块,用于将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;an area alignment module, configured to align the area to be measured with the measurement area, and extract edge points of the area to be measured;
边缘拟合模块,用于利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。The edge fitting module is used for performing edge fitting on the area to be tested by using a random sampling consensus algorithm to obtain the sub-pixel edge angle of the part to be tested.
本发明实施例还提供了一种虚拟桌面显示设备,其特征在于,包括处理器和存储器;其中,所述处理器执行所述存储器中保存的计算机程序时实现如本发明实施例提供的上述亚像素边缘角度的测量方法。The embodiment of the present invention also provides a virtual desktop display device, which is characterized by including a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the above-mentioned sub A measure of the pixel edge angle.
本发明实施例还提供了一种计算机可读存储介质,其特征在于,用于存储计算机程序;所述计算机程序被处理器执行时实现如本发明实施例提供的上述亚像素边缘角度的测量方法。The embodiment of the present invention also provides a computer-readable storage medium, which is characterized in that it is used to store a computer program; when the computer program is executed by a processor, the above-mentioned method for measuring the sub-pixel edge angle as provided by the embodiment of the present invention is realized .
本发明所提供的一种亚像素边缘角度的测量方法、系统、设备及存储介质,该测量方法包括:采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。A method, system, device, and storage medium for measuring sub-pixel edge angles provided by the present invention, the measurement method includes: collecting an original image of a standard part, establishing a measurement model and adding the measurement area of the edge of the standard part in the original image The distribution parameter of the part to be measured; collect the target image of the part to be tested, and obtain the area to be measured on the edge of the part to be measured in the target image; align the area to be tested with the measurement area, and extract the edge points of the area to be measured ; Using a random sampling consensus algorithm to perform edge fitting on the region to be tested to obtain a sub-pixel edge angle of the part to be tested.
本发明通过建立的测量模型进行区域对齐,再通过随机抽样一致性算法进行边缘拟合,最终得到亚像素边缘角度,测量模型设定简单,计算量少,提高了测量的精度,并且系统的鲁棒性有所改善,测量效率高。The invention carries out area alignment through the established measurement model, and then performs edge fitting through the random sampling consistency algorithm, and finally obtains the sub-pixel edge angle. The measurement model setting is simple, the calculation amount is small, and the measurement accuracy is improved. The stickiness has been improved and the measurement efficiency is high.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明实施例提供的亚像素边缘角度的测量方法流程图;FIG. 1 is a flowchart of a method for measuring a sub-pixel edge angle provided by an embodiment of the present invention;
图2为本发明实施例提供的亚像素边缘角度的测量系统的结构示意图。FIG. 2 is a schematic structural diagram of a sub-pixel edge angle measurement system provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明提供一种亚像素边缘角度的测量方法,如图1所示,包括以下步骤:The present invention provides a method for measuring a sub-pixel edge angle, as shown in Figure 1, comprising the following steps:
S101、采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;S101. Collect the original image of the standard part, establish a measurement model and add the distribution parameters of the measurement area on the edge of the standard part in the original image;
实际应用中,采集的原始图像可以是将标准零件与周围背景相比较,选择对比度大的图像,这样在之后的阈值分割处理,颜色区间易划开,易于获取所述标准零件的原始边缘;刚建立的测量模型是一个空的测量模型的数据结构,之后在这个模型的数据结构中添加原始图像中标准零件边缘的测量区域的分布参数;需要说明的是,相机的标定参数、零件的位姿、参考系统的变量,以及之后测出的待测零件的形状参数、待测区域的分布参数等相关数据均可以实时添加在所述测量模型的数据结构中,作为参考数据,以提高系统的运算速度;In practical applications, the collected original image can be compared with the surrounding background of the standard part, and an image with high contrast is selected, so that the color interval can be easily divided in the subsequent threshold segmentation process, and the original edge of the standard part can be easily obtained; just The established measurement model is the data structure of an empty measurement model, and then the distribution parameters of the measurement area on the edge of the standard part in the original image are added to the data structure of the model; it should be noted that the calibration parameters of the camera, the pose of the part , the variables of the reference system, and related data such as the shape parameters of the parts to be measured and the distribution parameters of the area to be measured can be added in real time to the data structure of the measurement model as reference data to improve the calculation of the system speed;
S102、采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;S102. Collect a target image of the part to be tested, and obtain a region to be tested on the edge of the part to be tested in the target image;
同理,采集的目标图像可以是将待测零件与周围背景相比较,选择对比度大的图像,这样在之后的阈值分割处理,颜色区间易划开,易于获取所述待测零件的原始边缘;Similarly, the collected target image can be to compare the part to be tested with the surrounding background, and select an image with high contrast, so that in the subsequent threshold segmentation process, the color interval is easy to be divided, and the original edge of the part to be tested is easy to obtain;
S103、将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;S103. Align the area to be measured with the measurement area, and extract edge points of the area to be measured;
实际应用时,提取出所述待测区域的边缘点可以实时更新到测量模型中;In practical application, the extracted edge points of the area to be measured can be updated to the measurement model in real time;
S104、利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。S104. Using a random sampling consensus algorithm to perform edge fitting on the region to be tested to obtain a sub-pixel edge angle of the part to be tested.
在本发明实施例提供的上述亚像素边缘角度的测量方法中,首先采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;然后采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;之后将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;最后利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。这样通过建立的测量模型进行区域对齐,再通过随机抽样一致性算法进行边缘拟合,最终得到亚像素边缘角度,测量模型设定简单,计算量少,提高了测量的精度,并且系统的鲁棒性有所改善,测量效率高。In the method for measuring the above-mentioned sub-pixel edge angle provided by the embodiment of the present invention, first collect the original image of the standard part, establish a measurement model and add the distribution parameters of the measurement area of the edge of the standard part in the original image; then collect the part to be measured The target image of the target image is used to obtain the area to be measured on the edge of the part to be measured in the target image; then the area to be tested is aligned with the measurement area, and the edge points of the area to be measured are extracted; finally, the random sampling consistency is used The algorithm performs edge fitting on the area to be tested to obtain the sub-pixel edge angle of the part to be tested. In this way, the area alignment is carried out through the established measurement model, and then the edge fitting is carried out through the random sampling consensus algorithm, and finally the sub-pixel edge angle is obtained. The measurement model setting is simple, the calculation amount is small, the measurement accuracy is improved, and the system is robust. The performance has been improved and the measurement efficiency is high.
需要说明的是,亚像素边缘角度可以理解为待测区域的边缘之间的夹角,是亚像素级别的角度。这里的标准零件和待测零件的边缘有一定的夹角,例如三角形零件,该三角形零件的亚像素边缘角度就是指三角形任意两条边之间的夹角。上述对齐是由于待测零件的摆放有一定的位置误差,为了能够精确地应用测量模型,需要把目标图像摆正。It should be noted that the sub-pixel edge angle can be understood as the angle between the edges of the region to be measured, which is an angle at the sub-pixel level. Here, the edges of the standard part and the part to be tested have a certain included angle, such as a triangular part, and the sub-pixel edge angle of the triangular part refers to the included angle between any two sides of the triangle. The above alignment is due to a certain position error in the placement of the parts to be measured. In order to accurately apply the measurement model, the target image needs to be straightened.
在具体实施时,在本发明实施例提供的上述亚像素边缘角度的测量方法中,步骤S101采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数,具体可以包括以下步骤:During specific implementation, in the above-mentioned sub-pixel edge angle measurement method provided by the embodiment of the present invention, step S101 collects the original image of the standard part, establishes a measurement model and adds the distribution parameters of the measurement area of the edge of the standard part in the original image , which may specifically include the following steps:
步骤一、通过工业相机采集标准零件的原始图像;Step 1. Collect the original image of the standard part through the industrial camera;
实际应用中使用工业相机采集图像,只要获取所述原始图像的尺寸大小即可,可以避免使用高精度相机,减少了成本;In practical applications, industrial cameras are used to collect images, as long as the size of the original image can be obtained, the use of high-precision cameras can be avoided, and the cost can be reduced;
步骤二、建立测量模型,并将两个相交的测量线对象添加至所述测量模型;Step 2, establishing a measurement model, and adding two intersecting measurement line objects to the measurement model;
需要注意的是,加入的两个测量线对象,为之后划定测量矩形范围做准备,可以避免膨胀腐蚀运算改变零件的原始边缘;It should be noted that the two added measurement line objects are used to prepare for the subsequent delineation of the measurement rectangle range, which can avoid the original edge of the part being changed by the expansion and corrosion operation;
步骤三、根据两个所述测量线对象,确定所述原始图像中标准零件边缘的测量区域;Step 3. Determine the measurement area of the edge of the standard part in the original image according to the two measurement line objects;
具体地,在具体实施时,执行步骤三时,首先可以设置预先划定范围的测量矩形(只要包含测量区域,具体测量形状可以根据实际情况而定),所述测量矩形的中心为两个所述测量线对象的交点,这样保证测量区域的中心在所述测量线对象上;然后通过拉伸或收缩两个所述测量线对象,调整所述测量矩形的范围,就可以确定所述原始图像中标准零件边缘的测量区域;该测量区域可以认为是包含有标准零件一部分边缘图像的矩形状区域;Specifically, when implementing step 3, firstly, a measurement rectangle with a pre-defined range can be set (as long as the measurement area is included, the specific measurement shape can be determined according to the actual situation), and the center of the measurement rectangle is two The intersection point of the measurement line object, so that the center of the measurement area is on the measurement line object; then by stretching or shrinking the two measurement line objects, adjusting the range of the measurement rectangle, the original image can be determined The measurement area of the edge of the standard part; the measurement area can be considered as a rectangular area containing a part of the edge image of the standard part;
需要注意的是,为了减小运算量,所述测量矩形的四个边分别与所述原始图像的坐标轴保持平行;也就是说,所述测量矩形的相对两边与所述原始图像的X轴保持平行;所述测量矩形的另外相对两边与所述原始图像的Y轴保持平行;It should be noted that, in order to reduce the amount of computation, the four sides of the measurement rectangle are kept parallel to the coordinate axes of the original image; that is, the two opposite sides of the measurement rectangle are parallel to the X-axis of the original image keep parallel; the other two opposite sides of the measurement rectangle keep parallel to the Y-axis of the original image;
步骤四、对所述原始图像进行灰度化和中值滤波处理,得到原始灰度图像;Step 4, performing grayscale and median filter processing on the original image to obtain the original grayscale image;
步骤五、在所述原始灰度图像中通过阈值分割处理,获取所述测量区域的分布参数并添加至所述测量模型;Step 5. Obtain the distribution parameters of the measurement area through threshold segmentation processing in the original grayscale image and add them to the measurement model;
需要说明的是,在原始灰度图像中通过阈值分割来描述零件的测量区域,具体的阈值可以根据实际情况而定;在测量模型中,可以改变一些参考值,例如相机的标定参数、零件的位姿、参考系统的变量等。It should be noted that the measurement area of the part is described by threshold segmentation in the original grayscale image, and the specific threshold can be determined according to the actual situation; in the measurement model, some reference values can be changed, such as the calibration parameters of the camera, the pose, variables of the reference system, etc.
进一步地,在具体实施时,在本发明实施例提供的上述亚像素边缘角度的测量方法中,步骤S102采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域,具体可以包括以下步骤:Further, during specific implementation, in the above-mentioned sub-pixel edge angle measurement method provided by the embodiment of the present invention, step S102 collects the target image of the part to be measured, and obtains the area to be measured on the edge of the part to be measured in the target image, Specifically, the following steps may be included:
步骤一、通过工业相机采集待测零件的目标图像;Step 1. Collect the target image of the part to be tested through the industrial camera;
实际应用中使用工业相机采集图像,可以避免使用高精度相机,减少了成本;In practical applications, using industrial cameras to collect images can avoid the use of high-precision cameras and reduce costs;
步骤二、对所述目标图像进行灰度化和中值滤波处理,得到待测灰度图像;Step 2, performing grayscale and median filter processing on the target image to obtain a grayscale image to be measured;
步骤三、在所述待测灰度图像中通过阈值分割处理,获取所述目标图像中待测零件边缘的待测区域;Step 3: Obtain the region to be tested at the edge of the part to be tested in the target image through threshold segmentation processing in the grayscale image to be tested;
需要注意的是,所述待测区域可以在所述测量矩形的预先划定范围内,也就是说,可以调用之前预先划定范围的测量矩形来找到在所述目标图像中待测零件边缘上的待测区域;假设目标零件是三角形零件,该待测区域可以认为是包含有三角形零件一部分边缘图像的三角状区域;另外,需要注意的是,为了提高准确度,在测量过程中光源亮度应保持一致。It should be noted that the area to be measured can be within the pre-delimited range of the measurement rectangle, that is, the measurement rectangle with a pre-delimited range can be called to find the area on the edge of the part to be measured in the target image. The area to be tested; assuming that the target part is a triangular part, the area to be tested can be considered as a triangular area containing a part of the edge image of the triangular part; in addition, it should be noted that in order to improve the accuracy, the brightness of the light source should be be consistent.
进一步地,在具体实施时,在本发明实施例提供的上述亚像素边缘角度的测量方法中,步骤S103将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点,具体可以包括以下步骤:Further, during specific implementation, in the above-mentioned sub-pixel edge angle measurement method provided by the embodiment of the present invention, step S103 aligns the area to be measured with the measurement area, and extracts edge points of the area to be measured , which may specifically include the following steps:
首先,将所述测量区域的一个顶点作为参考点;First, a vertex of the measurement area is used as a reference point;
然后,根据所述参考点,将所述待测区域与所述测量区域进行形状或仿射变换对齐,确定所述待测区域的边缘位置,从边缘位置处可以提取出所述待测区域的边缘点。Then, according to the reference point, the shape or affine transformation alignment of the area to be measured and the measurement area is performed to determine the edge position of the area to be measured, and the edge position of the area to be measured can be extracted from the edge position. edge point.
进一步地,在具体实施时,在本发明实施例提供的上述亚像素边缘角度的测量方法中,步骤S104利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度,具体可以包括以下步骤:Further, in specific implementation, in the method for measuring the sub-pixel edge angle provided by the embodiment of the present invention, step S104 uses a random sampling consistency algorithm to perform edge fitting on the region to be measured, and obtains the The sub-pixel edge angle of the part may specifically include the following steps:
首先,利用随机抽样一致性算法对所述待测区域进行边缘拟合,获取所述待测零件的亚像素边缘轮廓;Firstly, using a random sampling consensus algorithm to perform edge fitting on the area to be tested to obtain the sub-pixel edge profile of the part to be tested;
然后,找出分布在所述亚像素边缘轮廓的两条相交直线,得出所述待测零件的亚像素边缘角度。Then, two intersecting straight lines distributed on the sub-pixel edge contour are found to obtain the sub-pixel edge angle of the part to be tested.
需要注意的是,在具体实施时,为了保证测量的准确性,所述待测零件的位姿应保持一致。It should be noted that during specific implementation, in order to ensure the accuracy of the measurement, the poses of the parts to be measured should be kept consistent.
基于同一发明构思,本发明实施例还提供了一种亚像素边缘角度的测量系统,由于该系统解决问题的原理与前述一种亚像素边缘角度的测量方法相似,因此该系统的实施可以参见亚像素边缘角度的测量方法的实施,重复之处不再赘述。Based on the same inventive concept, an embodiment of the present invention also provides a measurement system for sub-pixel edge angles. Since the problem-solving principle of this system is similar to the aforementioned measurement method for sub-pixel edge angles, the implementation of the system can be found in sub-pixel The implementation of the method for measuring the pixel edge angle will not be repeated.
在具体实施时,本发明实施例提供的亚像素边缘角度的测量系统,如图2所示,具体可以包括:In specific implementation, the measurement system of the sub-pixel edge angle provided by the embodiment of the present invention, as shown in FIG. 2 , may specifically include:
模型建立模块11,用于采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;The model building module 11 is used to collect the original image of the standard part, establish a measurement model and add the distribution parameters of the measurement area of the edge of the standard part in the original image;
区域获取模块12,用于采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;The area acquisition module 12 is used to collect the target image of the part to be tested, and acquire the area to be tested on the edge of the part to be measured in the target image;
区域对齐模块13,用于将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;An area alignment module 13, configured to align the area to be measured with the measurement area, and extract edge points of the area to be measured;
边缘拟合模块14,用于利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。The edge fitting module 14 is configured to use a random sampling consensus algorithm to perform edge fitting on the region to be tested to obtain a sub-pixel edge angle of the part to be tested.
在本发明实施例提供的上述亚像素边缘角度的测量系统中,可以通过上述四个模块的相互作用,得到亚像素边缘角度,测量模型设定简单,计算量少,提高了测量的精度,并且系统的鲁棒性有所改善,测量效率高。In the above-mentioned sub-pixel edge angle measurement system provided by the embodiment of the present invention, the sub-pixel edge angle can be obtained through the interaction of the above four modules, the measurement model is simple to set, the amount of calculation is small, and the measurement accuracy is improved, and The robustness of the system is improved and the measurement efficiency is high.
相应的,本发明实施例还公开了一种虚拟桌面显示设备,包括处理器和存储器;其中,所述处理器执行所述存储器中保存的计算机程序时实现前述实施例公开的亚像素边缘角度的测量方法。Correspondingly, the embodiment of the present invention also discloses a virtual desktop display device, including a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the sub-pixel edge angle disclosed in the foregoing embodiments is realized. Measurement methods.
关于上述方法更加具体的过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。For a more specific process of the above method, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.
进一步的,本发明还公开了一种计算机可读存储介质,用于存储计算机程序;所述计算机程序被处理器执行时实现前述公开的亚像素边缘角度的测量方法。Furthermore, the present invention also discloses a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the method for measuring the sub-pixel edge angle disclosed above is implemented.
关于上述方法更加具体的过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。For a more specific process of the above method, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的系统、设备、存储介质而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the systems, devices, and storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and for relevant details, please refer to the description of the methods.
本发明所提供的一种亚像素边缘角度的测量方法、系统、设备及存储介质,该测量方法包括:采集标准零件的原始图像,建立测量模型并添加所述原始图像中标准零件边缘的测量区域的分布参数;采集待测零件的目标图像,获取所述目标图像中待测零件边缘的待测区域;将所述待测区域与所述测量区域对齐,提取出所述待测区域的边缘点;利用随机抽样一致性算法对所述待测区域进行边缘拟合,得出所述待测零件的亚像素边缘角度。本发明通过建立的测量模型进行区域对齐,再通过随机抽样一致性算法进行边缘拟合,最终得到亚像素边缘角度,测量模型设定简单,计算量少,提高了测量的精度,并且系统的鲁棒性有所改善,测量效率高。A method, system, device, and storage medium for measuring sub-pixel edge angles provided by the present invention, the measurement method includes: collecting an original image of a standard part, establishing a measurement model and adding the measurement area of the edge of the standard part in the original image The distribution parameter of the part to be measured; collect the target image of the part to be tested, and obtain the area to be measured on the edge of the part to be measured in the target image; align the area to be tested with the measurement area, and extract the edge points of the area to be measured ; Using a random sampling consensus algorithm to perform edge fitting on the region to be tested to obtain a sub-pixel edge angle of the part to be tested. The invention carries out area alignment through the established measurement model, and then performs edge fitting through the random sampling consistency algorithm, and finally obtains the sub-pixel edge angle. The measurement model setting is simple, the calculation amount is small, and the measurement accuracy is improved. The stickiness has been improved and the measurement efficiency is high.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上对本发明所提供的亚像素边缘角度的测量方法及其测量系统进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method for measuring the sub-pixel edge angle and its measurement system provided by the present invention have been described above in detail. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The descriptions of the above embodiments are only used to help understanding The method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be construed as a limitation of the invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810359329.5A CN108876842A (en) | 2018-04-20 | 2018-04-20 | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810359329.5A CN108876842A (en) | 2018-04-20 | 2018-04-20 | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108876842A true CN108876842A (en) | 2018-11-23 |
Family
ID=64326431
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810359329.5A Pending CN108876842A (en) | 2018-04-20 | 2018-04-20 | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108876842A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110322395A (en) * | 2019-06-18 | 2019-10-11 | 电子科技大学中山学院 | Part outline shape detection method and device based on image processing and affine transformation |
CN110866949A (en) * | 2019-11-15 | 2020-03-06 | 广东利元亨智能装备股份有限公司 | Center point positioning method, device, electronic device and storage medium |
CN113269767B (en) * | 2021-06-07 | 2023-07-18 | 中电科机器人有限公司 | Batch part feature detection method, system, medium and equipment based on machine vision |
CN116503415A (en) * | 2023-06-29 | 2023-07-28 | 深圳思谋信息科技有限公司 | Defect detection method, defect detection device, computer equipment and computer readable storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103499296A (en) * | 2013-10-21 | 2014-01-08 | 东华大学 | Batch part automatic detection system and method based on machine vision |
CN104574421A (en) * | 2015-01-29 | 2015-04-29 | 北方工业大学 | Large-breadth small-overlapping-area high-precision multispectral image registration method and device |
-
2018
- 2018-04-20 CN CN201810359329.5A patent/CN108876842A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103499296A (en) * | 2013-10-21 | 2014-01-08 | 东华大学 | Batch part automatic detection system and method based on machine vision |
CN104574421A (en) * | 2015-01-29 | 2015-04-29 | 北方工业大学 | Large-breadth small-overlapping-area high-precision multispectral image registration method and device |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110322395A (en) * | 2019-06-18 | 2019-10-11 | 电子科技大学中山学院 | Part outline shape detection method and device based on image processing and affine transformation |
CN110866949A (en) * | 2019-11-15 | 2020-03-06 | 广东利元亨智能装备股份有限公司 | Center point positioning method, device, electronic device and storage medium |
CN113269767B (en) * | 2021-06-07 | 2023-07-18 | 中电科机器人有限公司 | Batch part feature detection method, system, medium and equipment based on machine vision |
CN116503415A (en) * | 2023-06-29 | 2023-07-28 | 深圳思谋信息科技有限公司 | Defect detection method, defect detection device, computer equipment and computer readable storage medium |
CN116503415B (en) * | 2023-06-29 | 2023-09-12 | 深圳思谋信息科技有限公司 | Defect detection method, defect detection device, computer equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Trujillo-Pino et al. | Accurate subpixel edge location based on partial area effect | |
CN106651828B (en) | Method for measuring sub-pixel of product size under industrial small-scale motion blur imaging condition | |
CN114897864B (en) | Workpiece detection and defect judgment method based on digital model information | |
CN101673397B (en) | Digital camera nonlinear calibration method based on LCDs | |
CN103353985B (en) | A kind of Measurement Method of image Gaussian Blur | |
JP6899189B2 (en) | Systems and methods for efficiently scoring probes in images with a vision system | |
CN108876842A (en) | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle | |
CN107192716A (en) | A kind of workpiece, defect quick determination method based on contour feature | |
CN107239742A (en) | A kind of gauge pointer scale value calculating method | |
CN109035230B (en) | Round hole diameter visual measurement method | |
CN116958145B (en) | Image processing method and device, visual detection system and electronic equipment | |
CN116165216B (en) | Liquid crystal display micro scratch flaw 3D detection method, system and computing equipment | |
CN111723821A (en) | Method and device for detecting and identifying images of power plant instrumentation | |
Nguyen et al. | Automatic crack detection from 2D images using a crack measure-based B-spline level set model | |
CN106595496A (en) | Man-machine interaction part size flexibility vision measurement method | |
CN113554688B (en) | O-shaped sealing ring size measurement method based on monocular vision | |
CN111102920A (en) | Mechanical component quality inspection method and system based on augmented reality | |
CN114445318A (en) | A defect detection method, device, electronic device and storage medium | |
CN107561736B (en) | LCD defect detection method based on Fourier transform and Hough transform | |
CN114998571B (en) | Image processing and color detection method based on fixed-size markers | |
CN116342585A (en) | Product defect detection method, device, equipment and storage medium | |
CN116152208A (en) | Defect detection method, device, equipment and storage medium | |
Nguyen et al. | Deep learning-enhanced defects detection for printed circuit boards | |
CN114152200A (en) | Chip pin measuring method and device | |
KR101574195B1 (en) | Auto Calibration Method for Virtual Camera based on Mobile Platform |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181123 |
|
RJ01 | Rejection of invention patent application after publication |