CN110634128A - A ball stud pin size detection method, device, computer equipment and storage medium - Google Patents
A ball stud pin size detection method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110634128A CN110634128A CN201910755038.2A CN201910755038A CN110634128A CN 110634128 A CN110634128 A CN 110634128A CN 201910755038 A CN201910755038 A CN 201910755038A CN 110634128 A CN110634128 A CN 110634128A
- Authority
- CN
- China
- Prior art keywords
- image
- ball stud
- edge
- straight line
- detection
- 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
- 238000001514 detection method Methods 0.000 title claims abstract description 89
- 238000003860 storage Methods 0.000 title claims abstract description 16
- 238000003708 edge detection Methods 0.000 claims abstract description 48
- 238000000034 method Methods 0.000 claims abstract description 36
- 238000004590 computer program Methods 0.000 claims abstract description 26
- 238000007781 pre-processing Methods 0.000 claims abstract description 26
- 238000010845 search algorithm Methods 0.000 claims description 12
- 230000009466 transformation Effects 0.000 claims description 10
- 230000003287 optical effect Effects 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 8
- 230000003068 static effect Effects 0.000 claims description 6
- 238000006073 displacement reaction Methods 0.000 claims description 4
- 238000003672 processing method Methods 0.000 claims description 4
- 230000000877 morphologic effect Effects 0.000 claims 2
- 230000010339 dilation Effects 0.000 claims 1
- 230000003628 erosive effect Effects 0.000 claims 1
- 238000004519 manufacturing process Methods 0.000 abstract description 5
- 230000033001 locomotion Effects 0.000 description 12
- 238000005259 measurement Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 238000012545 processing Methods 0.000 description 9
- 238000001914 filtration Methods 0.000 description 8
- 238000009825 accumulation Methods 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 7
- 230000007246 mechanism Effects 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 238000012800 visualization Methods 0.000 description 4
- 230000009977 dual effect Effects 0.000 description 3
- 238000003707 image sharpening Methods 0.000 description 3
- 238000003384 imaging method Methods 0.000 description 3
- 230000000717 retained effect Effects 0.000 description 3
- 239000000725 suspension Substances 0.000 description 3
- 239000000654 additive Substances 0.000 description 2
- 230000000996 additive effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 238000010009 beating Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 2
- 238000001035 drying Methods 0.000 description 2
- 238000009499 grossing Methods 0.000 description 2
- 238000003706 image smoothing Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012634 optical imaging Methods 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 238000013139 quantization Methods 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000001131 transforming effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- 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
-
- 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/24—Measuring arrangements characterised by the use of optical techniques for measuring contours or curvatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- 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/13—Edge detection
-
- 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/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
本发明适用于计算机领域,提供了一种球头销尺寸检测方法、装置、计算机设备及存储介质,所述球头销尺寸检测方法包括:获取第一图像,对第一图像进行预处理,得到第二图像,第二图像至少包括球头销的轮廓图;对轮廓图进行边缘检测,确定球头销的边缘线;对边缘线进行基于Hough变换的直线检测,确定边缘线中的直线部分,确定直线部分的两个端点,并采用欧式距离度量两个端点之间的距离,得到并输出球头销的直线尺寸。本发明实施例提供的球头销尺寸检测方法,通过计算机程序对球头销的图像进行识别测量,通过图像预处理、图像的边缘检测以及直线检测,消除图像噪声,同时通过计算机程序测量尺寸,速度快、效率高,保证产品质量的同时降低生产成本。
The present invention is applicable to the computer field, and provides a ball stud size detection method, device, computer equipment and storage medium. The ball stud size detection method includes: acquiring a first image, preprocessing the first image, and obtaining The second image, the second image at least includes a contour map of the ball stud; edge detection is performed on the contour map to determine the edge line of the ball stud; straight line detection based on Hough transform is performed on the edge line to determine the straight line part in the edge line, Determine the two endpoints of the straight line, and use the Euclidean distance to measure the distance between the two endpoints, and obtain and output the linear dimension of the ball stud. The method for detecting the size of the ball stud provided by the embodiment of the present invention uses a computer program to identify and measure the image of the ball stud, eliminates image noise through image preprocessing, image edge detection, and straight line detection, and measures the size through the computer program. Fast speed and high efficiency ensure product quality while reducing production costs.
Description
技术领域technical field
本发明属于计算机领域,尤其涉及一种球头销尺寸检测方法、装置、计算机设备及存储介质。The invention belongs to the field of computers, and in particular relates to a ball stud size detection method, device, computer equipment and storage medium.
背景技术Background technique
球头销在独立悬架系统中被广泛采用,用于实现控制臂或者推力杆与其它部件之间的连接,作为一种较为精密的连接件,球头销的形状和尺寸都是生成过程中的重要检测参数。Ball studs are widely used in independent suspension systems to realize the connection between control arms or thrust rods and other components. important detection parameters.
现有对于球头销尺寸、形状的检测,都是通过人工使用治具检测,但是治具在使用过程中会有磨损,导致对球头销的检测出现误差,并且人工检测存在效率低、精度差、检测数量有限的缺点,人工成本也较高,并且工人容易出现疲劳,导致漏检或者误检,导致次品或者不合格品流入市场,给商家造成名誉和经济上的损失。The existing detection of the size and shape of the ball stud is done manually using a jig, but the jig will be worn during use, resulting in errors in the detection of the ball stud, and the manual detection has low efficiency and low accuracy. The shortcomings of poor quality and limited testing quantity, high labor costs, and workers are prone to fatigue, resulting in missed or false detections, resulting in defective or substandard products flowing into the market, causing reputational and economic losses to businesses.
由此可见,现有球头销尺寸的检测基本都是依靠人工检测,成本高、精度低,并且效率低下,急需改进。It can be seen that the detection of the size of the existing ball stud basically relies on manual detection, which is costly, low in precision, and low in efficiency, and urgently needs to be improved.
发明内容Contents of the invention
本发明实施例的目的在于提供一种球头销尺寸检测方法、装置、计算机设备及存储介质,旨在解决现有球头销尺寸的检测基本都是依靠人工检测,成本高、精度低,并且效率低下的技术问题。The purpose of the embodiments of the present invention is to provide a ball stud size detection method, device, computer equipment and storage medium, aiming to solve the problem that the existing ball stud size detection basically relies on manual detection, which has high cost and low precision, and Inefficient technical issues.
本发明实施例是这样实现的,一种球头销尺寸检测方法,所述方法包括:The embodiment of the present invention is achieved in this way, a method for detecting the size of a ball stud, the method comprising:
获取第一图像,所述第一图像至少包含完整的球头销图像;acquiring a first image, the first image including at least a complete ball stud image;
对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图;Preprocessing the first image to obtain a second image, the second image at least including a profile of the ball stud;
对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线;performing edge detection on the contour map, and determining the edge line of the ball stud in the contour map;
对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分;Carrying out straight line detection based on Hough transform on the edge line, and determining the straight line part in the edge line;
采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。Using the nearest neighbor search algorithm to determine the two end points of the straight line part, and using the Euclidean distance to measure the distance between the two end points in the coordinate system, to obtain and output the straight line size of the ball stud.
本发明实施例的另一目的在于一种球头销尺寸检测装置,所述球头销尺寸检测装置包括:Another object of the embodiment of the present invention is a ball stud size detection device, the ball stud size detection device includes:
图像获取装置,用于获取第一图像,所述第一图像至少包含完整的球头销图像;An image acquisition device, configured to acquire a first image, the first image at least including a complete ball stud image;
图像预处理装置,用于对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图;An image preprocessing device, configured to preprocess the first image to obtain a second image, the second image at least including the outline of the ball stud;
边缘检测装置,用于对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线;an edge detection device, configured to perform edge detection on the contour map, and determine the edge line of the ball stud in the contour map;
直线检测装置,用于对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分;以及A straight line detection device, configured to perform straight line detection based on Hough transform on the edge line, and determine a straight line part in the edge line; and
信息输出装置,用于采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。The information output device is used to determine the two end points of the straight line part by using the nearest neighbor search algorithm, and measure the distance between the two end points by using the Euclidean distance in the coordinate system, and obtain and output the straight line of the ball stud size.
本发明实施例的另一目的在于一种计算机设备,其特征在于,包括存储器和处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行上述实施例所述球头销尺寸检测方法的步骤。Another object of the embodiments of the present invention is a computer device, which is characterized in that it includes a memory and a processor, a computer program is stored in the memory, and when the computer program is executed by the processor, the processor Execute the steps of the method for detecting the size of the ball stud described in the above embodiments.
本发明实施例的另一目的在于一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时,使得所述处理器执行权上述实施例所述球头销尺寸检测方法的步骤。Another object of the embodiments of the present invention is a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processor executes The steps of the method for detecting the size of the ball stud described in the above-mentioned embodiments.
本发明实施例提供的一种球头销尺寸检测方法,通过采集带检测球头销的图像,并对图像进行预处理,实现图像的滤波和去噪,得到球头销的轮廓图,然后通过边缘检测,找出球头销的边缘线,对边缘线进行基于Hough变换的直线检测,确定边缘线中的直线部分,然后测量直线部分的长度,确定球头销的尺寸,通过计算机程序对球头销的图像进行识别测量,通过图像预处理、图像的边缘检测以及直线检测,消除图像噪声,确保尺寸检测的精确度,同时,通过计算机程序测量尺寸,速度快、效率高,保证产品质量的同时降低生产成本。A method for detecting the size of a ball stud provided by an embodiment of the present invention collects an image of a ball stud with detection, and performs preprocessing on the image to realize filtering and denoising of the image to obtain a contour map of the ball stud, and then through Edge detection, find out the edge line of the ball stud, perform straight line detection based on Hough transform on the edge line, determine the straight line part in the edge line, then measure the length of the straight line part, determine the size of the ball stud pin, and measure the ball stud through the computer program The image of the head pin is recognized and measured. Through image preprocessing, image edge detection and line detection, image noise is eliminated to ensure the accuracy of size detection. At the same time, the size is measured through computer programs, which is fast and efficient, ensuring product quality. At the same time reduce production costs.
附图说明Description of drawings
图1示出了本发明实施例提供的球头销尺寸检测方法的流程图;Fig. 1 shows a flow chart of a ball stud size detection method provided by an embodiment of the present invention;
图2示出了本发明实施提供的一种球头销的形状示意图;Fig. 2 shows a schematic diagram of the shape of a ball stud provided by the implementation of the present invention;
图3示出了本发明实施例提供的一种像素点的梯度强度图;Fig. 3 shows a gradient intensity diagram of a pixel provided by an embodiment of the present invention;
图4示出了本发明实施例提供的一种球头销尺寸检测装置结构示意图;Fig. 4 shows a schematic structural diagram of a ball stud size detection device provided by an embodiment of the present invention;
图5示出了本发明实施例提供的计算机设备的内部结构图。Fig. 5 shows an internal structural diagram of a computer device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
图1为本发明实施例提供的一种球头销尺寸检测方法的流程图。如图1所示,一种球头销尺寸检测方法,具体可以包括以下步骤:Fig. 1 is a flow chart of a method for detecting the size of a ball stud provided by an embodiment of the present invention. As shown in Figure 1, a method for detecting the size of a ball stud may specifically include the following steps:
步骤S102,获取第一图像,所述第一图像至少包含完整的球头销图像。Step S102, acquiring a first image, the first image at least including a complete ball stud image.
在本发明实施例中,图2示出了本发明实施提供的一种球头销的形状示意图,如图2所示,球头销在独立悬架系统中被广泛采用,控制臂或推力杆常通过位于端部的球头销与其它部件相连,球头销的主要功能是实现车轮上下跳动和转向运动。其中,第一图像中至少应该包含完整的球头销图像,并且,球头销图像应该能展示出球头销待测尺寸的部分。In the embodiment of the present invention, Fig. 2 shows a schematic diagram of the shape of a ball stud provided by the present invention. As shown in Fig. 2, the ball stud is widely used in the independent suspension system, the control arm or the thrust rod It is often connected to other components through a ball stud located at the end. The main function of the ball stud is to realize the up and down beating and steering movement of the wheel. Wherein, the first image should at least include a complete image of the ball stud, and the image of the ball stud should be able to show the part of the ball stud whose size is to be measured.
在本发明实施例中,获取第一图像的方式可以是通过无线网络获取,也可以是通过有线网络获取,或者直接读取可移动存储介质中存储的第一图片,本发明不做限制。In the embodiment of the present invention, the first image may be acquired through a wireless network or a wired network, or directly read the first picture stored in a removable storage medium, which is not limited in the present invention.
本发明实施例通过多种方式获取球头销图像,便于后续尺寸检测,同时能够应用于多种场景。The embodiment of the present invention obtains the image of the ball stud in various ways, which is convenient for subsequent size detection, and can be applied to various scenarios at the same time.
步骤S104,对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图。Step S104, performing preprocessing on the first image to obtain a second image, the second image at least including a contour map of the ball stud.
在本发明实施例中,轮廓图是指图像中球头销的形状轮廓图,预处理是指在对图像中的长度进行检测前对图像所进行的操作,包括滤波、去燥、锐化、增强等操作。In the embodiment of the present invention, the contour map refers to the shape contour map of the ball stud in the image, and the preprocessing refers to the operations performed on the image before the length in the image is detected, including filtering, de-drying, sharpening, enhancement etc.
作为本发明一个实施例,对第一图像的预处理可以包括实际的高级可视化处理以及用于后续高级可视化处理的图像数据的任何准备,包括对原始图像进行图像增强处理,变换图像的灰度,使其图像变清晰,对比度增强,边缘特征突出,并对处理好的图像进行图像平滑处理,去除加性噪声、乘性噪声和量化噪声。作为本发明一个实施例,对原始图像进行灰度变换,所述灰度变换为对图像的对比度进行增强或对图像的对比度进行拉伸,生成灰度增强图像,将灰度增强图像变换为直方图均衡图像:设定原始图像中的像素点的原灰度为R,经过灰度变换后的像素点的灰度为S,灰度变换函数为T(R),那么根据以下公式进行灰度变换:As an embodiment of the present invention, the preprocessing of the first image may include actual advanced visualization processing and any preparation of image data for subsequent advanced visualization processing, including performing image enhancement processing on the original image, transforming the gray scale of the image, Make the image clearer, enhance the contrast, highlight the edge features, and perform image smoothing on the processed image to remove additive noise, multiplicative noise and quantization noise. As an embodiment of the present invention, grayscale transformation is performed on the original image, the grayscale transformation is to enhance the contrast of the image or stretch the contrast of the image to generate a grayscale enhanced image, and transform the grayscale enhanced image into a histogram Image equalization image: Set the original grayscale of the pixel in the original image as R, the grayscale of the pixel after grayscale transformation as S, and the grayscale transformation function as T(R), then perform grayscale according to the following formula transform:
其中,0≤Rj≤l-1;py(Rj)是第j级灰度值的概率,nj是图像中j级灰度的像素总数,l是图像中灰度级的总数目,n是图像中像素的总数,j标识灰度的级别,所述灰度的级别根据计算机中可以识别的灰度级别一致。Among them, 0≤R j ≤l-1; p y (R j ) is the probability of gray level j, n j is the total number of pixels of gray level j in the image, and l is the total number of gray levels in the image , n is the total number of pixels in the image, and j identifies the gray level, which is consistent with the gray level that can be recognized by the computer.
本发明实施例提供的图像预处理方法,解决了对摄像头获取的图像进行清晰化处理的技术问题,本发明采用图像增强、平滑滤波和图像锐化的处理方法,有效地消除噪声,改善图像质量,使图像清晰化,有利于更好地提取有效信息用于后续分析。The image preprocessing method provided by the embodiment of the present invention solves the technical problem of clearing the image acquired by the camera. The present invention adopts image enhancement, smoothing filtering and image sharpening processing methods to effectively eliminate noise and improve image quality , to make the image clearer, which is conducive to better extracting effective information for subsequent analysis.
步骤S106,对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线。Step S106, performing edge detection on the outline image, and determining the edge line of the ball stud in the outline image.
在本发明实施例中,边缘检测是图像处理和计算机视觉中的基本问题,边缘检测的目的是标识数字图像中亮度变化明显的点,图像属性中的显著变化通常反映了属性的重要事件和变化,这些包括深度上的不连续、表面方向不连续、物质属性变化和场景照明变化。In the embodiment of the present invention, edge detection is a basic problem in image processing and computer vision. The purpose of edge detection is to identify points with obvious brightness changes in digital images. Significant changes in image attributes usually reflect important events and changes in attributes. , these include discontinuities in depth, discontinuities in surface orientation, changes in material properties, and changes in scene lighting.
作为本发明一种实施例,可以利用Canny边缘检测算子和/或Sobel边缘检测算子对所述轮廓图进行边缘检测,确定所述球头销的边缘线。作为本发明一种实施例,采用Canny边缘检测算子对图像进行边缘检测,第一步是对原始数据与高斯mask作卷积,得到的图像与原始图像相比有些轻微的模糊。这样,单独的一个像素噪声在经过高斯平滑的图像上变得几乎没有影响。然后寻找图像中的强度梯度,平滑后的图像中每个像素点的梯度可以由Sobel算子来获得,首先,利用如下的核来分别求得沿水平(x)和垂直(y)方向的梯度Gx和Gy,如:As an embodiment of the present invention, a Canny edge detection operator and/or a Sobel edge detection operator may be used to perform edge detection on the contour map to determine the edge line of the ball stud. As an embodiment of the present invention, the Canny edge detection operator is used to detect the edge of the image. The first step is to convolve the original data with the Gaussian mask, and the obtained image is slightly blurred compared with the original image. In this way, a single pixel noise becomes almost insignificant on the Gaussian smoothed image. Then look for the intensity gradient in the image. The gradient of each pixel in the smoothed image can be obtained by the Sobel operator. First, use the following kernel to obtain the gradient along the horizontal (x) and vertical (y) directions respectively G x and G y , such as:
=[-101;-202;-121];=[-1-2-1;000;121]=[-101;-202;-121];=[-1-2-1;000;121]
之后便可利用公式来求得每一个像素点的梯度幅值:Then you can use the formula to find the gradient magnitude of each pixel:
有时为了计算简便,也会使用Gx和Gy的无穷大范数来代替二范数。把平滑后的图像中的每一个点用G代替,在变化剧烈的地方(边界处),将获得较大的梯度度量值G,对应的颜色为白色;然而,这些边界通常非常粗,难以标定边界的真正位置。为了做到这一点,还必须存储梯度方向,其公式如下:Sometimes for the convenience of calculation, the infinite norms of G x and G y are used instead of the two norms. Replace each point in the smoothed image with G, and in places with drastic changes (at the boundary), a larger gradient measure value G will be obtained, and the corresponding color will be white; however, these boundaries are usually very thick and difficult to calibrate The real location of the border. In order to do this, the gradient direction must also be stored, with the following formula:
Θ=arctan2(Gy,Gx)Θ = arctan2(G y , G x )
在寻找到图像的强度梯度之后,将其梯度方向近似为以下值中的一个(0,45,90,135,180,225,270,315)比较该像素点,和其梯度方向正负方向的像素点的梯度强度,如果该像素点梯度强度最大则保留,否则抑制,如图3所示,图中的数字代表了像素点的梯度强度,箭头方向代表了梯度方向。以第二排第三个像素点为例,由于梯度方向向上,则将这一点的强度(7)与其上下两个像素点的强度(5和4)比较,由于这一点强度最大,则保留。因为边界处的梯度方向总是指向垂直于边界的方向,即最后会保留一条边界处最亮的一条细线,然后利用之后的边界跟踪,检测到球头销的边缘线。After finding the intensity gradient of the image, approximate its gradient direction to one of the following values (0, 45, 90, 135, 180, 225, 270, 315) and compare the pixel with the gradient strength of the pixel in the positive and negative directions of the gradient direction. If the pixel If the gradient strength is the largest, it is retained, otherwise it is suppressed, as shown in Figure 3, the number in the figure represents the gradient strength of the pixel, and the direction of the arrow represents the gradient direction. Taking the third pixel in the second row as an example, since the gradient direction is upward, compare the intensity (7) of this point with the intensity (5 and 4) of the two pixels above and below, and keep it because the intensity of this point is the largest. Because the gradient direction at the boundary always points to the direction perpendicular to the boundary, that is, the brightest thin line at the boundary will be reserved at the end, and then the edge line of the ball stud will be detected by using the subsequent boundary tracking.
本发明实施例通过边缘检测得到图像中球头销的准确边缘线,便于后续球头销尺寸的识别。In the embodiment of the present invention, the accurate edge line of the ball stud in the image is obtained through edge detection, which facilitates subsequent recognition of the size of the ball stud.
步骤S108,对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分。Step S108, performing straight line detection based on Hough transform on the edge line, and determining a straight line part in the edge line.
在本发明实施例中,利用点线的对偶特性,即图像空间中共线的点对应在参数空间里相交的线,且在参数空间中相交于同一个点的所有直线在图像空间里都有共线的点与之对应的特点,在图像空间中的直线检测问题转换到参数空间中对点的检测问题,并通过在参数空间里进行简单的累加统计完成检测任务。In the embodiment of the present invention, the dual property of point and line is used, that is, the collinear points in the image space correspond to the intersecting lines in the parameter space, and all lines intersecting at the same point in the parameter space have a common According to the corresponding characteristics of the points of the line, the problem of line detection in the image space is transformed into the problem of point detection in the parameter space, and the detection task is completed by simple accumulation statistics in the parameter space.
作为本发明一种实施例,在提取出图像中球头销的边缘线之后,需要对球头销边缘线中的直线部分进行检测,以便于对球头销直线部分的尺寸进行检测。在本发明实施例中,采用基于Hough变换的直线检测方法,对边缘线进行直线检测,通过在参数空间里进行简单的累加统计,然后在Hough参数空间寻找累加器峰值的方法检测直线,Hough变换的实质是将图像空间内具有一定关系的像元进行聚类,寻找能把这些像元用某一解析形式联系起来的参数空间累积对应点,其具体操作步骤,在说明书后续部分会做详细说明。As an embodiment of the present invention, after the edge line of the ball stud in the image is extracted, it is necessary to detect the straight portion of the edge line of the ball stud, so as to detect the size of the straight portion of the ball stud. In the embodiment of the present invention, the straight line detection method based on Hough transform is used to detect the straight line on the edge line, and the straight line is detected by performing simple accumulation statistics in the parameter space, and then finding the peak value of the accumulator in the Hough parameter space, and the Hough transform The essence of this method is to cluster the pixels with a certain relationship in the image space, and find the corresponding point of parameter space accumulation that can connect these pixels with a certain analytical form. The specific operation steps will be explained in detail in the subsequent part of the manual. .
本发明实施例通过基于Hough变换的直线检测对球头销的边缘线进行直线检测,得到球头图像中的直线部分,便于后续对球头销直线部分尺寸的检测,识别精度高,检测结果准。In the embodiment of the present invention, the edge line of the ball stud is detected by the straight line detection based on Hough transform, and the straight line part in the ball head image is obtained, which facilitates subsequent detection of the size of the straight line part of the ball stud, with high recognition accuracy and accurate detection results. .
步骤S110,采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。Step S110, using the nearest neighbor search algorithm to determine the two end points of the straight line, and using the Euclidean distance to measure the distance between the two end points in the coordinate system, to obtain and output the straight line size of the ball stud.
在本发明实施例中,欧式距离是指欧几里得距离,指欧几里得空间中两点间的普通距离,即直线距离。In the embodiment of the present invention, the Euclidean distance refers to the Euclidean distance, and refers to the ordinary distance between two points in the Euclidean space, that is, the straight-line distance.
作为本发明一个实施例,在步骤S108中得到的直线部分中,通过灰度值的确认,当某一像素区域的灰度平均值明显高于该区域三个方向的灰度值,又略低于另一个方向的灰度值时,将该像素区域作为一个端点,通过最近邻搜寻算法,寻找该直线部分中的第二个端点,从而确定该直线部分的两个端点,将两个端点投射到直角坐标系中,然后利用公式:As an embodiment of the present invention, in the straight line part obtained in step S108, through the confirmation of the gray value, when the gray value of a certain pixel area is obviously higher than the gray value of the three directions of the area, and slightly lower For the gray value in the other direction, use the pixel area as an end point, and use the nearest neighbor search algorithm to find the second end point in the straight line part, so as to determine the two end points of the straight line part, and project the two end points into a Cartesian coordinate system, then use the formula:
计算两个端点的欧式距离l,其中,x1、y1、x2、y2分别为第一个端点和第二个端点在直角坐标系中的坐标值。通过计算得到两个端点的距离之后,直接输出l,即为球头销直线部分的尺寸。Calculate the Euclidean distance l between two endpoints, where x 1 , y 1 , x 2 , and y 2 are the coordinate values of the first endpoint and the second endpoint in the Cartesian coordinate system, respectively. After the distance between the two endpoints is obtained by calculation, directly output l, which is the size of the straight part of the ball stud.
本发明实施例提供的一种球头销尺寸检测方法,通过采集带检测球头销的图像,并对图像进行预处理,实现图像的滤波和去噪,得到球头销的轮廓图,然后通过边缘检测,找出球头销的边缘线,对边缘线进行基于Hough变换的直线检测,确定边缘线中的直线部分,然后测量直线部分的长度,确定球头销的尺寸,通过计算机程序对球头销的图像进行识别测量,通过图像预处理、图像的边缘检测以及直线检测,消除图像噪声,确保尺寸检测的精确度,同时,通过计算机程序测量尺寸,速度快、效率高,保证产品质量的同时降低生产成本。A method for detecting the size of a ball stud provided by an embodiment of the present invention collects an image of a ball stud with detection, and performs preprocessing on the image to realize filtering and denoising of the image to obtain a contour map of the ball stud, and then through Edge detection, find out the edge line of the ball stud, perform straight line detection based on Hough transform on the edge line, determine the straight line part in the edge line, then measure the length of the straight line part, determine the size of the ball stud pin, and measure the ball stud through the computer program The image of the head pin is recognized and measured. Through image preprocessing, image edge detection and line detection, image noise is eliminated to ensure the accuracy of size detection. At the same time, the size is measured through computer programs, which is fast and efficient, ensuring product quality. At the same time reduce production costs.
作为本发明一个实施例,所述对所述第一图像进行预处理,得到第二图像,包括:As an embodiment of the present invention, the preprocessing the first image to obtain the second image includes:
对所述第一图像并进行梯度锐化;所述梯度锐化公式为:Gradient sharpening is performed on the first image; the gradient sharpening formula is:
其中,f(x,y)代表图像,G′M[f(x,y)]为最终的灰度代替值,Among them, f(x, y) represents the image, G′ M [f(x, y)] is the final grayscale replacement value,
G′M[f(x,y)]max=225,T′1表示锐化阈值,当梯度值大于T′1时,加强梯度边缘;T′2表示灰度阈值,当图像灰度大于T′2时,灰度值减T2。G′ M [f(x, y)] max = 225, T′ 1 represents the sharpening threshold, when the gradient value is greater than T′ 1 , the gradient edge is strengthened; T′ 2 represents the grayscale threshold, when the image grayscale is greater than T ′ 2 , the gray value minus T 2 .
获取锐化后的所述第一图像内所述球头销图像的边缘灰度值,将灰度值之差满足边缘判定条件的相连像素点作为所述球头销的轮廓,得到所述第二图像。Obtain the edge gray value of the ball stud image in the sharpened first image, and use the connected pixels whose gray value difference satisfies the edge judgment condition as the outline of the ball stud to obtain the first Two images.
在本发明实施例中,现有的图像锐化运用双方向一次微分运算,算出梯度后直接用梯度值替代该点的灰度值,图像最后行列的像素值用临近的梯度值填充。实验发现直接用梯度值代替灰度值会使图像丢失大量原始信息,本发明根据球头销图像的特征,设置门限判断对梯度锐化进行了改进,具体公式为:In the embodiment of the present invention, the existing image sharpening uses a two-way one-time differential operation. After the gradient is calculated, the gradient value is directly used to replace the gray value of the point, and the pixel values in the last row and column of the image are filled with the adjacent gradient values. Experiments have found that directly replacing the gray value with the gradient value will cause the image to lose a large amount of original information. According to the characteristics of the ball stud image, the present invention improves the gradient sharpening by setting a threshold judgment. The specific formula is:
其中,f(x,y)代表图像,G′M[f(x,y)]为最终的灰度代替值,G′M[f(x,y)]max=225,T′1表示锐化阈值,当梯度值大于T′1时,加强梯度边缘;T′2表示灰度阈值,当图像灰度大于T′2时,灰度值减T2;采用上述梯度锐化处理方法可以保留原球头销图像高灰度值信息同时消除了其对梯度边缘的影响,其他情况灰度值不变,处理后的图像既增强了球头销的轮廓又增加边缘信息与其他背景的区分度。将边缘进行锐化之后,获取图像的灰度值,并对灰度值进行分析,当图像的灰度值从出现明显的分界线是,则该分界线即为球头销的边缘线。Among them, f(x, y) represents the image, G′ M [f(x, y)] is the final grayscale replacement value, G′ M [f(x, y)] max = 225, T′ 1 represents the sharpness When the gradient value is greater than T′ 1 , the gradient edge is strengthened; T′ 2 represents the grayscale threshold, when the image grayscale is greater than T′ 2 , the grayscale value is subtracted by T 2 ; the above gradient sharpening method can be used to retain The high gray value information of the original ball stud image eliminates its influence on the gradient edge at the same time, and the gray value remains unchanged in other cases. The processed image not only enhances the outline of the ball stud but also increases the distinction between the edge information and other backgrounds. . After sharpening the edge, obtain the gray value of the image and analyze the gray value. When the gray value of the image shows a clear boundary line, the boundary line is the edge line of the ball stud.
本发明实施例通过对球头销图像进行锐化处理,加强边缘梯度,并通过灰度值的分布确定球头销的边缘线,并与后续球头销直线部分的识别和测量,速度快,测量准确。The embodiment of the present invention sharpens the ball stud image, strengthens the edge gradient, and determines the edge line of the ball stud through the distribution of gray values, and recognizes and measures the straight line portion of the subsequent ball stud with fast speed. The measurements are accurate.
在本发明实施例中,所述对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线,包括:In an embodiment of the present invention, the performing edge detection on the contour map and determining the edge line of the ball stud in the contour map includes:
利用Canny边缘检测算子和/或Sobel边缘检测算子对所述轮廓图进行边缘检测,确定所述球头销的边缘线。An edge detection is performed on the contour map by using a Canny edge detection operator and/or a Sobel edge detection operator to determine the edge line of the ball stud.
作为本发明一种实施例,可以利用Canny边缘检测算子和/或Sobel边缘检测算子对所述轮廓图进行边缘检测,确定所述球头销的边缘线。作为本发明一种实施例,采用Canny边缘检测算子对图像进行边缘检测,第一步是对原始数据与高斯mask作卷积,得到的图像与原始图像相比有些轻微的模糊。这样,单独的一个像素噪声在经过高斯平滑的图像上变得几乎没有影响。然后寻找图像中的强度梯度,平滑后的图像中每个像素点的梯度可以由Sobel算子来获得,首先,利用如下的核来分别求得沿水平(x)和垂直(y)方向的梯度Gx和Gy,如:As an embodiment of the present invention, a Canny edge detection operator and/or a Sobel edge detection operator may be used to perform edge detection on the contour map to determine the edge line of the ball stud. As an embodiment of the present invention, the Canny edge detection operator is used to detect the edge of the image. The first step is to convolve the original data with the Gaussian mask, and the obtained image is slightly blurred compared with the original image. In this way, a single pixel noise becomes almost insignificant on the Gaussian smoothed image. Then look for the intensity gradient in the image. The gradient of each pixel in the smoothed image can be obtained by the Sobel operator. First, use the following kernel to obtain the gradient along the horizontal (x) and vertical (y) directions respectively G x and G y , such as:
=[-101;-202;-121];=[-1-2-1;000;121]=[-101;-202;-121];=[-1-2-1;000;121]
之后便可利用公式来求得每一个像素点的梯度幅值:Then you can use the formula to find the gradient magnitude of each pixel:
有时为了计算简便,也会使用Gx和Gy的无穷大范数来代替二范数。把平滑后的图像中的每一个点用G代替,在变化剧烈的地方(边界处),将获得较大的梯度度量值G,对应的颜色为白色;然而,这些边界通常非常粗,难以标定边界的真正位置。为了做到这一点,还必须存储梯度方向,其公式如下:Sometimes for the convenience of calculation, the infinite norms of G x and G y are used instead of the two norms. Replace each point in the smoothed image with G, and in places with drastic changes (at the boundary), a larger gradient measure value G will be obtained, and the corresponding color will be white; however, these boundaries are usually very thick and difficult to calibrate The real location of the border. In order to do this, the gradient direction must also be stored, with the following formula:
Θ=arctan2(Gy,Gx)Θ = arctan2(G y , G x )
在寻找到图像的强度梯度之后,将其梯度方向近似为以下值中的一个(0,45,90,135,180,225,270,315)比较该像素点,和其梯度方向正负方向的像素点的梯度强度,如果该像素点梯度强度最大则保留,否则抑制,如图3所示,图中的数字代表了像素点的梯度强度,箭头方向代表了梯度方向。以第二排第三个像素点为例,由于梯度方向向上,则将这一点的强度(7)与其上下两个像素点的强度(5和4)比较,由于这一点强度最大,则保留。因为边界处的梯度方向总是指向垂直于边界的方向,即最后会保留一条边界处最亮的一条细线,然后利用之后的边界跟踪,检测到球头销的边缘线。After finding the intensity gradient of the image, approximate its gradient direction to one of the following values (0, 45, 90, 135, 180, 225, 270, 315) and compare the pixel with the gradient strength of the pixel in the positive and negative directions of the gradient direction. If the pixel If the gradient strength is the largest, it is retained, otherwise it is suppressed, as shown in Figure 3, the number in the figure represents the gradient strength of the pixel, and the direction of the arrow represents the gradient direction. Taking the third pixel in the second row as an example, since the gradient direction is upward, compare the intensity (7) of this point with the intensity (5 and 4) of the two pixels above and below, and keep it because the intensity of this point is the largest. Because the gradient direction at the boundary always points to the direction perpendicular to the boundary, that is, the brightest thin line at the boundary will be reserved at the end, and then the edge line of the ball stud will be detected by using the subsequent boundary tracking.
本发明实施例通过边缘检测得到图像中球头销的准确边缘线,便于后续球头销尺寸的识别。In the embodiment of the present invention, the accurate edge line of the ball stud in the image is obtained through edge detection, which facilitates subsequent recognition of the size of the ball stud.
作为本发明一种实施例,所述对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分,包括:As an embodiment of the present invention, the performing straight line detection based on Hough transform on the edge line, and determining the straight line part in the edge line include:
将所述边缘线投射到平面直角坐标系中,并获取所述边缘线上样点的坐标;Projecting the edge line into a plane Cartesian coordinate system, and obtaining coordinates of sample points on the edge line;
通过极坐标运算,将所述样点转换到极坐标系下;其中,变换方程如下:Through the polar coordinate operation, the sample point is transformed into the polar coordinate system; wherein, the transformation equation is as follows:
其中,x、y表示所述样本点在所述平面直角坐标系中的横、纵坐标,Wherein, x and y represent the abscissa and ordinate of the sample point in the plane Cartesian coordinate system,
ρ表示所述样本点的极径,θ为所述样本点的极角;ρ represents the polar diameter of the sample point, and θ is the polar angle of the sample point;
在所述极坐标下检测所述样点中共线点的个数,当所述共线点的个数大于预设值时,则判断检测到直线。Detecting the number of collinear points of the sample points under the polar coordinates, and judging that a straight line is detected when the number of collinear points is greater than a preset value.
在本发明实施例中,原图像空间中的点对应新参数空间中的一条正弦曲线,即点-正弦曲线对偶。检测直线的具体过程就是让θ取遍可能的值,然后计算ρ的值,再根据θ和ρ的值对累加数组累加,从而得到共线点的个数。当直线从与x轴重合处逆时针旋转时,θ的值开始由0°增大,直到180°,即θ的取值范围为0°~180°。由直线极坐标方程可知:In the embodiment of the present invention, a point in the original image space corresponds to a sinusoid in the new parameter space, that is, a point-sine curve dual. The specific process of detecting a straight line is to let θ take all possible values, then calculate the value of ρ, and then accumulate the accumulation array according to the values of θ and ρ, so as to obtain the number of collinear points. When the line rotates counterclockwise from the coincidence with the x-axis, the value of θ starts to increase from 0° to 180°, that is, the value range of θ is 0°~180°. From the polar coordinate equation of a straight line, we know that:
所以当且仅当x和y都达到最大且θ+Φ=±90°时,有:So if and only if both x and y reach the maximum and θ+Φ=±90°, there are:
即ρ的取值范围为: That is, the value range of ρ is:
由θ、ρ的取值范围和它们的分辨率,可以确定Hough变换累加器的大小,并根据阈值大小将Hough变换累加器中累加值小于阈值的点清零,即认为这些点并不对应图像域中的一条直线,直至检测到直线。From the value range of θ and ρ and their resolution, the size of the Hough transform accumulator can be determined, and the points in the Hough transform accumulator whose cumulative value is less than the threshold value are cleared according to the threshold value, that is, these points are considered not to correspond to the image a line in the domain until a line is detected.
在本发明实施例中,通过基于Hough变换的直线检测算法,对球头销轮廓线的直线部分进行检测,确保直线检测在精确度,保证球头销直线部分尺寸测量的准确性。In the embodiment of the present invention, the straight line portion of the outline of the ball stud is detected through a straight line detection algorithm based on the Hough transform, so as to ensure the accuracy of the line detection and the accuracy of the dimension measurement of the straight line portion of the ball stud.
作为本发明一种实施例,所述采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸之前,还包括:As an embodiment of the present invention, the nearest neighbor search algorithm is used to determine the two endpoints of the straight line, and the distance between the two endpoints is measured by the Euclidean distance in the coordinate system to obtain and output the spherical Before the linear dimensions of the header pins, also include:
通过对已知尺寸为L的工件进行静态标定确定光学系统的放大倍数其中K为相机的像素尺寸,N为所述工件在图像上所占像素的个数;Determine the magnification of the optical system by statically calibrating the workpiece with known size L Wherein K is the pixel size of the camera, and N is the number of pixels occupied by the workpiece on the image;
通过公式计算所述光学系统调节后的放大倍数β1,其中,δ为振动位移,μ为静态标定时所述光学系统的物距;by formula Calculate the adjusted magnification β 1 of the optical system, where δ is the vibration displacement, and μ is the object distance of the optical system during static calibration;
利用公式计算所述球头销的尺寸;其中,l为进行误差补偿后的所述球头销的尺寸,N1为所述球头销在所述第二图像上所占像素点的个数use the formula Calculating the size of the ball stud; wherein, l is the size of the ball stud after error compensation, and N1 is the number of pixels occupied by the ball stud on the second image
在本发明实施例中,在高速在线检测过程中,传送机构带动工件运行,工件与传送机构表面将产生振动,可以将振动分解为两个方向:即垂直于传送机构运动方向的垂直振动,沿着传送机构运动方向的前后振动。垂直振动将引起光学成像系统中物距的变化,改变成像系统的放大倍率,带来尺寸测量误差。前后振动是指在线检测过程中传送机构以一定速度运行,导致工件与传送机构之间产生相对运动。在线检测过程中的运动模糊导致的图像模糊现象会使得物体表面的细节分辨不清,直接影响图像的清晰度,造成工件图像表面特征的分辨困难,运动模糊会使得图像的边缘扩大,影响尺寸测量精度。In the embodiment of the present invention, during the high-speed online detection process, the transmission mechanism drives the workpiece to run, and the workpiece and the surface of the transmission mechanism will vibrate, which can be decomposed into two directions: vertical vibration perpendicular to the direction of movement of the transmission mechanism, along the Vibration back and forth in the direction of movement of the transmission mechanism. Vertical vibration will cause changes in the object distance in the optical imaging system, change the magnification of the imaging system, and cause size measurement errors. Back and forth vibration means that the transmission mechanism runs at a certain speed during the online detection process, resulting in relative motion between the workpiece and the transmission mechanism. Image blur caused by motion blur in the online detection process will make the details of the object surface unclear, directly affect the clarity of the image, and make it difficult to distinguish the surface features of the workpiece image. Motion blur will enlarge the edge of the image and affect the size measurement precision.
作为本发明一种实施例,振动误差的补偿分为垂直误差补偿和水平振动误差补偿,其中,垂直误差补偿中,对工件进行在线尺寸检测,须建立图像像素与实际尺寸之间的对应关系。利用已知尺寸为L的工件进行静态标定,确定成像放大倍率。光学系统放大倍率为β,相机像素尺寸为K。通过处理工件图像获得工件在图像上所占像素个数N。则放大倍率为:As an embodiment of the present invention, the vibration error compensation is divided into vertical error compensation and horizontal vibration error compensation. In the vertical error compensation, the online size detection of the workpiece must establish the corresponding relationship between the image pixels and the actual size. Use a workpiece of known size L for static calibration to determine the imaging magnification. The optical system magnification is β, and the camera pixel size is K. The number N of pixels occupied by the workpiece on the image is obtained by processing the workpiece image. Then the magnification is:
不改变在线图像采集装置参数对工件进行在线尺寸检测,不考虑垂直振动补偿,图像上工件所占像素个数,设目标工件尺寸检测值为N1,由上面公式得到N为:Do not change the parameters of the online image acquisition device to detect the online size of the workpiece, regardless of the vertical vibration compensation, the number of pixels occupied by the workpiece on the image, set the target workpiece size detection value to N 1 , get N from the above formula as:
在线尺寸检测过程中对工件尺寸进行垂直振动误差补偿,在不改变焦距的条件下,由光学高斯公式计算放大倍率β1为:In the process of online size detection, the vertical vibration error compensation of the workpiece size is carried out. Under the condition of not changing the focal length, the magnification β1 is calculated by the optical Gaussian formula as:
其中δ为振动位移,β为静态标定时的放大倍率,由β和焦距计算得到静态标定时的光学成像系统物距μ。Where δ is the vibration displacement, β is the magnification during static calibration, and the object distance μ of the optical imaging system during static calibration is calculated from β and the focal length.
考虑垂直振动因素对尺寸测量精度的影响,根据上面公式补偿由振动对检测尺寸带来的误差,故补偿后的尺寸检测值L2为:Consider the influence of the vertical vibration factor on the dimension measurement accuracy, and compensate the error caused by the vibration to the detection dimension according to the above formula , so the dimension detection value L after compensation is:
其中N1为在线检测时工件在图像上所占像素个数。该方法通过对工件垂直振动位移的在线测量实时修正光学系统放大倍率,补偿由垂直振动所带来的尺寸检测误差。Among them, N 1 is the number of pixels occupied by the workpiece on the image during online detection. The method corrects the magnification of the optical system in real time through the online measurement of the vertical vibration displacement of the workpiece, and compensates the size detection error caused by the vertical vibration.
针对水平振动误差,当传送机构的速度v一定时,设相机曝光时间为t,则被测对象相对成像系统的运动模糊值为:For the horizontal vibration error, when the speed v of the transmission mechanism is constant, and the exposure time of the camera is set to t, then the motion blur value of the measured object relative to the imaging system is:
x=vtβx=vtβ
在v、β确定的情况下,x受t的影响。在实际应用时,只要是在线检测,由于速度的存在,运动模糊就不能被消除,所以只能控制运动模糊,将其缩小至不影响尺寸测量精度即可。常用的方法就是利用减小曝光时间控制运动模糊值,有利于减小在线检测中速度因素和前后振动对尺寸测量值带来的影响。但是运动模糊的减小需要以减小曝光时间为代价,曝光时间的减小又会使得图像亮度不足,难以辨认,此时需要靠高亮度的光源和大通光孔径来弥补光源不足,高亮度的光源会增加检测成本,而且高亮度的光源发热量较大,不利于长期工作。大通光孔径会造成镜头景深的的减小。所以需要在减小曝光时间、通光孔径大小控制、光源亮度调节三者之间综合考虑,实现运动模糊的控制。When v and β are determined, x is affected by t. In practical applications, as long as it is online detection, motion blur cannot be eliminated due to the existence of speed, so it can only be controlled and reduced to a size that does not affect the measurement accuracy. The commonly used method is to control the motion blur value by reducing the exposure time, which is beneficial to reduce the influence of the speed factor and front and rear vibration on the size measurement value in the online detection. However, the reduction of motion blur needs to be at the cost of reducing the exposure time. The reduction of exposure time will make the image brightness insufficient and difficult to recognize. The light source will increase the detection cost, and the high-brightness light source generates a lot of heat, which is not conducive to long-term work. A large aperture reduces the depth of field of the lens. Therefore, it is necessary to comprehensively consider reducing the exposure time, controlling the size of the clear aperture, and adjusting the brightness of the light source to achieve motion blur control.
本发明实施例通过对图像进行垂直振动误差补偿和水平振动误差补偿,尽可能的降低误差对测量结果的影响,提高尺寸测量结果的准确性,保证产品精度和良率。In the embodiment of the present invention, by performing vertical vibration error compensation and horizontal vibration error compensation on the image, the influence of errors on the measurement results is reduced as much as possible, the accuracy of the size measurement results is improved, and the product accuracy and yield are guaranteed.
本发明实施例提供的一种球头销尺寸检测方法,通过采集带检测球头销的图像,并对图像进行预处理,实现图像的滤波和去噪,得到球头销的轮廓图,然后通过边缘检测,找出球头销的边缘线,对边缘线进行基于Hough变换的直线检测,确定边缘线中的直线部分,然后测量直线部分的长度,确定球头销的尺寸,通过计算机程序对球头销的图像进行识别测量,通过图像预处理、图像的边缘检测以及直线检测,消除图像噪声,确保尺寸检测的精确度,同时,通过计算机程序测量尺寸,速度快、效率高,保证产品质量的同时降低生产成本。A method for detecting the size of a ball stud provided by an embodiment of the present invention collects an image of a ball stud with detection, and performs preprocessing on the image to realize filtering and denoising of the image to obtain a contour map of the ball stud, and then through Edge detection, find out the edge line of the ball stud, perform straight line detection based on Hough transform on the edge line, determine the straight line part in the edge line, then measure the length of the straight line part, determine the size of the ball stud pin, and measure the ball stud through the computer program The image of the head pin is recognized and measured. Through image preprocessing, image edge detection and line detection, image noise is eliminated to ensure the accuracy of size detection. At the same time, the size is measured through computer programs, which is fast and efficient, ensuring product quality. At the same time reduce production costs.
图4示出了本发明实施例提供的一种球头销尺寸检测装置结构示意图,如图4所示,本发明实施例提供的球头销尺寸检测装置包括:Fig. 4 shows a schematic structural diagram of a ball stud size detection device provided by an embodiment of the present invention. As shown in Fig. 4, the ball stud size detection device provided by an embodiment of the present invention includes:
图像获取装置410,用于获取第一图像,所述第一图像至少包含完整的球头销图像。The image acquiring device 410 is configured to acquire a first image, where the first image at least includes a complete image of the ball stud.
在本发明实施例中,图2示出了本发明实施提供的一种球头销的形状示意图,如图2所示,球头销在独立悬架系统中被广泛采用,控制臂或推力杆常通过位于端部的球头销与其它部件相连,球头销的主要功能是实现车轮上下跳动和转向运动。其中,第一图像中至少应该包含完整的球头销图像,并且,球头销图像应该能展示出球头销待测尺寸的部分。In the embodiment of the present invention, Fig. 2 shows a schematic diagram of the shape of a ball stud provided by the present invention. As shown in Fig. 2, the ball stud is widely used in the independent suspension system, the control arm or the thrust rod It is often connected to other components through a ball stud located at the end. The main function of the ball stud is to realize the up and down beating and steering movement of the wheel. Wherein, the first image should at least include a complete image of the ball stud, and the image of the ball stud should be able to show the part of the ball stud whose size is to be measured.
在本发明实施例中,获取第一图像的方式可以是通过无线网络获取,也可以是通过有线网络获取,还可以是通过局域网获取,或者直接读取可移动存储介质中存储的第一图片,本发明不做限制。In the embodiment of the present invention, the first image may be acquired through a wireless network, or through a wired network, or through a local area network, or directly read the first picture stored in a removable storage medium, The present invention is not limited.
本发明实施例通过多种方式获取球头销图像,便于后续尺寸检测,同时能够应用于多种场景。The embodiment of the present invention obtains the image of the ball stud in various ways, which is convenient for subsequent size detection, and can be applied to various scenarios at the same time.
图像预处理装置420,用于对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图。The image preprocessing device 420 is configured to preprocess the first image to obtain a second image, and the second image includes at least a contour map of the ball stud.
在本发明实施例中,轮廓图是指图像中球头销的形状轮廓图,预处理是指在对图像中的长度进行检测前对图像所进行的操作,包括滤波、去燥、锐化、增强等操作。In the embodiment of the present invention, the contour map refers to the shape contour map of the ball stud in the image, and the preprocessing refers to the operations performed on the image before the length in the image is detected, including filtering, de-drying, sharpening, enhancement etc.
作为本发明一个实施例,对第一图像的预处理可以包括实际的高级可视化处理以及用于后续高级可视化处理的图像数据的任何准备,包括对原始图像进行图像增强处理,变换图像的灰度,使其图像变清晰,对比度增强,边缘特征突出,并对处理好的图像进行图像平滑处理,去除加性噪声、乘性噪声和量化噪声。作为本发明一个实施例,对原始图像进行灰度变换,所述灰度变换为对图像的对比度进行增强或对图像的对比度进行拉伸,生成灰度增强图像,将灰度增强图像变换为直方图均衡图像:设定原始图像中的像素点的原灰度为R,经过灰度变换后的像素点的灰度为S,灰度变换函数为T(R),那么根据一下公式进行灰度变换:As an embodiment of the present invention, the preprocessing of the first image may include actual advanced visualization processing and any preparation of image data for subsequent advanced visualization processing, including performing image enhancement processing on the original image, transforming the gray scale of the image, Make the image clearer, enhance the contrast, highlight the edge features, and perform image smoothing on the processed image to remove additive noise, multiplicative noise and quantization noise. As an embodiment of the present invention, grayscale transformation is performed on the original image, the grayscale transformation is to enhance the contrast of the image or stretch the contrast of the image to generate a grayscale enhanced image, and transform the grayscale enhanced image into a histogram Image equalization image: Set the original grayscale of the pixel in the original image as R, the grayscale of the pixel after grayscale transformation as S, and the grayscale transformation function as T(R), then perform the grayscale according to the following formula transform:
其中,0≤Rj≤l-1;py(Rj)是第j级灰度值的概率,nj是图像中j级灰度的像素总数,l是图像中灰度级的总数目,n是图像中像素的总数,j标识灰度的级别,所述灰度的级别根据计算机中可以识别的灰度级别一致。Among them, 0≤R j ≤l-1; p y (R j ) is the probability of gray level j, n j is the total number of pixels of gray level j in the image, and l is the total number of gray levels in the image , n is the total number of pixels in the image, and j identifies the gray level, which is consistent with the gray level that can be recognized by the computer.
本发明实施例提供的图像预处理方法,解决了对摄像头获取的图像进行清晰化处理的技术问题,本发明采用图像增强、平滑滤波和图像锐化的处理方法,有效地消除噪声,改善图像质量,使图像清晰化,有利于更好地提取有效信息用于后续分析。The image preprocessing method provided by the embodiment of the present invention solves the technical problem of clearing the image acquired by the camera. The present invention adopts image enhancement, smoothing filtering and image sharpening processing methods to effectively eliminate noise and improve image quality , to make the image clearer, which is conducive to better extracting effective information for subsequent analysis.
边缘检测装置430,用于对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线。The edge detection device 430 is configured to perform edge detection on the contour map, and determine the edge line of the ball stud in the contour map.
在本发明实施例中,边缘检测是图像处理和计算机视觉中的基本问题,边缘检测的目的是标识数字图像中亮度变化明显的点,图像属性中的显著变化通常反映了属性的重要事件和变化,这些包括深度上的不连续、表面方向不连续、物质属性变化和场景照明变化。In the embodiment of the present invention, edge detection is a basic problem in image processing and computer vision. The purpose of edge detection is to identify points with obvious brightness changes in digital images. Significant changes in image attributes usually reflect important events and changes in attributes. , these include discontinuities in depth, discontinuities in surface orientation, changes in material properties, and changes in scene lighting.
作为本发明一种实施例,可以利用Canny边缘检测算子和/或Sobel边缘检测算子对所述轮廓图进行边缘检测,确定所述球头销的边缘线。作为本发明一种实施例,采用Canny边缘检测算子对图像进行边缘检测,第一步是对原始数据与高斯mask作卷积,得到的图像与原始图像相比有些轻微的模糊。这样,单独的一个像素噪声在经过高斯平滑的图像上变得几乎没有影响。然后寻找图像中的强度梯度,平滑后的图像中每个像素点的梯度可以由Sobel算子来获得,首先,利用如下的和来分别求得沿水平(x)和垂直(y)方向的梯度Gx和Gy,如:As an embodiment of the present invention, a Canny edge detection operator and/or a Sobel edge detection operator may be used to perform edge detection on the contour map to determine the edge line of the ball stud. As an embodiment of the present invention, the Canny edge detection operator is used to detect the edge of the image. The first step is to convolve the original data with the Gaussian mask, and the obtained image is slightly blurred compared with the original image. In this way, a single pixel noise becomes almost insignificant on the Gaussian smoothed image. Then look for the intensity gradient in the image. The gradient of each pixel in the smoothed image can be obtained by the Sobel operator. First, use the following sum to obtain the gradient along the horizontal (x) and vertical (y) directions respectively G x and G y , such as:
=[-101;-202;-121];=[-1-2-1;000;121]=[-101;-202;-121];=[-1-2-1;000;121]
之后便可利用公式来求得每一个像素点的梯度幅值:Then you can use the formula to find the gradient magnitude of each pixel:
有时为了计算简便,也会使用Gx和Gy的无穷大范数来代替二范数。把平滑后的图像中的每一个点用G代替,在变化剧烈的地方(边界处),将获得较大的梯度度量值G,对应的颜色为白色;然而,这些边界通常非常粗,难以标定边界的真正位置。为了做到这一点,还必须存储梯度方向,其公式如下:Sometimes for the convenience of calculation, the infinite norms of G x and G y are used instead of the two norms. Replace each point in the smoothed image with G, and in places with drastic changes (at the boundary), a larger gradient measure value G will be obtained, and the corresponding color will be white; however, these boundaries are usually very thick and difficult to calibrate The real location of the border. In order to do this, the gradient direction must also be stored, with the following formula:
Θ=arctan2(Gy,Gx)Θ = arctan2(G y , G x )
在寻找到图像的强度梯度之后,将其梯度方向近似为以下值中的一个(0,45,90,135,180,225,270,315)比较该像素点,和其梯度方向正负方向的像素点的梯度强度,如果该像素点梯度强度最大则保留,否则抑制,如图2所示,图中的数字代表了像素点的梯度强度,箭头方向代表了梯度方向。以第二排第三个像素点为例,由于梯度方向向上,则将这一点的强度(7)与其上下两个像素点的强度(5和4)比较,由于这一点强度最大,则保留。因为边界处的梯度方向总是指向垂直于边界的方向,即最后会保留一条边界处最亮的一条细线,然后利用之后的边界跟踪,检测到球头销的边缘线。After finding the intensity gradient of the image, approximate its gradient direction to one of the following values (0, 45, 90, 135, 180, 225, 270, 315) and compare the pixel with the gradient strength of the pixel in the positive and negative directions of the gradient direction. If the pixel If the gradient strength is the largest, it is retained, otherwise it is suppressed, as shown in Figure 2, the numbers in the figure represent the gradient strength of the pixel, and the direction of the arrow represents the gradient direction. Taking the third pixel in the second row as an example, since the gradient direction is upward, compare the intensity (7) of this point with the intensity (5 and 4) of the two pixels above and below, and keep it because the intensity of this point is the largest. Because the gradient direction at the boundary always points to the direction perpendicular to the boundary, that is, the brightest thin line at the boundary will be reserved at the end, and then the edge line of the ball stud will be detected by using the subsequent boundary tracking.
本发明实施例通过边缘检测得到图像中球头销的准确边缘线,便于后续球头销尺寸的识别。In the embodiment of the present invention, the accurate edge line of the ball stud in the image is obtained through edge detection, which facilitates subsequent recognition of the size of the ball stud.
直线检测装置440,用于对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分。The straight line detecting device 440 is configured to perform straight line detection based on Hough transform on the edge line, and determine the straight line part in the edge line.
在本发明实施例中,利用点线的对偶特性,即图像空间中共线的点对应在参数空间里相交的线,且在参数空间中相交于同一个点的所有直线在图像空间里都有共线的点与之对应的特点,在图像空间中的直线检测问题转换到参数空间中对点的检测问题,并通过在参数空间里进行简单的累加统计完成检测任务。In the embodiment of the present invention, the dual property of point and line is used, that is, the collinear points in the image space correspond to the intersecting lines in the parameter space, and all lines intersecting at the same point in the parameter space have a common According to the corresponding characteristics of the points of the line, the problem of line detection in the image space is transformed into the problem of point detection in the parameter space, and the detection task is completed by simple accumulation statistics in the parameter space.
作为本发明一种实施例,在提取出图像中球头销的边缘线之后,需要对球头销边缘线中的直线部分进行检测,以便于对球头销直线部分的尺寸进行检测。在本发明实施例中,采用基于Hough变换的直线检测方法,对边缘线进行直线检测,通过在参数空间里进行简单的累加统计,然后在Hough参数空间寻找累加器峰值的方法检测直线,Hough变换的实质是将图像空间内具有一定关系的像元进行聚类,寻找能把这些像元用某一解析形式联系起来的参数空间累积对应点,其具体操作步骤,在说明书后续部分会做详细说明。As an embodiment of the present invention, after the edge line of the ball stud in the image is extracted, it is necessary to detect the straight portion of the edge line of the ball stud, so as to detect the size of the straight portion of the ball stud. In the embodiment of the present invention, the straight line detection method based on Hough transform is used to detect the straight line on the edge line, and the straight line is detected by performing simple accumulation statistics in the parameter space, and then finding the peak value of the accumulator in the Hough parameter space, and the Hough transform The essence of this method is to cluster the pixels with a certain relationship in the image space, and find the corresponding point of parameter space accumulation that can connect these pixels with a certain analytical form. The specific operation steps will be explained in detail in the subsequent part of the manual. .
本发明实施例通过基于Hough变换的直线检测对球头销的边缘线进行直线检测,得到球头图像中的直线部分,便于后续对球头销直线部分尺寸的检测,识别精度高,检测结果准。In the embodiment of the present invention, the edge line of the ball stud is detected by the straight line detection based on Hough transform, and the straight line part in the ball head image is obtained, which facilitates subsequent detection of the size of the straight line part of the ball stud, with high recognition accuracy and accurate detection results. .
信息输出装置450,用于采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。The information output device 450 is configured to use the nearest neighbor search algorithm to determine the two end points of the straight line, and use the Euclidean distance to measure the distance between the two end points in the coordinate system, and obtain and output the distance between the two end points of the ball stud. linear dimension.
在本发明实施例中,欧式距离是指欧几里得距离,指欧几里得空间中两点间的普通距离,即直线距离。In the embodiment of the present invention, the Euclidean distance refers to the Euclidean distance, and refers to the ordinary distance between two points in the Euclidean space, that is, the straight-line distance.
作为本发明一个实施例,在步骤S108中得到的直线部分中,通过灰度值的确认,当某一像素区域的灰度平均值明显高于该区域三个方向的灰度值,又略低于另一个方向的灰度值时,将该像素区域作为一个端点,通过最近邻搜寻算法,寻找该直线部分中的第二个端点,从而确定该直线部分的两个端点,将两个端点投射到直角坐标系中,然后利用公式:As an embodiment of the present invention, in the straight line part obtained in step S108, through the confirmation of the gray value, when the gray value of a certain pixel area is obviously higher than the gray value of the three directions of the area, and slightly lower For the gray value in the other direction, use the pixel area as an end point, and use the nearest neighbor search algorithm to find the second end point in the straight line part, so as to determine the two end points of the straight line part, and project the two end points into a Cartesian coordinate system, then use the formula:
计算两个端点的欧式距离l,其中,x1、y1、y2、y2分别为第一个端点和第二个端点在直角坐标系中的坐标值。通过计算得到两个端点的距离之后,直接输出l,即为球头销直线部分的尺寸。Calculate the Euclidean distance l between two endpoints, where x 1 , y 1 , y 2 , and y 2 are the coordinate values of the first endpoint and the second endpoint in the Cartesian coordinate system, respectively. After the distance between the two endpoints is obtained by calculation, directly output l, which is the size of the straight part of the ball stud.
本发明实施例提供的一种球头销尺寸检测装置,通过采集带检测球头销的图像,并对图像进行预处理,实现图像的滤波和去噪,得到球头销的轮廓图,然后通过边缘检测,找出球头销的边缘线,对边缘线进行基于Hough变换的直线检测,确定边缘线中的直线部分,然后测量直线部分的长度,确定球头销的尺寸,通过计算机程序对球头销的图像进行识别测量,通过图像预处理、图像的边缘检测以及直线检测,消除图像噪声,确保尺寸检测的精确度,同时,通过计算机程序测量尺寸,速度快、效率高,保证产品质量的同时降低生产成本。The ball stud size detection device provided by the embodiment of the present invention collects the image of the ball stud with the detection, and preprocesses the image to realize the filtering and denoising of the image, and obtains the contour map of the ball stud, and then passes Edge detection, find out the edge line of the ball stud, perform straight line detection based on Hough transform on the edge line, determine the straight line part in the edge line, then measure the length of the straight line part, determine the size of the ball stud pin, and measure the ball stud through the computer program The image of the head pin is recognized and measured. Through image preprocessing, image edge detection and line detection, image noise is eliminated to ensure the accuracy of size detection. At the same time, the size is measured through computer programs, which is fast and efficient, ensuring product quality. At the same time reduce production costs.
图5示出了一个实施例中计算机设备的内部结构图。如图5所示,该计算机设备包括该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、输入装置和显示屏。其中,存储器包括非易失性存储介质和内存储器。该计算机设备的非易失性存储介质存储有操作系统,还可存储有计算机程序,该计算机程序被处理器执行时,可使得处理器实现球头销尺寸检测方法。该内存储器中也可储存有计算机程序,该计算机程序被处理器执行时,可使得处理器执行球头销尺寸检测方法。计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。Figure 5 shows a diagram of the internal structure of a computer device in one embodiment. As shown in FIG. 5 , the computer equipment includes a processor, a memory, a network interface, an input device, and a display screen connected through a system bus. Wherein, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and also stores a computer program, and when the computer program is executed by the processor, the processor can realize the ball stud size detection method. A computer program may also be stored in the internal memory, and when the computer program is executed by the processor, the processor may execute the method for detecting the size of the ball stud. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the computer equipment, or It can be an external keyboard, touchpad or mouse.
本领域技术人员可以理解,图5中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 5 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
在一个实施例中,提出了一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In one embodiment, a computer device is provided, the computer device includes a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executes the computer The following steps are implemented in the program:
获取第一图像,所述第一图像至少包含完整的球头销图像;acquiring a first image, the first image including at least a complete ball stud image;
对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图;Preprocessing the first image to obtain a second image, the second image at least including a profile of the ball stud;
对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线;performing edge detection on the contour map, and determining the edge line of the ball stud in the contour map;
对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分;Carrying out straight line detection based on Hough transform on the edge line, and determining the straight line part in the edge line;
采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。Using the nearest neighbor search algorithm to determine the two end points of the straight line part, and using the Euclidean distance to measure the distance between the two end points in the coordinate system, to obtain and output the straight line size of the ball stud.
在一个实施例中,提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时,使得处理器执行以下步骤:In one embodiment, a computer-readable storage medium is provided. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the processor is made to perform the following steps:
获取第一图像,所述第一图像至少包含完整的球头销图像;acquiring a first image, the first image including at least a complete ball stud image;
对所述第一图像进行预处理,得到第二图像,所述第二图像至少包括所述球头销的轮廓图;Preprocessing the first image to obtain a second image, the second image at least including a profile of the ball stud;
对所述轮廓图进行边缘检测,并确定所述轮廓图中所述球头销的边缘线;performing edge detection on the contour map, and determining the edge line of the ball stud in the contour map;
对所述边缘线进行基于Hough变换的直线检测,确定所述边缘线中的直线部分;Carrying out straight line detection based on Hough transform on the edge line, and determining the straight line part in the edge line;
采用最近邻搜寻算法确定所述直线部分的两个端点,并在坐标系中采用欧式距离度量所述两个端点之间的距离,得到并输出所述球头销的直线尺寸。Using the nearest neighbor search algorithm to determine the two end points of the straight line part, and using the Euclidean distance to measure the distance between the two end points in the coordinate system, to obtain and output the straight line size of the ball stud.
应该理解的是,虽然本发明各实施例的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,各实施例中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow charts of the embodiments of the present invention are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in each embodiment may include multiple sub-steps or multiple stages, these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, the sub-steps or stages The order of execution is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a non-volatile computer-readable storage medium When the program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The various technical features of the above-mentioned embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the various technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, should be considered as within the scope of this specification.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910755038.2A CN110634128A (en) | 2019-08-15 | 2019-08-15 | A ball stud pin size detection method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910755038.2A CN110634128A (en) | 2019-08-15 | 2019-08-15 | A ball stud pin size detection method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110634128A true CN110634128A (en) | 2019-12-31 |
Family
ID=68970054
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910755038.2A Pending CN110634128A (en) | 2019-08-15 | 2019-08-15 | A ball stud pin size detection method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110634128A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111951324A (en) * | 2020-07-30 | 2020-11-17 | 佛山科学技术学院 | A kind of aluminum profile packaging length detection method and system |
CN112897431A (en) * | 2020-10-24 | 2021-06-04 | 泰州无印广告传媒有限公司 | Compatible type self-adaptation filling system |
CN113052837A (en) * | 2021-04-22 | 2021-06-29 | 杭州电力设备制造有限公司 | Handcart contact state identification method and device |
CN114427965A (en) * | 2022-03-28 | 2022-05-03 | 迈赫机器人自动化股份有限公司 | Ball pin assembly design verification and durability test platform and use method thereof |
CN115138527A (en) * | 2022-06-22 | 2022-10-04 | 深圳市双翌光电科技有限公司 | Rapid machining path generation method through visual guidance |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103292701A (en) * | 2013-06-24 | 2013-09-11 | 哈尔滨工业大学 | Machine-vision-based online dimensional measurement method of precise instrument |
CN105258647A (en) * | 2015-07-26 | 2016-01-20 | 湖北工业大学 | Visual detection method of automobile lock catch rivet point |
CN106643549A (en) * | 2017-02-07 | 2017-05-10 | 泉州装备制造研究所 | Machine vision-based tile size detection method |
CN108662977A (en) * | 2018-03-14 | 2018-10-16 | 浙江大学山东工业技术研究院 | A kind of refractory brick geometric dimension measurement method |
-
2019
- 2019-08-15 CN CN201910755038.2A patent/CN110634128A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103292701A (en) * | 2013-06-24 | 2013-09-11 | 哈尔滨工业大学 | Machine-vision-based online dimensional measurement method of precise instrument |
CN105258647A (en) * | 2015-07-26 | 2016-01-20 | 湖北工业大学 | Visual detection method of automobile lock catch rivet point |
CN106643549A (en) * | 2017-02-07 | 2017-05-10 | 泉州装备制造研究所 | Machine vision-based tile size detection method |
CN108662977A (en) * | 2018-03-14 | 2018-10-16 | 浙江大学山东工业技术研究院 | A kind of refractory brick geometric dimension measurement method |
Non-Patent Citations (1)
Title |
---|
诸晓锋: "基于机器视觉的工件表面质量高速在线检测技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111951324A (en) * | 2020-07-30 | 2020-11-17 | 佛山科学技术学院 | A kind of aluminum profile packaging length detection method and system |
CN111951324B (en) * | 2020-07-30 | 2024-03-29 | 佛山科学技术学院 | Method and system for detecting packaging length of aluminum profile |
CN112897431A (en) * | 2020-10-24 | 2021-06-04 | 泰州无印广告传媒有限公司 | Compatible type self-adaptation filling system |
CN113052837A (en) * | 2021-04-22 | 2021-06-29 | 杭州电力设备制造有限公司 | Handcart contact state identification method and device |
CN114427965A (en) * | 2022-03-28 | 2022-05-03 | 迈赫机器人自动化股份有限公司 | Ball pin assembly design verification and durability test platform and use method thereof |
CN115138527A (en) * | 2022-06-22 | 2022-10-04 | 深圳市双翌光电科技有限公司 | Rapid machining path generation method through visual guidance |
CN115138527B (en) * | 2022-06-22 | 2023-12-26 | 深圳市双翌光电科技有限公司 | Rapid processing path generation method through visual guidance |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110634128A (en) | A ball stud pin size detection method, device, computer equipment and storage medium | |
US10823681B2 (en) | System and method for imaging a surface defect on an object | |
CN109580630B (en) | Visual inspection method for defects of mechanical parts | |
CN107203973B (en) | Sub-pixel positioning method for center line laser of three-dimensional laser scanning system | |
CN103353985B (en) | A kind of Measurement Method of image Gaussian Blur | |
US11636584B2 (en) | Real-time traceability method of width of defect based on divide-and-conquer | |
JP6899189B2 (en) | Systems and methods for efficiently scoring probes in images with a vision system | |
JP5852919B2 (en) | Crack detection method | |
JP7622203B2 (en) | COMPUTER IMPLEMENTED METHOD FOR QUALITY CONTROL OF DIGITAL IMAGES OF SAMPLES - Patent application | |
CN111354047B (en) | Computer vision-based camera module positioning method and system | |
CN111160477B (en) | An image template matching method based on feature point detection | |
WO2021179400A1 (en) | Computer vision-based adaptive measurement system and method for geometric parameters in assembly process | |
CN110084818B (en) | Dynamic down-sampling image segmentation method | |
WO2021227289A1 (en) | Deep learning-based low-quality two-dimensional barcode detection method in complex background | |
CN109148433B (en) | Method and apparatus for determining dimensions of an integrated circuit device | |
CN108764343A (en) | A kind of localization method of tracking target frame in track algorithm | |
CN116542979B (en) | Image measurement-based prediction correction method and terminal | |
JP2011133954A (en) | Edge extraction method and edge extraction device | |
CN116563298B (en) | Cross line center sub-pixel detection method based on Gaussian fitting | |
CN117392127A (en) | Method and device for detecting display panel frame and electronic equipment | |
Prabha et al. | Defect detection of industrial products using image segmentation and saliency | |
CN116188826A (en) | Template matching method and device under complex illumination condition | |
CN113406094B (en) | Metal surface defect online detection device and method based on image processing | |
CN110533670A (en) | A kind of striation dividing method based on subregion K-means algorithm | |
Mikołajczyk et al. | Camera-based automatic system for tool measurements and recognition |
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: 20191231 |
|
RJ01 | Rejection of invention patent application after publication |