CN114264661B - Definition self-adaptive coiled material detection method, device and system - Google Patents
Definition self-adaptive coiled material detection method, device and system Download PDFInfo
- Publication number
- CN114264661B CN114264661B CN202111480868.2A CN202111480868A CN114264661B CN 114264661 B CN114264661 B CN 114264661B CN 202111480868 A CN202111480868 A CN 202111480868A CN 114264661 B CN114264661 B CN 114264661B
- Authority
- CN
- China
- Prior art keywords
- image
- area
- instruction
- detection
- defect
- 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.)
- Active
Links
- 239000000463 material Substances 0.000 title claims abstract description 12
- 238000001514 detection method Methods 0.000 title claims description 198
- 238000000034 method Methods 0.000 claims abstract description 127
- 238000004891 communication Methods 0.000 claims abstract description 3
- 230000007547 defect Effects 0.000 claims description 399
- 230000008569 process Effects 0.000 claims description 114
- 238000011897 real-time detection Methods 0.000 claims description 28
- 230000000737 periodic effect Effects 0.000 claims description 26
- 230000008859 change Effects 0.000 claims description 22
- 238000001914 filtration Methods 0.000 claims description 22
- 230000002159 abnormal effect Effects 0.000 claims description 20
- 238000012216 screening Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 12
- 238000009826 distribution Methods 0.000 claims description 11
- 239000013078 crystal Substances 0.000 claims description 8
- 230000003044 adaptive effect Effects 0.000 claims description 6
- 239000007787 solid Substances 0.000 claims description 6
- 230000006978 adaptation Effects 0.000 claims description 4
- 238000012790 confirmation Methods 0.000 claims description 4
- 230000002146 bilateral effect Effects 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 claims description 3
- 238000011156 evaluation Methods 0.000 claims description 3
- 241000238631 Hexapoda Species 0.000 claims description 2
- 238000012887 quadratic function Methods 0.000 claims 4
- 238000012163 sequencing technique Methods 0.000 claims 2
- 230000009466 transformation Effects 0.000 claims 1
- 230000000875 corresponding effect Effects 0.000 description 35
- 238000010586 diagram Methods 0.000 description 16
- 238000007689 inspection Methods 0.000 description 8
- 238000004519 manufacturing process Methods 0.000 description 8
- 206010027146 Melanoderma Diseases 0.000 description 7
- 241000519995 Stachys sylvatica Species 0.000 description 7
- 230000002950 deficient Effects 0.000 description 7
- 239000011521 glass Substances 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 6
- 239000011159 matrix material Substances 0.000 description 6
- 238000003860 storage Methods 0.000 description 6
- 238000012795 verification Methods 0.000 description 5
- 238000012935 Averaging Methods 0.000 description 4
- 239000000428 dust Substances 0.000 description 4
- 238000003708 edge detection Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 4
- 230000005856 abnormality Effects 0.000 description 3
- 239000003086 colorant Substances 0.000 description 3
- 230000001276 controlling effect Effects 0.000 description 3
- 238000003825 pressing Methods 0.000 description 3
- 241000255969 Pieris brassicae Species 0.000 description 2
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 2
- 230000009471 action Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000877 morphologic effect Effects 0.000 description 2
- 230000001131 transforming effect Effects 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000011248 coating agent Substances 0.000 description 1
- 238000000576 coating method Methods 0.000 description 1
- 238000001816 cooling Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000003292 glue Substances 0.000 description 1
- 238000003703 image analysis method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000002649 leather substitute Substances 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000012552 review Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000003892 spreading Methods 0.000 description 1
- 230000007480 spreading Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
- G01N2021/8854—Grading and classifying of flaws
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
- G01N2021/8887—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20024—Filtering details
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20172—Image enhancement details
- G06T2207/20192—Edge enhancement; Edge preservation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Chemical & Material Sciences (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Signal Processing (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Image Processing (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及图像检测领域,特别是涉及一种清晰度自适应的卷材检测算法及装置、系统。The present invention relates to the field of image detection, and in particular to a definition-adaptive coil detection algorithm, device and system.
背景技术Background technique
目前卷材在生产加工的过程中,都会采用滚筒流水线进行传输,卷材在滚筒流水线上保持展开的状态,平铺前行。为了能够及时发现卷材的瑕疵,往往会在卷材的流水线传输过程中,进行卷材瑕疵检测。其中不同类型的卷材包含不同的瑕疵,比如PVB材料的卷材,主要包括晶点、虫斑、黑点和气泡等瑕疵,而合成革材料的卷材,则主要包括划痕、气泡、毛边、涂胶不均等瑕疵。卷材的瑕疵检测主要包括相机采集图像以及处理器分析图像两步。At present, during the production and processing of coils, roller production lines are used for transmission. The coils remain unfolded on the roller production lines and move forward flat. In order to detect defects in the coils in a timely manner, coil defect detection is often carried out during the coil production line transmission process. Different types of coils contain different defects. For example, PVB coils mainly include defects such as crystal points, insect spots, black spots and bubbles, while synthetic leather coils mainly include scratches, bubbles, burrs, uneven glue coating and other defects. Coil defect detection mainly includes two steps: camera acquisition of images and processor analysis of images.
对于相机采集图像,在目前的瑕疵检测设备中,大多采用线扫描相机,其中线扫描相机固定安装设置于支架上,使相机的镜头正对流水线,配合固定光源,完成卷材图像的采集。在传统的设备中,相机的位置、角度以及曝光参数等都需要事先完成调节,而且通常是人为进行调节,极为不便;另一方面,一旦流水线开始运作,操作人员就难以接触到相机,无法实现瑕疵检测设备对卷材流水线的动态适应调节,影响相机采集的图像质量。For camera image acquisition, most of the current defect detection equipment uses line scan cameras, which are fixedly installed on a bracket so that the camera lens faces the production line and cooperates with a fixed light source to complete the collection of web images. In traditional equipment, the position, angle, and exposure parameters of the camera need to be adjusted in advance, and usually manually, which is extremely inconvenient; on the other hand, once the production line starts operating, it is difficult for operators to access the camera, and it is impossible to achieve dynamic adaptive adjustment of the defect detection equipment to the web production line, which affects the image quality collected by the camera.
对于处理器分析图像,在目前的瑕疵检测方法中,由于检测方法效率低,使得图像的瑕疵检测往往存在滞后,继而会导致瑕疵的报警速度慢,错过了瑕疵的位置或者位置判断不准确,需要对卷材进行人工复查,费时费力,还降低卷材的生产效率。另外由于相机采集流水线运作时的图像,会导致图像模糊的问题,影响对图像的分析结果,因此需要先对图像进行滤波处理。在现有的图像分析方法中,往往对图像整体采用相同的滤波参数,完成图像滤波;但是由于在同一张图像中,存在不同的模糊程度,因此采用同样的滤波参数会导致部分区域的滤波效果不理想。For the processor to analyze the image, in the current defect detection method, due to the low efficiency of the detection method, the defect detection of the image often lags, which in turn leads to a slow alarm speed for the defect, missing the location of the defect or inaccurate location judgment, and requiring manual review of the coil, which is time-consuming and labor-intensive, and also reduces the production efficiency of the coil. In addition, since the camera collects images when the assembly line is in operation, it will cause image blur, affecting the analysis results of the image, so the image needs to be filtered first. In the existing image analysis method, the same filtering parameters are often used for the entire image to complete the image filtering; however, since there are different degrees of blur in the same image, using the same filtering parameters will result in unsatisfactory filtering effects in some areas.
因此现有的卷材流水线检测装置和检测方法难以满足实时、高效、高质量的卷材瑕疵检测需求。Therefore, existing coil assembly line inspection devices and inspection methods are difficult to meet the needs of real-time, efficient and high-quality coil defect detection.
发明内容Summary of the invention
本发明的目的是解决现有技术的不足,提供一种清晰度自适应的卷材检测算法及装置、系统。The purpose of the present invention is to solve the deficiencies of the prior art and to provide a definition-adaptive coil detection algorithm, device and system.
为了解决上述问题,本发明采用如下技术方案:In order to solve the above problems, the present invention adopts the following technical solutions:
一种卷材检测装置,包括操作台、支撑架、滑架、滑杆、相机模块以及光源模块;其中支撑架共两个,两个支撑架对称设置于流水线的两侧;滑架滑动设置于支撑架上,滑架能够沿着支撑架上下滑动;滑杆铰接设置于两个支撑架的滑架上;相机模块通过水平调节装置滑动设置于滑杆上;光源模块设置于支撑架上,并且分别位于流水线上的卷材的上方和下方;操作台设置于地面,操作台与相机模块以及光源模块通信连接;操作台包括显示器和处理器。A coil inspection device comprises an operating table, a support frame, a slide, a sliding rod, a camera module and a light source module; wherein there are two support frames, and the two support frames are symmetrically arranged on both sides of an assembly line; the sliding rod is slidably arranged on the support frame, and the sliding rod can slide up and down along the support frame; the sliding rod is hingedly arranged on the slides of the two support frames; the camera module is slidably arranged on the sliding rod through a horizontal adjustment device; the light source module is arranged on the support frame, and is respectively located above and below the coil on the assembly line; the operating table is arranged on the ground, and the operating table is communicatively connected with the camera module and the light source module; the operating table comprises a display and a processor.
一种清晰度自适应的卷材检测方法,包括如下步骤:A method for detecting a coiled material with self-adaptive clarity comprises the following steps:
步骤S1:操作台获取所有线扫相机采集的图像,并统计图像数量;Step S1: The operating console obtains images captured by all line scan cameras and counts the number of images;
步骤S2:判断采集的图像是否为多通道图像;若为多通道图像则转换为灰度图像,进入步骤S3;否则直接进入步骤S3;Step S2: Determine whether the acquired image is a multi-channel image; if it is a multi-channel image, convert it into a grayscale image and proceed to step S3; otherwise, directly proceed to step S3;
步骤S3:依次选取图像,计算图像尺寸,并根据左右不检测区域,完成每组图像的裁切并获取图像灰度值;其中每组图像表示同一时刻,不同线扫相机采集的图像;Step S3: Select images in sequence, calculate the image size, and complete the cropping of each group of images and obtain the image grayscale value according to the left and right undetected areas; wherein each group of images represents images collected by different line scan cameras at the same time;
步骤S4:根据全图背景评估,计算是否存在周期性条纹;若存在周期性纹理,则为有纹理的材质,需要进行去纹理步骤,完成去纹理后进入下一步骤;否则,直接进入下一步骤;Step S4: Calculate whether there are periodic stripes based on the full image background evaluation; if there are periodic textures, it is a textured material and needs to be detexturized. After detexturization is completed, proceed to the next step; otherwise, proceed directly to the next step;
步骤S5:根据图像的灰度值,完成图像的清晰度自适应流程,判断对应的滤波级数,完成图像滤波,并获得图像中的总瑕疵区域;Step S5: according to the gray value of the image, the image clarity adaptive process is completed, the corresponding filtering level is determined, the image filtering is completed, and the total defect area in the image is obtained;
步骤S6:基于聚类方法对总瑕疵区域进行临域多瑕疵处理,将满足要求的瑕疵区域进行连通;Step S6: Based on the clustering method, the total defect area is processed with multiple defects in the neighboring area, and the defect areas that meet the requirements are connected;
步骤S7:根据瑕疵区域或瑕疵连通区域面积获得瑕疵输出优先级;将瑕疵根据瑕疵输出优先级进行排序;Step S7: obtaining a defect output priority according to the area of the defect region or the defect connected region; and sorting the defects according to the defect output priority;
步骤S8:获取瑕疵信息,并按照瑕疵输出优先级顺序,依次判断瑕疵信息是否满足设定阈值范围要求;若瑕疵信息满足设定阈值要求,则将瑕疵信息依次放入输出队列;Step S8: Obtain defect information, and determine whether the defect information meets the set threshold range requirements in order of defect output priority; if the defect information meets the set threshold requirements, put the defect information into the output queue in order;
步骤S9:判断输出队列中的瑕疵信息是否超过瑕疵信息的设定输出数量上限;若超过了瑕疵信息的设定输出数量上限,则根据瑕疵输出优先级顺序输出设定输出数量的瑕疵信息,结束步骤;否则输出队列中的全部瑕疵信息,结束步骤。Step S9: Determine whether the defect information in the output queue exceeds the set output quantity upper limit of the defect information; if it exceeds the set output quantity upper limit of the defect information, output the set output quantity of defect information according to the defect output priority order, and end the step; otherwise, output all the defect information in the queue, and end the step.
进一步的,所述步骤S3中完成图像的裁剪并获取灰度值的过程包括如下步骤:Furthermore, the process of completing the image cropping and obtaining the grayscale value in step S3 includes the following steps:
步骤S31:获取一组图像,并判断该组图像中的图像数量大于或者等于一张;若图像的数量为一张,则进入步骤S32;若图像的数量大于一张,否则进入步骤S33;Step S31: Obtain a group of images, and determine whether the number of images in the group of images is greater than or equal to one; if the number of images is one, proceed to step S32; if the number of images is greater than one, otherwise proceed to step S33;
步骤S32:该组图像中仅包含一张图像,则判断左裁剪区域和右裁剪区域的宽度和与图像宽度的关系,其中左裁剪区域和右裁剪区域通过左右不检测区域获得;若左裁剪区域和右裁剪区域的宽度和大于图像宽度,则进入步骤S35;若左裁剪区域和右裁剪区域的宽度和小于等于图像宽度,则进入步骤S36;Step S32: if the group of images contains only one image, then determine the relationship between the sum of the widths of the left cropping area and the right cropping area and the image width, wherein the left cropping area and the right cropping area are obtained by the left and right undetected areas; if the sum of the widths of the left cropping area and the right cropping area is greater than the image width, proceed to step S35; if the sum of the widths of the left cropping area and the right cropping area is less than or equal to the image width, proceed to step S36;
步骤S33:该组图像中包含的图像数量大于一张,则判断第一张图像的宽度与左裁剪区域的宽度的关系;若第一张图像的宽度小于左裁剪区域的宽度,则进入步骤S35;否者进入步骤S34;Step S33: if the number of images included in the group of images is greater than one, determine the relationship between the width of the first image and the width of the left cropping area; if the width of the first image is less than the width of the left cropping area, proceed to step S35; otherwise, proceed to step S34;
步骤S34:判断最后一张图像的宽度与右裁剪区域的宽度的关系;若最后一张图像的宽度小于右裁剪区域的宽度,则进入步骤S35;否者进入步骤S36;Step S34: Determine the relationship between the width of the last image and the width of the right cropping area; if the width of the last image is smaller than the width of the right cropping area, proceed to step S35; otherwise, proceed to step S36;
步骤S35:图像裁剪区域过大,判断为图像检测异常,结束步骤,并结束检测算法;Step S35: if the image cropping area is too large, it is judged that the image detection is abnormal, and the step ends, and the detection algorithm ends;
步骤S36:依次获取该组图像中的一张图像,并判断该图像是否为该组图像的第一张图像;若为该组图像的第一张图像,则进入步骤S37;若不是该组图像的第一张图像,则进入步骤S38;Step S36: sequentially obtain one image in the group of images, and determine whether the image is the first image in the group of images; if it is the first image in the group of images, proceed to step S37; if it is not the first image in the group of images, proceed to step S38;
步骤S37:该图像为该组图像的第一张图像,则判断该组图像是否仅有一张图像;若只有一张图像,则根据左右不检测区域获取图像的左右裁剪区域,并完成图像的裁剪,进入步骤S310;若不为一张图像,则计算图像的左侧裁剪区域,并完成图像的裁剪,进入步骤S310;Step S37: if the image is the first image of the group of images, it is determined whether the group of images has only one image; if there is only one image, the left and right cropping areas of the image are obtained according to the left and right undetected areas, and the image is cropped, and the process proceeds to step S310; if there is not one image, the left cropping area of the image is calculated, and the image is cropped, and the process proceeds to step S310;
步骤S38:该图像不是该组图像的第一张图像,则判断该图像是否为该组图像的最后一张图像;若为该组图像的最后一张图像,则进入步骤S39;若不是该组图像的最后一张图像,则直接进入步骤S310;Step S38: if the image is not the first image of the group of images, determine whether the image is the last image of the group of images; if it is the last image of the group of images, proceed to step S39; if it is not the last image of the group of images, directly proceed to step S310;
步骤S39:该图像为该组图像的最后一张图像,并且不是第一张图像,则计算图像的右侧裁剪区域,并完成图像的裁剪,进入步骤S310;Step S39: if the image is the last image of the group of images and not the first image, the right cropping area of the image is calculated, and the image cropping is completed, and the process proceeds to step S310;
步骤S310:计算获得的图像的灰度值,结束步骤。Step S310: Calculate the grayscale value of the obtained image and end the step.
进一步的,所述步骤S310中,获取图像的灰度值后,还会求取图像的平均灰度值,若图像平均灰度值高于设定值Y1,或低于设定值Y2,则认为图像过亮或过暗,图像异常,结束检测算法。Furthermore, in step S310, after obtaining the grayscale value of the image, the average grayscale value of the image is also obtained. If the average grayscale value of the image is higher than the set value Y1, or lower than the set value Y2, the image is considered to be too bright or too dark, the image is abnormal, and the detection algorithm is terminated.
进一步的,所述步骤S4中的去纹理步骤,包括:Furthermore, the de-texturing step in step S4 includes:
步骤S41:获取裁剪后的图像,并计算图像的宽Width和高Height;Step S41: Obtain the cropped image and calculate the width and height of the image;
步骤S42:在图像中的随机区域,提取1/2Width*1/2Height区域的子图像;Step S42: extracting a sub-image of a 1/2Width*1/2Height area in a random area of the image;
步骤S43:在子图像中的随机位置设置相互垂直的两条直线L1、L2;Step S43: setting two mutually perpendicular straight lines L1 and L2 at random positions in the sub-image;
步骤S44:对子图像进行双边滤波去除尖锐噪声且保存边缘不被模糊后,并进行边缘增强,分别计算子图像在宽方向和高方向的二次导函数图像;Step S44: after performing bilateral filtering on the sub-image to remove sharp noise and preserve the edge without blurring, edge enhancement is performed, and the quadratic derivative function images of the sub-image in the width direction and the height direction are calculated respectively;
步骤S45:根据子图像在宽方向和高方向的二次导函数图像,获取二次导函数图像中的直线区域;Step S45: acquiring a straight line region in the quadratic derivative function image according to the quadratic derivative function image of the sub-image in the width direction and the height direction;
步骤S46:根据直线区域,在二次导函数图像中根据从亮到暗的极性变化提取直线区域骨架,并转化线性对象,获得条纹;Step S46: extracting the straight line region skeleton according to the polarity change from light to dark in the quadratic derivative function image, and transforming the linear object to obtain stripes;
步骤S47:计算提取的所有直线的霍夫变换值;Step S47: Calculate the Hough transform values of all extracted straight lines;
步骤S48:合并同一直线区域骨架内并且同一角度的低于设定像素点长度L3的条纹;Step S48: merging the stripes within the same straight line region skeleton and at the same angle that are less than the set pixel length L3;
步骤S49:条纹合并后,清除低于设定像素点长度L4的条纹;Step S49: after the stripes are merged, the stripes that are shorter than the set pixel length L4 are removed;
步骤S410:获取剩余条纹,并筛选出与直线L1或直线L2相交的条纹;Step S410: Obtain the remaining stripes, and filter out the stripes intersecting the straight line L1 or the straight line L2;
步骤S411:根据条纹与直线L1的交点,提取交点间距和夹角重复的条纹;根据条纹与直线L2的交点,提取交点间距和夹角重复的条纹;Step S411: extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L1; extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L2;
步骤S412:判断步骤S411提取出的条纹与直线L1及直线L2是否均存在夹角;若与直线L1及直线L2中的某条直线不存在夹角,则认为条纹与直线L1或直线L2平行,进入步骤S414;若均存在夹角,则认为条纹与直线L1和直线L2均不平行,进入步骤S413;Step S412: Determine whether the stripe extracted in step S411 has an angle with both the straight line L1 and the straight line L2; if no angle is present with either the straight line L1 or the straight line L2, it is considered that the stripe is parallel to the straight line L1 or the straight line L2, and the process proceeds to step S414; if both angles are present, it is considered that the stripe is not parallel to both the straight line L1 and the straight line L2, and the process proceeds to step S413;
步骤S413:根据条纹与直线L1和L2的夹角与交点间距,获取交点间距在条纹上的投影,包括投影长度和投影位置,该投影长度就是周期性条纹的间距;Step S413: according to the angle between the stripes and the straight lines L1 and L2 and the intersection spacing, obtaining the projection of the intersection spacing on the stripes, including the projection length and projection position, the projection length is the spacing of the periodic stripes;
步骤S414:获取条纹的周期性信息,包括投影长度和投影位置包括交点间距在条纹上的投影、条纹在直线L1或L2上的交点、条纹与直线L1和L2的角度;Step S414: acquiring periodic information of the stripes, including projection length and projection position including projection of the intersection spacing on the stripes, intersection points of the stripes on the straight line L1 or L2, and angles between the stripes and the straight lines L1 and L2;
步骤S415:根据条纹的周期线信息,生成周期函数,并通过傅里叶级数延拓展开,获得条纹的周期性频率;Step S415: Generate a periodic function based on the periodic line information of the fringes, and expand it through Fourier series extension to obtain the periodic frequency of the fringes;
步骤S416:根据傅里叶级数前n项周期性频率获得特定的空间滤波器;Step S416: obtaining a specific spatial filter according to the first n periodic frequencies of the Fourier series;
步骤S417:通过特定空间滤波器对步骤S41中获得的裁剪子图像进行卷积计算,实现图像去纹理操作,结束步骤。Step S417: Perform convolution calculation on the cropped sub-image obtained in step S41 through a specific spatial filter to implement image de-texturing operation, and end the step.
进一步的,所述步骤S5中对图像的清晰度自适应流程,包括对图像根据灰度值分布进行裁剪,并获得每块裁剪子图像的灰度方差D(x)、对比度cont、灰度能量ASM、逆差距Homo以及相关性Corr;Furthermore, the definition adaptation process of the image in step S5 includes cropping the image according to the gray value distribution, and obtaining the gray variance D(x), contrast cont, gray energy ASM, inverse difference Homo and correlation Corr of each cropped sub-image;
其中对比度cont表示图像的清晰度和纹理的沟纹深浅,对比度越大,表示图像越清晰,反之对比度越小,表示图像模糊;The contrast cont represents the clarity of the image and the depth of the texture grooves. The larger the contrast, the clearer the image, and vice versa, the smaller the contrast, the blurrier the image.
灰度能量ASM反映了图像的灰度分布均匀程度,当图像模糊时,灰度分布较均匀,能量值较大;当图像清晰时,能量值较小;Grayscale energy ASM reflects the uniformity of grayscale distribution of an image. When the image is blurred, the grayscale distribution is more uniform and the energy value is larger; when the image is clear, the energy value is smaller.
逆差距Homo反映了图像纹理局部变化程度;当图像模糊时,灰度分布较均匀,逆差距值较大;当图像清晰时,逆差距值较小;The inverse disparity Homo reflects the degree of local change in the image texture; when the image is blurred, the grayscale distribution is more uniform and the inverse disparity value is larger; when the image is clear, the inverse disparity value is smaller;
相关性Corr反映了裁剪子图像的整体灰度值相似程度;当图像模糊时,灰度变化小,相关性好,数值大;当图像清晰时,灰度剧烈变化,相关性差,数值低;The correlation Corr reflects the similarity of the overall grayscale values of the cropped sub-images. When the image is blurred, the grayscale changes little, the correlation is good, and the value is large. When the image is clear, the grayscale changes dramatically, the correlation is poor, and the value is low.
统计裁剪子图像的灰度方差D(x)、对比度cont、灰度能量ASM、逆差距Homo以及相关性Corr,并获取加权均值Ambiguity:Count the grayscale variance D(x), contrast cont, grayscale energy ASM, inverse difference Homo and correlation Corr of the cropped sub-image, and obtain the weighted mean Ambiguity:
其中χ、ε、η、α、β为设定的权值;加权均值Ambiguity越高,表示图像越模糊,则需要使用滤波核尺寸越小的高斯滤波器。Among them, χ, ε, η, α, and β are the set weights; the higher the weighted mean ambiguity, the blurrier the image, and a Gaussian filter with a smaller filter kernel size is required.
进一步的,所述步骤S6中临域多瑕疵处理流程,包括如下步骤:Furthermore, the adjacent domain multiple defect processing process in step S6 includes the following steps:
步骤S61:获取滤波后的整体图像,并对图像再分别使用一~四级的高斯滤波器进行滤波,获得四张再滤波图像;其中一级高斯滤波器的核尺寸为64*64,二级高斯滤波器的核尺寸为32*32,三级高斯滤波器的核尺寸为16*16,四级高斯滤波器的核尺寸为8*8;Step S61: Obtain the filtered overall image, and filter the image again using Gaussian filters of levels one to four to obtain four filtered images; wherein the kernel size of the first-level Gaussian filter is 64*64, the kernel size of the second-level Gaussian filter is 32*32, the kernel size of the third-level Gaussian filter is 16*16, and the kernel size of the fourth-level Gaussian filter is 8*8;
步骤S62:获取图像中的普通暗区域的像素点集合、非常暗区域的像素点集合、大面积暗区域的像素点集合、亮区域的像素点集合以及孔洞瑕疵区域的像素点合集;Step S62: Acquire a pixel set of a normal dark area, a pixel set of a very dark area, a pixel set of a large dark area, a pixel set of a bright area, and a pixel set of a hole defect area in the image;
步骤S63:获取暗区域;暗区域包括普通暗区域、非常暗区域和大面积暗区域;Step S63: Acquire dark areas; dark areas include ordinary dark areas, very dark areas and large dark areas;
步骤S64:获取总瑕疵区域;总瑕疵区域包括暗区域、亮区域和孔洞瑕疵区域;Step S64: obtaining a total defect area; the total defect area includes a dark area, a bright area and a hole defect area;
步骤S65:对总瑕疵区域进行闭运算连通邻近区域;Step S65: performing a closing operation on the total defect area to connect adjacent areas;
步骤S66:计算总瑕疵区域的连通域,分离所有闭合且不相连的区域;Step S66: Calculate the connected domain of the total defect area and separate all closed and unconnected areas;
步骤S67:计算总瑕疵区域内所有连通域的面积大小及中心点坐标,结束步骤。Step S67: Calculate the area size and center point coordinates of all connected domains in the total defect area, and end the step.
进一步的,所述步骤S62中,将一级滤波图像中像素点的灰度值小于三级滤波图像中对应位置的像素点灰度值与普通暗阈值Z1的差值的像素点设置为普通暗区域;将一级滤波图像中像素点的灰度值小于三级滤波图像中对应位置的像素点灰度值与非常暗阈值Z2的差值的像素点设置为非常暗区域;将二级滤波图像中像素点的灰度值小于四级滤波图像中对应位置的像素点灰度值与大面积暗阈值Z3的差值的像素点设置为大面积暗区域;将一级滤波图像中像素点的灰度值大于三级滤波图像中对应位置的像素点灰度值与普通亮阈值的和的像素点设置为亮区域;将步骤S61中再次滤波前的灰度值范围在250到255之间的像素点设置为孔洞瑕疵区域。Furthermore, in the step S62, the pixel points whose grayscale values in the first-level filtered image are less than the difference between the grayscale values of the pixels at the corresponding positions in the third-level filtered image and the normal dark threshold Z1 are set as normal dark areas; the pixel points whose grayscale values in the first-level filtered image are less than the difference between the grayscale values of the pixels at the corresponding positions in the third-level filtered image and the very dark threshold Z2 are set as very dark areas; the pixel points whose grayscale values in the second-level filtered image are less than the difference between the grayscale values of the pixels at the corresponding positions in the fourth-level filtered image and the large-area dark threshold Z3 are set as large-area dark areas; the pixel points whose grayscale values in the first-level filtered image are greater than the sum of the grayscale values of the pixels at the corresponding positions in the third-level filtered image and the normal bright threshold are set as bright areas; the pixel points whose grayscale values in the first-level filtered image before re-filtering in step S61 are set as hole defect areas.
进一步的,所述步骤S8中的瑕疵信息包括瑕疵类型,瑕疵类别包括黑点、气泡、虫斑、晶点、毛绒;瑕疵类别通过瑕疵识别特征算法获得,包括如下步骤:Furthermore, the defect information in step S8 includes defect types, and defect categories include black spots, bubbles, worm spots, crystal spots, and fluff; the defect categories are obtained by a defect recognition feature algorithm, including the following steps:
步骤S81:获取图像,检测图像中的暗区域;其中暗区域为图像灰度值低于设定阈值Y3的区域;Step S81: Acquire an image and detect dark areas in the image; wherein the dark areas are areas where the grayscale value of the image is lower than a set threshold value Y3;
步骤S82:判断图像中的暗区域数量是否为一个;若暗区域数量仅有一个,则进入步骤S83;若暗区域的数量为0或大于一个,则进入步骤S84;Step S82: Determine whether the number of dark areas in the image is one; if the number of dark areas is only one, proceed to step S83; if the number of dark areas is 0 or greater than one, proceed to step S84;
步骤S83:暗区域的数量仅有一个,进一步判断暗区域的轮廓为近似实心圆形或者近似实心矩形或者其他形状;若暗区域的轮廓近似圆形,则判断瑕疵为大黑点,结束步骤;若暗区域轮廓近似矩形,则判断瑕疵为毛绒,结束步骤;若暗区域的轮廓为其他形状,则进入步骤S84;Step S83: If there is only one dark area, further determine whether the outline of the dark area is approximately a solid circle or an approximately solid rectangle or other shapes; if the outline of the dark area is approximately a circle, determine that the defect is a large black spot, and end the step; if the outline of the dark area is approximately a rectangle, determine that the defect is fluff, and end the step; if the outline of the dark area is other shapes, proceed to step S84;
步骤S84:检测图像中的亮区域;判断亮区域和暗区域的数量是否均为0个,若均为0个,则认为图像无瑕疵;否者进入步骤S85;其中亮区域为图像灰度值高于设定阈值Y4的区域;Step S84: Detect the bright area in the image; determine whether the number of bright areas and dark areas are both 0, if both are 0, the image is considered flawless; otherwise, proceed to step S85; the bright area is the area where the grayscale value of the image is higher than the set threshold value Y4;
步骤S85:判断亮区域边缘是否被暗区域包围;若亮区域边缘被暗区域包围,则认为瑕疵为气泡,结束步骤;若亮区域边缘没有被暗区域包围,则进入步骤S86:Step S85: Determine whether the edge of the bright area is surrounded by the dark area; if the edge of the bright area is surrounded by the dark area, the defect is considered to be a bubble and the step ends; if the edge of the bright area is not surrounded by the dark area, proceed to step S86:
步骤S86:亮区域边缘没有被暗区域包围,则对亮区域和暗区域进行数量统计,并获取图像中的所有亮区域和暗区域的重心坐标;Step S86: if the edge of the bright area is not surrounded by the dark area, then the number of bright areas and dark areas is counted, and the centroid coordinates of all bright areas and dark areas in the image are obtained;
步骤S87:将亮区域和暗区域的重心坐标根据横坐标的大小进行排序,判断中重心坐标能否拟合成直线;若重心坐标能够拟合成一条直线,则进入步骤S88;否者,进入步骤S89;Step S87: sort the barycentric coordinates of the bright area and the dark area according to the size of the horizontal coordinate, and determine whether the barycentric coordinates can be fitted into a straight line; if the barycentric coordinates can be fitted into a straight line, proceed to step S88; otherwise, proceed to step S89;
步骤S88:重心坐标能够拟合成一条直线,则进一步判断亮区域和暗区域是否交替出现;若亮区域和暗区域交替出现,则判断瑕疵为虫斑,结束步骤;若亮区域和暗区域没有交替出现,则进入步骤S89;Step S88: If the centroid coordinates can be fitted into a straight line, it is further determined whether the bright area and the dark area appear alternately; if the bright area and the dark area appear alternately, it is determined that the defect is a worm spot, and the step ends; if the bright area and the dark area do not appear alternately, the process proceeds to step S89;
步骤S89:获取亮区域和暗区域的总区域骨架,判断骨架的形状是否呈箭头排列形状;若区域骨架为箭头排列形状,则认为瑕疵为晶点,结束步骤;否者进入步骤S810;Step S89: Obtain the total regional skeleton of the bright area and the dark area, and determine whether the shape of the skeleton is in the shape of arrow arrangement; if the regional skeleton is in the shape of arrow arrangement, the defect is considered to be a crystal point, and the step ends; otherwise, proceed to step S810;
步骤S810:认为瑕疵为其他,获取相邻区域的重心间距,并对区域进行聚合,计算聚合后的区域和面积;其中区域包括亮区域和暗区域。Step S810: the defect is considered to be other, the centroid distance between adjacent regions is obtained, and the regions are aggregated to calculate the aggregated regions and areas; wherein the regions include bright regions and dark regions.
一种卷材检测系统,所述检测系统基于上述的检测方法,检测系统包括如下步骤:A coil material detection system, the detection system is based on the above detection method, and the detection system comprises the following steps:
步骤1:操作台接收开机指令,处理器开始开机初始化流程;完成开机初始化流程后,显示器显示开机界面;开机界面包括“进入系统”和“退出系统”按钮,分别对应“进入系统”指令以及“退出系统”指令;Step 1: The console receives the power-on command, and the processor starts the power-on initialization process; after the power-on initialization process is completed, the display shows the power-on interface; the power-on interface includes "enter system" and "exit system" buttons, which correspond to the "enter system" command and the "exit system" command respectively;
步骤2:操作台接收开机界面的操作指令,并判断为“退出系统”指令还是“进入系统”指令;若为“退出系统”指令,则操作台关闭,结束步骤;若为“进入系统”指令,则显示器由开机界面跳转到瑕疵检测界面,并开启多个线扫相机采集线程;瑕疵检测界面包括“清除”、“检测/暂停”、“历史卷”、“换卷”、“设置”、“前进”、“后退”以及“退出”按钮,分别对应“清除”、“检测/暂停”、“历史卷”、“换卷”、“设置”、“前进”、“后退”以及“退出”指令;瑕疵检测界面还包括图像显示区域,图像显示区域实时显示相机模块采集的图像;在图像显示区域设置有检测区域滑条,检测区域滑条对应“检测区域划分”指令;Step 2: The console receives the operation instruction of the power-on interface, and determines whether it is an "exit system" instruction or an "enter system" instruction; if it is an "exit system" instruction, the console is closed and the step ends; if it is an "enter system" instruction, the display jumps from the power-on interface to the defect detection interface, and starts multiple line scan camera acquisition threads; the defect detection interface includes "clear", "detection/pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" buttons, which correspond to the "clear", "detection/pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" instructions respectively; the defect detection interface also includes an image display area, which displays the image collected by the camera module in real time; a detection area slider is set in the image display area, and the detection area slider corresponds to the "detection area division" instruction;
步骤3:操作台判断是否接收到瑕疵检测界面的操作指令;若接收到操作指令则进入步骤4,否则返回步骤3;Step 3: The operation console determines whether it has received the operation instruction of the defect detection interface; if it has received the operation instruction, it proceeds to step 4, otherwise it returns to step 3;
步骤4:并判断操作指令的类型;若为“清除”指令则进入步骤5;若为“检测/暂停”指令,则进入步骤6;若为“历史卷”指令,则进入步骤7;若为“换卷”指令,则进入步骤8;若为“设置”指令,则进入步骤9;若为“前进”或“后退”指令,则进入步骤10;若为“退出”指令,则进入步骤11;若为“检测区域划分”指令,则进入步骤12;Step 4: and determine the type of operation instruction; if it is a "clear" instruction, go to step 5; if it is a "detection/pause" instruction, go to step 6; if it is a "historical volume" instruction, go to step 7; if it is a "change volume" instruction, go to step 8; if it is a "set" instruction, go to step 9; if it is a "forward" or "backward" instruction, go to step 10; if it is a "exit" instruction, go to step 11; if it is a "detection area division" instruction, go to step 12;
步骤5:操作台收到“清除”指令,提示用户是否清除历史信息提示;若收到确认指令,则清除历史信息提示;若收到否认指令,则返回步骤3;Step 5: The console receives a "clear" command and prompts the user whether to clear the historical information prompt; if a confirmation command is received, the historical information prompt is cleared; if a denial command is received, the console returns to step 3;
步骤6:操作台收到“检测/暂停”指令,判断为“检测”指令还是“暂停”指令;若为“检测”指令,则进入实时检测流程,直至收到“暂停”指令,返回步骤3;若为“暂停”指令,则结束实时检测流程,返回步骤3;需要说明的是,在开机后首次进入瑕疵检测界面时,显示“检测”按钮,对应“检测”指令,“检测”按钮被点击后会切换为“暂停”按钮,“暂停”按钮被点击后会切换为“检测”按钮,“暂停”按钮对应“暂停”指令;Step 6: The console receives the "Detect/Pause" command and determines whether it is a "Detect" command or a "Pause" command; if it is a "Detect" command, the console enters the real-time detection process until a "Pause" command is received, and returns to step 3; if it is a "Pause" command, the real-time detection process ends and returns to step 3; it should be noted that when the defect detection interface is entered for the first time after powering on, the "Detect" button is displayed, corresponding to the "Detect" command, and the "Detect" button will switch to the "Pause" button after being clicked, and the "Pause" button will switch to the "Detect" button after being clicked, and the "Pause" button corresponds to the "Pause" command;
步骤7:操作台收到“历史卷”指令,控制显示器进入历史卷界面,开启历史卷界面流程,结束历史卷界面流程后返回步骤3;Step 7: The console receives the "historical volume" command, controls the display to enter the historical volume interface, starts the historical volume interface process, and returns to step 3 after the historical volume interface process ends;
步骤8:操作台收到“换卷”指令,判断实时检测流程是否开启;若实时检测流程开启,则在显示器提示“请先暂停实时检测”,返回步骤3;若实时检测流程未开启,则根据输入更新卷号、卷长信息,并释放显示图像资源,将对应数据写入数据库,返回步骤3;Step 8: The console receives the "change roll" command and determines whether the real-time detection process is turned on; if the real-time detection process is turned on, the display prompts "Please suspend real-time detection first" and returns to step 3; if the real-time detection process is not turned on, the roll number and roll length information are updated according to the input, and the display image resources are released, and the corresponding data is written into the database, and the return is to step 3;
步骤9:操作台收到“设置”指令,创建并进入设置界面;退出设置界面后返回步骤3;Step 9: The console receives the "Set" command, creates and enters the setting interface; exits the setting interface and returns to step 3;
步骤10:操作台收到“前进”或“后退”指令,判断为“前进”指令还是“后退”指令;若为“前进”指令,则进一步判断是否为当前图像的最后一页,若是最后一页,则进行提示并返回步骤3,若不是最后一页,则前进一页,并返回步骤3;若为“后退”指令,则进一步判断是否为当前图像的第一页,若是最第一页,则进行提示并返回步骤3,若不是第一页,则后退一页,并返回步骤3;Step 10: The console receives a "forward" or "backward" instruction, and determines whether it is a "forward" instruction or a "backward" instruction; if it is a "forward" instruction, further determine whether it is the last page of the current image, if it is the last page, give a prompt and return to step 3, if it is not the last page, advance one page and return to step 3; if it is a "backward" instruction, further determine whether it is the first page of the current image, if it is the first page, give a prompt and return to step 3, if it is not the first page, go back one page and return to step 3;
步骤11:操作台收到“退出”指令,提示用户是否确认退出系统;若确认退出系统,则结束步骤;若未确认退出系统,则返回步骤3;Step 11: The console receives the "exit" command and prompts the user whether to confirm to exit the system; if confirmed, the step ends; if not confirmed, the process returns to step 3;
步骤12:操作台收到“检测区域划分”指令,则对应修改图像的左右不检测区域的值,并将修改后的值保存至系统参数中,返回步骤3。Step 12: When the console receives the "detection area division" command, it modifies the values of the left and right non-detection areas of the image accordingly, saves the modified values into the system parameters, and returns to step 3.
本发明的有益效果为:The beneficial effects of the present invention are:
通过调节支撑架上的高低调节装置、转动滑杆以及调节相机模块在滑杆上的位置,实现对相机模块的准确位置调节;The camera module can be accurately adjusted by adjusting the height adjustment device on the support frame, rotating the slide bar, and adjusting the position of the camera module on the slide bar.
通过在相机模块中设置风扇,并且四个风扇分别负责进气和出气,保证线扫相机得到高效的冷却;By setting fans in the camera module, and four fans responsible for air intake and air exhaust respectively, the line scan camera can be efficiently cooled;
通过与负责出风的风扇对应设置导风管,并且导风管的出风口位于相机模块外壳的玻璃外侧,防止玻璃外侧落灰;An air duct is provided corresponding to the fan responsible for air discharge, and the air outlet of the air duct is located outside the glass of the camera module housing to prevent dust from falling outside the glass;
通过设置光源模块包括正面光源和背光源,满足各种材质卷材瑕疵检测中线扫相机的镜头范围内的亮度要求,满足图像拍摄的需求;By setting the light source module including the front light source and the back light source, the brightness requirements within the lens range of the line scan camera in the defect detection of various materials are met, and the image shooting requirements are met;
通过设置背光源模块包含光源和遮光片,并且遮光片安装于光源的两侧,遮光片的安装高度可调节,从而实现对光源的散射范围的精确调节;The backlight module includes a light source and a shading sheet, and the shading sheets are installed on both sides of the light source. The installation height of the shading sheets can be adjusted, thereby achieving precise adjustment of the scattering range of the light source.
通过系统初始化流程连接相机模块,获取图像数据,进行实时显示,并根据设定算法完成对卷材的瑕疵检测;Connect the camera module through the system initialization process, obtain image data, display it in real time, and complete the defect detection of the coil according to the set algorithm;
通过设置图像灰度值动态调节流程,控制光源的智能切换、光源亮度和相机曝光量的自动调节,从而保证相机模块采集到图像的灰度值达到设定范围;By setting the dynamic adjustment process of image grayscale value, the intelligent switching of light source, automatic adjustment of light source brightness and camera exposure are controlled, so as to ensure that the grayscale value of the image collected by the camera module is within the set range;
通过运行瑕疵打标流程,对于瑕疵在卷材上的位置能够准确记录,并进行实时显示,从而可查看当前瑕疵和历史瑕疵信息;By running the defect marking process, the location of the defect on the coil can be accurately recorded and displayed in real time, so that the current defect and historical defect information can be viewed;
对多个线扫相机的图像进行实时拼接显示,使得系统瑕疵实时界面能够完整显示卷材的幅面;The images of multiple line scan cameras are stitched and displayed in real time, so that the real-time interface of system defects can fully display the width of the coil;
通过将图像中灰度异常区域进行提取,主要提取与图像背景灰度值异常的区域,并进行形态特征判断后区分不同的瑕疵,实现对瑕疵类型的识别和区分;By extracting the grayscale abnormal area in the image, mainly extracting the area with abnormal grayscale value compared with the image background, and distinguishing different defects after judging the morphological characteristics, the defect types can be identified and distinguished;
通过图像去条纹处理,提取条纹区域,并根据条纹周期性获得空间滤波器,实现针对规律分布的条纹的滤波处理,避免条纹对后续的清晰度自适应流程以及缺陷判断产生干扰;Through image stripe removal processing, the stripe area is extracted, and a spatial filter is obtained according to the stripe periodicity to achieve filtering processing for regularly distributed stripes, thereby preventing the stripes from interfering with the subsequent clarity adaptation process and defect judgment;
通过对图像进行分段的清晰度自适应检测,使得幅宽较宽的同一张图像能够根据灰度值等参数分别采用对应的滤波核完成滤波,得到较佳的滤波效果,保证滤波后的图像符合图像处理要求;By performing segmented definition adaptive detection on the image, the same image with a wide width can be filtered using corresponding filter kernels according to parameters such as grayscale value, thus obtaining a better filtering effect and ensuring that the filtered image meets the image processing requirements;
通过基于聚类算法对瑕疵进行连通域处理,使得满足条件的瑕疵能够进行连通,提高算法的效率,并且实现对较小却密集分布的瑕疵的检测。By processing the connected domains of defects based on a clustering algorithm, defects that meet the conditions can be connected, improving the efficiency of the algorithm and enabling the detection of smaller but densely distributed defects.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明实施例一的除操作台的立体图;FIG1 is a perspective view of a cleaning operation table according to a first embodiment of the present invention;
图2为本发明实施例一的除操作台的主视图;FIG2 is a front view of the cleaning operation table according to the first embodiment of the present invention;
图3为本发明实施例一的相机架和滑架的连接示意图;FIG3 is a schematic diagram of the connection between the camera frame and the slide frame according to the first embodiment of the present invention;
图4为本发明实施例一的相机模块打开外壳正面板的主视图;FIG4 is a front view of the camera module with the housing front panel opened according to the first embodiment of the present invention;
图5为本发明实施例一的相机模块仰视图;FIG5 is a bottom view of the camera module according to the first embodiment of the present invention;
图6为本发明实施例一的光源架和光源模块的主视图;FIG6 is a front view of a light source frame and a light source module according to Embodiment 1 of the present invention;
图7为本发明实施例一的光源架和光源模块的立体图;FIG7 is a perspective view of a light source frame and a light source module according to Embodiment 1 of the present invention;
图8为本发明实施例一的除操作台的立体图二;FIG8 is a second perspective view of the operation table according to the first embodiment of the present invention;
图9为本发明实施例一的系统总流程框图;FIG9 is a system overall flow chart of Embodiment 1 of the present invention;
图10为本发明实施例一的开机初始化流程框图;10 is a flowchart of the power-on initialization process of Embodiment 1 of the present invention;
图11为本发明实施例一的数据库连接和读取流程框图;11 is a flowchart of database connection and reading process according to the first embodiment of the present invention;
图12为本发明实施例一的报警模块初始化流程框图;12 is a flowchart of the alarm module initialization process according to Embodiment 1 of the present invention;
图13为本发明实施例一的开机瑕疵信息显示流程框图;13 is a flowchart of the display process of the power-on defect information according to the first embodiment of the present invention;
图14为本发明实施例一的瑕疵实时检测流程框图;FIG14 is a flowchart of real-time defect detection according to Embodiment 1 of the present invention;
图15为本发明实施例一的图像灰度值动态调节流程框图;FIG15 is a flowchart of a dynamic adjustment process of image grayscale values according to a first embodiment of the present invention;
图16为本发明实施例一的瑕疵照片墙信息更新流程框图;16 is a flowchart of updating defective photo wall information according to the first embodiment of the present invention;
图17为本发明实施例一的瑕疵实时打标流程框图;FIG17 is a flowchart of real-time defect marking according to the first embodiment of the present invention;
图18为本发明实施例一的瑕疵检测报警流程框图;FIG18 is a flowchart of a defect detection alarm process according to Embodiment 1 of the present invention;
图19为本发明实施例一的历史卷历史瑕疵信息显示流程框图;19 is a flowchart of displaying historical defect information of historical volumes in accordance with the first embodiment of the present invention;
图20为本发明实施例一的历史卷瑕疵检测报告生成流程框图;20 is a flowchart of a historical volume defect detection report generation process according to the first embodiment of the present invention;
图21为本发明实施例一的参数操作界面流程图;FIG21 is a flow chart of a parameter operation interface according to Embodiment 1 of the present invention;
图22为本发明实施例一的瑕疵检测参数设置流程图;FIG22 is a flow chart of defect detection parameter setting according to Embodiment 1 of the present invention;
图23为本发明实施例一的瑕疵分类参数设置流程图FIG. 23 is a flow chart of defect classification parameter setting according to the first embodiment of the present invention.
图24为本发明实施例一的瑕疵实时检测界面示意图;FIG24 is a schematic diagram of a real-time defect detection interface according to the first embodiment of the present invention;
图25为本发明实施例一的参数设置界面示意图;FIG25 is a schematic diagram of a parameter setting interface of Embodiment 1 of the present invention;
图26为本发明实施例一的系统参数设置界面示意图;FIG26 is a schematic diagram of a system parameter setting interface according to Embodiment 1 of the present invention;
图27为本发明实施例一的瑕疵检测参数设置界面示意图;FIG27 is a schematic diagram of a defect detection parameter setting interface according to the first embodiment of the present invention;
图28为本发明实施例一的瑕疵分类设置界面示意图;FIG28 is a schematic diagram of a defect classification setting interface according to the first embodiment of the present invention;
图29为本发明实施例一的历史卷信息显示界面示意图;FIG29 is a schematic diagram of a display interface for historical volume information according to the first embodiment of the present invention;
图30为本发明实施例一的历史卷瑕疵统计界面示意图;FIG30 is a schematic diagram of a historical volume defect statistics interface according to the first embodiment of the present invention;
图31为本发明实施例一的卷材检测算法流程图;FIG31 is a flow chart of a coil detection algorithm according to Embodiment 1 of the present invention;
图32为本发明实施例一的图像裁剪流程图;FIG32 is a flowchart of image cropping according to the first embodiment of the present invention;
图33为本发明实施例一的卷材去纹理流程图;FIG33 is a flow chart of coil detexturing according to Embodiment 1 of the present invention;
图34为本发明实施例一的轮廓线示意图;FIG34 is a schematic diagram of the outline of the first embodiment of the present invention;
图35为本发明实施例一的图像S的对比度与方差走势;FIG35 is a trend of contrast and variance of an image S according to the first embodiment of the present invention;
图36为本发明实施例一的图像S的灰度能量、逆差距与相关性走势;FIG36 shows the grayscale energy, inverse difference and correlation trend of the image S according to the first embodiment of the present invention;
图37为本发明实施例一的临域多瑕疵处理流程图;FIG37 is a flowchart of the adjacent domain multi-defect processing according to the first embodiment of the present invention;
图38为本发明实施例一的确认瑕疵输出优先级的流程图;38 is a flow chart of confirming defect output priority according to the first embodiment of the present invention;
图39为本发明实施例二的瑕疵识别特征算法流程图;FIG39 is a flow chart of a defect recognition feature algorithm according to Embodiment 2 of the present invention;
图40为本发明实施例二的瑕疵类型和图像示意。FIG. 40 is a schematic diagram of defect types and images according to the second embodiment of the present invention.
附图标记说明:支撑架1、高度调节装置11、立柱12、相机架13、光源架14、滑架2、转动调节装置21、滑杆3、水平调节装置31、相机模块4、相机外壳41、风口42、导风管43、风扇44、线扫相机45、光源模块5、正面光源51、弧形灯罩52、透光缝隙53、背光源54、光源55、遮光片56、卷材6。Explanation of the accompanying drawings: support frame 1, height adjustment device 11, column 12, camera frame 13, light source frame 14, slide 2, rotation adjustment device 21, slide rod 3, horizontal adjustment device 31, camera module 4, camera housing 41, air outlet 42, air duct 43, fan 44, line scan camera 45, light source module 5, front light source 51, arc lampshade 52, light-transmitting gap 53, backlight source 54, light source 55, shading sheet 56, coil 6.
具体实施方式Detailed ways
以下通过特定的具体实例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
需要说明的是,以下实施例中所提供的图示仅以示意方式说明本发明的基本构想,遂图式中仅显示与本发明中有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
实施例一:Embodiment 1:
如图1、2所示,一种基于线扫相机的卷材检测装置,包括操作台、支撑架1、滑架2、滑杆3、相机模块4以及光源模块5;其中支撑架1共两个,两个支撑架1对称设置于流水线的两侧;滑架2滑动设置于支撑架1上,滑架2能够沿着支撑架1上下滑动;滑架2与支撑架1之间设置有高度调节装置11;滑杆3铰接设置于两个支撑架1的滑架2上;相机模块4通过水平调节装置31滑动设置于滑杆3上;光源模块5设置于支撑架1上,并且分别位于流水线上的卷材6的上方和下方;操作台设置于地面,操作台与相机模块4以及光源模块5通信连接;操作台包括显示器和处理器。As shown in Figures 1 and 2, a coil inspection device based on a line scan camera includes an operating table, a support frame 1, a slide 2, a slide rod 3, a camera module 4 and a light source module 5; wherein there are two support frames 1, and the two support frames 1 are symmetrically arranged on both sides of the assembly line; the slide 2 is slidably arranged on the support frame 1, and the slide 2 can slide up and down along the support frame 1; a height adjustment device 11 is arranged between the slide 2 and the support frame 1; the slide rod 3 is hingedly arranged on the slide 2 of the two support frames 1; the camera module 4 is slidably arranged on the slide rod 3 through a horizontal adjustment device 31; the light source module 5 is arranged on the support frame 1, and is respectively located above and below the coil 6 on the assembly line; the operating table is arranged on the ground, and the operating table is communicatively connected with the camera module 4 and the light source module 5; the operating table includes a display and a processor.
如图3所示,所述支撑架1包括立柱12、相机架13以及光源架14,其中立柱12共两根,两根立柱12对称设置于流水线的两侧;相机架13以及光源架14设置于两根立柱12上,相机架13设置于光源架14的上方。相机架13包括两根竖杆以及横杆,横杆设置于两根竖杆的底部,两根竖杆相互平行设置;竖杆上设置有滑轨;滑架2设置于两根竖杆之间,与竖杆上的滑轨滑动连接,能够沿滑轨滑动;滑架2与横杆相互平行;在横杆与滑架2之间设置有高度调节装置11,高度调节装置11可以为电推杆或者气缸,在本例中,高度调节装置11为150mm规格的电推杆,电推杆的两端分别与横杆以及滑架2铰接。通过电推杆动作能够调节滑架2的高度。光源架14呈方形的结构,两个光源架14对称设置于两根立柱12上。As shown in FIG3 , the support frame 1 includes a column 12, a camera frame 13 and a light source frame 14, wherein there are two columns 12, and the two columns 12 are symmetrically arranged on both sides of the assembly line; the camera frame 13 and the light source frame 14 are arranged on the two columns 12, and the camera frame 13 is arranged above the light source frame 14. The camera frame 13 includes two vertical bars and a cross bar, the cross bar is arranged at the bottom of the two vertical bars, and the two vertical bars are arranged parallel to each other; a slide rail is arranged on the vertical bar; the slide 2 is arranged between the two vertical bars, and is slidably connected with the slide rail on the vertical bar, and can slide along the slide rail; the slide 2 and the cross bar are parallel to each other; a height adjustment device 11 is arranged between the cross bar and the slide 2, and the height adjustment device 11 can be an electric push rod or a cylinder. In this example, the height adjustment device 11 is a 150mm electric push rod, and the two ends of the electric push rod are respectively hinged to the cross bar and the slide 2. The height of the slide 2 can be adjusted by the action of the electric push rod. The light source frame 14 is in a square structure, and two light source frames 14 are symmetrically arranged on the two pillars 12 .
所述滑架2上铰接设置有滑杆3,滑杆3位于两个支撑架1上的相机架13之间,滑杆3能够围绕铰接部位转动,在本例中滑杆3绕中轴线转动。在滑杆3与滑架2之间还设置有转动调节装置21,在本例中转动调节装置21为步进电机,步进电机设置于滑杆3的一端的铰接部位,通过步进电机,控制滑杆3的转动,进而控制滑杆3上的相机模块4的角度。滑竿上设置有水平调节装置31,水平调节装置31可以为无杆气缸、丝杠结构或者手摇模组,在本例中水平调节装置31采用1100mm长的手摇模组。相机模块4设置于手摇模组的滑块上,能够随着手摇模组的动作实现位置调节。水平调节装置31上设置有至少一个相机模块4,不同的相机模块4中的线扫相机45,连接于同一个触发器,保证同时采集图像。The slide 2 is hingedly provided with a slide bar 3, which is located between the camera frames 13 on the two support frames 1. The slide bar 3 can rotate around the hinged part, and in this example, the slide bar 3 rotates around the central axis. A rotation adjustment device 21 is also provided between the slide bar 3 and the slide 2. In this example, the rotation adjustment device 21 is a stepper motor, which is provided at the hinged part of one end of the slide bar 3. The stepper motor is used to control the rotation of the slide bar 3, and then the angle of the camera module 4 on the slide bar 3 is controlled. The slide bar is provided with a horizontal adjustment device 31, which can be a rodless cylinder, a screw structure or a hand-cranked module. In this example, the horizontal adjustment device 31 adopts a hand-cranked module with a length of 1100mm. The camera module 4 is provided on the slider of the hand-cranked module, and can realize position adjustment with the action of the hand-cranked module. At least one camera module 4 is provided on the horizontal adjustment device 31, and the line scan cameras 45 in different camera modules 4 are connected to the same trigger to ensure simultaneous image acquisition.
如图4、5所示,所述相机模块4包括相机外壳41、风扇44以及线扫相机45,其中线扫相机45和风扇44均设置于相机外壳41的内部。在本例中相机外壳41内设置有四个风扇44,其中以两个风扇44为一组,分别设置于线扫相机45的上下部位,位于线扫相机45的上部的风扇组用于为线扫相机45降温,位于线扫相机45的下部的风扇44组用于防止线扫相机45的镜头落灰以及外壳底部的玻璃的内侧落灰;需要说明的是风扇44不会对线扫相机45的镜头区域形成遮挡。在本例中,每一组风扇44中的一个风扇44负责进气,另一个风扇44负责出气,并且在线扫相机45的上部及下部的同一侧的两个风扇44分别负责进气和出气,比如位于上部左侧的风扇44负责进气,则位于下部左侧的风扇44负责出气,其目的是在相机模块4的外壳内形成上下循环的风道,提高风扇44对线扫相机45的降温效率。外壳上对应风扇44的位置设置有风口42或导风管43;在本例中导风管43设置于线扫相机45下部的出风风扇44的部位,导风管43的一端与风扇44连接,另一端朝向外壳底部的玻璃的外侧,防止外壳底部的玻璃的外侧落灰,保证线扫相机45采集的图像质量,其他三个风扇44在外壳上对应设置风口42。As shown in Figs. 4 and 5, the camera module 4 includes a camera housing 41, a fan 44 and a line scan camera 45, wherein the line scan camera 45 and the fan 44 are both arranged inside the camera housing 41. In this example, four fans 44 are arranged inside the camera housing 41, wherein two fans 44 form a group, which are arranged at the upper and lower parts of the line scan camera 45, respectively. The fan group located at the upper part of the line scan camera 45 is used to cool the line scan camera 45, and the fan group 44 located at the lower part of the line scan camera 45 is used to prevent dust from falling on the lens of the line scan camera 45 and the inner side of the glass at the bottom of the housing; it should be noted that the fan 44 will not block the lens area of the line scan camera 45. In this example, one fan 44 in each group of fans 44 is responsible for air intake, and the other fan 44 is responsible for air discharge. The two fans 44 on the same side of the upper and lower parts of the line scan camera 45 are responsible for air intake and air discharge respectively. For example, the fan 44 on the upper left side is responsible for air intake, and the fan 44 on the lower left side is responsible for air discharge. The purpose is to form an up-and-down circulation air duct in the housing of the camera module 4 to improve the cooling efficiency of the fan 44 on the line scan camera 45. An air outlet 42 or an air duct 43 is provided on the housing corresponding to the fan 44; in this example, the air duct 43 is provided at the position of the air outlet fan 44 at the lower part of the line scan camera 45. One end of the air duct 43 is connected to the fan 44, and the other end faces the outer side of the glass at the bottom of the housing to prevent dust from falling on the outer side of the glass at the bottom of the housing, thereby ensuring the image quality captured by the line scan camera 45. The other three fans 44 are provided with air outlets 42 on the housing correspondingly.
如图6-8所示,所述光源模块5包括正面光源51和背光源54,正面光源51设置于光源架14的上杆,背光源54设置于光源架14的下杆;流水线上的卷材6从正面光源51和背光源54之间穿过;其中正面光源51还位于流水线和相机模块4之间。正面光源51为穹顶光源,包括弧形灯罩52,弧形灯罩52上设置有透光缝隙53,透光缝隙53呈直线状,透光缝隙53正对相机模块4中的线扫相机45。在本例中正面光源51滑动设置于光源架14的上杆,使得正面光源51在流水线上的水平位置可调,便于实现线扫相机45和透光缝隙53的对应关系。背光源54的两端和光源架14铰接,使得背光源54能够围绕铰接部位转动。背光源54包括光源55以及遮光片56,其中光源55的两端与立架铰接;遮光片56设置于光源的两侧,遮光片56与光源55的外壳内壁相契合,遮光片56的上下两端贯通,使得光源55发出的光线能够从穿过遮光片56并射出,由遮光片56限制光线的发散。遮光片56的外周设置有柱形凸起,对应的在光源55的外壳上设置有腰形孔,腰形孔与柱形凸起相配合,在本例中腰形孔竖直设置,使得遮光片56能够在腰形孔内进行上下调节,控制遮光片56伸出光源55的高度,进而控制光线的散射范围。As shown in Figs. 6-8, the light source module 5 includes a front light source 51 and a back light source 54, wherein the front light source 51 is arranged on the upper rod of the light source frame 14, and the back light source 54 is arranged on the lower rod of the light source frame 14; the coil 6 on the assembly line passes between the front light source 51 and the back light source 54; wherein the front light source 51 is also located between the assembly line and the camera module 4. The front light source 51 is a dome light source, including an arc lampshade 52, on which a light-transmitting slit 53 is arranged, and the light-transmitting slit 53 is in a straight line shape, and the light-transmitting slit 53 is directly opposite to the line scan camera 45 in the camera module 4. In this example, the front light source 51 is slidably arranged on the upper rod of the light source frame 14, so that the horizontal position of the front light source 51 on the assembly line is adjustable, so as to realize the corresponding relationship between the line scan camera 45 and the light-transmitting slit 53. The two ends of the back light source 54 are hinged to the light source frame 14, so that the back light source 54 can rotate around the hinged part. The backlight source 54 includes a light source 55 and a light shielding sheet 56, wherein both ends of the light source 55 are hinged to the stand; the light shielding sheet 56 is arranged on both sides of the light source, and the light shielding sheet 56 fits with the inner wall of the outer shell of the light source 55. The upper and lower ends of the light shielding sheet 56 are connected, so that the light emitted by the light source 55 can pass through the light shielding sheet 56 and emit, and the light shielding sheet 56 limits the divergence of the light. The outer periphery of the light shielding sheet 56 is provided with a cylindrical protrusion, and a waist-shaped hole is correspondingly provided on the outer shell of the light source 55. The waist-shaped hole matches the cylindrical protrusion. In this example, the waist-shaped hole is vertically arranged, so that the light shielding sheet 56 can be adjusted up and down in the waist-shaped hole, and the height of the light shielding sheet 56 extending out of the light source 55 is controlled, thereby controlling the scattering range of the light.
在实施的过程中,通过调节支撑架1上的高度调节装置以及转动滑杆3以及调节相机模块4在滑杆3上的位置,实现对相机模块4的准确位置调节;通过在相机模块4中设置风扇44,并且四个风扇44分别负责进气和出气,保证线扫相机45得到高效的冷却;通过与负责出风的风扇44对应设置导风管43,并且导风管43的出风口42位于相机模块4的外壳的玻璃外侧,防止玻璃外侧落灰;通过设置光源模块5包括正面光源51和背光源54,充分保证在线扫相机45的镜头范围内的亮度充足,满足图像拍摄的需求;通过设置背光源54包括光源55和遮光片56,并且遮光片56嵌于光源55内,遮光片56与光源55内嵌的深度可调节,实现对光源55的散步角度进行调节,精确控制灯光模组的打光范围。During the implementation process, the camera module 4 is accurately adjusted in position by adjusting the height adjustment device on the support frame 1, rotating the slide bar 3, and adjusting the position of the camera module 4 on the slide bar 3; a fan 44 is set in the camera module 4, and four fans 44 are responsible for air intake and air outlet respectively, so as to ensure that the line scan camera 45 is efficiently cooled; an air duct 43 is set corresponding to the fan 44 responsible for air outlet, and the air outlet 42 of the air duct 43 is located on the glass outside of the housing of the camera module 4 to prevent dust from falling on the outside of the glass; the light source module 5 is set to include a front light source 51 and a backlight source 54, so as to fully ensure that the brightness within the lens range of the line scan camera 45 is sufficient to meet the image shooting requirements; the backlight source 54 is set to include a light source 55 and a shading sheet 56, and the shading sheet 56 is embedded in the light source 55, and the depth of the shading sheet 56 and the light source 55 embedded in the light source 55 is adjustable, so as to adjust the spreading angle of the light source 55 and accurately control the lighting range of the lighting module.
如图9所示,一种基于线扫相机的卷材检测系统,包括如下步骤:As shown in FIG9 , a coil inspection system based on a line scan camera includes the following steps:
步骤1:操作台接收开机指令,处理器开始开机初始化流程;完成开机初始化流程后,显示器显示开机界面;开机界面包括“进入系统”和“退出系统”按钮,分别对应“进入系统”指令以及“退出系统”指令;Step 1: The console receives the power-on command, and the processor starts the power-on initialization process; after the power-on initialization process is completed, the display shows the power-on interface; the power-on interface includes "enter system" and "exit system" buttons, which correspond to the "enter system" command and the "exit system" command respectively;
步骤2:操作台接收开机界面的操作指令,并判断为“退出系统”指令还是“进入系统”指令;若为“退出系统”指令,则操作台关闭,结束步骤;若为“进入系统”指令,则显示器由开机界面跳转到瑕疵检测界面,并开启多个线扫相机采集线程;瑕疵检测界面包括“清除”、“检测/暂停”、“历史卷”、“换卷”、“设置”、“前进”、“后退”以及“退出”按钮,分别对应“清除”、“检测/暂停”、“历史卷”、“换卷”、“设置”、“前进”、“后退”以及“退出”指令;瑕疵检测界面还包括图像显示区域,图像显示区域实时显示相机模块采集的图像;在图像显示区域设置有检测区域滑条,检测区域滑条对应“检测区域划分”指令;Step 2: The console receives the operation instruction of the power-on interface, and determines whether it is an "exit system" instruction or an "enter system" instruction; if it is an "exit system" instruction, the console is closed and the step ends; if it is an "enter system" instruction, the display jumps from the power-on interface to the defect detection interface, and starts multiple line scan camera acquisition threads; the defect detection interface includes "clear", "detection/pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" buttons, which correspond to the "clear", "detection/pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" instructions respectively; the defect detection interface also includes an image display area, which displays the image collected by the camera module in real time; a detection area slider is set in the image display area, and the detection area slider corresponds to the "detection area division" instruction;
步骤3:操作台判断是否接收到瑕疵检测界面的操作指令;若接收到操作指令则进入步骤4,否则返回步骤3;Step 3: The operation console determines whether it has received the operation instruction of the defect detection interface; if it has received the operation instruction, it proceeds to step 4, otherwise it returns to step 3;
步骤4:并判断操作指令的类型;若为“清除”指令则进入步骤5;若为“检测/暂停”指令,则进入步骤6;若为“历史卷”指令,则进入步骤7;若为“换卷”指令,则进入步骤8;若为“设置”指令,则进入步骤9;若为“前进”或“后退”指令,则进入步骤10;若为“退出”指令,则进入步骤11;若为“检测区域划分”指令,则进入步骤12;Step 4: and determine the type of operation instruction; if it is a "clear" instruction, go to step 5; if it is a "detection/pause" instruction, go to step 6; if it is a "historical volume" instruction, go to step 7; if it is a "change volume" instruction, go to step 8; if it is a "set" instruction, go to step 9; if it is a "forward" or "backward" instruction, go to step 10; if it is a "exit" instruction, go to step 11; if it is a "detection area division" instruction, go to step 12;
步骤5:操作台收到“清除”指令,提示用户是否清除历史信息提示,在本例中历史信息为历史程序异常信息等;若收到确认指令,则清除历史信息提示;若收到否认指令,则返回步骤3;Step 5: The console receives a "clear" command and prompts the user whether to clear the historical information prompt. In this example, the historical information is the historical program exception information, etc. If a confirmation command is received, the historical information prompt is cleared; if a denial command is received, the process returns to step 3;
步骤6:操作台收到“检测/暂停”指令,判断为“检测”指令还是“暂停”指令;若为“检测”指令,则进入实时检测流程,直至收到“暂停”指令,返回步骤3;若为“暂停”指令,则结束实时检测流程,返回步骤3;需要说明的是,在开机后首次进入瑕疵检测界面时,显示“检测”按钮,对应“检测”指令,“检测”按钮被点击后会切换为“暂停”按钮,“暂停”按钮被点击后会切换为“检测”按钮,“暂停”按钮对应“暂停”指令;Step 6: The console receives the "Detect/Pause" command and determines whether it is a "Detect" command or a "Pause" command; if it is a "Detect" command, the console enters the real-time detection process until a "Pause" command is received, and returns to step 3; if it is a "Pause" command, the real-time detection process ends and returns to step 3; it should be noted that when the defect detection interface is entered for the first time after powering on, the "Detect" button is displayed, corresponding to the "Detect" command, and the "Detect" button will switch to the "Pause" button after being clicked, and the "Pause" button will switch to the "Detect" button after being clicked, and the "Pause" button corresponds to the "Pause" command;
步骤7:操作台收到“历史卷”指令,控制显示器进入历史卷界面,开启历史卷界面流程,结束历史卷界面流程后返回步骤3;Step 7: The console receives the "historical volume" command, controls the display to enter the historical volume interface, starts the historical volume interface process, and returns to step 3 after the historical volume interface process ends;
步骤8:操作台收到“换卷”指令,判断实时检测流程是否开启;若实时检测流程开启,则在显示器提示“请先暂停实时检测”,返回步骤3;若实时检测流程未开启,则根据输入更新卷号、卷长等信息,并释放显示图像资源,将对应数据写入数据库,返回步骤3;Step 8: The console receives the "change roll" command and determines whether the real-time detection process is turned on; if the real-time detection process is turned on, the display prompts "Please suspend real-time detection first" and returns to step 3; if the real-time detection process is not turned on, the roll number, roll length and other information are updated according to the input, and the display image resources are released, the corresponding data is written into the database, and the return is to step 3;
步骤9:操作台收到“设置”指令,创建并进入设置界面;退出设置界面后返回步骤3;Step 9: The console receives the "Set" command, creates and enters the setting interface; exits the setting interface and returns to step 3;
步骤10:操作台收到“前进”或“后退”指令,判断为“前进”指令还是“后退”指令;若为“前进”指令,则进一步判断是否为当前图像的最后一页,若是最后一页,则进行提示并返回步骤3,若不是最后一页,则前进一页,并返回步骤3;若为“后退”指令,则进一步判断是否为当前图像的第一页,若是最第一页,则进行提示并返回步骤3,若不是第一页,则后退一页,并返回步骤3;Step 10: The console receives a "forward" or "backward" instruction, and determines whether it is a "forward" instruction or a "backward" instruction; if it is a "forward" instruction, further determine whether it is the last page of the current image, if it is the last page, give a prompt and return to step 3, if it is not the last page, advance one page and return to step 3; if it is a "backward" instruction, further determine whether it is the first page of the current image, if it is the first page, give a prompt and return to step 3, if it is not the first page, go back one page and return to step 3;
步骤11:操作台收到“退出”指令,提示用户是否确认退出系统;若确认退出系统,则结束步骤;若未确认退出系统,则返回步骤3;Step 11: The console receives the "exit" command and prompts the user whether to confirm to exit the system; if confirmed, the step ends; if not confirmed, the process returns to step 3;
步骤12:操作台收到“检测区域划分”指令,则对应修改图像的左右不检测区域的值,并将修改后的值保存至系统参数中,返回步骤3。Step 12: When the console receives the "detection area division" command, it modifies the values of the left and right non-detection areas of the image accordingly, saves the modified values into the system parameters, and returns to step 3.
如图10所示,所述步骤1中的开机初始化流程包括如下步骤:As shown in FIG. 10 , the power-on initialization process in step 1 includes the following steps:
步骤101:操作台完成开机检测界面初始化;Step 101: The console completes the initialization of the power-on detection interface;
步骤102:完成界面初始化后,进行数据库连接流程;Step 102: After completing the interface initialization, proceed with the database connection process;
步骤103:完成数据库连接流程后,读取数据库数据;数据库数据包括系统配置参数、相机配置参数、瑕疵检测内部参数、瑕疵检测产品参数等;Step 103: After completing the database connection process, read the database data; the database data includes system configuration parameters, camera configuration parameters, defect detection internal parameters, defect detection product parameters, etc.;
步骤104:控制操作台内的存储设备与线扫相机连接;使得线扫相机采集的数据能够存储于存储设备内;在本例中存储设备采用采集卡;Step 104: controlling the storage device in the console to be connected to the line scan camera so that the data collected by the line scan camera can be stored in the storage device; in this example, the storage device is a capture card;
步骤105:连接串口,并校验每个串口通道;Step 105: Connect the serial port and check each serial port channel;
步骤106:校验初始化状态,包括校验步骤101~步骤105的过程是否顺利完成;Step 106: Verify the initialization status, including verifying whether the process of steps 101 to 105 is successfully completed;
若存在异常步骤,则提示用户选择仍旧进入系统或者退出系统;若用户选择仍旧进入系统则进入开机界面,结束步骤;若用户选择退出系统,则退出系统,结束步骤;If there are abnormal steps, the user is prompted to choose to enter the system or exit the system; if the user chooses to enter the system, the boot interface is entered and the steps are ended; if the user chooses to exit the system, the system is exited and the steps are ended;
若不存在异常步骤,则直接进入开机界面,结束步骤。If there is no abnormal step, directly enter the power-on interface and end the step.
所述步骤101的开机检测界面初始化过程包括如下步骤:The boot detection interface initialization process of step 101 includes the following steps:
步骤1011:操作台通过网络连接,获取当前的时间日期;Step 1011: The operation console obtains the current time and date through the network connection;
步骤1012:开启日期获取和定时器的显示;Step 1012: Start date acquisition and timer display;
步骤1013:开机检测相关变量初始化,相关变量包括数据库连接和读取的结果标志位、存储设备和线扫相机连接结果标志位和串口模块连接结果标志位;其中操作台的系统在运行过程中,会根据初始化出状态设置上述的标志位的值;Step 1013: Initialize the power-on detection related variables, including the result flags of database connection and reading, the result flags of storage device and line scan camera connection, and the result flags of serial port module connection; during the operation of the console system, the values of the above flags will be set according to the initialization status;
步骤1014:获取开机界面控件,并完成开机界面控件的显示设置;进入开机界面,则显示开机界面控件;Step 1014: obtaining a startup interface control and completing display settings of the startup interface control; entering the startup interface, and displaying the startup interface control;
步骤1015:创建数据库连接和数据库读取的线程,存储设备和线扫相机连接的线程,以及串口转IO模块的线程,结束步骤。Step 1015: Create threads for database connection and database reading, threads for storage device and line scan camera connection, and threads for serial port to IO module, and then end the step.
在步骤1013中创建标志位的目的是为了便于在步骤106中校验初始化状态,通过读取标志位,就能够获取步骤102~步骤105的完成情况。The purpose of creating the flag bit in step 1013 is to facilitate the verification of the initialization status in step 106. By reading the flag bit, the completion status of steps 102 to 105 can be obtained.
如图11所示,所述步骤102中数据库连接流程包括如下步骤:As shown in FIG. 11 , the database connection process in step 102 includes the following steps:
步骤1021:获取设定信息,调用数据库连接函数,并输入设定信息;设定信息为操作台自带的信息或者预输入的信息,设定信息包括数据库服务器名、用户名、密码;Step 1021: Get setting information, call the database connection function, and enter setting information; the setting information is the information provided by the console or pre-entered information, and the setting information includes the database server name, user name, and password;
步骤1022:获取数据库连接函数的返回值,并根据返回值,判断数据库连接情况,数据库连接情况包括数据库连接成功、数据库连接失败以及数据库连接异常;若数据库连接成功,则进入步骤1023;若数据库连接失败,则进入步骤1024;若数据库连接异常,则进入步骤1025;Step 1022: Get the return value of the database connection function, and determine the database connection status according to the return value. The database connection status includes database connection success, database connection failure, and database connection abnormality. If the database connection is successful, go to step 1023; if the database connection fails, go to step 1024; if the database connection is abnormal, go to step 1025;
步骤1023:数据库连接成功,设置数据库连接标志位为数据库连接成功状态,并设置控件显示为数据库连接成功,进入步骤1026;Step 1023: The database connection is successful, the database connection flag is set to the database connection success state, and the control display is set to the database connection success, and the process goes to step 1026;
步骤1024:数据库连接失败,设置数据库连接标志位为数据库连接失败状态,并设置控件显示为数据库连接失败;将数据库连接失败信息写入系统日志文件,弹出数据库连接失败提示对话框,结束步骤;Step 1024: if the database connection fails, the database connection flag is set to the database connection failure state, and the control display is set to database connection failure; the database connection failure information is written into the system log file, a database connection failure prompt dialog box is popped up, and the step ends;
步骤1025:数据库连接异常,设置数据库连接标志位为数据库连接异常状态,并设置控件显示为数据库连接异常;将数据库连接异常信息写入系统日志文件,弹出数据库连接失败提示对话框,结束步骤;其中数据库连接异常表示数据库连接函数显示连接成功和连接失败以外的异常结果;Step 1025: Database connection is abnormal, the database connection flag is set to the database connection abnormal state, and the control display is set to database connection abnormal; the database connection abnormal information is written into the system log file, and a database connection failure prompt dialog box is popped up, and the step ends; wherein the database connection abnormality means that the database connection function displays an abnormal result other than connection success and connection failure;
步骤1026:数据库连接成功,判断数据库中是否存在项目数据库;若项目数据库存在,则结束步骤;否则创建项目数据库,结束步骤。Step 1026: If the database connection is successful, determine whether the project database exists in the database; if the project database exists, end the step; otherwise, create the project database and end the step.
所述步骤1026中的项目数据库包括系统参数表、相机配置参数表、产品瑕疵参数表、实时检测参数表、历史卷信息记录表以及历史卷瑕疵信息表。在创建项目数据库的过程中,需要配置系统参数表、相机配置参数表、产品瑕疵参数表、实时检测参数表、历史卷信息记录表以及历史卷瑕疵信息表,同时设置各个数据表的建表命令、判断表是否存在命令、搜索数据表的数据命令以及插入数据表数据命令。在本例中,各个数据表包括的内容如下:The project database in step 1026 includes a system parameter table, a camera configuration parameter table, a product defect parameter table, a real-time detection parameter table, a historical roll information record table, and a historical roll defect information table. In the process of creating a project database, it is necessary to configure the system parameter table, the camera configuration parameter table, the product defect parameter table, the real-time detection parameter table, the historical roll information record table, and the historical roll defect information table, and set the table creation command, table existence judgment command, data table search command, and data table insertion command for each data table. In this example, the contents of each data table are as follows:
系统参数表,命名为systemparameter:"相机数"、"系统配置选中相机"、"检测参数选中相机"、"串口号"、"左侧边缘检测位置"、"右侧边缘检测位置"、"软件版本号"、"管理员密码"、"操作员密码"、"技术员密码";System parameter table, named systemparameter: "Number of cameras", "System configuration selected camera", "Detection parameter selected camera", "Serial port number", "Left edge detection position", "Right edge detection position", "Software version number", "Administrator password", "Operator password", "Technician password";
相机配置参数表,命名为CameraParameter:"相机类型"、"最大曝光"、"最小曝光"、"调节刻度"、"灰度上限"、"灰度下限"、"放大率"、"瑕疵个数上限"、"动态暗阈值"、"动态亮阈值"、"动态极暗阈值"、"动态极亮阈值"、"普通暗阈值"、"普通亮阈值"、"大面积动态暗阈值"、"分段数"、"检测段"、"均值化卷积核1"、"均值化卷积核2"、"均值化卷积核3"、"均值化卷积核4";The camera configuration parameter table is named CameraParameter: "Camera type", "Maximum exposure", "Minimum exposure", "Adjustment scale", "Upper grayscale limit", "Lower grayscale limit", "Magnification", "Upper limit of defect number", "Dynamic dark threshold", "Dynamic bright threshold", "Dynamic extremely dark threshold", "Dynamic extremely bright threshold", "Normal dark threshold", "Normal bright threshold", "Large area dynamic dark threshold", "Number of segments", "Detection segments", "Averaging convolution kernel 1", "Averaging convolution kernel 2", "Averaging convolution kernel 3", "Averaging convolution kernel 4";
产品瑕疵参数表,命名为ProductDefectParameter:"产品名称"、"瑕疵名称"、"优先级别"、"横宽上限"、"横宽下限"、"纵长上限"、"纵长下限"、"纵长比线宽上限"、"纵长比线宽下限"、"横宽比纵长上限"、"横宽比纵长下限"、"面积上限"、"面积下限"、"亮面积比上限"、"亮面积比下限"、"孔面积比上限"、"孔面积比下限"、"暗面积比上限"、"暗面积比下限"、"是否显示标记符号"、"字体样式"、"字体尺寸"、"标记字符"、"颜色R"、"颜色G"、"颜色B"、"红灯警报开关"、"红灯警报时长"、"绿灯警报开关"、"绿灯警报时长"、"黄灯警报开关"、"黄灯警报时长";Product defect parameter table, named ProductDefectParameter: "Product Name", "Defect Name", "Priority", "Upper limit of horizontal width", "Lower limit of horizontal width", "Upper limit of vertical length", "Lower limit of vertical length", "Upper limit of vertical length to line width", "Lower limit of vertical length to line width", "Upper limit of horizontal width to vertical length", "Lower limit of horizontal width to vertical length", "Upper limit of area", "Lower limit of area", "Upper limit of bright area ratio", "Lower limit of bright area ratio", "Upper limit of hole area ratio", "Lower limit of hole area ratio", "Upper limit of dark area ratio", "Lower limit of dark area ratio", "Whether to display mark symbol", "Font style", "Font size", "Mark character", "Color R", "Color G", "Color B", "Red light alarm switch", "Red light alarm duration", "Green light alarm switch", "Green light alarm duration", "Yellow light alarm switch", "Yellow light alarm duration";
实时检测参数表:"当前班次"、"当前卷号"、"当前检测产品"、"当前检测瑕疵";Real-time inspection parameter table: "Current shift", "Current roll number", "Current inspection product", "Current inspection defect";
历史卷信息记录表:"卷号"、"宽度"、"已检测长度";Historical volume information record table: "Volume number", "Width", "Detected length";
历史卷瑕疵信息表:"卷号"、"瑕疵编号"、"相机编号"、"产品名"、"瑕疵名"、"图像地址"、"宽度"、"长度"、"工纵位"、"工横位"、"工边沿"、"传边沿"、"面积"、"暗亮孔"、"线宽比"、"检测时间"。Historical roll defect information table: "Roll number", "Defect number", "Camera number", "Product name", "Defect name", "Image address", "Width", "Length", "Working vertical position", "Working horizontal position", "Working edge", "Transmission edge", "Area", "Dark and light holes", "Line width ratio", and "Detection time".
所述步骤103中,读取数据库的过程中,首先需要判断项目数据库中是否存在数据,该处的数据表示步骤102中的数据表的具体数据;若存在数据,则读取相应数据,并根据读取的数据完成相应设备配置;若不存在数据,则写入默认的数据,并读取各个数据表的数据储存至程序中,同时完成相应设备配置。在本例中项目数据库的默认数据包括:In step 103, during the process of reading the database, it is first necessary to determine whether there is data in the project database. The data here represents the specific data of the data table in step 102; if there is data, the corresponding data is read, and the corresponding device configuration is completed according to the read data; if there is no data, the default data is written, and the data of each data table is read and stored in the program, and the corresponding device configuration is completed at the same time. In this example, the default data of the project database includes:
系统参数表默认数据:相机数默认值为2;相机配置参数相机号选择默认值为1;串口号默认值为COM5;左侧边缘检测位置默认值为100,单位为mm;右侧边缘检测位置默认值为100,单位为mm;软件版本号默认值为V1.0;管理员密码默认值为123456;操作员密码默认值为123456、技术员密码默认值为123456;Default data of the system parameter table: The default value of the number of cameras is 2; The default value of the camera configuration parameter camera number selection is 1; The default value of the serial port number is COM5; The default value of the left edge detection position is 100, in mm; The default value of the right edge detection position is 100, in mm; The default value of the software version number is V1.0; The default value of the administrator password is 123456; The default value of the operator password is 123456, and the default value of the technician password is 123456;
相机配置参数表默认数据:相机号,根据相机数编号从1开始递增;最大曝光时间,默认值为950;最小曝光时间,默认值为50;曝光调节刻度默认值为10;灰度上限默认值为160;灰度下限默认值为120;相机放大率默认值为8.822;瑕疵个数上限默认值为10;动态暗阈值默认值为50、动态亮阈值默认值为50、动态极暗阈值默认值为60、动态极亮阈值默认值为60、普通暗阈值默认值为45、普通亮阈值默认值为45、大面积动态暗阈值默认值为60、分段数默认值为10、检测段默认值为5、均值化卷积核1默认值为5、均值化卷积核2默认值为30、均值化卷积核3默认值为80、均值化卷积核4默认值为130;Default data of the camera configuration parameter table: Camera number, which is incremented from 1 according to the camera number; Maximum exposure time, the default value is 950; Minimum exposure time, the default value is 50; Exposure adjustment scale default value is 10; Grayscale upper limit default value is 160; Grayscale lower limit default value is 120; Camera magnification default value is 8.822; Defect upper limit default value is 10; Dynamic dark threshold default value is 50, dynamic bright threshold default value is 50, dynamic extremely dark threshold default value is 60, dynamic extremely bright threshold default value is 60, normal dark threshold default value is 45, normal bright threshold default value is 45, large area dynamic dark threshold default value is 60, segment number default value is 10, detection segment default value is 5, average convolution kernel 1 default value is 5, average convolution kernel 2 default value is 30, average convolution kernel 3 default value is 80, average convolution kernel 4 default value is 130;
产品瑕疵参数表中的瑕疵名称默认包括小黑点、中黑点、大黑点、小白点、中白点、大白点、小孔洞、中孔洞和大孔洞九个类型,针对每个类型,均设置有其瑕疵参数,包括:The defect names in the product defect parameter table include nine types by default: small black spots, medium black spots, large black spots, small white spots, medium white spots, large white spots, small holes, medium holes and large holes. For each type, its defect parameters are set, including:
小黑点:产品名称默认值为PVB、瑕疵名称默认值为小黑点、优先级别默认值为1、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0)、横宽比纵长上限默认值为0)、横宽比纵长下限默认值为0、面积上限默认值为0.35、面积下限默认值为0.1、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为1.1、暗面积比下限默认值为0.4、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为b、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Small black dots: The default value of product name is PVB, the default value of defect name is small black dots, the default value of priority level is 1, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0), the default value of horizontal width ratio vertical length upper limit is 0), the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 0, hole area The default value of the lower limit of the ratio is 0, the default value of the upper limit of the dark area ratio is 1.1, the default value of the lower limit of the dark area ratio is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is b, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.
中黑点:产品名称默认值为PVB、瑕疵名称默认值为中黑点、优先级别默认值为2、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为0.5、面积下限默认值为0.35、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为1.1、暗面积比下限默认值为0.4、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为B、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Medium black spot: The default value of product name is PVB, the default value of defect name is medium black spot, the default value of priority level is 2, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 0, the default value of hole area ratio The default value of the lower limit is 0, the default value of the upper limit of the dark area ratio is 1.1, the default value of the lower limit of the dark area ratio is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is B, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.
大黑点:产品名称默认值为PVB、瑕疵名称默认值为大黑点、优先级别默认值为3、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为2000、面积下限默认值为0.5、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为1.1、暗面积比下限默认值为0.4、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为B、颜色R默认值为255、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Big Black Spot: The default value of Product Name is PVB, the default value of Defect Name is Big Black Spot, the default value of Priority is 3, the default value of Horizontal Width Upper Limit is 0, the default value of Horizontal Width Lower Limit is 0, the default value of Vertical Length Upper Limit is 0, the default value of Vertical Length Lower Limit is 0, the default value of Vertical Length Ratio Line Width Upper Limit is 0, the default value of Vertical Length Ratio Line Width Lower Limit is 0, the default value of Horizontal Width Ratio Vertical Width Upper Limit is 0, the default value of Horizontal Width Ratio Vertical Width Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 0, the default value of Bright Area Ratio Lower Limit is 0, the default value of Hole Area Ratio Upper Limit is 0, the default value of Hole Area Ratio Lower Limit is The default value of the upper limit is 0, the default value of the dark area ratio upper limit is 1.1, the default value of the dark area ratio lower limit is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is B, the default value of color R is 255, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.
小白点:产品名称默认值为PVB、瑕疵名称默认值为小白点、优先级别默认值为4、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为0.35、面积下限默认值为0.1、亮面积比上限默认值为1.1、亮面积比下限默认值为0.4、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为w、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Small white dots: The default value of product name is PVB, the default value of defect name is small white dots, the default value of priority level is 4, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 1.1, the default value of bright area ratio lower limit is 0.4, the default value of hole area ratio upper limit is 0, The default value of the lower limit of hole area ratio is 0, the default value of the upper limit of dark area ratio is 0, the default value of the lower limit of dark area ratio is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is w, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.
中白点:产品名称默认值为PVB、瑕疵名称默认值为中白点、优先级别默认值为5、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为0.5、面积下限默认值为0.35、亮面积比上限默认值为1.1、亮面积比下限默认值为0.4、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为W、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Middle white point: The default value of product name is PVB, the default value of defect name is middle white point, the default value of priority level is 5, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 1.1, the default value of bright area ratio lower limit is 0.4, the default value of hole area ratio upper limit is 0, The default value of the lower limit of hole area ratio is 0, the default value of the upper limit of dark area ratio is 0, the default value of the lower limit of dark area ratio is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is W, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.
大白点:产品名称默认值为PVB、瑕疵名称默认值为大白点、优先级别默认值为6、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为2000、面积下限默认值为0.5、亮面积比上限默认值为1.1、亮面积比下限默认值为0.4、孔面积比上限默认值为0、孔面积比下限默认值为0、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为W、颜色R默认值为255、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。White Spot: The default value of Product Name is PVB, the default value of Defect Name is White Spot, the default value of Priority is 6, the default value of Horizontal Width Upper Limit is 0, the default value of Horizontal Width Lower Limit is 0, the default value of Vertical Length Upper Limit is 0, the default value of Vertical Length Lower Limit is 0, the default value of Vertical Length Ratio Line Width Upper Limit is 0, the default value of Vertical Length Ratio Line Width Lower Limit is 0, the default value of Horizontal Width Ratio Vertical Width Upper Limit is 0, the default value of Horizontal Width Ratio Vertical Width Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 1.1, the default value of Bright Area Ratio Lower Limit is 0.4, the default value of Hole Area Ratio Upper Limit is 0, Hole The default value of area ratio lower limit is 0, the default value of dark area ratio upper limit is 0, the default value of dark area ratio lower limit is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is W, the default value of color R is 255, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.
小孔洞:产品名称默认值为PVB、瑕疵名称默认值为小孔洞、优先级别默认值为7、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为0.35、面积下限默认值为0.1、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为1.1、孔面积比下限默认值为0.4、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为h、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Small holes: The default value of product name is PVB, the default value of defect name is small holes, the default value of priority level is 7, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 1.1, hole surface The default value of the lower limit of the area ratio is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is h, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.
中孔洞:产品名称默认值为PVB、瑕疵名称默认值为中孔洞、优先级别默认值为8、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为0.5、面积下限默认值为0.35、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为1.1、孔面积比下限默认值为0.4、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为H、颜色R默认值为0、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0。Medium Hole: The default value of product name is PVB, the default value of defect name is medium hole, the default value of priority level is 8, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 1.1, hole surface The default value of the lower limit of the area ratio is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is H, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.
大孔洞:产品名称默认值为PVB、瑕疵名称默认值为大孔洞、优先级别默认值为9、横宽上限默认值为0、横宽下限默认值为0、纵长上限默认值为0、纵长下限默认值为0、纵长比线宽上限默认值为0、纵长比线宽下限默认值为0、横宽比纵长上限默认值为0、横宽比纵长下限默认值为0、面积上限默认值为2000、面积下限默认值为0.5、亮面积比上限默认值为0、亮面积比下限默认值为0、孔面积比上限默认值为1.1、孔面积比下限默认值为0.4、暗面积比上限默认值为0、暗面积比下限默认值为0、是否显示标记符号默认值为True、字体样式默认值为宋体、字体尺寸默认值为12、标记字符默认值为H、颜色R默认值为255、颜色G默认值为0、颜色B默认值为0、红灯警报开关默认值为True、红灯警报时长默认值为1、绿灯警报开关默认值为False、绿灯警报时长默认值为0、黄灯警报开关默认值为False、黄灯警报时长默认值为0;Large Holes: The default value of Product Name is PVB, the default value of Defect Name is Large Holes, the default value of Priority is 9, the default value of Width Upper Limit is 0, the default value of Width Lower Limit is 0, the default value of Length Upper Limit is 0, the default value of Length Lower Limit is 0, the default value of Length Ratio Line Width Upper Limit is 0, the default value of Length Ratio Line Width Lower Limit is 0, the default value of Width Ratio Vertical Upper Limit is 0, the default value of Width Ratio Vertical Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 0, the default value of Bright Area Ratio Lower Limit is 0, the default value of Hole Area Ratio Upper Limit is 1.1, Hole Area The default value of the lower limit is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is H, the default value of the color R is 255, the default value of the color G is 0, the default value of the color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, the default value of the yellow light alarm duration is 0;
实时检测参数表默认数据:当前班次默认值为1、当前卷号默认值为1、当前检测产品默认值为PVB、当前检测瑕疵默认值为小黑点;Default data of real-time detection parameter table: the default value of current shift is 1, the default value of current roll number is 1, the default value of current detection product is PVB, the default value of current detection defect is small black dot;
历史卷信息记录表默认数据:卷号、宽度、已检测长度;Default data of historical volume information record table: volume number, width, detected length;
历史卷瑕疵信息默认数据:卷号、瑕疵编号、相机编号、产品名、瑕疵名、图像地址、宽度、长度、工纵位、工横位、工边沿、传边沿、面积、暗亮孔、线宽比、检测时间。The default data of historical roll defect information: roll number, defect number, camera number, product name, defect name, image address, width, length, work vertical position, work horizontal position, work edge, transmission edge, area, dark and light holes, line width ratio, and detection time.
如图12所示,所述步骤105的校验串口主要通过数据库中读取的串口号与波特率打开串口并返回的操作结果,两者比对获得校验结果。连接串口并进行校验的过程包括:As shown in FIG12 , the serial port verification in step 105 is mainly performed by comparing the serial port number and the baud rate read from the database to open the serial port and the returned operation result to obtain the verification result. The process of connecting the serial port and performing the verification includes:
步骤1051:添加串口回调函数,设置对于不同串口返回信号的处理方式;Step 1051: Add a serial port callback function and set the processing method for different serial port return signals;
步骤1052:打开串口;Step 1052: Open the serial port;
步骤1053:判断串口连接状态,并返回串口连接状态;Step 1053: Determine the serial port connection status and return the serial port connection status;
步骤1054:根据返回的串口状态判断串口是否完成连接;若串口完成连接,则进入步骤1055;否则进行提示,结束步骤;Step 1054: judging whether the serial port connection is completed according to the returned serial port status; if the serial port connection is completed, proceeding to step 1055; otherwise, prompting is given and the steps are ended;
步骤1055:读取连接的串口地址,将串口地址设置为0,并读取返回值;若返回值为”FE4200AD24”,则表示串口地址设置成功;否则进行提示,结束步骤;Step 1055: Read the connected serial port address, set the serial port address to 0, and read the return value; if the return value is "FE4200AD24", it means that the serial port address is set successfully; otherwise, a prompt is given and the step ends;
步骤1056:依次打开和关闭串口的各个通道,对打开的通道发送自检命令,并根据返回值判断通道是否正常;Step 1056: Open and close each channel of the serial port in turn, send a self-test command to the opened channel, and determine whether the channel is normal based on the return value;
步骤1057:完成串口的各个通道的校验,结束步骤。Step 1057: Complete the verification of each channel of the serial port and end the step.
所述步骤2中的瑕疵检测界面的图像显示区域包括上部和下部,其中上部显示打标图像,打标图像通过实时检测流程获得,下部显示会实时显示线扫相机采集的图像,在本例中下部显示线扫相机拼接的图像。需要说明的是在瑕疵检测界面进入实时检测流程时,会失能瑕疵检测界面的“清除”、“历史卷”、“换卷”、“设置”、“前进”、“后退”以及“退出”按钮,仅赋能“检测/暂停”按钮。The image display area of the defect detection interface in step 2 includes an upper part and a lower part, wherein the upper part displays the marking image, which is obtained through the real-time detection process, and the lower part displays the image captured by the line scan camera in real time. In this example, the lower part displays the image spliced by the line scan camera. It should be noted that when the defect detection interface enters the real-time detection process, the "Clear", "History Volume", "Change Volume", "Set", "Forward", "Backward" and "Exit" buttons of the defect detection interface will be disabled, and only the "Detect/Pause" button will be enabled.
其中实时显示线扫相机采集的图像,包括如下步骤:The real-time display of the image acquired by the line scan camera includes the following steps:
步骤21:线扫相机采集图像,并将相机的图像缓存传输至操作台;Step 21: The line scan camera collects images and transmits the camera's image buffer to the operation console;
步骤22:操作台接收图像缓存,通过线扫相机的回调函数将相机缓存转化为图像数据;Step 22: The console receives the image buffer and converts the camera buffer into image data through the callback function of the line scan camera;
步骤23:将图像数据依次存入图像队列中,并判断是否所有队列都存在图像数据缓存;若所有队列都存在图像数据缓存,则取出各个队列的第一个图像数据组成实时图像列表;若存在队列为空,则返回步骤21;Step 23: Store the image data in the image queues in sequence, and determine whether all queues have image data caches; if all queues have image data caches, take out the first image data of each queue to form a real-time image list; if any queue is empty, return to step 21;
步骤24:在每个队列取出第一张图像后,清空每个图像队列的图像缓存;Step 24: After taking out the first image from each queue, clear the image buffer of each image queue;
步骤25:将取出的图像进行拼接,将拼接图像在图像显示区域进行显示,结束步骤。Step 25: stitch the retrieved images, display the stitched images in the image display area, and end the step.
所述步骤23中图像队列的数量与线扫相机的数量有关,比如在滑杆上设置有十个相机模块进行图像采集,则设置图像队列为10队,每个线扫相机采集的图像数据会存储于相应的队列中。The number of image queues in step 23 is related to the number of line scan cameras. For example, if ten camera modules are arranged on the slide bar for image acquisition, the image queues are set to 10, and the image data acquired by each line scan camera will be stored in the corresponding queue.
瑕疵检测界面的图像显示区域的最上方设置有检测区域滑条,在本例中检测区域滑条共两条,分别设置于左侧和右侧,在本例中左侧滑条的右侧图像和右侧滑条的左侧图像为图像的检测区域,左侧滑条的左侧图像和右侧滑条的右侧图像为图像的不检测区域。A detection area slider is set at the top of the image display area of the defect detection interface. In this example, there are two detection area sliders, which are set on the left and right sides respectively. In this example, the right image of the left slider and the left image of the right slider are the detection area of the image, and the left image of the left slider and the right image of the right slider are the non-detection area of the image.
瑕疵检测界面还包括瑕疵照片墙区域,在本例中位于瑕疵检测界面的右侧,瑕疵照片墙用于显示瑕疵截图,瑕疵截图为瑕疵图像中截取的显示瑕疵区域的图像,瑕疵截图通过实时检测流程获得,在本例中还与瑕疵截图对应设置有瑕疵截图的长宽以及瑕疵截图所属的图像数据的检测卷长,检测卷长表示采集的图像数据对应的卷材卷长;其中“前进”、“后退”按钮设置于瑕疵照片墙区域,“前进”、“后退”按钮用于控制瑕疵照片墙中显示的照片。瑕疵检测界面还包括卷材实时瑕疵信息显示区域,卷材实时瑕疵信息显示区域显示有当前卷材的具体信息,包括产品名、班号、卷号、检测卷长、幅宽、车速、瑕疵数、匀度、系统时间,在本例中卷材实时瑕疵信息显示区域位于瑕疵检测界面的最上方。瑕疵检测界面还包括最新瑕疵信息显示区域,在本例中位于瑕疵检测界面的左侧,包括类型、纵位、工横位、工边沿、传边沿、暗亮孔、线宽比、宽度、长度、面积、相机号、卷号、编号、检测时间。瑕疵检测界面还包括消息提示框,在本例中消息提示框设置于瑕疵检测界面的左下方,其中“清除”按钮设置于消息提示框,消息提示框用于显示程序异常或者曝光自动调节等提示。瑕疵检测界面的最下方还显示有相机采图数、相机缓存数、已处理图像数等数据。The defect detection interface also includes a defect photo wall area, which is located on the right side of the defect detection interface in this example. The defect photo wall is used to display defect screenshots. The defect screenshots are images showing defect areas captured from defect images. The defect screenshots are obtained through real-time detection processes. In this example, the length and width of the defect screenshots and the detection roll length of the image data to which the defect screenshots belong are also set corresponding to the defect screenshots. The detection roll length indicates the roll length of the coil corresponding to the collected image data; the "forward" and "backward" buttons are set in the defect photo wall area, and the "forward" and "backward" buttons are used to control the photos displayed in the defect photo wall. The defect detection interface also includes a coil real-time defect information display area, which displays specific information of the current coil, including product name, class number, roll number, detection roll length, width, vehicle speed, number of defects, uniformity, and system time. In this example, the coil real-time defect information display area is located at the top of the defect detection interface. The defect detection interface also includes the latest defect information display area, which is located on the left side of the defect detection interface in this example, including type, vertical position, horizontal position, edge, transfer edge, dark and bright holes, line width ratio, width, length, area, camera number, roll number, number, and detection time. The defect detection interface also includes a message prompt box. In this example, the message prompt box is set at the bottom left of the defect detection interface, where the "clear" button is set in the message prompt box. The message prompt box is used to display prompts such as program abnormalities or automatic exposure adjustment. The bottom of the defect detection interface also displays data such as the number of camera images, the number of camera caches, and the number of processed images.
如图13所示,瑕疵检测界面显示的数据进行实时更新,包括瑕疵信息显示区域的检测卷长、幅宽、车速信息,以及相机采图数、相机缓存数、已处理图像数的信息,其中数据实时更新,首先,需要根据当前已检测的卷材长度、流水线传输速度、相机采集图片的数量、已处理的图片数量以及未处理的图片数量,更新卷长、车速、相机采图数、已处理图片数以及相机缓存数;其次,根据图像显示区域设置有检测区域滑条判断并更新幅宽数据;最后判断并更新卷材的班号、卷号数据,在本例中卷材的班号、卷号数据根据用户的输入确定。As shown in Figure 13, the data displayed on the defect detection interface is updated in real time, including the detection roll length, width, vehicle speed information in the defect information display area, as well as the number of camera pictures, camera buffer number, and processed image number information. The data is updated in real time. First, the roll length, vehicle speed, camera picture number, processed image number, and camera buffer number need to be updated according to the current detected roll length, assembly line transmission speed, number of camera pictures, number of processed pictures, and number of unprocessed pictures; secondly, the width data is judged and updated according to the detection area slider set in the image display area; finally, the class number and roll number data of the roll are judged and updated. In this example, the class number and roll number data of the roll are determined according to the user's input.
如图14所示,所述步骤6中的实时检测流程,包括如下步骤:As shown in FIG. 14 , the real-time detection process in step 6 includes the following steps:
步骤61:操作台通过线扫相机获取图像数据;将图像数据进行深拷贝;深拷贝表示源对象与拷贝对象互相独立的拷贝形式,为现有拷贝技术;Step 61: The operating console acquires image data through a line scan camera; and performs a deep copy of the image data; a deep copy means that the source object and the copy object are copied independently of each other, which is an existing copy technology;
步骤62:将检测算法返回参数初始化,并将当前的产品检测瑕疵参数转化为算法数据格式;其中算法数据格式为对应算法检测流程的格式;Step 62: Initialize the detection algorithm return parameters and convert the current product detection defect parameters into an algorithm data format; wherein the algorithm data format is a format corresponding to the algorithm detection process;
步骤63:将转化为算法数据格式的产品检测瑕疵参数、深拷贝的图像数据以及初始化后的检测算法返回参数输入到设定的检测算法流程中,并返回检测算法结果;通过检测算法流程检测图像数据中的瑕疵以及灰度值等参数,在本例中瑕疵包括小黑点、中黑点、大黑点、小白点、中白点、大白点、小孔洞、中孔洞和大孔洞;Step 63: input the product detection defect parameters converted into the algorithm data format, the deep copy image data and the initialized detection algorithm return parameters into the set detection algorithm process, and return the detection algorithm result; detect the defects and grayscale value and other parameters in the image data through the detection algorithm process. In this example, the defects include small black dots, medium black dots, large black dots, small white dots, medium white dots, large white dots, small holes, medium holes and large holes;
步骤64:遍历检测算法结果,筛选出判断为瑕疵的检测算法结果;Step 64: traverse the detection algorithm results and filter out the detection algorithm results judged as defects;
步骤65:依次判断瑕疵的检测算法结果的位置是否位于检测范围内;在本例中表示为检测算法结果位置的横坐标是否位于“检测区域划分”指令所对应的范围内;Step 65: determine in turn whether the position of the defect detection algorithm result is within the detection range; in this example, it is represented by whether the horizontal coordinate of the position of the detection algorithm result is within the range corresponding to the "detection area division" instruction;
步骤66:获取位于检测范围内的瑕疵点的瑕疵信息,并添加到瑕疵列表与打标队列中,同时将瑕疵信息记录到数据库;瑕疵信息包括检测到的瑕疵图像、瑕疵位置、瑕疵类型以及瑕疵截图等,瑕疵图像为包括瑕疵的拼接图像数据;Step 66: Obtain defect information of defect points within the detection range, add them to the defect list and marking queue, and record the defect information to the database; the defect information includes the detected defect image, defect location, defect type, and defect screenshot, etc. The defect image is the spliced image data including the defect;
步骤67:获取图像数据,并根据图像数据,完成灰度值动态调节流程,调节线扫相机的曝光量以及光源模块的亮度等;Step 67: Acquire image data, and complete the grayscale value dynamic adjustment process according to the image data, adjust the exposure of the line scan camera and the brightness of the light source module, etc.;
步骤68:根据瑕疵信息完成瑕疵处理流程;Step 68: Complete the defect handling process according to the defect information;
步骤69:释放检测线程中使用的资源,结束步骤。Step 69: Release the resources used in the detection thread and end the step.
在步骤61中获取图像数据,首先需要获取相机模块的图像缓存,然后通过线扫相机的回调函数将相机缓存转化为图像数据。To obtain image data in step 61, it is first necessary to obtain the image buffer of the camera module, and then convert the camera buffer into image data through the callback function of the line scan camera.
在步骤62中算法数据格式的检测瑕疵参数包括:In step 62, the defect detection parameters in the algorithm data format include:
a)瑕疵名称:defectName.a) Defect name: defectName.
b)瑕疵筛选长度阈值mm下限:detectLengthArrayFrom.b) Defect screening length threshold lower limit in mm: detectLengthArrayFrom.
c)瑕疵筛选长度阈值mm上限:detectLengthArrayTo.c) Defect screening length threshold (mm): detectLengthArrayTo.
d)瑕疵筛选宽度阈值mm下限:detectWidthArrayFrom.d) Defect screening width threshold lower limit (mm): detectWidthArrayFrom.
e)瑕疵筛选宽度阈值mm上限:detectWidthArrayTo.e) Defect screening width threshold mm upper limit: detectWidthArrayTo.
f)瑕疵筛选面积阈值mm2下限,0表示该项标准不作为评判标准:detectAreaArrayFrom.f) The lower limit of the defect screening area threshold in mm2, 0 means that this criterion is not used as a criterion: detectAreaArrayFrom.
g)瑕疵筛选面积阈值mm2上限,0表示没有上线:detectAreaArrayTo.g) Upper limit of defect screening area threshold mm2, 0 means no upper limit: detectAreaArrayTo.
h)瑕疵筛选宽度与长度比例下限:detectWidthLengthArrayFrom.h) Lower limit of the ratio of defect screening width to length: detectWidthLengthArrayFrom.
i)瑕疵筛选宽度与长度比例上限:detectWidthLengthArrayTo.i) Upper limit of defect screening width and length ratio: detectWidthLengthArrayTo.
j)瑕疵筛选线宽与长度比例下限:detectLineWidthLengthArrayFrom.j) The lower limit of the ratio of defect screening line width to length: detectLineWidthLengthArrayFrom.
k)瑕疵筛选线宽与长度比例上限:detectLineWidthLengthArrayTo.k) Upper limit of the ratio of defect screening line width to length: detectLineWidthLengthArrayTo.
l)瑕疵亮面积比例下限:detectLightRegionPercentsArrayFrom.l) Lower limit of defect bright area ratio: detectLightRegionPercentsArrayFrom.
m)瑕疵亮面积比例上限:detectLightRegionPercentsArrayTo.m) Upper limit of defect bright area ratio: detectLightRegionPercentsArrayTo.
n)瑕疵暗面积比例下限:detectDarkRegionPercentsArrayFrom.n) The lower limit of the dark area ratio of defects: detectDarkRegionPercentsArrayFrom.
o)瑕疵暗面积比例上限:detectDarkRegionPercentsArrayTo.o) Upper limit of the proportion of dark area of defects: detectDarkRegionPercentsArrayTo.
p)瑕疵孔面积比例下限:detectHoleRegionPercentsArrayFrom.p) Lower limit of defect hole area ratio: detectHoleRegionPercentsArrayFrom.
q)瑕疵孔面积比例上限:detectHoleRegionPercentsArrayTo.q) Upper limit of defect hole area ratio: detectHoleRegionPercentsArrayTo.
r)左侧不检测区域长度:LeftDetectOneImageAbandonWidth.r) Length of the left undetected area: LeftDetectOneImageAbandonWidth.
s)右侧不检测区域长度:RightDetectOneImageAbandonWidth.s) Length of the right non-detection area: RightDetectOneImageAbandonWidth.
t)最大检测瑕疵数:maxDefectNumber.t) Maximum number of detected defects: maxDefectNumber.
u)普通暗阈值:CommonDarkThresh.u) Common dark threshold: CommonDarkThresh.
v)动态暗阈值:DynamicDarkThresh.v) Dynamic dark threshold: DynamicDarkThresh.
w)动态极暗阈值:DynamicVeryDarkThresh.w) Dynamic Very Dark Threshold: DynamicVeryDarkThresh.
x)大区域动态暗阈值:DynamicBigAreaDarkThresh.x) Dynamic Big Area Dark Threshold: Dynamic Big Area Dark Thresh.
y)普通亮阈值:CommonLightThresh.y) Common Light Threshold: CommonLightThresh.
z)动态亮阈值:DynamicLightThresh.z) Dynamic light threshold: DynamicLightThresh.
aa)动态极亮阈值:DynamicVeryLightThresh.aa) Dynamic Very Light Threshold: DynamicVeryLightThresh.
bb)图像放大率(piexels/mm):CameraImageMagnification.bb) Image magnification (piexels/mm): CameraImageMagnification.
cc)相机灰度调节分段数:CameraImageGrayAdjustImageSectionNum.cc) Camera grayscale adjustment segment number: CameraImageGrayAdjustImageSectionNum.
dd)相机灰度调节检测段:CameraImageGrayAdjustDetectSection.dd) Camera grayscale adjustment detection section: CameraImageGrayAdjustDetectSection.
在步骤63中,返回的检测算法结果包括:In step 63, the detection algorithm results returned include:
a)返回结果:result:(0:检测合格,1:有瑕疵为,-1:检测异常为,-2:输出检测参数有误,-3:图像为空,10:图像过亮,11:图像过暗).a) Return result: result: (0: qualified detection, 1: defective, -1: abnormal detection, -2: incorrect output detection parameters, -3: image is empty, 10: image is too bright, 11: image is too dark).
b)灰度值:ImageGray.b) Gray value: ImageGray.
c)照片数:picNumber.c) Number of photos: picNumber.
d)瑕疵列表arrayDefectsClass.d) Defect list arrayDefectsClass.
e)瑕疵中心X坐标数组:arrayDefectCenterX.e) Defect center X coordinate array: arrayDefectCenterX.
f)瑕疵中心Y坐标数组:arrayDefectCenterY.f) Defect center Y coordinate array: arrayDefectCenterY.
//瑕疵最小外接矩形//Minimum bounding rectangle of defect
g)arrayDefectRectangleX.g)arrayDefectRectangleX.
h)arrayDefectRectangleY.h)arrayDefectRectangleY.
i)arrayDefectRectangleWidth.i)arrayDefectRectangleWidth.
j)arrayDefectRectangleHeight.j)arrayDefectRectangleHeight.
k)瑕疵面积数组:arrayDefectArea.k) Defect area array: arrayDefectArea.
l)瑕疵长度数组:arrayDefectLength.l) Defect length array: arrayDefectLength.
m)瑕疵宽度数组:arrayDefectWidth.m) Defect width array: arrayDefectWidth.
n)瑕疵宽度长度比例数组:arrayDefectWidthLength.n) Defect width length ratio array: arrayDefectWidthLength.
o)瑕疵线度长度比例数组:arrayDefectLineWidthLength.o) Defect line length ratio array: arrayDefectLineWidthLength.
p)瑕疵孔面积比例数组:arrayDefectHoleRegionPercents.p) Defect hole area ratio array: arrayDefectHoleRegionPercents.
q)瑕疵亮面积比例数组:arrayDefectLightRegionPercents.q) Defective light area ratio array: arrayDefectLightRegionPercents.
r)瑕疵暗面积比例数组:arrayDefectDarkRegionPercents.r) Defect dark area ratio array: arrayDefectDarkRegionPercents.
s)平均灰度:imageMean.s) Average grayscale: imageMean.
t)灰度方差:imageDeviation.t) Grayscale variance: imageDeviation.
u)图片宽度:mm:imageWidth.u) Image width: mm:imageWidth.
v)图像高度:mm:imageHeight.v) Image height: mm:imageHeight.
w)检测区域宽度:mm:detectRegionWidth.w) Detection area width: mm: detectRegionWidth.
在步骤65中遍历检测算法结果之前,还需要将检测算法结果由算法数据格式换成C#数据格式,便于对检测算法结果进行筛选。Before traversing the detection algorithm results in step 65, the detection algorithm results need to be converted from the algorithm data format to the C# data format to facilitate screening of the detection algorithm results.
如图15所示,所述步骤67中的灰度值动态调节,包括如下步骤:As shown in FIG. 15 , the dynamic adjustment of the grayscale value in step 67 includes the following steps:
步骤6701:操作台获取所有线扫相机采集的实时拼接图像数据A1,检测拼接图像数据A1的整体灰度值;Step 6701: the operating console obtains the real-time stitched image data A1 collected by all line scan cameras, and detects the overall grayscale value of the stitched image data A1;
步骤6702:判断图像A1的整体灰度值与设定的极限值X1的关系;在本例中图像整体灰度值小于极限值X1,表示图像数据A1为接近纯黑的图像;若图像整体灰度值小于极限值X1,则开启光源切换流程,完成光源切换流程后清除线扫相机曝光调节标志位,进入步骤6703;否则,直接进入步骤6703;Step 6702: determine the relationship between the overall gray value of the image A1 and the set limit value X1; in this example, the overall gray value of the image is less than the limit value X1, indicating that the image data A1 is an image close to pure black; if the overall gray value of the image is less than the limit value X1, the light source switching process is started, and after the light source switching process is completed, the line scan camera exposure adjustment flag is cleared and the process proceeds to step 6703; otherwise, the process proceeds directly to step 6703;
步骤6703:判断是否存在未处理的检测线程;若存在未处理的检测线程,则结束步骤;否则进入步骤6704;检测线程表示对图像的算法检测;Step 6703: determine whether there is an unprocessed detection thread; if there is an unprocessed detection thread, end the step; otherwise, proceed to step 6704; the detection thread represents an algorithm detection of the image;
步骤6704:操作台没有进行实时检测流程,将图像数据A1根据设定的分段参数进行分段;在本例设定为10段;Step 6704: The operation console does not perform a real-time detection process, and the image data A1 is segmented according to the set segmentation parameters; in this example, it is set to 10 segments;
步骤6705:对获得的分段图像分别计算每段图像的整体灰度值,判断设定段图像A2的整体灰度值与其他段图像的平均灰度值的差值的比值与设定数值X2的关系,在本例中设定的段图像A2为第5段的段图像;若比值大于设定数值X2,则认为图像异常,结束步骤,在本例中设定数值X2为0.1;若比值小于等于设定数值X2,则进入步骤6706;Step 6705: Calculate the overall grayscale value of each segment image for the obtained segmented images, and determine the relationship between the ratio of the overall grayscale value of the set segment image A2 to the average grayscale value of other segment images and the set value X2. In this example, the set segment image A2 is the segment image of the 5th segment. If the ratio is greater than the set value X2, the image is considered abnormal, and the step ends. In this example, the set value X2 is 0.1. If the ratio is less than or equal to the set value X2, proceed to step 6706.
步骤6706:判断当前的图像数据A1是否为该线扫相机采集的第一帧图像;若为第一帧图像,则直接进入步骤6712;否则进入步骤6707;Step 6706: determine whether the current image data A1 is the first frame image captured by the line scan camera; if it is the first frame image, directly proceed to step 6712; otherwise, proceed to step 6707;
步骤6707:获取该线扫相机在当前图像数据A1的前n帧图像数据,若当前图像数据A1之前的图像数据少于n帧,则获取图像数据A1之前的所有图像;在本例中n取10;Step 6707: Obtain n frames of image data before the current image data A1 of the line scan camera. If the image data before the current image data A1 is less than n frames, obtain all images before the image data A1. In this example, n is 10.
步骤6708:求取步骤6707获得的之前的图像数据的平均灰度值,并将该平均灰度值与段图像A2的整体灰度值进行比较,判断两者差值与段图像A2整体灰度值的比值与设定数值X3的关系;若差值比值大于设定数值X3,则认为图像异常,结束步骤,在本例中设定数值X3为0.1;若比值小于等于设定数值X3,则进入步骤6709;Step 6708: Calculate the average grayscale value of the previous image data obtained in step 6707, and compare the average grayscale value with the overall grayscale value of segment image A2 to determine the relationship between the difference between the two and the ratio of the overall grayscale value of segment image A2 and the set value X3; if the difference ratio is greater than the set value X3, the image is considered abnormal and the step ends. In this example, the set value X3 is 0.1; if the ratio is less than or equal to the set value X3, proceed to step 6709;
步骤6709:获取所有线扫相机采集的数据拼接形成的新的图像数据A3,并获取图像数据A3的整体灰度值;Step 6709: obtaining new image data A3 formed by stitching data collected by all line scan cameras, and obtaining the overall grayscale value of the image data A3;
步骤6710:将图像数据A3的整体灰度值与设定的系统灰度值范围(X3,X4)进行比较;若拼接的图像数据A3的整体灰度值大于系统灰度值上限X4,则进入步骤6711;若拼接的图像数据A3的整体灰度值小于系统灰度值下限X3,进入步骤6712;否则,直接进入步骤6713;Step 6710: compare the overall gray value of the image data A3 with the set system gray value range (X3, X4); if the overall gray value of the spliced image data A3 is greater than the system gray value upper limit X4, proceed to step 6711; if the overall gray value of the spliced image data A3 is less than the system gray value lower limit X3, proceed to step 6712; otherwise, directly proceed to step 6713;
步骤6711:图像数据A3的整体灰度值大于系统灰度值上限X4,判断光源模块的亮度是否大于设定的最小值X5;若光源模块的亮度大于设定的最小值X5,则降低光源模块的亮度,并清除线扫相机曝光调节标志位,进入步骤6713;否则,直接进入步骤6713;其中光源模块的亮度通过功率进行测量和调整;Step 6711: if the overall grayscale value of the image data A3 is greater than the upper limit of the system grayscale value X4, determine whether the brightness of the light source module is greater than the set minimum value X5; if the brightness of the light source module is greater than the set minimum value X5, reduce the brightness of the light source module, clear the line scan camera exposure adjustment flag, and enter step 6713; otherwise, directly enter step 6713; wherein the brightness of the light source module is measured and adjusted by power;
步骤6712:图像数据A3的整体灰度值小于系统灰度值下限X3,判断光源模块的亮度是否小于设定的最大值X6;若光源模块的亮度小于设定的最大值X6,则增强光源模块的亮度,并清除线扫相机曝光调节标志位,进入步骤6713;否则,直接进入步骤6713;Step 6712: if the overall grayscale value of the image data A3 is less than the lower limit of the grayscale value of the system X3, it is determined whether the brightness of the light source module is less than the set maximum value X6; if the brightness of the light source module is less than the set maximum value X6, the brightness of the light source module is enhanced, and the exposure adjustment flag of the line scan camera is cleared, and the process proceeds to step 6713; otherwise, the process proceeds directly to step 6713;
步骤6713:获取所有线扫相机的曝光调节标志位,并判断是否均完成了曝光调节;若均完成了曝光调节,则进入步骤6723;否则进入步骤6714;Step 6713: Obtain the exposure adjustment flags of all line scan cameras and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, proceed to step 6714;
步骤6714:获取未完成曝光调节的线扫相机的编号;其中编号为线扫相机的预设值,用于在系统中区分不同的线扫相机,在本例中线扫相机的编号与其图像存储队列相对应;控制设定编号的线扫相机采集图像数据A4,在本例中为控制未完成曝光调节的线扫相机中编号最小线扫相机;Step 6714: obtaining the serial number of the line scan camera that has not completed the exposure adjustment; wherein the serial number is a preset value of the line scan camera, and is used to distinguish different line scan cameras in the system. In this example, the serial number of the line scan camera corresponds to its image storage queue; controlling the line scan camera with a set serial number to collect image data A4, in this example, the line scan camera with the smallest serial number among the line scan cameras that have not completed the exposure adjustment is controlled;
步骤6715:判断该线扫相机的灰度值精准调节标志位是否开启;若灰度值精准调节标志位开启则进入步骤6716;否则进入步骤6719;其中灰度值精准调节标志位可以通过外部输入进行开启和关闭;Step 6715: Determine whether the grayscale value precision adjustment flag of the line scan camera is turned on; if the grayscale value precision adjustment flag is turned on, proceed to step 6716; otherwise, proceed to step 6719; wherein the grayscale value precision adjustment flag can be turned on and off by external input;
步骤6716:灰度值精准调节标志位开启,判断图像数据A4的整体灰度值与高精度灰度值范围(X7,X8)之间的关系;若图像数据A4的整体灰度值小于X7,则进入步骤6717;若图像数据A4的整体灰度值大于X8,则进入步骤6718;否则,表示图像数据A4灰度值符合高精度灰度值范围,关闭灰度值精准调节标志位,并输入线扫相机曝光调节标志位,表示已经进行过曝光调节,进入步骤6722;Step 6716: The grayscale value precision adjustment flag is turned on, and the relationship between the overall grayscale value of the image data A4 and the high-precision grayscale value range (X7, X8) is determined; if the overall grayscale value of the image data A4 is less than X7, then the process proceeds to step 6717; if the overall grayscale value of the image data A4 is greater than X8, then the process proceeds to step 6718; otherwise, it indicates that the grayscale value of the image data A4 meets the high-precision grayscale value range, and the grayscale value precision adjustment flag is turned off, and the line scan camera exposure adjustment flag is input, indicating that exposure adjustment has been performed, and then the process proceeds to step 6722;
步骤6717:图像数据A4的整体灰度值小于X7,判断线扫相机当前曝光量与设定的曝光上限X9的关系;若线扫相机当前曝光量大于曝光上限X9,则提示无法调节,并输入线扫相机曝光调节标志位,进入步骤6722;否则增加线扫相机曝光量,并输入线扫相机曝光调节标志位,进入步骤6722;Step 6717: if the overall grayscale value of the image data A4 is less than X7, the relationship between the current exposure of the line scan camera and the set upper exposure limit X9 is determined; if the current exposure of the line scan camera is greater than the upper exposure limit X9, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is increased, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;
步骤6718:图像数据A4的整体灰度值大于X8,判断线扫相机当前曝光量与设定的曝光下限X10的关系;若线扫相机当前曝光量小于曝光下限X10,则提示无法调节,并输入线扫相机曝光调节标志位,进入步骤6722;否则降低线扫相机曝光量,并输入线扫相机曝光调节标志位,进入步骤6722;Step 6718: if the overall grayscale value of the image data A4 is greater than X8, the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;
步骤6719:灰度值精准调节标志位未开启,判断图像数据A4的整体灰度值与灰度值调节范围(X11,X12)之间的关系;若图像数据A4的整体灰度值小于X11,则进入步骤6720;若图像数据A4的整体灰度值大于X12,则进入步骤6720;否则,表示图像数据A4灰度值符合灰度值调节范围,并输入线扫相机曝光调节标志位,进入步骤6722;Step 6719: if the grayscale value precise adjustment flag is not turned on, determine the relationship between the overall grayscale value of the image data A4 and the grayscale value adjustment range (X11, X12); if the overall grayscale value of the image data A4 is less than X11, proceed to step 6720; if the overall grayscale value of the image data A4 is greater than X12, proceed to step 6720; otherwise, it means that the grayscale value of the image data A4 meets the grayscale value adjustment range, and the line scan camera exposure adjustment flag is input, and proceed to step 6722;
步骤6720:图像数据A4的整体灰度值小于X11,判断线扫相机当前曝光量与设定的曝光上限X9的关系;若线扫相机当前曝光量大于曝光上限X9,则提示无法调节,并输入线扫相机曝光调节标志位,进入步骤6722;否则增加线扫相机曝光量,并输入线扫相机曝光调节标志位,进入步骤6722;Step 6720: if the overall grayscale value of the image data A4 is less than X11, determine the relationship between the current exposure of the line scan camera and the set upper exposure limit X9; if the current exposure of the line scan camera is greater than the upper exposure limit X9, indicate that it cannot be adjusted, input the line scan camera exposure adjustment flag, and proceed to step 6722; otherwise, increase the line scan camera exposure, input the line scan camera exposure adjustment flag, and proceed to step 6722;
步骤6721:图像数据A4的整体灰度值大于X12,判断线扫相机当前曝光量与设定的曝光下限X10的关系;若线扫相机当前曝光量小于曝光下限X10,则提示无法调节,并输入线扫相机曝光调节标志位,进入步骤6722;否则降低线扫相机曝光量,并输入线扫相机曝光调节标志位,进入步骤6722;Step 6721: if the overall grayscale value of the image data A4 is greater than X12, the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;
步骤6722:获取所有线扫相机的曝光调节标志位,并判断是否均完成了曝光调节;若均完成了曝光调节,则进入步骤6723;否则返回步骤6714;Step 6722: Obtain the exposure adjustment flags of all line scan cameras, and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, return to step 6714;
步骤6723:所有线扫相机均已完成曝光调节,结束灰度值动态调节。Step 6723: All line scan cameras have completed exposure adjustment, and the dynamic adjustment of grayscale values is ended.
在步骤6701中确定需要调节的线扫相机,并获取该线扫相机的图像,其目的是为了对每个线扫相机的曝光度进行分别调节,保证线扫相机的曝光度调节准确。In step 6701, the line scan camera that needs to be adjusted is determined, and the image of the line scan camera is acquired. The purpose is to adjust the exposure of each line scan camera separately to ensure that the exposure adjustment of the line scan camera is accurate.
在步骤6702的光源切换流程中,首先需要判断光源模块中的正面光源和背光源的开关状态,需要说明的是,通常情况下正面光源和背光源仅开启一组;随后增强光源模块中开启的光源的亮度,并判断此时采集的图像数据的灰度值变化,若图像整体的灰度值提升量大于设定的阈值X2,则认为无需改变光源,否则切换灯组,由正面光源切换至背光源或者由背光源切换至正面光源。In the light source switching process of step 6702, it is first necessary to determine the switching status of the front light source and the backlight source in the light source module. It should be noted that, usually, only one group of the front light source and the backlight source is turned on; then, the brightness of the light source turned on in the light source module is enhanced, and the grayscale value change of the image data collected at this time is determined. If the overall grayscale value increase of the image is greater than the set threshold X2, it is considered that there is no need to change the light source, otherwise switch the light group from the front light source to the backlight source or from the backlight source to the front light source.
在步骤6704中将图像数据进行分段,并设定检测段图像,将检测段图像与其他段图像或者之前的帧图像数据进行比较,是因为在一些卷材中仅需要保证设定范围宽度内的卷材满足要求,避免不必要的检测,保证检测速度。In step 6704, the image data is segmented, and a detection segment image is set, and the detection segment image is compared with other segment images or previous frame image data. This is because in some coils, only the coils within the set width range need to meet the requirements, avoiding unnecessary detection and ensuring the detection speed.
在步骤6704-6708中,判断当前段图像A2与其他段图像以及之前的图像数据的灰度值关系,是为了避免卷材输送完或者运输非单一色调卷材的情况出现,因为卷材输送完后或者不同色调的卷材,均会导致图像的灰度值出现极大的变化,通过与之前的图像的灰度值比较,能够获知卷材是否输送完,避免不必要的检测和调节;另外通过当前段图像A2与其他段图像的比较,还能够应对卷材末端不平齐的情况,保证卷材末端不平齐时,也能够快速准确做出判断。并且需要说明的是即便在步骤6702中出现了光源切换的流程,对本步骤的判定结果的准确性也不会产生影响,因为该步骤的灰度值关系比较主要是为了判断卷材的传输情况,保证卷材仍在传输。In steps 6704-6708, the grayscale value relationship between the current segment image A2 and other segment images and previous image data is determined to avoid the situation where the coil is delivered or the coil of non-single color tone is transported, because the delivery of the coil or the coil of different tones will cause a great change in the grayscale value of the image. By comparing the grayscale value with the previous image, it can be known whether the coil is delivered, avoiding unnecessary detection and adjustment; in addition, by comparing the current segment image A2 with other segment images, it can also deal with the situation where the end of the coil is not flush, ensuring that a quick and accurate judgment can be made when the end of the coil is not flush. It should be noted that even if the light source switching process occurs in step 6702, it will not affect the accuracy of the judgment result of this step, because the grayscale value relationship comparison in this step is mainly to determine the transmission status of the coil and ensure that the coil is still being transmitted.
在步骤6710中和步骤6714中,获取新的拼接的实时图像数据A3和图像数据A4,是因为在步骤6702中以及步骤6711-6712中存在光源切换流程,光源切换流程,会影响线扫相机采集的图像数据,因此需要重新获取实时图像数据,避免光源切换对新的图像数据的灰度值的影响,保证实现线扫相机的精确灰度值动态调节。In step 6710 and step 6714, new stitched real-time image data A3 and image data A4 are obtained because there is a light source switching process in step 6702 and steps 6711-6712. The light source switching process will affect the image data collected by the line scan camera. Therefore, it is necessary to re-acquire the real-time image data to avoid the influence of the light source switching on the grayscale value of the new image data, so as to ensure the dynamic adjustment of the accurate grayscale value of the line scan camera.
在步骤6716和步骤6719中的高精度灰度值范围(X7,X8)∈灰度值调节范围(X11,X12)。The high-precision grayscale value range (X7, X8) in step 6716 and step 6719∈the grayscale value adjustment range (X11, X12).
在灰度值动态调节的过程中设置曝光调节标志位,其中曝光调节标志位在线扫相机完成曝光调节后会进行输入标记,并且在光源模块调节后会清除重置,保证在灰度值动态调节的过程中,所有相机都会进行曝光调节,并且在光源模块调节会对线扫相机的曝光重新进行适应性调节,保证图像质量,减少不必要的曝光调节。需要说明是在一些其他实施方式中,线扫相机的曝光调节标志位在设定时间或者换卷后均会清除重置,保证对不同的卷材能够第一时间进行线扫相机的曝光调节适应,保证采集的图像质量。曝光调节标志位还能够根据外部输入进行设置。During the process of dynamic adjustment of grayscale values, an exposure adjustment flag is set, wherein the exposure adjustment flag is input marked after the line scan camera completes the exposure adjustment, and is cleared and reset after the light source module is adjusted, to ensure that during the process of dynamic adjustment of grayscale values, all cameras will perform exposure adjustment, and the light source module adjustment will adaptively re-adjust the exposure of the line scan camera to ensure image quality and reduce unnecessary exposure adjustment. It should be noted that in some other implementations, the exposure adjustment flag of the line scan camera will be cleared and reset after the set time or the roll change, to ensure that the exposure adjustment of the line scan camera can be adapted to different rolls in the first place, to ensure the quality of the captured image. The exposure adjustment flag can also be set according to external input.
如图16所示,图16为缺陷照片墙的更新流程,所述步骤68中的瑕疵处理流程包括如下步骤:As shown in FIG. 16 , FIG. 16 is an update process of a defective photo wall, and the defect processing process in step 68 includes the following steps:
步骤681:根据瑕疵信息,更新瑕疵检测界面的显示数据,包括瑕疵信息显示区域以及瑕疵照片墙等;Step 681: updating the display data of the defect detection interface according to the defect information, including the defect information display area and the defect photo wall;
步骤682:根据打标队列和瑕疵信息,完成瑕疵打标流程;Step 682: Complete the defect marking process according to the marking queue and defect information;
步骤683:根据瑕疵信息进行瑕疵报警。Step 683: Issue a defect alarm based on the defect information.
如图17所示,在步骤682中瑕疵打标流程包括如下步骤:As shown in FIG. 17 , in step 682 , the defect marking process includes the following steps:
步骤6821:获取瑕疵信息和打标队列,瑕疵信息包括瑕疵图像;瑕疵图像为包括瑕疵的拼接图像数据;Step 6821: Obtain defect information and a marking queue, where the defect information includes a defect image; the defect image is stitched image data including defects;
步骤6822:分别获取需要打标的瑕疵图像的卷长和幅宽,并判断是否为0;若卷长和幅宽中的任意一者为0,则结束步骤;否者进入步骤6823;其中瑕疵图像的卷长表示瑕疵图像内显示的卷材长度,瑕疵图像的幅宽表示瑕疵图像内显示的卷材幅宽;Step 6822: respectively obtain the roll length and width of the defect image to be marked, and determine whether they are 0; if either the roll length or the width is 0, end the step; otherwise, proceed to step 6823; wherein the roll length of the defect image represents the length of the roll material displayed in the defect image, and the width of the defect image represents the width of the roll material displayed in the defect image;
步骤6823:根据瑕疵图像的卷长和幅宽生成相同长宽的白底图像;Step 6823: Generate a white background image with the same length and width according to the roll length and width of the defective image;
步骤6824:在白底图像的设定位置打上检测卷长刻度;检测卷长表示采集的图像数据对应的卷材卷长;Step 6824: Mark a detection roll length scale at a set position of the white background image; the detection roll length indicates the roll length of the roll corresponding to the collected image data;
步骤6825:根据瑕疵信息中的位置信息,在白底图像上找到瑕疵点的位置,并打上标记,获得打标图像;标记包括文字、图案、颜色等信息;Step 6825: Find the position of the defect point on the white background image according to the position information in the defect information, and mark it to obtain a marked image; the mark includes information such as text, pattern, color, etc.;
步骤6826:判断瑕疵检测界面的图像显示区域是否显示有打标图像;若显示有打标图像,则将新获得的打标图像连接于旧的打标图像的下方;若未显示实时打标图像,则直接显示打标图像;Step 6826: Determine whether the image display area of the defect detection interface displays a marking image; if a marking image is displayed, connect the newly obtained marking image to the bottom of the old marking image; if the real-time marking image is not displayed, directly display the marking image;
步骤6827:判断图像显示区域显示的打标图像的像素长度是否大于设定的控件尺寸上限Y;若大于设定的控件尺寸上限Y,则裁剪图像显示区域显示的打标图像,保留打标图像尾部的Y1个像素长度的图像,其中尾部为打标图像靠近实时检测卷长的一侧;在本例中设置Y为40000,Y1为0,即清空打标图像;Step 6827: Determine whether the pixel length of the marking image displayed in the image display area is greater than the set control size upper limit Y; if it is greater than the set control size upper limit Y, crop the marking image displayed in the image display area and retain the image with a length of Y1 pixels at the tail of the marking image, where the tail is the side of the marking image close to the real-time detection roll length; in this example, set Y to 40000 and Y1 to 0, that is, clear the marking image;
步骤6828:控制图像显示区域显示的打标图像滑动至最尾端;Step 6828: Control the marking image displayed in the image display area to slide to the end;
步骤6829:释放图像资源,并更新卷长数据;结束步骤。Step 6829: Release image resources and update volume length data; end step.
如图18所示,在步骤683的瑕疵报警中,首先需要获取瑕疵信息;随后遍历瑕疵信息,获取其中报警优先级最高的瑕疵点,其中报警优先级根据瑕疵点的类型进行设定,不同的报警优先级对应不同的报警灯闪烁时间、报警灯颜色等;再然后取该瑕疵点的不同颜色的报警灯闪烁时间中的最大值,并将该最大值确定为报警器报警时间,在本例中包括红灯闪烁时间、绿灯闪烁时间和黄灯闪烁时间;最后根据报警器报警时间,控制报警器报警,并根据不同颜色的报警灯闪烁时间,控制报警灯闪烁,完成瑕疵报警。As shown in FIG. 18 , in the defect alarm of step 683, it is first necessary to obtain the defect information; then the defect information is traversed to obtain the defect point with the highest alarm priority, wherein the alarm priority is set according to the type of the defect point, and different alarm priorities correspond to different alarm light flashing times, alarm light colors, etc.; then the maximum value of the alarm light flashing times of different colors of the defect point is taken, and the maximum value is determined as the alarm time, which in this example includes the red light flashing time, the green light flashing time and the yellow light flashing time; finally, according to the alarm time, the alarm is controlled to alarm, and according to the flashing time of the alarm lights of different colors, the alarm light is controlled to flash, thereby completing the defect alarm.
如图19所示,所述步骤7中历史卷界面,包括瑕疵卷编号区域、历史打标图像显示区域以及历史瑕疵照片墙区域;其中瑕疵卷编号区域包括日期显示,以及当日内的瑕疵卷编号,瑕疵卷编号区域采用树状图进行展示,便于进行查看和选择;历史打标图像显示区域用于显示对应瑕疵卷编号的打标图像,历史瑕疵照片墙区域用于显示对应瑕疵卷编号所截取的瑕疵截图。历史卷界面还设置有操作按钮,包括“查看报告”按钮、“前进”按钮、“后退”按钮以及“返回”按钮;其中“查看报告”按钮用于跳转至瑕疵统计报表界面,在本例中“查看报告”按钮设置于瑕疵卷编号区域;“前进”按钮和“后退”按钮在历史打标图像显示区域以及历史瑕疵照片墙区域均有设置,分别用于控制打标图像和瑕疵图片的前进和后退。历史卷界面还包括页码输入框,用于实现历史打标图像显示区域显示图像的快速跳转。“查看报告”按钮、“前进”按钮、“后退”按钮以及“返回”按钮分别对应“查看报告”指令、“前进”指令、“后退”指令以及“返回”指令。历史卷界面流程包括如下步骤:As shown in FIG. 19 , the historical roll interface in step 7 includes a defect roll number area, a historical marking image display area, and a historical defect photo wall area; wherein the defect roll number area includes a date display and a defect roll number within the day, and the defect roll number area is displayed in a tree diagram for easy viewing and selection; the historical marking image display area is used to display the marking image corresponding to the defect roll number, and the historical defect photo wall area is used to display the defect screenshots captured by the corresponding defect roll number. The historical roll interface is also provided with operation buttons, including a "view report" button, a "forward" button, a "backward" button, and a "return" button; wherein the "view report" button is used to jump to the defect statistical report interface, and in this example, the "view report" button is set in the defect roll number area; the "forward" button and the "backward" button are both set in the historical marking image display area and the historical defect photo wall area, and are used to control the forward and backward movement of the marking image and the defect picture, respectively. The historical roll interface also includes a page number input box for realizing a quick jump of the image displayed in the historical marking image display area. The "View Report" button, "Forward" button, "Back" button and "Return" button correspond to the "View Report" command, "Forward" command, "Back" command and "Return" command respectively. The historical volume interface process includes the following steps:
步骤71:操作台读取数据库中的历史卷信息,包括历史打标图像和历史瑕疵截图;Step 71: The operation console reads historical volume information in the database, including historical marking images and historical defect screenshots;
步骤72:根据读取的历史卷信息,生成历史卷树状图,并加载显示于瑕疵卷编号区域;在本例中历史卷树状图为三层树状图,包括年月-日-瑕疵卷编号;Step 72: Generate a historical volume tree diagram based on the read historical volume information, and load and display it in the defective volume number area; in this example, the historical volume tree diagram is a three-layer tree diagram, including year-month-day-defective volume number;
步骤73:判断是否收到用户通过历史卷树状图的输入指令;若收到输入指令,则从数据库中加载对应的历史卷信息;否则,返回步骤73;Step 73: Determine whether an input instruction from the user through the historical volume tree diagram is received; if an input instruction is received, load the corresponding historical volume information from the database; otherwise, return to step 73;
步骤74:将对应的历史卷信息中的打标图像加载显示于历史打标图像显示区域,将瑕疵截图加载显示于历史瑕疵照片墙区域;Step 74: loading and displaying the marked image in the corresponding historical volume information in the historical marked image display area, and loading and displaying the defect screenshot in the historical defect photo wall area;
步骤75:判断是否收到用户通过操作按钮或者历史卷树状图发出的操作指令;若收到操作指令,则根据操作指令,完成操作流程;否则返回步骤75。Step 75: Determine whether an operation instruction is received from the user through the operation button or the history volume tree diagram; if an operation instruction is received, complete the operation process according to the operation instruction; otherwise, return to step 75.
如图20所示,所述瑕疵统计报表界面,包括瑕疵统计表、瑕疵柱状图以及卷材信息,其中瑕疵统计表统计对应瑕疵卷编号的卷材的瑕疵种类、数量和各自的占比;瑕疵柱状图根据瑕疵统计表进行绘制,在本例中瑕疵柱状图的横坐标为瑕疵种类,纵坐标为瑕疵数量;卷材信息包括产品名、卷长、卷号、总瑕疵数、幅宽、班号等信息,卷材信息通过传感器或者操作台的输入获取。瑕疵统计报表界面还包括“导出PDF文件”按钮以及“返回”按钮;“导出PDF文件”按钮用于将瑕疵统计报表界面展示的图像打印为PDF格式,并输出;“返回”按钮用于返回历史卷界面。As shown in Figure 20, the defect statistics report interface includes a defect statistics table, a defect bar graph and coil information, wherein the defect statistics table counts the defect types, quantities and respective proportions of the coils corresponding to the defective roll numbers; the defect bar graph is drawn according to the defect statistics table, in this example, the horizontal axis of the defect bar graph is the defect type, and the vertical axis is the defect quantity; the coil information includes product name, roll length, roll number, total number of defects, width, class number and other information, and the coil information is obtained through input from sensors or operating consoles. The defect statistics report interface also includes an "Export PDF File" button and a "Return" button; the "Export PDF File" button is used to print the image displayed on the defect statistics report interface in PDF format and output it; the "Return" button is used to return to the historical roll interface.
所述步骤8中的更新瑕疵检测界面的显示信息,在本例中包括更新卷号、卷材参数以及清空卷材实时瑕疵信息显示区域,并且将实时卷长和幅宽设置为0;释放显示图像资源包括清空图像显示区域和瑕疵照片墙区域。另外在本例中设置为隔天自动换卷。The updating of the display information of the defect detection interface in step 8 includes updating the roll number, roll parameters, clearing the real-time roll defect information display area, and setting the real-time roll length and width to 0; releasing the display image resources includes clearing the image display area and the defect photo wall area. In addition, in this example, it is set to automatically change the roll every other day.
如图21-30所示,所述步骤9中的设置界面包括“系统参数”按钮、“瑕疵分类”按钮、“检测参数”按钮以及“返回”按钮;其中“系统参数”按钮、“检测参数”按钮、“瑕疵分类”按钮以及“返回”按钮均为跳转按钮;“系统参数”按钮对应系统配置界面;“检测参数”按钮对应检测参数设置界面;“瑕疵分类”按钮对应瑕疵分类设置界面;“返回”按钮对应瑕疵检测界面。As shown in Figures 21-30, the setting interface in step 9 includes a "system parameters" button, a "defect classification" button, a "detection parameters" button and a "return" button; among which the "system parameters" button, the "detection parameters" button, the "defect classification" button and the "return" button are all jump buttons; the "system parameters" button corresponds to the system configuration interface; the "detection parameters" button corresponds to the detection parameters setting interface; the "defect classification" button corresponds to the defect classification setting interface; the "return" button corresponds to the defect detection interface.
在本例中系统配置界面包括相机号、最大曝光值、最小曝光值、调节刻度、灰度上限、灰度下限、相机数、串口端口、左侧边缘以及右侧边缘的参数设置,其中相机号表示用户修改的线扫相机对象;最大曝光值表示灰度值动态调节时能调节到的曝光度上限,该变量为整型,取值范围为最小曝光值-1000Hv,单位为Hv;最小曝光值表示灰度值动态调节时能调节到的曝光度下限,该变量为整型,取值范围为0Hv-最大曝光值,单位为Hv;调节刻度表示灰度值动态调节时每次调节的相机曝光量大小,该变量为整型,取值范围为0Hv-100Hv,单位为Hv;灰度上限表示开启灰度值动态调节的灰度值上限,若返回的图像灰度值大于该值,则调节曝光量,该变量为整型,取值范围为灰度值下限-255;灰度下限表示开启灰度值动态调节的灰度值下限,若返回的图像灰度值小于该值,则调节曝光量,该变量为整型,取值范围为0-灰度值上限;相机数表示启用的线扫相机个数,该变量为整型,取值范围为1-4;串口端口表示串口模块连接的端口号,该变量为整型,取值范围为1-20;左侧边缘表示瑕疵检测流程中左侧不检测区域的长度,该变量为整型,取值范围为0mm-200mm,单位为mm;右侧边缘表示瑕疵检测流程中右侧不检测区域的长度,该变量为整型,取值范围为0mm-200mm,单位为mm。In this example, the system configuration interface includes the parameter settings of camera number, maximum exposure value, minimum exposure value, adjustment scale, grayscale upper limit, grayscale lower limit, number of cameras, serial port, left edge and right edge, where the camera number indicates the line scan camera object modified by the user; the maximum exposure value indicates the upper limit of exposure that can be adjusted when the grayscale value is dynamically adjusted. The variable is an integer with a value range of -1000Hv, in Hv; the minimum exposure value indicates the lower limit of exposure that can be adjusted when the grayscale value is dynamically adjusted. The variable is an integer with a value range of 0Hv-maximum exposure value, in Hv; the adjustment scale indicates the amount of camera exposure adjusted each time when the grayscale value is dynamically adjusted. The variable is an integer with a value range of 0Hv-100Hv, in Hv; the grayscale upper limit indicates the upper limit of the grayscale value when dynamic adjustment of the grayscale value is turned on. If the grayscale value of the returned image is greater than this value, the exposure is adjusted. This variable is an integer with a value range of -255. The grayscale lower limit indicates the grayscale lower limit for enabling dynamic grayscale adjustment. If the grayscale value of the returned image is less than this value, the exposure is adjusted. This variable is an integer with a value range of 0-grayscale upper limit. The number of cameras indicates the number of enabled line scan cameras. This variable is an integer with a value range of 1-4. The serial port indicates the port number to which the serial port module is connected. This variable is an integer with a value range of 1-20. The left edge indicates the length of the left non-detection area in the defect detection process. This variable is an integer with a value range of 0mm-200mm, in mm. The right edge indicates the length of the right non-detection area in the defect detection process. This variable is an integer with a value range of 0mm-200mm, in mm.
检测参数设置界面包括相机号、瑕疵个数上限、动态暗阈值、动态量阈值、动态极暗阈值、动态极亮阈值、普通暗阈值、普通亮阈值、大面积暗阈值、均值卷积1、均值卷积2、均值卷积3、均值卷积4的参数设置。其中相机号表示用户修改的线扫相机对象;瑕疵个数上限表示该相机图像每次瑕疵检测能检测瑕疵数的上限,该变量为整型,取值范围为0-20;动态暗阈值表示图像检测的标准动态暗阈值,该变量为整型,取值范围为5-150;动态量阈值表示图像检测的标准动态量阈值,该变量为整型,取值范围为5-150;动态极暗阈值表示图像检测的标准动态极暗阈值,该变量为整型,取值范围为5-150;动态极亮阈值表示图像检测的标准动态极亮阈值,该变量为整型,取值范围为5-150;普通暗阈值表示图像检测的标准普通暗阈值,该变量为整型,取值范围表示5-150;普通亮阈值表示图像检测的标准普通亮阈值,该变量为整型,取值范围为5-150;大面积暗阈值表示图像检测的标准大面积暗阈值,该变量为整型,取值范围为5-150;均值卷积1表示图像检测的均值卷积1,该变量为整型,取值范围为5-150;均值卷积2表示图像检测的均值卷积2,该变量为整型,取值范围为5-150;均值卷积3表示图像检测的均值卷积3,该变量为整型,取值范围为5-150;均值卷积4表示图像检测的均值卷积4,该变量为整型,取值范围为5-150。The detection parameter setting interface includes the parameter settings of camera number, upper limit of defect number, dynamic dark threshold, dynamic volume threshold, dynamic extremely dark threshold, dynamic extremely bright threshold, normal dark threshold, normal bright threshold, large area dark threshold, mean convolution 1, mean convolution 2, mean convolution 3, and mean convolution 4. The camera number indicates the line scan camera object modified by the user; the upper limit of defect number indicates the upper limit of the number of defects that can be detected by the camera image each time the defect detection is performed. The variable is an integer with a value range of 0-20; the dynamic dark threshold indicates the standard dynamic dark threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic volume threshold indicates the standard dynamic volume threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic extremely dark threshold indicates the standard dynamic extremely dark threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic extremely bright threshold indicates the standard dynamic extremely bright threshold of image detection. The variable is an integer with a value range of 5-150; the normal dark threshold indicates the standard normal dark threshold of image detection. This variable is an integer, and its value range is 5-150; normal bright threshold represents the standard normal bright threshold for image detection. This variable is an integer, and its value range is 5-150; large area dark threshold represents the standard large area dark threshold for image detection. This variable is an integer, and its value range is 5-150; mean convolution 1 represents the mean convolution 1 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 2 represents the mean convolution 2 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 3 represents the mean convolution 3 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 4 represents the mean convolution 4 of image detection. This variable is an integer, and its value range is 5-150.
瑕疵分类设置界面包括产品名称、瑕疵名称、横宽上限、横宽下限、纵长上限、纵长下限、纵长/线宽上限、纵长/线宽下限、线宽/纵长上限、线宽/纵长下限、面积上限、面积下限、亮面积上限、亮面积下限、孔面积上限、孔面积下限、暗面积上限、暗面积下限、优先级、打标显示、打标字体、打标字符、报警绿灯、报警黄灯、报警红灯、绿灯报警时长、黄灯报警时长、红灯报警时长的参数设置。其中,产品名称表示用户修改的产品对象;瑕疵名称表示用户修改的产品对象中的指定瑕疵对象;横宽上限表示检测到的瑕疵点的横宽上限,该变量为整型,取值范围为横宽下限-100;横宽下限表示检测到的瑕疵点的横宽下限,该变量为整型,取值范围为0-横宽上限;纵长上限表示检测到的瑕疵点的纵长上限,该变量为整型,取值范围为纵长下限-100;纵长下限表示检测到的瑕疵点的纵长下限,该变量为整型,取值范围为0-纵长上限;纵长/线宽上限表示检测到的瑕疵点的纵长/线宽上限,该变量为整型,取值范围为纵长/线宽下限-100;纵长/线宽下限表示检测到的瑕疵点的纵长/线宽下限,该变量为整型,取值范围为0-纵长/线宽上限;线宽/纵长上限表示检测到的瑕疵点的线宽/纵长上限,该变量为整型,取值范围为线宽/纵长下限-100;线宽/纵长下限表示检测到的瑕疵点的线宽/纵长下限,该变量为整型,取值范围为0-线宽/纵长上限;面积上限表示检测到的瑕疵点的面积上限,该变量为整型,取值范围为面积下限-100;面积下限表示检测到的瑕疵点的面积下限,该变量为整型,取值范围为0-面积上限;亮面积上限表示检测到的瑕疵点的亮面积上限,该变量为整型,取值范围为亮面积下限-100;亮面积下限表示检测到的瑕疵点的亮面积下限,该变量为整型,取值范围为0-亮面积上限;孔面积上限表示检测到的瑕疵点的孔面积上限,该变量为整型,取值范围为孔面积下限-100;孔面积下限表示检测到的瑕疵点的孔面积下限,该变量为整型,取值范围为0-孔面积上限;暗面积上限表示检测到的瑕疵点的暗面积上限,该变量为整型,取值范围为暗面积下限-100;暗面积下限表示检测到的瑕疵点的暗面积下限,该变量为整型,取值范围为0-暗面积上限;优先级表示该瑕疵的优先显示等级,1为最高。优先级高的瑕疵可以优先被报警与打标,该变量为整型,取值范围为0-100;打标显示表示检测到瑕疵后是否打标显示,勾选为打标,不勾选为不打标;打标字体表示打标的字体大小,字体颜色,字体样式;打标字符表示选择标记的字符;报警绿灯表示检测到瑕疵后是否绿灯亮起,勾选为亮起,不勾选为不亮起;报警黄灯表示检测到瑕疵后是否黄灯亮起,勾选为亮起,不勾选为不亮起;报警红灯表示检测到瑕疵后是否红灯亮起,勾选为亮起,不勾选为不亮起;绿灯报警时长表示检测到瑕疵后绿灯亮起的时长,该变量为整型,取值范围为1ms-100ms,单位ms;黄灯报警时长表示检测到瑕疵后黄灯亮起的时长,该变量为整型,取值范围为1ms-100ms,单位ms;红灯报警时长表示检测到瑕疵后红灯亮起的时长,该变量为整型,取值范围为1ms-100ms,单位ms。The defect classification setting interface includes parameter settings for product name, defect name, upper limit of horizontal width, lower limit of horizontal width, upper limit of vertical length, lower limit of vertical length, upper limit of vertical length/line width, lower limit of vertical length/line width, upper limit of line width/vertical length, lower limit of line width/vertical length, upper limit of area, lower limit of area, upper limit of bright area, lower limit of bright area, upper limit of hole area, lower limit of hole area, upper limit of dark area, lower limit of dark area, priority, marking display, marking font, marking character, green alarm light, yellow alarm light, red alarm light, green light alarm duration, yellow light alarm duration, and red light alarm duration. Among them, product name indicates the product object modified by the user; defect name indicates the specified defect object in the product object modified by the user; upper limit of horizontal width indicates the upper limit of horizontal width of the detected defect point, the variable is integer, and the value range is lower limit of horizontal width - 100; lower limit of horizontal width indicates the lower limit of horizontal width of the detected defect point, the variable is integer, and the value range is 0-upper limit of horizontal width; upper limit of vertical length indicates the upper limit of vertical length of the detected defect point, the variable is integer, and the value range is lower limit of vertical length - 100; lower limit of vertical length indicates the lower limit of vertical length of the detected defect point, the variable is integer. The variable is of integer type, with a value range of 0-upper limit of vertical length; upper limit of vertical length/line width indicates the upper limit of vertical length/line width of the detected defect point, and the variable is of integer type, with a value range of vertical length/line width lower limit -100; lower limit of vertical length/line width indicates the lower limit of vertical length/line width of the detected defect point, and the variable is of integer type, with a value range of 0-upper limit of vertical length/line width; upper limit of line width/longitudinal length indicates the upper limit of line width/longitudinal length of the detected defect point, and the variable is of integer type, with a value range of line width/longitudinal length lower limit -100; lower limit of line width/longitudinal length indicates the lower limit of line width/longitudinal length of the detected defect point, and the variable is of The value is an integer, and its value range is 0-line width/vertical length upper limit; the area upper limit indicates the upper limit of the area of the detected defect point, and this variable is an integer, and its value range is the area lower limit-100; the area lower limit indicates the lower limit of the area of the detected defect point, and this variable is an integer, and its value range is 0-area upper limit; the bright area upper limit indicates the upper limit of the bright area of the detected defect point, and this variable is an integer, and its value range is the bright area lower limit-100; the bright area lower limit indicates the lower limit of the bright area of the detected defect point, and this variable is an integer, and its value range is 0-bright area upper limit; hole area The upper limit indicates the upper limit of the hole area of the detected defect point. This variable is an integer, and its value range is -100. The lower limit of hole area indicates the lower limit of the hole area of the detected defect point. This variable is an integer, and its value range is 0-the upper limit of hole area. The upper limit of dark area indicates the upper limit of the dark area of the detected defect point. This variable is an integer, and its value range is -100. The lower limit of dark area indicates the lower limit of the dark area of the detected defect point. This variable is an integer, and its value range is 0-the upper limit of dark area. The priority indicates the priority display level of the defect, and 1 is the highest. Defects with high priority can be alarmed and marked first. This variable is an integer with a value range of 0-100; Marking display indicates whether to mark the display after the defect is detected. Check it for marking, and uncheck it for not marking; Marking font indicates the font size, font color, and font style of the marking; Marking character indicates the character to be marked; Alarm green light indicates whether the green light is on after the defect is detected. Check it for on, and uncheck it for off; Alarm yellow light indicates whether the yellow light is on after the defect is detected. Check it for on, and uncheck it for off; Alarm red Light indicates whether the red light is on after a defect is detected. If checked, it is on, and if unchecked, it is not on. The green light alarm duration indicates the duration that the green light is on after a defect is detected. The variable is an integer with a value range of 1ms-100ms, and the unit is ms. The yellow light alarm duration indicates the duration that the yellow light is on after a defect is detected. The variable is an integer with a value range of 1ms-100ms, and the unit is ms. The red light alarm duration indicates the duration that the red light is on after a defect is detected. The variable is an integer with a value range of 1ms-100ms, and the unit is ms.
所述步骤12中的图像的左右不检测区域的值根据瑕疵检测界面的图像显示区域的检测区域滑条确定。The values of the left and right non-detection areas of the image in step 12 are determined according to the detection area slider of the image display area of the defect detection interface.
所述操作台还设置有外置的机械按钮,机械按钮与操作台通过串口通信连接;在本例中机械按钮为检测/暂停机械按钮以及换卷机械按钮。通过机械按钮能够实现按钮串口控制流程,包括如下步骤:The operating console is also provided with an external mechanical button, which is connected to the operating console via a serial communication; in this example, the mechanical button is a detection/pause mechanical button and a roll-changing mechanical button. The button serial control process can be implemented through the mechanical button, including the following steps:
步骤a1:操作台通过设置的定时器以设定的时间间隔向连接机械按钮的串口发送光耦查询信号;Step a1: the operating console sends an optocoupler query signal to the serial port connected to the mechanical button at a set time interval through a set timer;
步骤a2:机械按钮接收光耦查询信号,并根据机械按钮的按动状态返回光光耦查询结果信号;Step a2: the mechanical button receives the optocoupler query signal and returns the optocoupler query result signal according to the pressing state of the mechanical button;
步骤a3:操作台接收返回的光耦查询结果信号,获取机械按钮的按动状态,并根据返回信号的串口,获取连接的机械按钮类型;Step a3: The console receives the returned optocoupler query result signal, obtains the pressing state of the mechanical button, and obtains the type of the connected mechanical button according to the serial port of the returned signal;
步骤a4:操作台根据机械按钮类型和按动状态,执行相应动作,结束步骤。Step a4: The operating console performs corresponding actions according to the type and pressing status of the mechanical button, and ends the step.
在实施的过程中,通过设置操作台连接相机模块,获取图像数据,根据获取的图像数据,进行实时显示,并根据设定算法完成对卷材的瑕疵检测;通过设置灰度值动态调节流程,控制相机模块和光源模块的曝光和亮度等,保证相机模块采集的图像灰度值满足设定范围;通过设置瑕疵打标流程,对于瑕疵在卷材上的位置能够准确判断,并进行显示,便于查看历史瑕疵;通过对线扫相机的图像进行实时拼接显示,使得线扫相机能够采集并在操作台展示完整幅宽的卷材图像。During the implementation process, an operating console is set up to connect the camera module to obtain image data, and real-time display is performed based on the obtained image data, and defect detection of the coil is completed according to the set algorithm; by setting the grayscale value dynamic adjustment process, the exposure and brightness of the camera module and the light source module are controlled to ensure that the grayscale value of the image collected by the camera module meets the set range; by setting the defect marking process, the position of the defect on the coil can be accurately judged and displayed, which is convenient for viewing historical defects; by real-time splicing and displaying the image of the line scan camera, the line scan camera can collect and display the full-width coil image on the operating console.
如图31所示,一种基于线扫描相机的卷材检测方法,该算法可以作为卷材实时检测流程中的检测算法,包括如下步骤:As shown in FIG. 31 , a coil detection method based on a line scan camera, which can be used as a detection algorithm in a coil real-time detection process, includes the following steps:
步骤S1:操作台获取所有线扫相机采集的图像,并统计图像数量;Step S1: The operating console obtains images captured by all line scan cameras and counts the number of images;
步骤S2:判断采集的图像是否为多通道图像;若为多通道图像则转换为灰度图像,进入步骤S3;否则直接进入步骤S3;Step S2: Determine whether the acquired image is a multi-channel image; if it is a multi-channel image, convert it into a grayscale image and proceed to step S3; otherwise, directly proceed to step S3;
步骤S3:依次选取图像,计算图像尺寸,并根据左右不检测区域,完成每组图像的裁切并获取图像灰度值;其中每组图像表示同一时刻,不同线扫相机采集的图像;Step S3: Select images in sequence, calculate the image size, and complete the cropping of each group of images and obtain the image grayscale value according to the left and right undetected areas; wherein each group of images represents images collected by different line scan cameras at the same time;
步骤S4:根据全图背景评估,计算是否存在周期性条纹;若存在周期性纹理,则为有纹理的材质,需要进行去纹理步骤,完成去纹理后进入下一步骤;否则,直接进入下一步骤;Step S4: Calculate whether there are periodic stripes based on the full image background evaluation; if there are periodic textures, it is a textured material and needs to be detexturized. After detexturization is completed, proceed to the next step; otherwise, proceed directly to the next step;
步骤S5:根据图像的灰度值,完成图像的清晰度自适应流程,判断对应的滤波级数,完成图像滤波,并获得图像中的总瑕疵区域;Step S5: according to the gray value of the image, the image clarity adaptive process is completed, the corresponding filtering level is determined, the image filtering is completed, and the total defect area in the image is obtained;
步骤S6:基于聚类方法对总瑕疵区域进行临域多瑕疵处理,将满足要求的瑕疵区域进行连通;Step S6: Based on the clustering method, the total defect area is processed with multiple defects in the neighboring area, and the defect areas that meet the requirements are connected;
步骤S7:根据瑕疵区域或瑕疵连通区域面积获得瑕疵输出优先级;将瑕疵根据瑕疵输出优先级进行排序;Step S7: obtaining a defect output priority according to the area of the defect region or the defect connected region; and sorting the defects according to the defect output priority;
步骤S8:获取瑕疵信息,并按照瑕疵输出优先级顺序,依次判断瑕疵信息是否满足设定阈值范围要求;若瑕疵信息满足设定阈值要求,则将瑕疵信息依次放入输出队列;Step S8: Obtain defect information, and determine whether the defect information meets the set threshold range requirements in order of defect output priority; if the defect information meets the set threshold requirements, put the defect information into the output queue in order;
步骤S9:判断输出队列中的瑕疵信息是否超过瑕疵信息的设定输出数量上限;若超过了瑕疵信息的设定输出数量上限,则根据瑕疵输出优先级顺序输出设定输出数量的瑕疵信息,结束步骤;否则输出队列中的全部瑕疵信息,结束步骤。Step S9: Determine whether the defect information in the output queue exceeds the set output quantity upper limit of the defect information; if it exceeds the set output quantity upper limit of the defect information, output the set output quantity of defect information according to the defect output priority order, and end the step; otherwise, output all the defect information in the queue, and end the step.
如图32所示,所述步骤S3中完成图像的裁剪并获取灰度值的过程包括如下步骤:As shown in FIG. 32 , the process of completing image cropping and obtaining grayscale values in step S3 includes the following steps:
步骤S31:获取一组图像,并判断该组图像中的图像数量大于或者等于一张;若图像的数量为一张,则进入步骤S32;若图像的数量大于一张,否则进入步骤S33;Step S31: Obtain a group of images, and determine whether the number of images in the group of images is greater than or equal to one; if the number of images is one, proceed to step S32; if the number of images is greater than one, otherwise proceed to step S33;
步骤S32:该组图像中仅包含一张图像,则判断左裁剪区域和右裁剪区域的宽度和与图像宽度的关系,其中左裁剪区域和右裁剪区域通过左右不检测区域获得;若左裁剪区域和右裁剪区域的宽度和大于图像宽度,则进入步骤S35;若左裁剪区域和右裁剪区域的宽度和小于等于图像宽度,则进入步骤S36;Step S32: if the group of images contains only one image, then determine the relationship between the sum of the widths of the left cropping area and the right cropping area and the image width, wherein the left cropping area and the right cropping area are obtained by the left and right undetected areas; if the sum of the widths of the left cropping area and the right cropping area is greater than the image width, proceed to step S35; if the sum of the widths of the left cropping area and the right cropping area is less than or equal to the image width, proceed to step S36;
步骤S33:该组图像中包含的图像数量大于一张,则判断第一张图像的宽度与左裁剪区域的宽度的关系;若第一张图像的宽度小于左裁剪区域的宽度,则进入步骤S35;否者进入步骤S34;Step S33: if the number of images included in the group of images is greater than one, determine the relationship between the width of the first image and the width of the left cropping area; if the width of the first image is less than the width of the left cropping area, proceed to step S35; otherwise, proceed to step S34;
步骤S34:判断最后一张图像的宽度与右裁剪区域的宽度的关系;若最后一张图像的宽度小于右裁剪区域的宽度,则进入步骤S35;否者进入步骤S36;Step S34: Determine the relationship between the width of the last image and the width of the right cropping area; if the width of the last image is smaller than the width of the right cropping area, proceed to step S35; otherwise, proceed to step S36;
步骤S35:图像裁剪区域过大,判断为图像检测异常,结束步骤,并结束检测算法;Step S35: if the image cropping area is too large, it is judged that the image detection is abnormal, and the step ends, and the detection algorithm ends;
步骤S36:依次获取该组图像中的一张图像,并判断该图像是否为该组图像的第一张图像;若为该组图像的第一张图像,则进入步骤S37;若不是该组图像的第一张图像,则进入步骤S38;Step S36: sequentially obtain one image in the group of images, and determine whether the image is the first image in the group of images; if it is the first image in the group of images, proceed to step S37; if it is not the first image in the group of images, proceed to step S38;
步骤S37:该图像为该组图像的第一张图像,则判断该组图像是否仅有一张图像;若只有一张图像,则根据左右不检测区域获取图像的左右裁剪区域,并完成图像的裁剪,进入步骤S310;若不为一张图像,则计算图像的左侧裁剪区域,并完成图像的裁剪,进入步骤S310;Step S37: if the image is the first image of the group of images, it is determined whether the group of images has only one image; if there is only one image, the left and right cropping areas of the image are obtained according to the left and right undetected areas, and the image is cropped, and the process proceeds to step S310; if there is not one image, the left cropping area of the image is calculated, and the image is cropped, and the process proceeds to step S310;
步骤S38:该图像不是该组图像的第一张图像,则判断该图像是否为该组图像的最后一张图像;若为该组图像的最后一张图像,则进入步骤S39;若不是该组图像的最后一张图像,则直接进入步骤S310;Step S38: if the image is not the first image of the group of images, determine whether the image is the last image of the group of images; if it is the last image of the group of images, proceed to step S39; if it is not the last image of the group of images, directly proceed to step S310;
步骤S39:该图像为该组图像的最后一张图像,并且不是第一张图像,则计算图像的右侧裁剪区域,并完成图像的裁剪,进入步骤S310;Step S39: if the image is the last image of the group of images and not the first image, the right cropping area of the image is calculated, and the image cropping is completed, and the process proceeds to step S310;
步骤S310:计算获得的图像的灰度值,结束步骤。Step S310: Calculate the grayscale value of the obtained image and end the step.
需要说明的是在步骤S310中,获取图像的灰度值后,还会求取图像的平均灰度值,若图像平均灰度值高于设定值Y1,或低于设定值Y2,则认为图像过亮或过暗,图像异常,结束检测算法;在本例中设定值Y1为230,Y2为30。It should be noted that in step S310, after obtaining the grayscale value of the image, the average grayscale value of the image will also be calculated. If the average grayscale value of the image is higher than the set value Y1, or lower than the set value Y2, the image is considered to be too bright or too dark, the image is abnormal, and the detection algorithm is terminated; in this example, the set values Y1 are 230 and Y2 are 30.
如图33所示,所述步骤S4中的去纹理步骤,包括:As shown in FIG. 33 , the de-texturing step in step S4 includes:
步骤S41:获取裁剪后的图像,并计算图像的宽Width和高Height;Step S41: Obtain the cropped image and calculate the width and height of the image;
步骤S42:在图像中的随机区域,提取1/2Width*1/2Height区域的子图像;Step S42: extracting a sub-image of a 1/2Width*1/2Height area in a random area of the image;
步骤S43:在子图像中的随机位置设置相互垂直的两条直线L1、L2;在本例中,两条直线L1、L2还分别与子图像的宽和高的边缘平行,并且直线L1和直线L2穿过子图像的中心点;Step S43: setting two mutually perpendicular straight lines L1 and L2 at random positions in the sub-image; in this example, the two straight lines L1 and L2 are also parallel to the width and height edges of the sub-image respectively, and the straight lines L1 and L2 pass through the center point of the sub-image;
步骤S44:对子图像进行双边滤波去除尖锐噪声且保存边缘不被模糊后,并进行边缘增强,分别计算子图像在宽方向和高方向的二次导函数图像;Step S44: after performing bilateral filtering on the sub-image to remove sharp noise and preserve the edge without blurring, edge enhancement is performed, and the quadratic derivative function images of the sub-image in the width direction and the height direction are calculated respectively;
步骤S45:根据子图像在宽方向和高方向的二次导函数图像,获取二次导函数图像中的直线区域;Step S45: acquiring a straight line region in the quadratic derivative function image according to the quadratic derivative function image of the sub-image in the width direction and the height direction;
步骤S46:根据直线区域,在二次导函数图像中根据从亮到暗的极性变化提取直线区域骨架,并转化线性对象,获得条纹;在本例中条纹为亮区域;Step S46: extracting the straight line region skeleton in the quadratic derivative image according to the polarity change from bright to dark, and transforming the linear object to obtain stripes; in this example, the stripes are bright areas;
步骤S47:计算提取的所有直线的霍夫变换值(p,theta);通过霍夫变换将直角坐标转换为极坐标,方便确认夹角并完成位置定位;Step S47: Calculate the Hough transform values (p, theta) of all extracted straight lines; convert rectangular coordinates into polar coordinates through Hough transform to facilitate confirmation of angles and complete position positioning;
步骤S48:合并同一直线区域骨架内并且同一角度的低于设定像素点长度L3的条纹;在本例中L3为4个像素点长度;Step S48: merge the stripes within the same straight line region skeleton and at the same angle that are shorter than the set pixel length L3; in this example, L3 is 4 pixels long;
步骤S49:条纹合并后,清除低于设定像素点长度L4的条纹;在本例中L4为20个像素点长度;Step S49: after the stripes are merged, the stripes shorter than the set pixel length L4 are removed; in this example, L4 is 20 pixels long;
步骤S410:获取剩余条纹,并筛选出与直线L1或直线L2相交的条纹;Step S410: Obtain the remaining stripes, and filter out the stripes intersecting the straight line L1 or the straight line L2;
步骤S411:根据条纹与直线L1的交点,提取交点间距和夹角重复的条纹;根据条纹与直线L2的交点,提取交点间距和夹角重复的条纹;Step S411: extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L1; extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L2;
步骤S412:判断步骤S411提取出的条纹与直线L1及直线L2是否均存在夹角;若与直线L1及直线L2中的某条直线不存在夹角,则认为条纹与直线L1或直线L2平行,进入步骤S414;若均存在夹角,则认为条纹与直线L1和直线L2均不平行,进入步骤S413;Step S412: Determine whether the stripe extracted in step S411 has an angle with both the straight line L1 and the straight line L2; if no angle is present with either the straight line L1 or the straight line L2, it is considered that the stripe is parallel to the straight line L1 or the straight line L2, and the process proceeds to step S414; if both angles are present, it is considered that the stripe is not parallel to both the straight line L1 and the straight line L2, and the process proceeds to step S413;
步骤S413:根据条纹与直线L1和L2的夹角与交点间距,获取交点间距在条纹上的投影,包括投影长度和投影位置,该投影长度就是周期性条纹的间距;Step S413: according to the angle between the stripes and the straight lines L1 and L2 and the intersection spacing, obtaining the projection of the intersection spacing on the stripes, including the projection length and projection position, the projection length is the spacing of the periodic stripes;
步骤S414:获取条纹的周期性信息,包括交点间距在条纹上的投影长度和投影位置、条纹在直线L1或L2上的交点、条纹与直线L1和L2的角度;Step S414: acquiring periodic information of the stripes, including the projection length and projection position of the intersection point spacing on the stripes, the intersection points of the stripes on the straight line L1 or L2, and the angles between the stripes and the straight lines L1 and L2;
步骤S415:根据条纹的周期线信息,生成周期函数,并通过傅里叶级数延拓展开,获得条纹的周期性频率;Step S415: Generate a periodic function based on the periodic line information of the fringes, and expand it through Fourier series extension to obtain the periodic frequency of the fringes;
步骤S416:根据傅里叶级数前n项周期性频率获得空间滤波器;Step S416: obtaining a spatial filter according to the first n periodic frequencies of the Fourier series;
步骤S417:通过空间滤波器对步骤S41中获得的裁剪子图像进行卷积计算,实现图像去纹理操作,结束步骤。Step S417: Perform convolution calculation on the cropped sub-image obtained in step S41 through a spatial filter to implement image de-texturing operation, and end the step.
需要说明的是在本申请中所指的条纹为周期性的条纹,包括竖直、水平或者倾斜的条纹、方格等。It should be noted that the stripes referred to in this application are periodic stripes, including vertical, horizontal or inclined stripes, squares, etc.
如图34-36所示,所述步骤S5中对图像的清晰度自适应流程,具体通过如下方法实现:As shown in FIGS. 34-36 , the image definition adaptation process in step S5 is specifically implemented by the following method:
首先针对步骤S4获得的图像,获取图像中心坐标位置,并穿过中心坐标位置画一条平行于X轴方向的轮廓线,其中X轴在图像中表现为卷材的幅宽方向;提取轮廓线上的像素点的灰度信息,获得最大灰度值Gmax、最小灰度值Gmin以及平均灰度值Gmean;设定划分灰度级为n级,其中高于平均灰度值Gmean的灰度级分为n1级,低于平均灰度值的Gmean的灰度级分为n2级,n1+n2=n,在本例中n1=n2=n/2;获取高于平均灰度值Gmean的灰度级差a1,以及低于平均灰度值的Gmean的灰度级差a2:First, for the image obtained in step S4, the center coordinate position of the image is obtained, and a contour line parallel to the X-axis direction is drawn through the center coordinate position, where the X-axis is represented as the width direction of the coil in the image; the grayscale information of the pixel points on the contour line is extracted to obtain the maximum grayscale value Gmax, the minimum grayscale value Gmin and the average grayscale value Gmean; the grayscale level is set to n levels, where the grayscale level higher than the average grayscale value Gmean is divided into n1 levels, and the grayscale level lower than the average grayscale value Gmean is divided into n2 levels, n1+n2=n, in this example n1=n2=n/2; the grayscale level difference a1 higher than the average grayscale value Gmean, and the grayscale level difference a2 lower than the average grayscale value Gmean are obtained:
a1=(Gmax-Gmean)/n1a1=(Gmax-Gmean)/n1
a2=(Gmean-Gmin)/n2a2=(Gmean-Gmin)/n2
将图像中的灰度值根据上述的n级进行划分,其中高于平均灰度值Gmean的灰度级差a1,低于平均灰度值Gmean的灰度级差为a2;根据n级灰度值对轮廓线上的像素点进行划分,并根据划分位置按垂直轮廓线方向完成图像裁剪,最终裁剪的区域数量记为Nw,其中将轮廓线上的连续的并且属于统一灰度值级别的区域划分为一块,直至出现不同灰度值级别的像素点;完成图像裁剪后,按位置信息编码获得二维数组[Nw,n],共Nw*n个图像子区域;The grayscale values in the image are divided according to the above n levels, where the grayscale difference above the average grayscale value Gmean is a1, and the grayscale difference below the average grayscale value Gmean is a2; the pixels on the contour line are divided according to the n-level grayscale value, and the image is cropped in the direction perpendicular to the contour line according to the division position. The number of finally cropped areas is recorded as Nw, where the continuous areas on the contour line that belong to the same grayscale value level are divided into one piece until pixels of different grayscale value levels appear; after completing the image cropping, the two-dimensional array [Nw,n] is obtained according to the position information encoding, with a total of Nw*n image sub-areas;
获取裁剪子图像的尺寸,并计算每块图像的灰度均值与灰度方差D(x),以及每块图像的灰度共生矩阵;其中对于灰度级低于平均灰度值Gmean的裁剪子图像的灰度共生矩阵GLCM表示为:Get the size of the cropped sub-image, and calculate the grayscale mean and grayscale variance D(x) of each image, as well as the grayscale co-occurrence matrix of each image; the grayscale co-occurrence matrix GLCM of the cropped sub-image with a grayscale lower than the average grayscale value Gmean is expressed as:
其中,n′取1、2、3...n2;对于灰度级高于平均灰度值Gmean的裁剪子图像的灰度共生矩阵GLCM表示为:Where n′ is 1, 2, 3...n2; the gray level co-occurrence matrix GLCM of the cropped sub-image with gray level higher than the average gray value Gmean is expressed as:
其中,n″取1、2、3...n1;p(i,j)={counter(i=f(x,y),j=f(x,y+1))}/(α*α),表示遍历整张裁剪子图像,出现相邻灰度值为(i,j)的概率,若裁剪子图像的灰度值高于平均灰度值Gmean,则a=a1,若裁剪子图像的灰度值低于平均灰度值Gmean,则a=a2;f(x,y)表示该裁剪子图像上点(x,y)位置的灰度值;counter(i=f(x,y),j=f(x,y+1)),表示遍历整张裁剪子图像,出现相邻灰度值为(i,j)的次数;Where n″ is 1, 2, 3...n1; p(i,j) = {counter(i = f(x,y), j = f(x,y+1))}/(α*α), which indicates the probability of the adjacent grayscale value (i,j) appearing when traversing the entire cropped sub-image. If the grayscale value of the cropped sub-image is higher than the average grayscale value Gmean, then a = a1; if the grayscale value of the cropped sub-image is lower than the average grayscale value Gmean, then a = a2; f(x,y) indicates the grayscale value of the point (x,y) on the cropped sub-image; counter(i = f(x,y), j = f(x,y+1)), which indicates the number of times the adjacent grayscale value (i,j) appears when traversing the entire cropped sub-image;
随后根据灰度共生矩阵CLCM获得裁剪子图像的对比度cont,其中Then the contrast cont of the cropped sub-image is obtained according to the gray-level co-occurrence matrix CLCM, where
其中i=f(x,y),j=f(x,y+1);图像的对比度主要反映了图像的清晰度和纹理的沟纹深浅,对比度越大,表示图像越清晰,反之对比度越小,表示图像模糊。Where i=f(x,y), j=f(x,y+1); the contrast of an image mainly reflects the clarity of the image and the depth of the texture grooves. The greater the contrast, the clearer the image, and vice versa, the smaller the contrast, the blurred the image.
随后计算裁剪子图像的灰度共生矩阵GLCM的元素平方和,即ASM能量,表示为:Then the sum of squares of the elements of the gray-level co-occurrence matrix GLCM of the cropped sub-image, i.e., the ASM energy, is calculated and expressed as:
其中能量反映了图像的灰度分布均匀程度;当图像模糊时,灰度分布较均匀,能量值较大;当图像清晰时,能量值较小。随后计算裁剪子图像的逆差距Homogenity,简写为Homo,表示为:The energy reflects the uniformity of the grayscale distribution of the image; when the image is blurred, the grayscale distribution is more uniform and the energy value is larger; when the image is clear, the energy value is smaller. Then the inverse difference Homogenity of the cropped sub-image is calculated, abbreviated as Homo, which is expressed as:
Homogenity反映了图像纹理局部变化程度。当图像模糊时,灰度分布较均匀,逆差距值较大;当图像清晰时,逆差距值较小。Homogenity reflects the degree of local change in image texture. When the image is blurred, the grayscale distribution is more uniform and the inverse difference value is larger; when the image is clear, the inverse difference value is smaller.
随后计算裁剪子图像的灰度值在行或列方向上的相关性Corr,Then the correlation Corr of the grayscale value of the cropped sub-image in the row or column direction is calculated.
其中ui和uj分别表示灰度共生矩阵水平方向与竖直方向的平均值,δi和δj表示水平方向与竖直方向的方差值。相关性的大小反映了裁剪子图像的整体灰度值相似程度;当图像模糊时,灰度变化小,相关性好,数值大;当图像清晰时,灰度剧烈变化,相关性差,数值低。Where ui and uj represent the horizontal and vertical average values of the grayscale co-occurrence matrix, respectively, and δi and δj represent the horizontal and vertical variance values. The magnitude of the correlation reflects the similarity of the overall grayscale values of the cropped sub-images; when the image is blurred, the grayscale changes little, the correlation is good, and the value is large; when the image is clear, the grayscale changes dramatically, the correlation is poor, and the value is low.
最后,统计裁剪子图像的灰度方差D(x)、对比度cont、灰度能量ASM、逆差距Homo以及相关性Corr,并获取加权均值Ambiguity,Finally, the grayscale variance D(x), contrast cont, grayscale energy ASM, inverse difference Homo and correlation Corr of the cropped sub-image are counted, and the weighted mean Ambiguity is obtained.
其中χ、ε、η、α、β为设定的权值;加权均值Ambiguity越高,表示图像越模糊,则需要使用滤波核尺寸越小的高斯滤波器;若Ambiguity<A1,则选用一级高斯滤波器;若A1=<Ambiguity<A2,则选用二级高斯滤波器;若A2=<Ambiguity>A3,则选用三级高斯滤波器;若A3=<Ambiguity,则选用四级高斯滤波器;在本例中,A1、A2以及A3均为设定值,一级高斯滤波器的核尺寸为64*64,二级高斯滤波器的核尺寸为32*32,三级高斯滤波器的核尺寸为16*16,四级高斯滤波器的核尺寸为8*8;选用对应级数的高斯滤波器完成对裁剪子图像的滤波处理,直至完成所有裁剪子图像的滤波处理。Where χ, ε, η, α, and β are the set weights; the higher the weighted mean Ambiguity, the more blurred the image is, and a Gaussian filter with a smaller filter kernel size is needed; if Ambiguity<A1, a first-order Gaussian filter is selected; if A1=<Ambiguity<A2, a second-order Gaussian filter is selected; if A2=<Ambiguity>A3, a third-order Gaussian filter is selected; if A3=<Ambiguity, a fourth-order Gaussian filter is selected; in this example, A1, A2, and A3 are all set values, the kernel size of the first-order Gaussian filter is 64*64, the kernel size of the second-order Gaussian filter is 32*32, the kernel size of the third-order Gaussian filter is 16*16, and the kernel size of the fourth-order Gaussian filter is 8*8; Gaussian filters of corresponding levels are selected to complete the filtering process of the cropped sub-images until the filtering process of all cropped sub-images is completed.
如图37所示,所述步骤S6中临域多瑕疵处理流程,包括如下步骤:As shown in FIG. 37 , the process of handling multiple defects in the adjacent domain in step S6 includes the following steps:
步骤S61:获取滤波后的整体图像,并对图像再分别使用一~四级的高斯滤波器进行滤波,获得四张再滤波图像;Step S61: obtaining the filtered overall image, and filtering the image again using Gaussian filters of levels one to four to obtain four filtered images;
步骤S62:获取图像中的普通暗区域的像素点集合、非常暗区域的像素点集合、大面积暗区域的像素点集合、亮区域的像素点集合以及孔洞瑕疵区域的像素点合集;Step S62: Acquire a pixel set of a normal dark area, a pixel set of a very dark area, a pixel set of a large dark area, a pixel set of a bright area, and a pixel set of a hole defect area in the image;
步骤S63:获取暗区域;在本例中,暗区域包括普通暗区域、非常暗区域和大面积暗区域;Step S63: Acquire a dark area; in this example, the dark area includes a normal dark area, a very dark area, and a large dark area;
步骤S64:获取总瑕疵区域;在本例中,总瑕疵区域包括暗区域、亮区域和孔洞瑕疵区域;Step S64: obtaining a total defect area; in this example, the total defect area includes a dark area, a bright area, and a hole defect area;
步骤S65:对总瑕疵区域进行闭运算连通邻近区域;Step S65: performing a closing operation on the total defect area to connect adjacent areas;
步骤S66:计算总瑕疵区域的连通域,分离所有闭合且不相连的区域;Step S66: Calculate the connected domain of the total defect area and separate all closed and unconnected areas;
步骤S67:计算总瑕疵区域内所有连通域的面积大小及中心点坐标,结束步骤。Step S67: Calculate the area size and center point coordinates of all connected domains in the total defect area, and end the step.
所述步骤S62中,在本例中将一级滤波图像中像素点的灰度值<(三级滤波图像中对应位置的像素点灰度值-普通暗阈值Z1)的像素点认为是普通暗区域;将一级滤波图像中像素点的灰度值<(三级滤波图像中对应位置的像素点灰度值-非常暗阈值Z2)的像素点认为是非常暗区域;将二级滤波图像中像素点的灰度值<(四级滤波图像中对应位置的像素点灰度值-大面积暗阈值Z3)的像素点认为是大面积暗区域;将一级滤波图像中像素点的灰度值>(三级滤波图像中对应位置的像素点灰度值+普通亮阈值)的像素点认为是亮区域;将步骤S61中再次滤波前的灰度值范围为(250,255)的像素点认为是孔洞瑕疵区域。In the step S62, in this example, the pixel points whose grayscale values in the first-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image - the normal dark threshold Z1) are considered to be normal dark areas; the pixel points whose grayscale values in the first-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image - the very dark threshold Z2) are considered to be very dark areas; the pixel points whose grayscale values in the second-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the fourth-level filtered image - the large-area dark threshold Z3) are considered to be large-area dark areas; the pixel points whose grayscale values in the first-level filtered image are greater than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image + the normal bright threshold) are considered to be bright areas; the pixel points whose grayscale value range before re-filtering in step S61 is (250, 255) are considered to be hole defect areas.
如图38所示,所述步骤S7中瑕疵输出优先级通过连通域面积的大小进行确定,在本例中连通域的面积越大,瑕疵输出的优先级越高。在步骤S7,确定输出优先级之前,还需要对瑕疵连通域进行筛选,其中筛选条件为连通域面积大于设定的“瑕疵面积上限阈值”。As shown in Figure 38, the defect output priority in step S7 is determined by the size of the connected domain area. In this example, the larger the area of the connected domain, the higher the defect output priority. In step S7, before determining the output priority, the defect connected domain needs to be screened, where the screening condition is that the connected domain area is greater than the set "defect area upper limit threshold".
所述步骤S8中,瑕疵信息包括瑕疵面积、瑕疵最小外接矩形的长宽以及长宽比、瑕疵线长宽比、瑕疵暗面积比、瑕疵亮面积比、瑕疵孔面积比。其中瑕疵线宽=瑕疵面积/瑕疵最小外接矩形长;瑕疵线长宽比=瑕疵线宽/瑕疵最小外接矩形长;瑕疵暗面积比=暗瑕疵区域与当前瑕疵区域交集/当前瑕疵面积;瑕疵亮面积比=亮瑕疵区域与当前瑕疵区域交集/当前瑕疵面积;瑕疵孔面积比=1-亮面积比-暗面积比。在本例中上述的瑕疵信息满足设定的阈值范围要求,则输出瑕疵信息。瑕疵信息还包括瑕疵类型、瑕疵中心点坐标等。瑕疵类型包括黑点、白点和孔洞,其中黑点、白点和孔洞通过像素点的灰度值进行判断,对于每类瑕疵还会根据瑕疵面积,分为大、中、小三个级别;在本例中,将步骤S6的临域多瑕疵处理流程中判断为非常暗区域像素点的认为是黑点,判断为亮区域像素点的认为是白点,判断为孔洞瑕疵区域的像素点认为是孔洞。In step S8, the defect information includes defect area, length, width and length-to-width ratio of the minimum circumscribed rectangle of the defect, defect line length-to-width ratio, defect dark area ratio, defect bright area ratio, and defect hole area ratio. Wherein defect line width = defect area/defect minimum circumscribed rectangle length; defect line length-to-width ratio = defect line width/defect minimum circumscribed rectangle length; defect dark area ratio = intersection of dark defect area and current defect area/current defect area; defect bright area ratio = intersection of bright defect area and current defect area/current defect area; defect hole area ratio = 1-bright area ratio-dark area ratio. In this example, if the above defect information meets the set threshold range requirements, the defect information is output. The defect information also includes defect type, defect center point coordinates, etc. Defect types include black spots, white spots and holes, among which black spots, white spots and holes are judged by the grayscale values of pixels. Each type of defect is also divided into three levels: large, medium and small according to the defect area. In this example, pixels judged as very dark areas in the neighboring multi-defect processing flow of step S6 are considered to be black spots, pixels judged as bright areas are considered to be white spots, and pixels judged as hole defect areas are considered to be holes.
在本申请中,通过将图像中灰度异常区域进行提取,主要提取跟图像背景灰度值异常的区域,并进行形态特征判断后区分不同的瑕疵,实现对瑕疵类型的识别和区分;获取图像横向轮廓线灰度变化信息,对图像进行分段的清晰度自适应检测,使得幅宽较宽的同一张图像能够得到较高的滤波效果,保证滤波后的图像清晰一致;通过对不同瑕疵,进行形状、轮廓、亮暗区域位置相关特征判定以达到细致分类,通过基于聚类算法对瑕疵进行连通域处理,使得满足条件的瑕疵能够进行连通,集中临近位置的多个缺陷输出一个位置,减少打标输出,同时帮助提高算法的效率,并且保证对较小却密集的瑕疵也能够被发现。In the present application, the grayscale abnormal areas in the image are extracted, mainly the areas with abnormal grayscale values of the image background are extracted, and different defects are distinguished after morphological feature judgment, so as to realize the recognition and distinction of defect types; the grayscale change information of the horizontal contour line of the image is obtained, and the clarity of the image is adaptively detected in segments, so that the same image with a wider width can obtain a higher filtering effect, and the filtered image is clear and consistent; the shape, contour, and light and dark area position-related feature judgments are performed on different defects to achieve detailed classification, and the connected domain processing of the defects is performed based on the clustering algorithm, so that the defects that meet the conditions can be connected, and multiple defects in adjacent positions are concentrated and output to one position, which reduces the marking output, helps to improve the efficiency of the algorithm, and ensures that smaller but dense defects can also be discovered.
实施例二:Embodiment 2:
如图39、40所示,本实施例基于实施例一改进获得,其中步骤S8中输出的瑕疵信息中的瑕疵类型通过瑕疵识别特征算法获得,其中瑕疵类型包括黑点、气泡、虫斑、晶点、毛绒。在本例中,将特征为全黑得到瑕疵识别为黑点,并根据瑕疵面积,进一步识别为大中小黑点;将特征为有黑白俩个圆环的瑕疵识别为气泡;特征为黑齿排列的瑕疵识别为虫斑;将特征为一个黑色区域和一个白色区域相邻的瑕疵识别为晶点;将特征为一条黑线的瑕疵识别为毛绒。瑕疵识别特征算法包括如下步骤:As shown in Figures 39 and 40, this embodiment is obtained based on the improvement of the first embodiment, wherein the defect type in the defect information output in step S8 is obtained by a defect recognition feature algorithm, wherein the defect types include black spots, bubbles, worm spots, crystal spots, and fuzz. In this example, the defect characterized by being completely black is identified as a black spot, and is further identified as large, medium, and small black spots according to the defect area; the defect characterized by two black and white rings is identified as a bubble; the defect characterized by black teeth arrangement is identified as a worm spot; the defect characterized by a black area and a white area adjacent to each other is identified as a crystal spot; the defect characterized by a black line is identified as fuzz. The defect recognition feature algorithm includes the following steps:
步骤S81:获取图像,检测图像中的暗区域;其中暗区域为图像灰度值低于设定阈值Y3的区域;Step S81: Acquire an image and detect dark areas in the image; wherein the dark areas are areas where the grayscale value of the image is lower than a set threshold value Y3;
步骤S82:判断图像中的暗区域数量是否为一个;若暗区域数量仅有一个,则进入步骤S83;若暗区域的数量为0或大于一个,则进入步骤S84;Step S82: Determine whether the number of dark areas in the image is one; if the number of dark areas is only one, proceed to step S83; if the number of dark areas is 0 or greater than one, proceed to step S84;
步骤S83:暗区域的数量仅有一个,进一步判断暗区域的轮廓为近似实心圆形或者近似实心矩形或者其他形状;若暗区域的轮廓近似圆形,则判断瑕疵为大黑点,结束步骤;若暗区域轮廓近似矩形,则判断瑕疵为毛绒,结束步骤;若暗区域的轮廓为其他形状,则进入步骤S84;Step S83: If there is only one dark area, further determine whether the outline of the dark area is approximately a solid circle or an approximately solid rectangle or other shapes; if the outline of the dark area is approximately a circle, determine that the defect is a large black spot, and end the step; if the outline of the dark area is approximately a rectangle, determine that the defect is fluff, and end the step; if the outline of the dark area is other shapes, proceed to step S84;
步骤S84:检测图像中的亮区域;判断亮区域和暗区域的数量是否均为0个,若均为0个,则认为图像无瑕疵;否者进入步骤S85;其中亮区域为图像灰度值高于设定阈值Y4的区域;Step S84: Detect the bright area in the image; determine whether the number of bright areas and dark areas are both 0, if both are 0, the image is considered flawless; otherwise, proceed to step S85; the bright area is the area where the grayscale value of the image is higher than the set threshold value Y4;
步骤S85:判断亮区域边缘是否被暗区域包围;若亮区域边缘被暗区域包围,则认为瑕疵为气泡,结束步骤;若亮区域边缘没有被暗区域包围,则进入步骤S86:Step S85: Determine whether the edge of the bright area is surrounded by the dark area; if the edge of the bright area is surrounded by the dark area, the defect is considered to be a bubble and the step ends; if the edge of the bright area is not surrounded by the dark area, proceed to step S86:
步骤S86:亮区域边缘没有被暗区域包围,则对亮区域和暗区域进行数量统计,并获取图像中的所有亮区域和暗区域的重心坐标;Step S86: if the edge of the bright area is not surrounded by the dark area, then the number of bright areas and dark areas is counted, and the centroid coordinates of all bright areas and dark areas in the image are obtained;
步骤S87:将亮区域和暗区域的重心坐标根据横坐标的大小进行排序,判断中重心坐标能否拟合成直线;若重心坐标能够拟合成一条直线,则进入步骤S88;否者,进入步骤S89;Step S87: sort the barycentric coordinates of the bright area and the dark area according to the size of the horizontal coordinate, and determine whether the barycentric coordinates can be fitted into a straight line; if the barycentric coordinates can be fitted into a straight line, proceed to step S88; otherwise, proceed to step S89;
步骤S88:重心坐标能够拟合成一条直线,则进一步判断亮区域和暗区域是否交替出现;若亮区域和暗区域交替出现,则判断瑕疵为虫斑,结束步骤;若亮区域和暗区域没有交替出现,则进入步骤S89;Step S88: If the centroid coordinates can be fitted into a straight line, it is further determined whether the bright area and the dark area appear alternately; if the bright area and the dark area appear alternately, it is determined that the defect is a worm spot, and the step ends; if the bright area and the dark area do not appear alternately, the process proceeds to step S89;
步骤S89:获取亮区域和暗区域的总区域骨架,判断骨架的形状是否呈箭头排列形状;若区域骨架为箭头排列形状,则认为瑕疵为晶点,结束步骤;否者进入步骤S810;Step S89: Obtain the total regional skeleton of the bright area and the dark area, and determine whether the shape of the skeleton is in the shape of arrow arrangement; if the regional skeleton is in the shape of arrow arrangement, the defect is considered to be a crystal point, and the step ends; otherwise, proceed to step S810;
步骤S810:认为瑕疵为其他,获取相邻区域的重心间距,并对区域进行聚合,计算聚合后的区域和面积;其中区域包括亮区域和暗区域。Step S810: the defect is considered to be other, the centroid distance between adjacent regions is obtained, and the regions are aggregated to calculate the aggregated regions and areas; wherein the regions include bright regions and dark regions.
所述步骤S81中的暗区域和步骤S84中的亮区域通过实施例一中的步骤S6的临域多瑕疵处理流程获得。The dark area in step S81 and the bright area in step S84 are obtained through the neighboring multi-defect processing flow of step S6 in the first embodiment.
所述步骤S86中对亮区域和暗区域统计的过程中,分别用1和0对亮区域和暗区域进行标记,并统计每一块区域的面积和每一块区域的最小外接圆。In the process of counting the bright area and the dark area in step S86, the bright area and the dark area are marked with 1 and 0 respectively, and the area of each area and the minimum circumscribed circle of each area are counted.
以上描述仅是本发明的一个具体实例,不构成对本发明的任何限制。显然对于本领域的专业人员来说,在了解了本发明内容和原理后,都可能在不背离本发明原理、结构的情况下,进行形式和细节上的各种修改和改变,但是这些基于本发明思想的修正和改变仍在本发明的权利要求保护范围之内。The above description is only a specific example of the present invention and does not constitute any limitation to the present invention. It is obvious that for professionals in this field, after understanding the content and principle of the present invention, various modifications and changes in form and details may be made without departing from the principle and structure of the present invention, but these modifications and changes based on the idea of the present invention are still within the scope of protection of the claims of the present invention.
Claims (8)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111480868.2A CN114264661B (en) | 2021-12-06 | 2021-12-06 | Definition self-adaptive coiled material detection method, device and system |
CN202410586785.9A CN118671067A (en) | 2021-12-06 | 2021-12-06 | Image definition self-adaption method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111480868.2A CN114264661B (en) | 2021-12-06 | 2021-12-06 | Definition self-adaptive coiled material detection method, device and system |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410586785.9A Division CN118671067A (en) | 2021-12-06 | 2021-12-06 | Image definition self-adaption method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114264661A CN114264661A (en) | 2022-04-01 |
CN114264661B true CN114264661B (en) | 2024-05-31 |
Family
ID=80826387
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111480868.2A Active CN114264661B (en) | 2021-12-06 | 2021-12-06 | Definition self-adaptive coiled material detection method, device and system |
CN202410586785.9A Pending CN118671067A (en) | 2021-12-06 | 2021-12-06 | Image definition self-adaption method |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410586785.9A Pending CN118671067A (en) | 2021-12-06 | 2021-12-06 | Image definition self-adaption method |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN114264661B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114689591A (en) * | 2021-12-06 | 2022-07-01 | 浙江大学台州研究院 | Coiled material detection device, system and detection method based on line scanning camera |
CN116124694A (en) * | 2022-07-12 | 2023-05-16 | 厦门兴全龙机械有限公司 | Cloth detection device and method suitable for open-width cloth winding machine |
CN115082445B (en) * | 2022-07-25 | 2022-11-08 | 山东鲁泰防水科技有限公司 | Method for detecting surface defects of building waterproof roll |
CN119313660A (en) * | 2024-12-16 | 2025-01-14 | 江苏格罗瑞节能科技有限公司 | Dynamic detection and feature extraction method of textile spindle speed |
Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101383479A (en) * | 2008-09-28 | 2009-03-11 | 中国科学院上海光学精密机械研究所 | Two-dimensional fiber laser array phase-locking and aperture filling device |
JP2010226259A (en) * | 2009-03-19 | 2010-10-07 | Rhythm Watch Co Ltd | Detection system and signal processing method thereof |
CN102590218A (en) * | 2012-01-16 | 2012-07-18 | 安徽中科智能高技术有限责任公司 | Device and method for detecting micro defects on bright and clean surface of metal part based on machine vision |
CN105631854A (en) * | 2015-12-16 | 2016-06-01 | 天津天地伟业数码科技有限公司 | FPGA platform-based self-adaptive image definition evaluation algorithm |
CN106251332A (en) * | 2016-07-17 | 2016-12-21 | 西安电子科技大学 | SAR image airport target detection method based on edge feature |
EP3260505A1 (en) * | 2016-06-22 | 2017-12-27 | Agfa Nv | Methods of manufacturing packaging for food, cosmetics and pharma |
CN107894252A (en) * | 2017-11-14 | 2018-04-10 | 江苏科沃纺织有限公司 | It is a kind of to monitor the buried telescopic monitoring system for being sprayed filling device running status in real time |
CN108259753A (en) * | 2018-02-28 | 2018-07-06 | 中国航空工业集团公司洛阳电光设备研究所 | A kind of camera auto-focusing method and device that climbing method is improved based on defocus estimation |
CN108305234A (en) * | 2018-01-17 | 2018-07-20 | 华侨大学 | A kind of Double-histogram equalization methods based on optimal model |
DE102017102664A1 (en) * | 2017-02-10 | 2018-08-16 | Retzlaff Schweißtechnik UG (haftungsbeschränkt) | Method for underwater repair of a steel structure |
CN109685766A (en) * | 2018-11-23 | 2019-04-26 | 江苏大学 | A kind of Fabric Defect detection method based on region fusion feature |
CN111209876A (en) * | 2020-01-10 | 2020-05-29 | 汕头大学 | Method and system for detecting oil leakage defect |
CN111707675A (en) * | 2020-06-11 | 2020-09-25 | 圣山集团有限公司 | Cloth surface flaw on-line monitoring device and monitoring method thereof |
CN112330599A (en) * | 2020-10-15 | 2021-02-05 | 浙江大学台州研究院 | A dimension measuring and scoring device, adjustment method and scoring method |
CN113420810A (en) * | 2021-06-22 | 2021-09-21 | 中国民航大学 | Cable trench intelligent inspection system and method based on infrared and visible light |
CN113567447A (en) * | 2019-08-07 | 2021-10-29 | 浙江大学台州研究院 | Synthetic leather hemming online detection method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4797550B2 (en) * | 2005-10-05 | 2011-10-19 | 富士ゼロックス株式会社 | Droplet discharge device |
JP6403445B2 (en) * | 2014-06-09 | 2018-10-10 | 株式会社キーエンス | Inspection device, inspection method, and program |
US9791979B2 (en) * | 2015-04-21 | 2017-10-17 | Dell Products L.P. | Managing inputs at an information handling system by adaptive infrared illumination and detection |
-
2021
- 2021-12-06 CN CN202111480868.2A patent/CN114264661B/en active Active
- 2021-12-06 CN CN202410586785.9A patent/CN118671067A/en active Pending
Patent Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101383479A (en) * | 2008-09-28 | 2009-03-11 | 中国科学院上海光学精密机械研究所 | Two-dimensional fiber laser array phase-locking and aperture filling device |
JP2010226259A (en) * | 2009-03-19 | 2010-10-07 | Rhythm Watch Co Ltd | Detection system and signal processing method thereof |
CN102590218A (en) * | 2012-01-16 | 2012-07-18 | 安徽中科智能高技术有限责任公司 | Device and method for detecting micro defects on bright and clean surface of metal part based on machine vision |
CN105631854A (en) * | 2015-12-16 | 2016-06-01 | 天津天地伟业数码科技有限公司 | FPGA platform-based self-adaptive image definition evaluation algorithm |
EP3260505A1 (en) * | 2016-06-22 | 2017-12-27 | Agfa Nv | Methods of manufacturing packaging for food, cosmetics and pharma |
CN106251332A (en) * | 2016-07-17 | 2016-12-21 | 西安电子科技大学 | SAR image airport target detection method based on edge feature |
DE102017102664A1 (en) * | 2017-02-10 | 2018-08-16 | Retzlaff Schweißtechnik UG (haftungsbeschränkt) | Method for underwater repair of a steel structure |
CN107894252A (en) * | 2017-11-14 | 2018-04-10 | 江苏科沃纺织有限公司 | It is a kind of to monitor the buried telescopic monitoring system for being sprayed filling device running status in real time |
CN108305234A (en) * | 2018-01-17 | 2018-07-20 | 华侨大学 | A kind of Double-histogram equalization methods based on optimal model |
CN108259753A (en) * | 2018-02-28 | 2018-07-06 | 中国航空工业集团公司洛阳电光设备研究所 | A kind of camera auto-focusing method and device that climbing method is improved based on defocus estimation |
CN109685766A (en) * | 2018-11-23 | 2019-04-26 | 江苏大学 | A kind of Fabric Defect detection method based on region fusion feature |
CN113567447A (en) * | 2019-08-07 | 2021-10-29 | 浙江大学台州研究院 | Synthetic leather hemming online detection method |
CN111209876A (en) * | 2020-01-10 | 2020-05-29 | 汕头大学 | Method and system for detecting oil leakage defect |
CN111707675A (en) * | 2020-06-11 | 2020-09-25 | 圣山集团有限公司 | Cloth surface flaw on-line monitoring device and monitoring method thereof |
CN112330599A (en) * | 2020-10-15 | 2021-02-05 | 浙江大学台州研究院 | A dimension measuring and scoring device, adjustment method and scoring method |
CN113420810A (en) * | 2021-06-22 | 2021-09-21 | 中国民航大学 | Cable trench intelligent inspection system and method based on infrared and visible light |
Non-Patent Citations (11)
Title |
---|
Flaw Detection in Welded Metal Using Magnetic Induction Tomography;Sutisna D;《Advanced Materials Research》;20140828;第896卷;722-725 * |
K-space linear Fourier domain mode locked laser and applications for optical coherence tomography;Eigenwillig Christoph M.;《OPTICS EXPRESS》;20080609;第16卷(第12期);8916-8937 * |
Optimized dithering technique in frequency domain for high-quality three-dimensional depth data acquisition;Cai Ning;《CHINESE PHYSICS B》;20190904;第28卷(第8期);1-11 * |
一种基于信息理论的高动态范围图像评价方法;陈浙泊;徐进;林斌;陆祖康;;光学技术;20100115(第01期);108-112 * |
基于FPGA的数字多道梯形成形算法研究;汤建文;王仁波;王海涛;;测试技术学报;20181029(第05期);42-47 * |
基于SeetaFace的人脸识别门禁系统;汪成龙;孙培宜;林晓鹏;黄余凤;陈国壮;;制造业自动化;20180825(第08期);117-118 * |
基于改进相干增强扩散与纹理能量测度和高斯混合模型的导光板表面缺陷检测方法;张亚洲;卢先领;;计算机应用;20201231(第05期);309-316 * |
基于清晰度评价的自适应阈值图像分割法;张田;田勇;王子;王昭东;;东北大学学报(自然科学版);20200915(第09期);17-24 * |
张亚洲 ; 卢先领 ; .基于改进相干增强扩散与纹理能量测度和高斯混合模型的导光板表面缺陷检测方法.计算机应用.2020,(第05期),309-316. * |
张田 ; 田勇 ; 王子 ; 王昭东 ; .基于清晰度评价的自适应阈值图像分割法.东北大学学报(自然科学版).2020,(第09期),17-24. * |
现代航天光学成像遥感器的应用与发展;胡君;王栋;孙天宇;;中国光学与应用光学;20101231(第06期);519-533 * |
Also Published As
Publication number | Publication date |
---|---|
CN118671067A (en) | 2024-09-20 |
CN114264661A (en) | 2022-04-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114264661B (en) | Definition self-adaptive coiled material detection method, device and system | |
CN114486903B (en) | A grayscale adaptive coil detection system, device and algorithm | |
CN114689591A (en) | Coiled material detection device, system and detection method based on line scanning camera | |
DE10317917B4 (en) | System and method for bounding and classifying regions within a graphic image | |
CN109815998A (en) | A kind of AI dress dimension method for inspecting and system based on YOLO algorithm | |
CN106604005B (en) | A kind of projection TV Atomatic focusing method and system | |
DE112013000627T5 (en) | Segmentation for wafer inspection | |
CN1674630A (en) | Defective pixel correcting method, program and defective pixel correcting system for implementing the method | |
CN110599453A (en) | Panel defect detection method and device based on image fusion and equipment terminal | |
CN110389130A (en) | Intelligent checking system applied to fabric | |
CN1575477A (en) | Automatic digitization of garment patterns | |
CN118369685A (en) | Method for detecting at least one defect on a support, associated device and computer program | |
CN113610843B (en) | Real-time defect identification system and method for optical fiber braiding layer | |
JP7531628B2 (en) | Method and system for imaging moving prints - Patents.com | |
CN109782688A (en) | A kind of fabric divides imaging method and device automatically | |
CN111681229B (en) | Deep learning model training method, wearable clothes flaw identification method and wearable clothes flaw identification device | |
JP2005164565A (en) | Defect detection method for flat panel light- related plate element in low and high resolution images | |
CN108428247A (en) | Method and system for detecting direction of soldering tin point | |
TWI510776B (en) | Bubble inspection processing method for glass | |
CN110135426B (en) | Sample labeling method and computer storage medium | |
JPS62231069A (en) | Defect detection method for fabric inspection machine | |
CN116258703A (en) | Defect detection method, defect detection device, electronic equipment and computer readable storage medium | |
CN106846419B (en) | Method and device for determining portrait outline in image | |
TWI767229B (en) | Appearance inspection management system, appearance inspection management device, appearance inspection management method, and program | |
JP4238074B2 (en) | Surface wrinkle inspection method |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |