CN104515473A - Online diameter detection method of varnished wires - Google Patents
Online diameter detection method of varnished wires Download PDFInfo
- Publication number
- CN104515473A CN104515473A CN201410767526.2A CN201410767526A CN104515473A CN 104515473 A CN104515473 A CN 104515473A CN 201410767526 A CN201410767526 A CN 201410767526A CN 104515473 A CN104515473 A CN 104515473A
- Authority
- CN
- China
- Prior art keywords
- image
- edge
- diameter
- gray
- pixel
- 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 15
- 238000000034 method Methods 0.000 claims abstract description 44
- 238000001914 filtration Methods 0.000 claims abstract description 20
- 230000011218 segmentation Effects 0.000 claims abstract description 12
- 238000004364 calculation method Methods 0.000 claims description 8
- 239000011159 matrix material Substances 0.000 claims description 6
- 238000003709 image segmentation Methods 0.000 claims 1
- 238000010998 test method Methods 0.000 claims 1
- 238000003708 edge detection Methods 0.000 abstract description 33
- 238000012545 processing Methods 0.000 abstract description 8
- 238000005259 measurement Methods 0.000 description 14
- 238000004519 manufacturing process Methods 0.000 description 8
- 238000003384 imaging method Methods 0.000 description 7
- 239000011248 coating agent Substances 0.000 description 4
- 238000000576 coating method Methods 0.000 description 4
- 238000009413 insulation Methods 0.000 description 4
- 239000003973 paint Substances 0.000 description 4
- 239000004020 conductor Substances 0.000 description 3
- 235000002566 Capsicum Nutrition 0.000 description 2
- 239000006002 Pepper Substances 0.000 description 2
- 241000722363 Piper Species 0.000 description 2
- 235000016761 Piper aduncum Nutrition 0.000 description 2
- 235000017804 Piper guineense Nutrition 0.000 description 2
- 235000008184 Piper nigrum Nutrition 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000007888 film coating Substances 0.000 description 2
- 238000009501 film coating Methods 0.000 description 2
- 239000011810 insulating material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 150000003839 salts Chemical class 0.000 description 2
- 238000004804 winding Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000000691 measurement method Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
Landscapes
- Image Analysis (AREA)
Abstract
本发明公开了一种漆包线直径的在线检测方法,包括步骤:采集漆包线的直径图像;对该直径图像进行噪声滤除处理;对经过噪声滤除处理后的直径图像进行边缘检测,得到边缘图像;根据边缘图像计算漆包线的直径。由于采用了迭代法对图像进行阈值分割和基于图像扫描的边缘跟踪方法相结合的边缘检测方法,因而,得到的边缘图像很好地区分了背景与目标,且边缘连续、没有伪边缘、没有毛刺点产生,边缘宽度为单像素,较好保留了边缘细节,使本发明具有较高的检测精度;同时,与传统边缘检测方法相比,本发明的边缘检测方法耗时更少,使本发明具有较快的检测速度;综上两点,使本发明具有较强的理论价值和工程应用推广价值。
The invention discloses an online detection method for the diameter of an enameled wire, which comprises the steps of: collecting a diameter image of the enameled wire; performing noise filtering processing on the diameter image; performing edge detection on the diameter image after the noise filtering processing to obtain an edge image; Calculate the diameter of the enameled wire from the edge image. Since the edge detection method combined with the iterative method for threshold segmentation of the image and the edge tracking method based on image scanning, the obtained edge image can well distinguish the background and the target, and the edge is continuous, there is no false edge, and there is no burr point generation, the edge width is a single pixel, and the edge details are better reserved, so that the present invention has higher detection accuracy; at the same time, compared with the traditional edge detection method, the edge detection method of the present invention is less time-consuming, making the present invention It has faster detection speed; in summary of the above two points, the present invention has strong theoretical value and engineering application promotion value.
Description
技术领域technical field
本发明属于控制与仪表领域,涉及一种对漆包线直径的在线检测方法。The invention belongs to the field of control and instrumentation, and relates to an online detection method for the diameter of an enameled wire.
背景技术Background technique
漆包线是由导体和绝缘层两部分组成的一种绕组线。这种绕组线是在导体表面涂覆一种或多种具有绝缘性材料,性能良好漆包线的绝缘材料涂覆厚度与内层导体直径成正比且绝缘层涂覆均匀连续。太薄或太厚的绝缘涂层都会影响漆包线使用性能。因此,绝缘涂层均匀性、线径均匀性是决定漆包线绝缘性能的重要因素之一。而在漆包线的生产过程中,由于某种原因,可能导致漆包线漆膜涂覆不均匀,即,膜缺陷,从而影响漆包线整体绝缘性能。所以在漆包线生产过程中,能够有效在线测出漆包线漆膜涂层厚度或漆包线直径,具有非常重要的工程意义。Enameled wire is a kind of winding wire composed of two parts: conductor and insulating layer. This kind of winding wire is coated with one or more insulating materials on the surface of the conductor. The coating thickness of the insulating material of the enameled wire with good performance is proportional to the diameter of the inner layer conductor, and the coating of the insulating layer is uniform and continuous. Too thin or too thick insulating coating will affect the performance of enameled wire. Therefore, the uniformity of the insulating coating and the uniformity of the wire diameter are one of the important factors that determine the insulation performance of the enameled wire. However, in the production process of enameled wires, for some reason, the enameled wire enameled film coating may be uneven, that is, film defects, thereby affecting the overall insulation performance of enameled wires. Therefore, in the enameled wire production process, it is of great engineering significance to be able to effectively measure the thickness of the enameled wire paint film coating or the diameter of the enameled wire online.
在过去20年,我国漆包线的产量以每年超过10%的速度增长。预计到2015年,我国的漆包线生产量将达到160万吨,成为漆包线生产大国。但在我国目前漆包线生产中却多为低水平重复生产现象,“高产量、低质量”,漆包线绝缘性能低导致漆包线质量低。随着制造及加工技术的不断发展与提高,对测量精度和速度提出更高要求。常用测量方法,如:千分尺测量,激光测量,CCD成像方法等已不能满足当前需要。而且,其中一些方法操作过程繁琐,效率低。在这种情况下,快速、准确、非接触式、在线的测量漆包线的直径显得颇为重要。有学者提出一种接触式在线检测漆膜,易损坏表面漆膜,影响绝缘性能。有研究者设计了漆包线计算机在线监测系统,利用电涡流装置检测出缺陷信号。In the past 20 years, the output of enameled wire in my country has grown at an annual rate of more than 10%. It is estimated that by 2015, my country's enameled wire production will reach 1.6 million tons, becoming a major producer of enameled wire. However, in my country's current enameled wire production, there are mostly low-level repetitive production phenomena, "high output, low quality", and the low insulation performance of enameled wires leads to low quality of enameled wires. With the continuous development and improvement of manufacturing and processing technology, higher requirements are placed on measurement accuracy and speed. Common measurement methods, such as: micrometer measurement, laser measurement, CCD imaging methods, etc. can no longer meet the current needs. Moreover, some of these methods are cumbersome and inefficient. In this case, it is very important to measure the diameter of enameled wire quickly, accurately, non-contact and online. Some scholars have proposed a contact-type online detection of paint film, which is easy to damage the surface paint film and affect the insulation performance. Some researchers have designed an enameled wire computer online monitoring system, which uses eddy current devices to detect defect signals.
当前,国内专门用于测量漆包线直径系统还很少,漆包线直径测量大部分停留在人工离线操作阶段,人工测量给带来极大制约,主要表现为:一方面,人工测量取决于人对测量结果的观察,易受主观因素影响。且长时间的读数工作将难以避免地让人疲劳,降低读数准确性,将使得测量结果产生较大误差,影响测量结果;另一方面,人工测量效率有限,为提高效率,必须增大操作人员数量,引起成本增加。同时,人工测量易对漆包线的漆膜造成一定程度的损坏,影响漆包线性能。At present, there are few domestic systems dedicated to measuring the diameter of enameled wires, and most of the enameled wire diameter measurement stays in the stage of manual offline operation. Manual measurement brings great constraints. The main performance is: On the one hand, manual measurement depends on the measurement results Observations are susceptible to subjective factors. And the long-time reading work will inevitably make people tired, reduce the accuracy of readings, and will cause large errors in the measurement results, which will affect the measurement results; on the other hand, the efficiency of manual measurement is limited. quantity, resulting in an increase in cost. At the same time, manual measurement is easy to cause a certain degree of damage to the paint film of the enameled wire, which affects the performance of the enameled wire.
在以上技术背景条件需求下,为提高漆包线产品质量,提高漆包线生产效率,降低人工劳动成本,促成我们考虑采用计算机数字图像处理技术,对生产线上的漆包线直径进行自动快速测量,为生产现场提供准确、有益信息。Under the requirements of the above technical background conditions, in order to improve the quality of enameled wire products, improve the production efficiency of enameled wires, and reduce labor costs, we have prompted us to consider using computer digital image processing technology to automatically and quickly measure the diameter of enameled wires on the production line. Provide accurate , useful information.
发明内容Contents of the invention
为了解决上述问题,本发明提供一种漆包线直径的在线检测方法。In order to solve the above problems, the present invention provides an online detection method of enameled wire diameter.
本发明的技术方案:Technical scheme of the present invention:
一种漆包线直径的在线检测方法,包括以下步骤:An online detection method for the diameter of an enameled wire, comprising the following steps:
S1、采集漆包线的直径图像;S1, collecting the diameter image of the enameled wire;
S2、对该直径图像进行噪声滤除处理,利用中值滤波算法来滤除直径图像的噪声,进一步的,包括以下步骤:S2. Perform noise filtering processing on the diameter image, and use a median filter algorithm to filter noise of the diameter image, further comprising the following steps:
S21、选取模板,将直径图像中不同位置的像素点,采用像素遍历的方法依次使当前像素点和模板中心位置重合,优选的,采用3*3像素矩阵或5*5像素矩阵的模板;S21. Select a template, and use a pixel traversal method to sequentially overlap the current pixel with the center position of the template for pixels at different positions in the diameter image. Preferably, a template of a 3*3 pixel matrix or a 5*5 pixel matrix is used;
S22、将模板覆盖位置的所有像素点的灰度值读出;S22. Read out the gray values of all pixels at the positions covered by the template;
S23、找出这些灰度值的中值;S23. Find the median of these gray values;
S24、将得到的中值赋给模板中心当前对应的像素点,作为该点的灰度值;S24. Assign the obtained median value to the pixel point currently corresponding to the center of the template as the gray value of the point;
S3、对步骤S2中经过噪声处理后的直径图像进行边缘检测,包括以下步骤:S3, performing edge detection on the diameter image after the noise processing in step S2, including the following steps:
S31、采用迭代法对图像进行阈值分割,进一步的,包括以下步骤:S31. Using an iterative method to perform threshold segmentation on the image, further comprising the following steps:
S311、选择一个初始阈值T,S311. Select an initial threshold T,
式中fmin为图像像素点中的最小灰度值,fmax为图像像素点中的最大灰度值;In the formula, f min is the minimum gray value in the image pixel, and f max is the maximum gray value in the image pixel;
S312、应用初始阈值T对图像进行分割,根据图像像素点的灰度值,将图像分割为两部分,灰度值大于T的区域和灰度值小T的区域;S312. Segment the image by applying an initial threshold T, and divide the image into two parts according to the gray value of the image pixel, an area with a gray value greater than T and an area with a gray value smaller than T;
S313、分别计算灰度值大于T的区域和灰度值小T的区域所包含的像素点的灰度均值u1和u2;S313. Calculate the gray mean values u 1 and u 2 of the pixels included in the region with gray value greater than T and the region with gray value smaller than T, respectively;
S314、计算新阈值T,S314. Calculate a new threshold T,
S315、重复步骤S312、S313、S314,直到连续两次计算得到的T值的差满足小于等于1为止;S315. Steps S312, S313, and S314 are repeated until the difference between the T values obtained by two consecutive calculations is less than or equal to 1;
S32、对步骤S31中进行阈值分割后的图像进行边缘跟踪得到边缘图像,进一步的,包括以下步骤:S32. Perform edge tracking on the image subjected to threshold segmentation in step S31 to obtain an edge image, further comprising the following steps:
S321、首先按从左到右的顺序扫描图像,寻找第一个灰度值为1的像素点,并标记为A0(i,j),其中i、j分别为像素点A0的横坐标和纵坐标;S321. First scan the image in order from left to right, find the first pixel with a gray value of 1, and mark it as A 0 (i, j), where i and j are the abscissas of the pixel A 0 and the ordinate;
S322、按顺时针方向搜索像素点A0(i,j)的3*3邻域,将搜索到的第一个与该像素点灰度值相同的像素点定为新的边界点An;S322. Search the 3*3 neighborhood of the pixel point A 0 (i, j) in a clockwise direction, and set the first searched pixel point with the same gray value as the pixel point as a new boundary point A n ;
S323、如果An的灰度值等于第二个边界点A1的灰度值,且前一个边界点An-1的灰度值等于第一个边界点A0的灰度值,则停止搜索,否则重复步骤S322继续搜索;S323. If the grayscale value of A n is equal to the grayscale value of the second boundary point A1 , and the grayscale value of the previous boundary point An -1 is equal to the grayscale value of the first boundary point A0 , stop Search, otherwise repeat step S322 to continue searching;
S4、根据步骤S3得到的直径图像计算漆包线的直径,进一步地,包括以下步骤:S4. Calculating the diameter of the enameled wire according to the diameter image obtained in step S3, further comprising the following steps:
S41、通过摄像标定确定该直径图像中一个像素点所对应的实际距离L0;S41. Determine the actual distance L 0 corresponding to one pixel in the diameter image through camera calibration;
S42、计算漆包线直径在图像中所占像素点个数n,S42. Calculate the number n of pixels occupied by the diameter of the enameled wire in the image,
n=x1-x2 n= x1- x2
式中x1、x2分别是图像中横坐标不同的两个边界点对应的横坐标;In the formula, x 1 and x 2 are respectively the abscissas corresponding to two boundary points with different abscissas in the image;
S43、计算漆包线直径L=n*L0。S43. Calculate the enameled wire diameter L=n*L 0 .
采用本发明技术方案的有益效果:由于本发明对图形进行边缘检测时,采用了迭代法对图像进行阈值分割和基于图像扫描的边缘跟踪方法相结合的边缘检测方法,因而,得到的边缘图像很好地区分了背景与目标,且边缘连续、没有伪边缘、没有毛刺点产生,边缘宽度为单像素,较好保留了边缘细节,使本发明具有较高的检测精度;同时,与传统边缘检测方法相比,本发明的边缘检测方法耗时更少,使本发明具有较快的检测速度;综上两点,使本发明具有较强的理论价值和工程应用推广价值。The beneficial effect of adopting the technical scheme of the present invention: when the present invention carries out edge detection to figure, has adopted the edge detection method that iterative method is carried out threshold value segmentation to image and the edge tracking method based on image scanning combines, thus, the edge image that obtains is very The background and the target are well distinguished, and the edges are continuous, there are no false edges, no burr points are generated, the edge width is single pixel, and the edge details are better preserved, so that the present invention has higher detection accuracy; at the same time, compared with the traditional edge detection Compared with the method, the edge detection method of the present invention consumes less time, which makes the present invention have a faster detection speed; in summary of the above two points, the present invention has strong theoretical value and engineering application promotion value.
附图说明Description of drawings
图1是本发明的流程示意图;Fig. 1 is a schematic flow sheet of the present invention;
图2迭代法选取阈值流程图;Fig. 2 iterative method selects the threshold flow chart;
图3是像素点A0(i,j)的3*3邻域内的像素点的坐标示意图;Fig. 3 is a schematic diagram of the coordinates of the pixels in the 3*3 neighborhood of the pixel A 0 (i, j);
图4是采用本发明的边缘检测算法得到的边缘图像;Fig. 4 is the edge image that adopts edge detection algorithm of the present invention to obtain;
图5是本发明边缘检测算法与传统边缘检测算法的运行时间统计;图中Sobel即Sobel边缘检测运行时间统计曲线,Robert即Robert边缘检测运行时间统计曲线,Canny即Canny边缘检测运行时间统计曲线,Our即本发明边缘检测运行时间统计曲线;Fig. 5 is the running time statistics of the edge detection algorithm of the present invention and the traditional edge detection algorithm; among the figure Sobel is the Sobel edge detection running time statistical curve, Robert is the Robert edge detection running time statistical curve, Canny is the Canny edge detection running time statistical curve, Our is the edge detection running time statistical curve of the present invention;
图6是CCD测径原理示意图;图中1为透镜,2为线阵CCD传感器,f为透镜焦距,u为物距,v为像距,p为线阵CCD像元大小,L被测漆包线直径,n为漆包线经过成像系统在线阵CCD靶面上的影像所占像元数目。Figure 6 is a schematic diagram of the principle of CCD diameter measurement; in the figure, 1 is the lens, 2 is the linear array CCD sensor, f is the focal length of the lens, u is the object distance, v is the image distance, p is the pixel size of the linear array CCD, and L is the measured enameled wire Diameter, n is the number of pixels occupied by the image of the enameled wire passing through the imaging system on the linear CCD target surface.
具体实施方式Detailed ways
下面结合说明书附图对本发明作进一步说明。The present invention will be further described below in conjunction with the accompanying drawings of the description.
如图1所示,一种漆包线直径的在线检测方法,包括以下步骤:As shown in Figure 1, a kind of online detection method of enameled wire diameter comprises the following steps:
S1、采集漆包线的直径图像;S1, collecting the diameter image of the enameled wire;
S2、对该直径图像进行噪声滤除处理;S2. Perform noise filtering processing on the diameter image;
S3、对步骤S2中经过噪声滤除处理后的直径图像进行边缘检测,得到边缘图像;S3. Performing edge detection on the diameter image processed by noise filtering in step S2 to obtain an edge image;
S4、根据边缘图像计算漆包线的直径。S4. Calculate the diameter of the enameled wire according to the edge image.
其中,步骤S1中采集漆包线的直径图像时,采用线阵CCD工业相机采集图像,光源选择高亮LED平行光源;在采集漆包线直径图像时,环境条件和传感元器件自身的质量都会导致图像噪声的产生,由于噪声具有随机性、不可预测性,常用概率密度函数近似描述噪声,以期更好抵制噪声,通过分析可知,本实施例中图像的噪声主要是随机噪声和椒盐噪声。Wherein, when collecting the diameter image of the enameled wire in step S1, a linear array CCD industrial camera is used to collect the image, and the light source is selected as a high-brightness LED parallel light source; when collecting the diameter image of the enameled wire, environmental conditions and the quality of the sensing components themselves will cause image noise Due to the randomness and unpredictability of the noise, the probability density function is commonly used to approximate the noise in order to better resist the noise. It can be seen from the analysis that the image noise in this embodiment is mainly random noise and salt and pepper noise.
步骤S2中利用中值滤波算法对采集到的直径图像进行噪声处理,其原理是把图像中邻域内的像素点按灰度等级排序,随后选择中间的灰度值作为灰度输出赋给当前像素点,具体包括以下步骤:In step S2, the median filter algorithm is used to perform noise processing on the collected diameter image. The principle is to sort the pixels in the neighborhood of the image according to the gray level, and then select the middle gray value as the gray output and assign it to the current pixel point, including the following steps:
S21、将直径图像中不同位置的像素点,采用像素遍历的方法依次使当前像素点和模板中心位置重合,优选的,模板采用3*3像素矩阵或5*5像素矩阵的模板;S21. Use the method of pixel traversal to sequentially make the current pixel coincide with the central position of the template for the pixels at different positions in the diameter image. Preferably, the template is a template of a 3*3 pixel matrix or a 5*5 pixel matrix;
S22、将模板覆盖位置的所有像素点的灰度值读出;S22. Read out the gray values of all pixels at the positions covered by the template;
S23、找出这些灰度值的中值;S23. Find the median of these gray values;
S24、将得到的中值赋给模板中心的当前像素点,作为该点的灰度值。S24. Assign the obtained median value to the current pixel point in the center of the template as the gray value of the point.
中值滤波消除噪声的效果与模板的尺寸以及在模板中参与运算的像素的个数密切相关,在进行中值滤波过程中,模板可以只选择其中的一部分像素点进行计算,以此减少运算量,提高计算速度;由中值滤波原理可知,中值滤波有平滑图像作用,其主要目的是消除孤立噪声点;中值滤波是一种非线性滤波方式,可以在一定程度上克服线性滤波造成的图像模糊问题,对随机噪声和椒盐噪声都有较好的滤除效果,同时可以更好的保留图像的边缘信息。The effect of median filtering to eliminate noise is closely related to the size of the template and the number of pixels involved in the calculation in the template. In the process of median filtering, the template can only select a part of the pixels for calculation, so as to reduce the amount of calculation , to improve the calculation speed; from the principle of median filtering, we can see that median filtering has the function of smoothing images, and its main purpose is to eliminate isolated noise points; median filtering is a nonlinear filtering method, which can overcome the problems caused by linear filtering to a certain extent. For the image blur problem, it has a good filtering effect on random noise and salt and pepper noise, and can better preserve the edge information of the image.
步骤S3中对噪声滤除处理后的直径图像进行边缘检测时,采用了迭代法对图像进行阈值分割和基于图像扫描的边缘跟踪方法相结合的边缘检测方法,即:When performing edge detection on the diameter image after the noise filtering process in step S3, an iterative method is used to perform threshold segmentation on the image and an edge detection method that combines an edge tracking method based on image scanning, namely:
首先,S31、采用迭代法对直径图像进行阈值分割,如图2所示,在进行阈值分割时具体包括以下步骤:First, S31. Using an iterative method to perform threshold segmentation on the diameter image, as shown in FIG. 2 , the threshold segmentation specifically includes the following steps:
S311、选择一个初始阈值T,S311. Select an initial threshold T,
式中fmin为图像像素点中的最小灰度值,fmax为图像像素点中的最大灰度值;In the formula, f min is the minimum gray value in the image pixel, and f max is the maximum gray value in the image pixel;
S312、应用初始阈值T对图像进行分割,根据图像像素点的灰度值,将图像分割为两部分,灰度值大于T的区域和灰度值小T的区域;S312. Segment the image by applying an initial threshold T, and divide the image into two parts according to the gray value of the image pixel, an area with a gray value greater than T and an area with a gray value smaller than T;
S313、分别计算灰度值大于T的区域和灰度值小T的区域所包含的像素点的灰度均值u1和u2;S313. Calculate the gray mean values u 1 and u 2 of the pixels included in the region with gray value greater than T and the region with gray value smaller than T, respectively;
S314、计算新阈值T,S314. Calculate a new threshold T,
S315、重复步骤S312、S313、S314,直到连续两次计算得到的T值的差满足小于或等于1为止。S315. Steps S312, S313, and S314 are repeated until the difference between the T values obtained by two consecutive calculations is less than or equal to 1.
然后,S32、对步骤S31中进行阈值分割后的图像进行边缘跟踪,边缘跟踪即是找出图像边缘被提取出来后的边缘点的坐标,并在图像上标记;现在常用的边缘跟踪方法是图像扫描法,通过扫描整幅图像找出灰度值为1的点,并标记出相应的坐标;由于这种方法需要扫描整幅图像,其效率比较低,结合本实施例中采集到的漆包线直径图像边缘为两条直线的特征,本发明在图像扫描法的基础上进行了改进,具体包括以下步骤:Then, S32, carry out edge tracking to the image after the threshold segmentation in step S31, edge tracking is to find out the coordinates of the edge point after the edge of the image is extracted, and mark on the image; the edge tracking method commonly used now is image Scanning method, by scanning the entire image to find out the point with a gray value of 1, and mark the corresponding coordinates; since this method needs to scan the entire image, its efficiency is relatively low, combined with the enameled wire diameter collected in this embodiment Image edge is the feature of two straight lines, the present invention improves on the basis of image scanning method, specifically comprises the following steps:
S321、首先按从左到右的顺序扫描图像,寻找第一个灰度值为1的像素点,并标记为A0(i,j),其中i、j分别为像素点A0的横坐标和纵坐标;S321. First scan the image in order from left to right, find the first pixel with a gray value of 1, and mark it as A 0 (i, j), where i and j are the abscissas of the pixel A 0 and the ordinate;
S322、按顺时针方向搜索像素点A0(i,j)的3*3邻域,A0(i,j)的3*3邻域内的像素点的坐标如图3所示,将搜索到的第一个与该像素点灰度值相同的像素点定为新的边界点An;S322. Search the 3*3 neighborhood of the pixel point A 0 (i, j) in a clockwise direction, the coordinates of the pixels in the 3*3 neighborhood of A 0 (i, j) are shown in FIG. 3 , and the searched The first pixel point with the same gray value as the pixel point is defined as the new boundary point A n ;
S323、如果An的灰度值等于第二个边界点A1的灰度值,且前一个边界点An-1的灰度值等于第一个边界点A0的灰度值,则停止搜索,否则重复步骤S322继续搜索。S323. If the grayscale value of A n is equal to the grayscale value of the second boundary point A1 , and the grayscale value of the previous boundary point An -1 is equal to the grayscale value of the first boundary point A0 , stop Search, otherwise repeat step S322 to continue searching.
采用本发明实施例中的边缘检测方法得到的边缘图像如图4所示,从图中可以看出得到的边缘图像很好的区分了背景与目标,且边缘连续、没有伪边缘、没有毛刺点产生,边缘宽度为单像素,较好保留了边缘细节;传统的边缘检测算法有Sobel边缘检测、Robert边缘检测和Canny边缘检测,与本发明的边缘检测算法相比,本发明的边缘检测算法耗时更少,如图5,对上述的每种算法分别测试5次,取其平均值,从图中可知,Canny边缘检测平均耗时最高约为11s,其次是Robert边缘检测与Sobel边缘检测,两者平均耗时相近约为3s,而本发明的边缘检测算法耗时仅为0.33s,极大的减少了运行时间。利用边缘图像即可计算漆包线直径。The edge image obtained by using the edge detection method in the embodiment of the present invention is shown in Figure 4. It can be seen from the figure that the obtained edge image can distinguish the background and the target very well, and the edge is continuous, there are no false edges, and there are no glitch points Produce, and edge width is single pixel, preferably has reserved edge detail; Traditional edge detection algorithm has Sobel edge detection, Robert edge detection and Canny edge detection, compared with edge detection algorithm of the present invention, edge detection algorithm of the present invention consumes It takes less time, as shown in Figure 5. Each of the above algorithms is tested 5 times and the average value is taken. It can be seen from the figure that the average time-consuming of Canny edge detection is about 11s, followed by Robert edge detection and Sobel edge detection. The average time consumption of the two is similar to about 3s, while the edge detection algorithm of the present invention takes only 0.33s, greatly reducing the running time. The enameled wire diameter can be calculated using the edge image.
步骤S4中计算漆包线的直径,所依据原理是:利用均匀散射的平行光从背面照射漆包线,漆包线经过光学系统成像到CCD工业相机传感器上,成像尺寸乘上一个由光学系统决定的系数,即为漆包线的实际尺寸,如图6所示,The calculation of the diameter of the enameled wire in step S4 is based on the principle that uniformly scattered parallel light is used to irradiate the enameled wire from the back, and the enameled wire is imaged on the CCD industrial camera sensor through the optical system, and the imaging size is multiplied by a coefficient determined by the optical system, which is The actual size of the enameled wire, as shown in Figure 6,
根据成像公式得:According to the imaging formula:
式(3)中f为透镜焦距,u为物距,v为像距,式(4)中β为透镜放大倍率,p为线阵CCD像元大小,L被测漆包线直径,n为漆包线经过成像系统在线阵CCD靶面上的影像所占像元数目,由式(3)和式(4)可求出被测漆包线直径L:In the formula (3), f is the focal length of the lens, u is the object distance, v is the image distance, in the formula (4), β is the lens magnification, p is the pixel size of the linear array CCD, L is the diameter of the enameled wire to be measured, and n is the enameled wire passing through The number of pixels occupied by the image on the linear array CCD target surface of the imaging system can be calculated from the formula (3) and formula (4) to obtain the diameter L of the measured enameled wire:
由式(5)可以看出,由于u、f、p在测量系统设计时已确定,漆包线直径大小实际上变为漆包线经过成像系统在线阵CCD靶面上的影像所占像元数目,即n大小,而确定出被测漆包线的两个边缘即可算出n,由此CCD测量直径的问题转换为漆包线直径图像边缘的识别与计数。It can be seen from formula (5) that since u, f, and p have been determined during the design of the measurement system, the diameter of the enameled wire actually becomes the number of pixels occupied by the image of the enameled wire passing through the imaging system on the linear CCD target surface, that is, n Size, and determine the two edges of the measured enameled wire to calculate n, so the problem of measuring the diameter of the CCD is transformed into the identification and counting of the enameled wire diameter image edge.
具体的,计算漆包线的直径包括以下步骤:Specifically, calculating the diameter of the enameled wire includes the following steps:
S41、通过摄像标定确定边缘图像中一个像素点所对应的实际距离L0:S41. Determine the actual distance L 0 corresponding to a pixel in the edge image through camera calibration:
在本实施例中采用的线阵CCD的像元尺寸大小为H4.7×V4.7um,为了提高系统的测量精度在系统硬件设计时增加了一个可用于调节镜头与摄相机之间距离的套筒,根据成像公式放大倍数及采集到的漆包线图像清晰程度,确定出本系统的物距u=128mm,像距v=240mm;The pixel size of the linear array CCD used in this embodiment is H4.7×V4.7um. In order to improve the measurement accuracy of the system, a sleeve that can be used to adjust the distance between the lens and the camera is added during the design of the system hardware. cylinder, according to the imaging formula gain And the clarity of the enameled wire images collected, it is determined that the object distance of the system is u = 128mm, and the image distance is v = 240mm;
在确定摄像机与镜头距离(像距)及镜头与漆包线距离(物距)后,分别采用3mm、3.5mm、5mm、8mm的高精度标定块作为标定参照物,根据标点块的实际尺寸及图像中对应的像素点个数,最终得到图像像素与距离的对应关系,得出本系统图像中的一个像素对应的物体实际距离为L0=0.0025mm。After determining the distance between the camera and the lens (image distance) and the distance between the lens and the enameled wire (object distance), respectively use 3mm, 3.5mm, 5mm, 8mm high-precision calibration blocks as calibration reference objects, according to the actual size of the punctuation block and the image According to the number of corresponding pixels, the corresponding relationship between image pixels and distances is finally obtained, and the actual distance of an object corresponding to one pixel in the image of this system is obtained as L 0 =0.0025mm.
S42、计算边缘图像中漆包线直径所占像素点个数n,S42. Calculate the number n of pixels occupied by the diameter of the enameled wire in the edge image,
n=x1-x2 n= x1- x2
式中x1、x2分别是边缘图像中两边缘上的点的横坐标。In the formula, x 1 and x 2 are respectively the abscissa coordinates of the points on the two edges in the edge image.
S43、计算漆包线直径L=n*L0。S43. Calculate the enameled wire diameter L=n*L 0 .
本发明采用了迭代法对图像进行阈值分割和基于图像扫描的边缘跟踪方法相结合的边缘检测方法,故得到的边缘图像很好地区分了背景与目标,且边缘连续、没有伪边缘、没有毛刺点产生,边缘宽度为单像素,较好保留了边缘细节,使本发明具有较高的检测精度;同时,与传统边缘检测方法相比,本发明的边缘检测方法耗时更少,使本发明具有较快的检测速度;综上两点,使本发明具有较强的理论价值和工程应用推广价值。The present invention adopts an iterative method for image threshold segmentation and an edge detection method based on an image scanning edge tracking method, so the obtained edge image can distinguish the background and the target well, and the edge is continuous, without false edges, and without burrs point generation, the edge width is a single pixel, and the edge details are better reserved, so that the present invention has higher detection accuracy; at the same time, compared with the traditional edge detection method, the edge detection method of the present invention consumes less time, making the present invention It has faster detection speed; in summary of the above two points, the present invention has strong theoretical value and engineering application promotion value.
本领域的普通技术人员将会意识到,这里所述的实施例是为了帮助读者理解本发明的原理,应被理解为本发明的保护范围并不局限于这样的特别陈述和实施例。本领域的普通技术人员可以根据本发明公开的这些技术启示做出各种不脱离本发明实质的其它各种具体变形和组合,这些变形和组合仍然在本发明的保护范围内。Those skilled in the art will appreciate that the embodiments described here are to help readers understand the principles of the present invention, and it should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical revelations disclosed in the present invention without departing from the essence of the present invention, and these modifications and combinations are still within the protection scope of the present invention.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410767526.2A CN104515473A (en) | 2014-12-12 | 2014-12-12 | Online diameter detection method of varnished wires |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410767526.2A CN104515473A (en) | 2014-12-12 | 2014-12-12 | Online diameter detection method of varnished wires |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104515473A true CN104515473A (en) | 2015-04-15 |
Family
ID=52791141
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410767526.2A Pending CN104515473A (en) | 2014-12-12 | 2014-12-12 | Online diameter detection method of varnished wires |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104515473A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105157586A (en) * | 2015-04-24 | 2015-12-16 | 北京林业大学 | Method of measuring and calculating the diameter of any trunk by a photography range finding method |
CN105203039A (en) * | 2015-11-10 | 2015-12-30 | 山东赛特电工股份有限公司 | Electromagnetic wire intelligent laser automatic diameter measurement control system |
CN111968797A (en) * | 2020-08-06 | 2020-11-20 | 珠海格力电工有限公司 | Method and device for adjusting thickness of enameled wire paint film, storage medium and electronic equipment |
CN113554854A (en) * | 2021-08-02 | 2021-10-26 | 铜陵兢强电子科技股份有限公司 | Enameled equipment stall alarm system |
CN114877821A (en) * | 2022-05-31 | 2022-08-09 | 苏州浪潮智能科技有限公司 | Back drilling depth detection system and method for PCB |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1989004946A1 (en) * | 1987-11-26 | 1989-06-01 | Fardeau Jean Francois | Method for measuring diameters of wires, profiles or circular parts by diffraction of light rays and device for implementing such method |
CN101419058A (en) * | 2008-12-15 | 2009-04-29 | 北京农业信息技术研究中心 | Plant haulm diameter measurement device and measurement method based on machine vision |
CN102032875A (en) * | 2009-09-28 | 2011-04-27 | 王吉林 | Image-processing-based cable sheath thickness measuring method |
CN102147857A (en) * | 2011-03-22 | 2011-08-10 | 黄晓华 | Image processing method for detecting similar round by using improved hough transformation |
CN102607437A (en) * | 2011-01-24 | 2012-07-25 | 广东蓉胜超微线材股份有限公司 | Movable online detection device and detection method of enamelled wire diameter |
CN103512494A (en) * | 2013-07-16 | 2014-01-15 | 宁波职业技术学院 | Visual inspection system and method for scale micro changes of plant fruits |
-
2014
- 2014-12-12 CN CN201410767526.2A patent/CN104515473A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1989004946A1 (en) * | 1987-11-26 | 1989-06-01 | Fardeau Jean Francois | Method for measuring diameters of wires, profiles or circular parts by diffraction of light rays and device for implementing such method |
CN101419058A (en) * | 2008-12-15 | 2009-04-29 | 北京农业信息技术研究中心 | Plant haulm diameter measurement device and measurement method based on machine vision |
CN102032875A (en) * | 2009-09-28 | 2011-04-27 | 王吉林 | Image-processing-based cable sheath thickness measuring method |
CN102607437A (en) * | 2011-01-24 | 2012-07-25 | 广东蓉胜超微线材股份有限公司 | Movable online detection device and detection method of enamelled wire diameter |
CN102147857A (en) * | 2011-03-22 | 2011-08-10 | 黄晓华 | Image processing method for detecting similar round by using improved hough transformation |
CN103512494A (en) * | 2013-07-16 | 2014-01-15 | 宁波职业技术学院 | Visual inspection system and method for scale micro changes of plant fruits |
Non-Patent Citations (2)
Title |
---|
朱虹 主编: "《数字图像技术与应用》", 31 May 2011, 机械工程出版社 * |
郑继刚 等: "《基于MATLAB的数字图像处理研究》", 31 December 2010, 云南大学出版社 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105157586A (en) * | 2015-04-24 | 2015-12-16 | 北京林业大学 | Method of measuring and calculating the diameter of any trunk by a photography range finding method |
CN105157586B (en) * | 2015-04-24 | 2017-03-15 | 北京林业大学 | A kind of method that photography telemetry calculates any place trunk diameter |
CN105203039A (en) * | 2015-11-10 | 2015-12-30 | 山东赛特电工股份有限公司 | Electromagnetic wire intelligent laser automatic diameter measurement control system |
CN111968797A (en) * | 2020-08-06 | 2020-11-20 | 珠海格力电工有限公司 | Method and device for adjusting thickness of enameled wire paint film, storage medium and electronic equipment |
CN113554854A (en) * | 2021-08-02 | 2021-10-26 | 铜陵兢强电子科技股份有限公司 | Enameled equipment stall alarm system |
CN113554854B (en) * | 2021-08-02 | 2022-08-05 | 铜陵兢强电子科技股份有限公司 | Enameled equipment stall alarm system |
CN114877821A (en) * | 2022-05-31 | 2022-08-09 | 苏州浪潮智能科技有限公司 | Back drilling depth detection system and method for PCB |
CN114877821B (en) * | 2022-05-31 | 2023-09-22 | 苏州浪潮智能科技有限公司 | Back drilling depth detection system and method for PCB |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110415257B (en) | Gas-liquid two-phase flow overlapped bubble image segmentation method | |
CN103439342B (en) | Based on the Infrared Non-destructive Testing method of thermal map temporal aspect | |
CN103761743B (en) | A kind of solid wooden floor board detection method of surface flaw based on image co-registration segmentation | |
CN112651968B (en) | A method for detecting the deformation and pits of wooden boards based on depth information | |
Chen et al. | The defect detection of 3D-printed ceramic curved surface parts with low contrast based on deep learning | |
CN104515473A (en) | Online diameter detection method of varnished wires | |
CN101718528B (en) | Digital image based rapid solving method of circle parameters | |
CN106643965B (en) | Method for accurately identifying liquid level by utilizing template matching | |
CN103389310B (en) | Online sub-pixel optical component damage detection method based on radiation calibration | |
CN104966300B (en) | Bearing roller image detecting system and method and image detection device | |
CN109508709B (en) | Single pointer instrument reading method based on machine vision | |
CN112308854B (en) | Automatic detection method and system for chip surface flaws and electronic equipment | |
CN111415349B (en) | Polyester filament yarn detection method based on image processing technology | |
Ye et al. | High-resolution optical inspection system for fast detection and classification of surface defects | |
CN113705564B (en) | Pointer type instrument identification reading method | |
CN105184792B (en) | A kind of saw blade wear extent On-line Measuring Method | |
CN103886602A (en) | Radial image deflect detecting method based on veins | |
CN106595496A (en) | Man-machine interaction part size flexibility vision measurement method | |
CN106770296B (en) | A kind of four ball friction tests mill spot image polishing scratch deflection automatic measuring method | |
CN103743750B (en) | A kind of generation method of distribution diagram of surface damage of heavy calibre optical element | |
CN110873718A (en) | System and method for surface defect detection of steel plate based on machine vision | |
CN110426395B (en) | A kind of solar EL battery silicon wafer surface detection method and device | |
CN107478656A (en) | Paper pulp mixing effect method of determination and evaluation based on machine vision, device, system | |
Mi et al. | Steel strip surface defect detection based on multiscale feature sensing and adaptive feature fusion | |
Zhou et al. | An adaptive clustering method detecting the surface defects on linear guide rails |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20150415 |