CN115631173B - A Composite Thin Film Defect Identification Method - Google Patents
A Composite Thin Film Defect Identification Method Download PDFInfo
- Publication number
- CN115631173B CN115631173B CN202211336527.2A CN202211336527A CN115631173B CN 115631173 B CN115631173 B CN 115631173B CN 202211336527 A CN202211336527 A CN 202211336527A CN 115631173 B CN115631173 B CN 115631173B
- Authority
- CN
- China
- Prior art keywords
- gray
- pixel
- index
- composite film
- window
- 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
- 230000007547 defect Effects 0.000 title claims abstract description 177
- 239000002131 composite material Substances 0.000 title claims abstract description 96
- 238000000034 method Methods 0.000 title claims abstract description 36
- 239000010409 thin film Substances 0.000 title description 3
- 230000011218 segmentation Effects 0.000 claims description 33
- 239000010408 film Substances 0.000 description 77
- 230000037303 wrinkles Effects 0.000 description 41
- 238000009826 distribution Methods 0.000 description 17
- 230000002950 deficient Effects 0.000 description 16
- 230000008569 process Effects 0.000 description 7
- 241001085205 Prenanthella exigua Species 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 3
- 239000003086 colorant Substances 0.000 description 3
- 238000003860 storage Methods 0.000 description 3
- 230000032683 aging Effects 0.000 description 2
- 238000009835 boiling Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000010411 cooking Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 239000005021 flexible packaging material Substances 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 239000002861 polymer material Substances 0.000 description 1
- 238000000513 principal component analysis Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
-
- 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
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Quality & Reliability (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
- Image Processing (AREA)
Abstract
本发明涉及缺陷识别技术领域,具体涉及一种复合薄膜缺陷识别方法,该方法包括:获取复合薄膜的表面灰度图像,根据灰度值确定疑似存在缺陷的复合薄膜图像;对图像进行分割得到疑似缺陷区域;根据设定尺寸大小的窗口内中心像素点的灰度值与窗口内其他像素点的灰度值差异得到像素点的灰度偏差指标;根据灰度偏差指标将像素点分为三个等级,确定可能缺陷像素点,利用可能缺陷像素点进行区域生长得到可能缺陷区域;获取可能缺陷区域的主成分方向所在线段的端点,根据可能缺陷区域对应的端点之间的距离得到非连通性指标,根据非连通性指标和指标阈值确定连通区域,根据连通区域识别复合薄膜的缺陷,本发明能够获得准确的缺陷识别结果。
The present invention relates to the technical field of defect identification, in particular to a defect identification method for a composite film. The method includes: obtaining a grayscale image of the surface of the composite film, determining the image of the composite film suspected of having a defect according to the gray value; segmenting the image to obtain a suspected Defect area; according to the difference between the gray value of the central pixel in the window of the set size and the gray value of other pixels in the window, the gray value deviation index of the pixel point is obtained; according to the gray value deviation index, the pixel point is divided into three Level, determine the possible defect pixels, use the possible defect pixels to perform region growth to obtain the possible defect area; obtain the end points of the line segment of the principal component direction of the possible defect area, and obtain the non-connectivity according to the distance between the end points corresponding to the possible defect area Indices, the connected area is determined according to the non-connected index and the index threshold, and the defect of the composite film is identified according to the connected area. The present invention can obtain accurate defect identification results.
Description
技术领域technical field
本发明涉及缺陷识别技术领域,具体涉及一种复合薄膜缺陷识别方法。The invention relates to the technical field of defect identification, in particular to a defect identification method of a composite thin film.
背景技术Background technique
复合薄膜是由两层或多层不同材料的薄膜复合而成的高分子材料,主要用于包装。复合薄膜的表面皱褶是复合软包装材料加工及应用过程中常见的问题,所谓表面皱褶问题的表现是表层的薄膜向上凸起,表面皱褶问题会影响复合薄膜包装的美观性和质量,故需要对每一生产阶段处理后的复合薄膜进行表面缺陷识别,识别出皱褶缺陷。Composite film is a polymer material composed of two or more layers of films of different materials, and is mainly used for packaging. The surface wrinkle of the composite film is a common problem in the processing and application of composite flexible packaging materials. The so-called surface wrinkle problem is that the surface film is raised upwards. The surface wrinkle problem will affect the aesthetics and quality of the composite film packaging. Therefore, It is necessary to identify surface defects of the processed composite film at each production stage, and identify wrinkle defects.
常规的识别方法为利用阈值分割的方法对复合薄膜的表面图像进行处理,但是由于复合薄膜表面的褶皱缺陷主要呈现为近似隧道形状,灰度差异较不明显,且大多数的复合薄膜为白色,由于光照的存在会出现反光的情况影响阈值的选取,使得图像分割的结果并不准确,进而导致复合薄膜缺陷识别的结果也不准确。The conventional identification method is to use the threshold segmentation method to process the surface image of the composite film, but because the wrinkle defects on the surface of the composite film are mainly in the shape of a tunnel, the difference in gray level is not obvious, and most of the composite films are white. Due to the presence of light, reflections will affect the selection of the threshold, making the result of image segmentation inaccurate, which in turn leads to inaccurate recognition of composite film defects.
发明内容Contents of the invention
为了解决上述技术问题,本发明的目的在于提供一种复合薄膜缺陷识别方法,所采用的技术方案具体如下:In order to solve the above-mentioned technical problems, the object of the present invention is to provide a method for identifying defects in a composite film, and the technical solution adopted is as follows:
获取复合薄膜的表面灰度图像,根据所述表面灰度图像中像素点的灰度值确定疑似存在缺陷的复合薄膜图像;对所述复合薄膜图像进行阈值分割得到疑似缺陷区域;Obtaining a surface grayscale image of the composite film, determining a composite film image suspected of having a defect according to the gray value of a pixel in the surface grayscale image; performing threshold segmentation on the composite film image to obtain a suspected defective region;
利用设定尺寸大小的窗口对疑似缺陷区域内像素点进行滑窗处理,根据窗口内中心像素点的灰度值与窗口内其他像素点的灰度值差异得到像素点的灰度偏差指标;根据灰度偏差指标将像素点分为三个等级,根据像素点对应的窗口内不同等级的数量确定可能缺陷像素点,利用可能缺陷像素点进行区域生长得到可能缺陷区域;Use the window of set size to perform sliding window processing on the pixels in the suspected defect area, and obtain the gray value deviation index of the pixel according to the difference between the gray value of the central pixel in the window and the gray value of other pixels in the window; The gray level deviation index divides the pixels into three grades, determines the possible defective pixels according to the number of different grades in the window corresponding to the pixels, and uses the possible defective pixels to perform region growth to obtain the possible defective regions;
获取可能缺陷区域的主成分方向所在线段的端点,根据可能缺陷区域对应的端点之间的距离得到非连通性指标,根据非连通性指标和指标阈值确定连通区域,根据连通区域识别复合薄膜的缺陷。Obtain the end points of the line segment of the principal component direction of the possible defect area, obtain the non-connectivity index according to the distance between the end points corresponding to the possible defect area, determine the connected area according to the non-connectivity index and the index threshold, and identify the composite film according to the connected area defect.
优选地,所述根据所述表面灰度图像中像素点的灰度值确定疑似存在缺陷的复合薄膜图像具体为:Preferably, the determination of the composite film image suspected of having a defect according to the gray value of the pixel in the surface gray image is specifically:
根据所述表面灰度图像中像素点的灰度值计算所述图像的颜色二阶矩,根据颜色二阶矩得到表面灰度图像对应的颜色特征值,将颜色特征值大于颜色阈值的表面灰度图像记为疑似存在缺陷的复合薄膜图像。Calculate the color second-order moment of the image according to the grayscale value of the pixel in the surface grayscale image, obtain the color feature value corresponding to the surface grayscale image according to the color second-order moment, and calculate the surface gray with the color feature value greater than the color threshold The high-degree image is recorded as a composite film image suspected of having a defect.
优选地,所述对所述复合薄膜图像进行阈值分割得到疑似缺陷区域具体为:Preferably, performing threshold segmentation on the composite film image to obtain the suspected defect area is specifically:
根据所述复合薄膜图像中像素点的灰度值构建灰度直方图,获取灰度直方图中两个波谷对应的灰度值,将两个波谷对应的灰度值较小的记为第一分割阈值,将两个波谷对应的灰度值较大的记为第二分割阈值;灰度值小于第一分割阈值的像素点构成的区域以及灰度值大于第二分割阈值的像素点构成的区域为疑似缺陷区域。Construct a grayscale histogram according to the grayscale values of the pixels in the composite film image, obtain the grayscale values corresponding to the two troughs in the grayscale histogram, and record the smaller grayscale value corresponding to the two troughs as the first Segmentation threshold, record the larger gray value corresponding to the two troughs as the second segmentation threshold; the area formed by the pixels whose gray value is smaller than the first segmentation threshold and the pixel points whose gray value is greater than the second segmentation threshold The area is a suspected defect area.
优选地,所述灰度偏差指标的获取方法具体为:;Preferably, the method for obtaining the gray scale deviation index is specifically: ;
其中,表示第z个像素点对应的灰度偏差指标,表示第z个像素点的灰度值,表示第z个像素点所在窗口内其他的第一个像素点的灰度值,表示第z个像素点所在窗口内其他的第j个像素点的灰度值,表示窗口内除中心点外的其他像素点的总数量,exp()表示以自然常数e为底的指数函数。in, Indicates the grayscale deviation index corresponding to the zth pixel, Indicates the gray value of the zth pixel, Indicates the gray value of the other first pixel in the window where the zth pixel is located, Indicates the gray value of the other jth pixel in the window where the zth pixel is located, Indicates the total number of other pixels in the window except the center point, and exp() indicates an exponential function with the natural constant e as the base.
优选地,所述根据灰度偏差指标将像素点分为三个等级具体为:获取任意两个像素点的灰度偏差指标之间的差值,基于所有差值将所有像素点分为三个等级。Preferably, dividing the pixels into three grades according to the grayscale deviation index is specifically: obtaining the difference between the grayscale deviation indexes of any two pixels, and dividing all the pixels into three grades based on all the differences. grade.
优选地,所述根据像素点对应的窗口内不同等级的数量确定可能缺陷像素点具体为:Preferably, the determining possible defective pixels according to the number of different levels in the window corresponding to the pixels is specifically:
对于任意一个像素点所在的窗口内,在窗口内所有像素点中若存在三种等级的像素点,则所述任意一个像素点为可能缺陷像素点;若不存在三种等级的像素点,将该窗口按照设定步长进行扩大,若扩大后的窗口内的所有像素点中存在三种等级的像素点,则所述任意一个像素点为可能缺陷像素点,若扩大后的窗口内的所有像素点中不存在三种等级的像素点,则所述任意一个像素点为噪声像素点。For the window where any pixel is located, if there are three levels of pixels among all the pixels in the window, then the arbitrary pixel is a possible defective pixel; if there are no three levels of pixels, it will be The window is expanded according to the set step length. If there are three levels of pixels in all the pixels in the expanded window, then any one of the pixels is a possible defective pixel. If all pixels in the expanded window are If there are no pixels of the three levels among the pixels, any one of the pixels is a noise pixel.
优选地,所述根据非连通性指标和指标阈值确定连通区域具体为:Preferably, the determining the connected region according to the non-connectivity index and the index threshold is specifically:
当可能缺陷区域的端点对应的非连通性指标均小于指标阈值时,将该可能缺陷区域与非连通性指标小于指标阈值对应的可能缺陷区域连接起来;当只存在可能缺陷区域的一个端点对应的非连通性指标小于指标阈值时,计算另一个端点到复合薄膜图像的边缘的最短距离,若所述最短距离小于指标阈值,则将该可能缺陷区域与非连通性指标小于指标阈值对应的可能缺陷区域连接起来,若所述最短距离大于或者等于指标阈值,则将该可能缺陷区域舍去,不进行连接;当可能缺陷区域的端点对应的非连通性指标均不小于指标阈值时,将该可能缺陷区域舍去,不进行连接;所有连接后的区域构成连通区域。When the non-connectivity indicators corresponding to the endpoints of the possible defect area are all less than the index threshold, connect the possible defect area with the possible defect area corresponding to the non-connectivity index less than the index threshold; when there is only one end point of the possible defect area corresponding to When the non-connectivity index is less than the index threshold, calculate the shortest distance from the other end point to the edge of the composite film image, if the shortest distance is less than the index threshold, then the possible defect area and the non-connectivity index are less than the index threshold corresponding to the possible defect If the shortest distance is greater than or equal to the index threshold, the possible defect area will be discarded and not connected; when the non-connectivity indicators corresponding to the endpoints of the possible defect area are not less than the index threshold, the possible defect area will be connected. Defect areas are discarded and not connected; all connected areas form a connected area.
本发明实施例至少具有如下有益效果:Embodiments of the present invention have at least the following beneficial effects:
本发明先通过图像中像素点的灰度值确定疑似存在缺陷的复合薄膜图像,结合图像中的颜色分布特征粗略的对图像进行分析,筛选出存在缺陷部分的图像进行后续进一步的判断;然后利用窗口对复合薄膜图像进行处理,计算像素点的灰度偏差指标,进而根据灰度偏差指标获得可能缺陷像素点,通过对窗口范围内像素点的灰度值差异进行分析,考虑了邻域内像素点的灰度差异情况,使得能够获得更加准确的缺陷信息;最后根据缺陷区域之间的连通性,将各缺陷区域连接起来,进而得到缺陷识别结果,考虑了复合薄膜存在的缺陷的形状特征,即在一定程度上的连通性,进一步增大了获得的缺陷区域的准确程度,使得缺陷识别的结果也更加准确。The present invention firstly determines the composite film image suspected of having defects through the gray value of the pixels in the image, analyzes the image roughly in combination with the color distribution characteristics in the image, and screens out the images with defective parts for subsequent further judgment; and then uses The window processes the composite film image, calculates the gray scale deviation index of the pixel point, and then obtains the possible defective pixel point according to the gray scale deviation index point, and analyzes the gray value difference of the pixel point within the window range, considering the pixel point in the neighborhood The gray level difference of the composite film makes it possible to obtain more accurate defect information; finally, according to the connectivity between the defect regions, the defect regions are connected, and then the defect identification result is obtained, considering the shape characteristics of the defects in the composite film, that is, A certain degree of connectivity further increases the accuracy of the obtained defect area, making the result of defect identification more accurate.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案和优点,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它附图。In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or in the prior art, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Apparently, the appended The drawings are only some embodiments of the present invention, and those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1是本发明的一种复合薄膜缺陷识别方法的方法流程图。Fig. 1 is a method flow chart of a composite film defect identification method of the present invention.
具体实施方式Detailed ways
为了更进一步阐述本发明为达成预定发明目的所采取的技术手段及功效,以下结合附图及较佳实施例,对依据本发明提出的一种复合薄膜缺陷识别方法,其具体实施方式、结构、特征及其功效,详细说明如下。在下述说明中,不同的“一个实施例”或“另一个实施例”指的不一定是同一实施例。此外,一或多个实施例中的特定特征、结构、或特点可由任何合适形式组合。In order to further explain the technical means and effects of the present invention to achieve the intended purpose of the invention, the specific implementation, structure, Features and their effects are detailed below. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention.
下面结合附图具体的说明本发明所提供的一种复合薄膜缺陷识别方法的具体方案。The specific scheme of a composite thin film defect identification method provided by the present invention will be described in detail below with reference to the accompanying drawings.
实施例Example
本发明的主要目的是:通过图像处理技术对每个生产阶段的复合薄膜下机后的复合薄膜进行表面缺陷检测,主要检测缺陷的为皱褶缺陷。The main purpose of the present invention is to detect the surface defect of the composite film after the composite film is off the machine at each production stage through the image processing technology, and the main detection defect is the wrinkle defect.
本发明所针对的具体场景为:在复合薄膜下机后、经过熟化处理后、制袋加工完成时及放置一段时间后、水煮处理完成时及放置一段时间后、蒸煮处理完成时及放置一段时间均都进行皱褶缺陷检测。The specific scenarios targeted by the present invention are: after the composite film is off the machine, after aging treatment, when the bag-making process is completed and placed for a period of time, when the boiling treatment is completed and placed for a period of time, when the cooking treatment is completed and placed for a period of time, Wrinkle defect detection is carried out at all times.
请参阅图1,其示出了本发明一个实施例提供的一种复合薄膜缺陷识别方法的方法流程图,该方法包括以下步骤:Please refer to Fig. 1, which shows a method flow chart of a composite film defect identification method provided by an embodiment of the present invention, the method includes the following steps:
步骤一,获取复合薄膜的表面灰度图像,根据所述表面灰度图像中像素点的灰度值确定疑似存在缺陷的复合薄膜图像;对所述复合薄膜图像进行阈值分割得到疑似缺陷区域。Step 1: Acquiring a surface grayscale image of the composite film, determining a composite film image suspected of having a defect according to the gray value of a pixel in the surface grayscale image; performing threshold segmentation on the composite film image to obtain a suspected defect area.
首先,当复合薄膜下机后、经过熟化处理后、制袋加工完成时及放置一段时间后、水煮处理完成时及放置一段时间后、蒸煮处理完成时及放置一段时间后的各个阶段都进行图像采集,获取复合薄膜的表面图像。由于采集过程中受到机械噪声的影响,故对获取到的复合薄膜的表面图像进行降噪处理。在本实施例中,采用高斯滤波的方法对表面图像进行降噪处理,然后采用语义分割方法去除背景的干扰,最后将语义分割处理后得到的图像进行灰度化处理,得到复合薄膜的表面灰度图像。First of all, after the composite film is off the machine, after the aging treatment, when the bag making process is completed and after a period of storage, when the boiling treatment is completed and after a period of storage, when the cooking treatment is completed and after a period of storage, all stages are carried out. Image acquisition, to obtain the surface image of the composite film. Due to the influence of mechanical noise during the acquisition process, the acquired surface image of the composite film was subjected to noise reduction processing. In this embodiment, the Gaussian filtering method is used to denoise the surface image, and then the semantic segmentation method is used to remove the interference of the background, and finally the image obtained after the semantic segmentation process is grayscaled to obtain the surface gray of the composite film. degree image.
需要说明的是,为了减少计算量,首先需要对各个阶段采集的图像均进行图像分析,即根据图像中的灰度特征进行预先判断当前阶段对应的复合薄膜的表面灰度图像中是否存在褶皱缺陷,从而仅对于存在褶皱缺陷的表面灰度图像进行后续的分析。It should be noted that, in order to reduce the amount of calculation, it is first necessary to perform image analysis on the images collected at each stage, that is, to pre-judge whether there is a wrinkle defect in the surface grayscale image of the composite film corresponding to the current stage according to the grayscale features in the image , so that subsequent analysis is only performed on the surface grayscale image with wrinkle defects.
当复合薄膜存在褶皱缺陷时,复合薄膜的表面就会出现凸起的隧道形状的褶皱,在褶皱存在的区域表现在图像中,褶皱部分中凸起的部分颜色偏亮偏白色,但是凸起部分两侧的凹陷部分颜色偏暗偏灰色。由此可知,若复合薄膜表面存在褶皱缺陷,则在复合薄膜的表面灰度图像中,由于褶皱缺陷的产生会出现亮白色以及暗灰色。When there is a wrinkle defect in the composite film, there will be raised tunnel-shaped wrinkles on the surface of the composite film. The area where the wrinkles exist is shown in the image. The color of the raised part of the folded part is brighter and whiter, but the raised part The depressions on both sides are darker to grayish in color. It can be seen that if there are wrinkle defects on the surface of the composite film, bright white and dark gray will appear in the surface grayscale image of the composite film due to the wrinkle defects.
基于此,根据复合薄膜的表面灰度图像中像素点的灰度特征进行分析,判断复合薄膜的表面灰度图像中的颜色分布范围,当复合薄膜不存在褶皱缺陷时,复合薄膜的表面灰度图像中的灰度值均较为接近,表现为较为接近的一种颜色值,而当复合薄膜存在褶皱缺陷时,复合薄膜的表面灰度图像中会增加两种灰度值不同的颜色,则图像中表现为三种颜色值。Based on this, according to the analysis of the grayscale characteristics of the pixels in the surface grayscale image of the composite film, the color distribution range in the surface grayscale image of the composite film is judged. When there is no wrinkle defect in the composite film, the surface grayscale of the composite film The gray values in the images are relatively close, which is represented as a relatively close color value, and when there is a wrinkle defect in the composite film, two colors with different gray values will be added to the surface gray image of the composite film, and the image Expressed as three color values.
然后,由于颜色矩是一种简单有效的颜色特征标记方法,而颜色二阶矩能够表征图像中的颜色的分布范围,在本实施例中基于复合薄膜的表面灰度图像中像素点的灰度值计算图像的颜色二阶矩,用公式表示为:;Then, since the color moment is a simple and effective color feature marking method, and the second-order moment of color can characterize the distribution range of the color in the image, in this embodiment, the grayscale of the pixel in the surface grayscale image based on the composite film Value computes the color second moment of the image , expressed as: ;
其中,表示复合薄膜的表面灰度图像中第i个像素点的灰度值,N表示表面灰度图像中像素点的总数量。式中计算每个像素点的灰度值与图像灰度均值的差值,反映了每个像素点相对于图像灰度均值的偏离程度,在对所有像素点的偏离程度进行求和取均值,表示表面灰度图像的颜色分布范围的大小。当越大表示图像颜色分布范围越广,说明表面灰度图像中可能存在较多种颜色值,反之当越小时,也即代表图像颜色分布范围越窄,说明表面灰度图像中可能存在较少的颜色值,即可能存在一种颜色值。in, Indicates the gray value of the i-th pixel in the surface gray image of the composite film, and N indicates the total number of pixels in the surface gray image. In the formula, the difference between the gray value of each pixel and the average gray value of the image is calculated, which reflects the degree of deviation of each pixel relative to the average gray value of the image, and the deviation degree of all pixels is summed to obtain the average value. Indicates the size of the color distribution range of the surface grayscale image. when The larger the value, the wider the color distribution range of the image, indicating that there may be more color values in the surface grayscale image, and vice versa. The smaller the value, the narrower the color distribution range of the image, indicating that there may be fewer color values in the surface grayscale image, that is, there may be one color value.
在本实施例中对基于复合薄膜的表面灰度图像中像素点的灰度值得到的颜色二阶矩进行归一化处理,即根据颜色二阶矩得到表面灰度图像的颜色特征值,用公式表示为,其中,为对颜色二阶矩进行归一化处理后得到的颜色特征值,为图像的颜色二阶矩,e为自然常数。In this embodiment, the color second-order moment obtained based on the gray value of the pixel in the surface gray image of the composite film Perform normalization processing, that is, obtain the color feature value of the surface grayscale image according to the second-order moment of the color, expressed as ,in, is the color eigenvalue obtained after normalizing the second moment of the color, is the second-order moment of the color of the image, and e is a natural constant.
当的取值越大时,的取值越大,表示图像颜色分布范围越广,说明表面灰度图像中可能存在较多种颜色值,则该图像对应复合薄膜表面可能存在褶皱缺陷,反之当越小时,的取值越小,也即代表图像颜色分布范围越窄,说明表面灰度图像中可能存在较少的颜色值,即可能存在一种颜色值,则该图像对应的复合薄膜表面可能不存在褶皱缺陷。when When the value of is larger, The larger the value of , the wider the color distribution range of the image, indicating that there may be more color values in the surface grayscale image, and there may be wrinkle defects on the surface of the composite film corresponding to the image, otherwise when the younger The smaller the value of , that is, the narrower the color distribution range of the image, it means that there may be fewer color values in the surface grayscale image, that is, there may be one color value, and there may be no wrinkles on the surface of the composite film corresponding to the image defect.
设置颜色阈值,在本实施例中的取值为0.4,当表面灰度图像对应的颜色特征值的取值大于颜色阈值时,即时,说明表面灰度图像中颜色分布范围较大,可能存在褶皱缺陷,故将该表面灰度图像记为疑似存在缺陷的复合薄膜图像。当表面灰度图像对应的颜色特征值的取值小于或等于颜色阈值时,即时,说明表面灰度图像中颜色分布范围较窄,可能不存在褶皱缺陷,故本实施例不对颜色特征值小于或等于颜色阈值的复合薄膜的表面灰度图像进行后续的分析。Set the color threshold, the value in this embodiment is 0.4, when the value of the color feature value corresponding to the surface grayscale image is greater than the color threshold, that is , it indicates that the color distribution range in the surface grayscale image is large, and there may be wrinkle defects, so the surface grayscale image is recorded as a composite film image suspected of having defects. When the value of the color feature value corresponding to the surface grayscale image is less than or equal to the color threshold, that is When , it means that the color distribution range in the surface grayscale image is narrow, and there may be no wrinkle defects. Therefore, this embodiment does not perform subsequent analysis on the surface grayscale image of the composite film whose color characteristic value is less than or equal to the color threshold.
最后,在复合薄膜图像上褶皱存在的区域中,在褶皱上的凸起的部分是由于反光而呈现出亮白色,在褶皱上凸起部分的两侧山根底部由于凸起部分的遮挡而呈现出暗灰色的阴影。在本实施例中涉及的所有褶皱存在的区域均包括凸起的亮白色部分和凸起部分两侧山根底部的暗灰色阴影部分。Finally, in the area where wrinkles exist on the composite film image, the raised parts on the folds appear bright white due to reflection, and the bottom of the mountains on both sides of the raised parts on the folds appear bright white due to the occlusion of the raised parts. A dark gray shade. All the wrinkled areas involved in this embodiment include the raised bright white part and the dark gray shaded part at the bottom of the mountain roots on both sides of the raised part.
基于此,根据疑似存在缺陷的复合薄膜图像中像素点的灰度值构建灰度直方图,以灰度直方图中两个波谷对应的灰度值作为分割阈值,对所述复合薄膜图像进行分割得到疑似缺陷区域。Based on this, a grayscale histogram is constructed based on the grayscale values of the pixels in the composite film image suspected to have defects, and the grayscale value corresponding to the two valleys in the grayscale histogram is used as the segmentation threshold to segment the composite film image Get the suspected defect area.
具体地,以灰度直方图中两个波谷对应的灰度值作为分割阈值,将两个波谷对应的灰度值较小的记为第一分割阈值,将两个波谷对应的灰度值较大的记为第二分割阈值,利用第一分割阈值和第二分割阈值将图像分割为三个区域,第一分割阈值作为暗灰色阴影部分和复合薄膜的主色部分之间的分割点,故将灰度值小于第一分割阈值的像素点构成的区域记为褶皱凸起区域,第二分割阈值作为复合薄膜主色部分与亮白色凸起部分之间的分割点,故将灰度值大于第二分割阈值的像素点构成的区域记为褶皱阴影区域。则灰度值大于或等于第一分割阈值小于或等于第二分割阈值的像素点构成的区域为正常区域,正常区域内不存在褶皱缺陷。其中,褶皱凸起区域和褶皱阴影区域构成了疑似缺陷区域。Specifically, the gray value corresponding to the two valleys in the gray histogram is used as the segmentation threshold, the gray value corresponding to the two valleys is smaller as the first segmentation threshold, and the gray value corresponding to the two valleys is compared The larger one is recorded as the second segmentation threshold, and the image is divided into three regions by using the first segmentation threshold and the second segmentation threshold, and the first segmentation threshold is used as the segmentation point between the dark gray shadow part and the main color part of the composite film, so The area composed of pixels whose gray value is less than the first segmentation threshold is recorded as the wrinkled convex area, and the second segmentation threshold is used as the segmentation point between the main color part of the composite film and the bright white convex part, so the gray value is greater than The area formed by the pixels of the second segmentation threshold is recorded as the wrinkled shadow area. Then, the area formed by pixels whose gray value is greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold is a normal area, and there is no wrinkle defect in the normal area. Among them, the wrinkled raised area and the wrinkled shadow area constitute the suspected defect area.
步骤二,利用设定尺寸大小的窗口对疑似缺陷区域内像素点进行滑窗处理,根据窗口内中心像素点的灰度值与窗口内其他像素点的灰度值差异得到像素点的灰度偏差指标;根据灰度偏差指标将像素点分为三个等级,根据像素点对应的窗口内不同等级的数量确定可能缺陷像素点,利用可能缺陷像素点进行区域生长得到可能缺陷区域。Step 2: Use the window of the set size to perform sliding window processing on the pixels in the suspected defect area, and obtain the gray value deviation of the pixel according to the difference between the gray value of the central pixel in the window and the gray value of other pixels in the window Index: Divide the pixels into three grades according to the gray level deviation index, determine the possible defect pixels according to the number of different grades in the window corresponding to the pixels, and use the possible defect pixels to perform region growth to obtain the possible defect area.
首先,需要说明的是,褶皱存在的区域内包括褶皱上的凸起部分和褶皱上凸起两侧的山根底部阴影部分,使用设定尺寸大小的窗口对复合薄膜图像进行处理,从复合薄膜图像的左上角开始自左至右、自上至下的滑动,滑动的步长为1,每滑动到一个位置时,根据窗口中心位置像素点的灰度值判断该像素点属于哪个区域,当中心位置像素点属于可能缺陷区域时,分析该窗口内的像素分布特征。First of all, it needs to be explained that the area where the folds exist includes the raised parts on the folds and the shadow parts at the bottom of the mountain root on both sides of the raised folds. The composite film image is processed using a window of a set size. From the composite film image The upper left corner of the window starts to slide from left to right and from top to bottom. The sliding step is 1. When sliding to a position, it is judged which area the pixel belongs to according to the gray value of the pixel at the center of the window. When the center When the position pixel belongs to the possible defect area, the pixel distribution characteristics in the window are analyzed.
当中心位置像素点属于可能缺陷区域时,也即该像素点属于褶皱凸起区域或者褶皱阴影区域时,说明在该窗口内存在褶皱缺陷,而褶皱中凸起的部分和阴影部分是同时存在且集中分布的,进而在一定尺寸大小的窗口内,会同时存在像素点属于褶皱凸起区域和褶皱阴影区域,表现在颜色分布上,该窗口内像素点的灰度值会存在两个区间内,即小于第一分割阈值和大于第二分割阈值,即存在亮白色的像素点和暗灰色的像素点。将该窗口的尺寸大小扩大后,窗口内除了缺陷部分还包含复合薄膜的正常区域,则窗口内一定会存在三种颜色分布,即窗口内像素点的灰度值会存在三个区间内。同时窗口内存在的三种颜色分布的像素点不是凌乱分布的,而是分成三个区域集中分布。When the pixel point at the center belongs to the possible defect area, that is, the pixel point belongs to the wrinkle raised area or the wrinkle shadow area, it means that there is a wrinkle defect in the window, and the raised part and the shadow part of the wrinkle exist simultaneously and Concentrated distribution, and in a window of a certain size, there will be pixels belonging to the wrinkled raised area and the wrinkled shadow area at the same time, which is reflected in the color distribution. The gray value of the pixel in the window will exist in two intervals, That is, if it is less than the first segmentation threshold and greater than the second segmentation threshold, there are bright white pixels and dark gray pixels. After the size of the window is enlarged, the window includes the normal area of the composite film in addition to the defective part, then there must be three color distributions in the window, that is, the gray value of the pixel point in the window will exist in three intervals. At the same time, the pixels of the three colors distributed in the window are not distributed randomly, but are divided into three areas and distributed intensively.
其中,在本实施例中,设定尺寸大小的取值为3*3,实施者可根据实际情况进行设置。Wherein, in this embodiment, the value of the set size is 3*3, and the implementer can set it according to the actual situation.
然后,利用3*3的窗口对复合薄膜图像中的可能缺陷区域进行处理,对于任意一个像素点,以该像素点为中心的3*3的窗口内,若该窗口内存在褶皱区域,则分别计算该窗口内中心位置处的像素点与其他像素点的灰度值差值,根据每个差值之间的差异可以获得中心位置处像素点的像素偏差情况。Then, use the 3*3 window to process the possible defect area in the composite film image. For any pixel, if there is a wrinkle area in the window with the pixel as the center, then respectively The difference between the gray value of the pixel at the center position and other pixels in the window is calculated, and the pixel deviation of the pixel at the center position can be obtained according to the difference between each difference.
根据窗口内中心像素点的灰度值与窗口内其他像素点的灰度值差异得到像素点的灰度偏差指标,用公式表示为:;According to the difference between the gray value of the central pixel in the window and the gray value of other pixels in the window, the gray value deviation index of the pixel is obtained, expressed as: ;
其中,表示第z个像素点对应的灰度偏差指标,表示第z个像素点的灰度值,表示第z个像素点所在窗口内其他的第一个像素点的灰度值,表示第z个像素点所在窗口内其他的第j个像素点的灰度值,exp()表示以自然常数e为底的指数函数,表示窗口内除中心点外的其他像素点的总数量,在本实施例中的取值为8。in, Indicates the grayscale deviation index corresponding to the zth pixel, Indicates the gray value of the zth pixel, Indicates the gray value of the other first pixel in the window where the zth pixel is located, Indicates the gray value of the other jth pixel in the window where the zth pixel is located, and exp() represents an exponential function based on the natural constant e, Indicates the total number of other pixels in the window except the center point, which is 8 in this embodiment.
表示以第z个像素点的灰度值与该窗口内其他的第一个像素点的灰度值之间的差值为基准值,计算第z个像素点的灰度值与窗口内其他的第j个像素点的灰度值之间的差值的偏差,进而依次计算基准值与其他差值之间的偏差。窗口内像素点的灰度值之间的差值能够反映像素点的灰度差异,通过选择任意一个灰度差异为基准值,进而计算灰度差异之间的偏差程度。 Indicates that the difference between the gray value of the zth pixel and the gray value of the first other pixel in the window is used as the reference value to calculate the gray value of the zth pixel and the other gray values in the window The deviation of the difference between the gray values of the jth pixel, and then sequentially calculate the deviation between the reference value and other differences. The difference between the grayscale values of the pixels in the window can reflect the grayscale difference of the pixels, and by selecting any grayscale difference as the reference value, the degree of deviation between the grayscale differences is calculated.
像素点之间的灰度值差值越小,其对应的灰度差异越小,说明该像素点所在的窗口内可能不存在褶皱缺陷,则灰度差异之间的偏差程度就越小,像素点的灰度偏差指标的取值就越小,说明该像素点越可能属于复合薄膜图像上正常的像素点。像素点之间的灰度值差值越大,其对应的灰度差异就越大,说明该像素点所在的窗口内可能存在褶皱缺陷,则灰度差异之间的偏差程度就越大,像素点的灰度偏差指标的取值就越大,说明该像素点越可能属于复合薄膜图像上可能缺陷区域内的像素点。The smaller the gray value difference between pixels, the smaller the corresponding gray difference, indicating that there may be no wrinkle defects in the window where the pixel is located, and the smaller the deviation between the gray differences, the pixel The smaller the value of the gray scale deviation index of the point, the more likely the pixel point belongs to the normal pixel point on the composite film image. The larger the gray value difference between pixels, the larger the corresponding gray difference, indicating that there may be wrinkle defects in the window where the pixel is located, and the greater the deviation between the gray differences, the pixel The larger the value of the gray scale deviation index of the point, the more likely the pixel point belongs to the pixel point in the possible defect area on the composite film image.
最后,按照上述方法分别计算复合薄膜图像上可能缺陷区域内所有像素点的灰度偏差指标,获取任意两个像素点的灰度偏差指标之间的差值,基于所有差值将所有像素点分为三个等级。Finally, calculate the gray scale deviation indexes of all pixels in the possible defect area on the composite film image according to the above method, obtain the difference between the gray scale deviation indexes of any two pixels, and classify all pixels based on all differences. for three levels.
具体地,选取任意两个像素点记为第一像素点和第二像素点,计算两个像素点对应的灰度偏差指标的差值,若该差值的取值大于阈值时,则认为这两个像素点越不可能属于同一区域内的像素点,故将这两个像素点对应的灰度偏差指标划分为两个不同的等级;若该差值的取值小于或者等于阈值时,则认为这两个像素点可能属于同一区域内的像素点,故将这两个像素点对应的灰度偏差指标划分为同一个等级。Specifically, any two pixels are selected as the first pixel and the second pixel, and the difference value of the gray scale deviation index corresponding to the two pixels is calculated. If the value of the difference is greater than the threshold, it is considered that this Two pixels are less likely to belong to pixels in the same area, so the gray scale deviation indicators corresponding to these two pixels are divided into two different levels; if the value of the difference is less than or equal to the threshold, then It is considered that these two pixels may belong to pixels in the same area, so the gray scale deviation indicators corresponding to these two pixels are classified into the same level.
进而任意选择一个其他的像素点记为第三像素点,分别计算第三像素点对应的灰度偏差指标与第一像素点对应的灰度偏差指标的差值,计算第三像素点对应的灰度偏差指标与第二像素点对应的灰度偏差指标的差值。若存在差值小于或者等于阈值,即第三像素点与第一像素点对应的灰度偏差指标的差值小于或者等于阈值,则将第三像素点对应的灰度偏差指标划分为与第一像素点对应的灰度偏差指标所在的等级,或者第三像素点与第二像素点对应的灰度偏差指标的差值小于或者等于阈值,则将第三像素点对应的灰度偏差指标划分为与第二像素点对应的灰度偏差指标所在的等级。若不存在差值小于或者等于阈值,即第三像素点与其他两个像素点的灰度偏差指标之间的差值均大于阈值,则将第三像素点对应的灰度偏差指标划分为第三个等级。其中,在本实施例中,阈值的取值为0.2,实施者可根据实际情况进行设置。Then, arbitrarily select another pixel to be recorded as the third pixel, calculate the difference between the gray scale deviation index corresponding to the third pixel point and the gray scale deviation index corresponding to the first pixel point, and calculate the gray scale deviation index corresponding to the third pixel point The difference between the gray scale deviation index and the gray scale deviation index corresponding to the second pixel point. If there is a difference that is less than or equal to the threshold value, that is, the difference between the gray scale deviation index corresponding to the third pixel point and the first pixel point is less than or equal to the threshold value, then the gray scale deviation index corresponding to the third pixel point is divided into the gray scale deviation index corresponding to the first pixel point. If the level of the gray scale deviation index corresponding to the pixel is located, or the difference between the gray scale deviation index corresponding to the third pixel point and the second pixel point is less than or equal to the threshold value, then the gray scale deviation index corresponding to the third pixel point is divided into The level of the gray scale deviation index corresponding to the second pixel. If there is no difference less than or equal to the threshold value, that is, the difference between the gray scale deviation indicators of the third pixel point and the other two pixel points is greater than the threshold value, then the gray scale deviation index corresponding to the third pixel point is divided into the first three grades. Wherein, in this embodiment, the value of the threshold is 0.2, and the implementer can set it according to the actual situation.
基于此,以此类推,基于所有差值将所有像素点分为三个等级,分级的标准即将灰度偏差指标最小的一级划分为第一等级,将灰度偏差较大的一级划分为第二等级,将灰度偏差最大的一级划分为第三等级。由于复合薄膜图像中若存在褶皱缺陷,则该图像中像素点的颜色分布一定表现为三种颜色,图像中的像素点对应的灰度偏差指标一定能够分为三个等级。同时,每个像素点对应一个灰度偏差指标,每个灰度偏差指标对应一个等级,进而每个像素点对应一个等级,且三个等级可以近似看作三个不同的区域,即正常区域,褶皱凸起区域以及褶皱阴影区域。Based on this, and so on, all pixels are divided into three grades based on all differences. The classification standard is to divide the level with the smallest gray scale deviation index into the first level, and divide the level with the larger gray scale deviation into the first level. In the second level, the level with the largest gray scale deviation is divided into the third level. Because if there is a wrinkle defect in the composite film image, the color distribution of the pixels in the image must be three colors, and the gray scale deviation index corresponding to the pixels in the image must be divided into three levels. At the same time, each pixel corresponds to a grayscale deviation index, each grayscale deviation index corresponds to a level, and each pixel corresponds to a level, and the three levels can be approximately regarded as three different areas, that is, normal areas, Wrinkled raised areas as well as wrinkled shaded areas.
需要说明的是,本实施例通过考虑像素点与其邻域内像素点之间的灰度差异的偏差,进而能够更加详细的分析图像中灰度差异的变化情况,基于该差异的变化情况对像素点进行判断,能够获得更加准确的缺陷信息。It should be noted that, in this embodiment, by considering the deviation of the gray level difference between the pixel point and the pixel points in its neighborhood, the change of the gray level difference in the image can be analyzed in more detail, and the pixel point is calculated based on the change state of the difference. By making a judgment, more accurate defect information can be obtained.
进一步的,对像素点所在窗口内像素点进行判断,在一定尺寸大小的窗口内,会同时存在像素点属于褶皱凸起区域和褶皱阴影区域,表现在灰度差异的偏差上,该窗口内像素点对应的等级可能存在两个不同的等级,将该窗口的尺寸大小扩大后,窗口内除了缺陷部分还包含复合薄膜的正常区域,则窗口内一定会存在三种颜色分布,表现在灰度差异的偏差上,扩大后的窗口内像素点对应的等级存在三个不同的等级。Further, judge the pixels in the window where the pixels are located. In a window of a certain size, there will be pixels belonging to the wrinkled raised area and the wrinkled shadow area at the same time, which is reflected in the deviation of the gray level difference. The pixel in the window The level corresponding to the point may have two different levels. After the size of the window is enlarged, the window includes the normal area of the composite film in addition to the defect part, and there must be three color distributions in the window, which are manifested in the difference in grayscale. In terms of deviation, there are three different levels of levels corresponding to pixels in the enlarged window.
因此,对于任意一个像素点所在的窗口内,在窗口内所有像素点中若存在三种等级的像素点,说明在该像素点所在的窗口内可能存在三个不同区域的像素点,则所述任意一个像素点为可能缺陷像素点;若不存在三种等级的像素点,将该窗口按照设定步长进行扩大,若扩大后的窗口内的所有像素点中存在三种等级的像素点,则所述任意一个像素点为可能缺陷像素点,若扩大后的窗口内的所有像素点中不存在三种等级的像素点,说明当前进行判断的像素点不属于缺陷部分只可能是一个噪声点,则所述任意一个像素点为噪声像素点。其中,在本实施例中,设定步长的取值为2,即扩大后的窗口尺寸大小为5*5,实施者可根据实际情况对设定步长的取值进行设置。Therefore, in the window where any pixel is located, if there are three levels of pixels among all the pixels in the window, it means that there may be pixels in three different regions in the window where the pixel is located, then the Any pixel is a possible defective pixel; if there are no three-level pixels, expand the window according to the set step size, and if there are three-level pixels among all the pixels in the expanded window, Then any one of the pixel points is a possible defective pixel point. If there are no three-level pixel points in all the pixel points in the enlarged window, it means that the currently judged pixel point does not belong to the defective part and may only be a noise point. , then any pixel is a noise pixel. Wherein, in this embodiment, the value of the setting step is 2, that is, the size of the enlarged window is 5*5, and the implementer can set the value of the setting step according to the actual situation.
按照上述方法获取可能缺陷像素点后,将各可能缺陷像素点分别作为初始种子点进行区域生长,将区域生长得到的区域记为可能缺陷区域,其中进行区域生长的规则实施者可根据实际情况进行设置,例如像素点的灰度值之间的差值小于设定阈值时进行生长,设定阈值的取值需实施者根据实际情况进行设置。After obtaining possible defective pixels according to the above method, each possible defective pixel is used as an initial seed point for region growth, and the region obtained by region growth is recorded as a possible defect region, and the implementer of the rule for region growth can carry out according to the actual situation Settings, such as growing when the difference between the gray values of pixels is less than the set threshold, the value of the set threshold needs to be set by the implementer according to the actual situation.
步骤三,获取可能缺陷区域的主成分方向所在线段的端点,根据可能缺陷区域对应的端点之间的距离得到非连通性指标,根据非连通性指标和指标阈值确定连通区域,根据连通区域识别复合薄膜的缺陷。Step 3: Obtain the end points of the line segment of the principal component direction of the possible defect area, obtain the non-connectivity index according to the distance between the end points corresponding to the possible defect area, determine the connected area according to the non-connectivity index and the index threshold, and identify the connected area according to Composite Film Defects.
需要说明的是,对于复合薄膜表面存在的褶皱缺陷也可被称为隧道型缺陷,是因为褶皱上凸起部分四通八达,不断汇合或者分叉,进而形成近似于隧道形状的完整的褶皱,也即褶皱在复合薄膜上均是互相连通而存在的,不会存在褶皱部分离散分布。因此,对于任意一个可能缺陷区域,分别分析该可能缺陷区域与其他可能缺陷区域之间的连通性,根据连通性判断该可能缺陷区域为真实缺陷区域的置信程度。It should be noted that the wrinkle defects existing on the surface of the composite film can also be called tunnel-type defects, because the raised parts on the folds extend in all directions, constantly converging or bifurcating, and then forming a complete wrinkle similar to the tunnel shape, that is, Wrinkles are connected to each other on the composite film, and there is no discrete distribution of wrinkled parts. Therefore, for any possible defect region, the connectivity between the possible defect region and other possible defect regions is analyzed respectively, and the degree of confidence that the possible defect region is a real defect region is judged according to the connectivity.
具体地,对各可能缺陷区域进行PCA主成分分析,获得每个可能缺陷区域的主成分方向,获取可能缺陷区域的主成分方向所在线段的两个端点,则这两个端点可以看作可能缺陷区域中褶皱线段的两个端点。Specifically, PCA principal component analysis is performed on each possible defect region to obtain the principal component direction of each possible defect region, and the two endpoints of the line segment where the principal component direction of the possible defect region is obtained, then these two endpoints can be regarded as possible The two endpoints of the wrinkle line segment in the defect area.
由于褶皱缺陷在图像中呈现隧道形状,则存在褶皱缺陷的区域之间是互相连通的,基于此,通过判断可能缺陷区域对应的两个端点分别与其他可能缺陷区域对应的端点之间的距离的远近,进而判断可能缺陷区域与其他可能缺陷区域是否连通。Since the wrinkle defect presents a tunnel shape in the image, the areas with wrinkle defects are connected to each other. Based on this, by judging the distance between the two end points corresponding to the possible defect area and the end points corresponding to other possible defect areas Distance, and then judge whether the possible defect area is connected with other possible defect areas.
基于此,根据可能缺陷区域对应的端点之间的距离得到非连通性指标,将可能缺陷区域对应的两个端点分别与其他可能缺陷区域的端点之间的非连通性指标分别记为第一非连通性指标和第二非连通性指标,即可能缺陷区域对应的两个端点分别对应一个非连通性指标,用公式表示为:Based on this, the non-connectivity index is obtained according to the distance between the endpoints corresponding to the possible defect area, and the non-connectivity index between the two endpoints corresponding to the possible defect area and the endpoints of other possible defect areas is respectively recorded as the first non-connectivity index. The connectivity index and the second non-connectivity index, that is, the two endpoints corresponding to the possible defect area correspond to a non-connectivity index, expressed as:
; ;
其中,表示可能缺陷区域c中第一个端点对应的第一非连通性指标,表示可能缺陷区域c中第二个端点对应的第二非连通性指标,min()表示求最小值的函数。in, Indicates the first non-connectivity index corresponding to the first endpoint in the possible defect area c, Indicates the second non-connectivity index corresponding to the second end point in the possible defect area c, and min() indicates a function for finding the minimum value.
以图像左上角为原点建立以像素点为单位的直角坐标系,像素点的横坐标与纵坐标分别是在其图像中所在的列数与所在行数。和分别表示可能缺陷区域c中第一个端点在复合薄膜图像上的横坐标和纵坐标,和分别表示可能缺陷区域c中第一个端点在该图像上的横坐标和纵坐标,和分别表示其他可能缺陷区域的第k个端点在该图像上的横坐标和纵坐标,和分别表示其他可能缺陷区域的第o个端点在该图像上的横坐标和纵坐标。A Cartesian coordinate system with pixels as the unit is established with the upper left corner of the image as the origin, and the abscissa and ordinate of the pixels are the number of columns and rows in the image respectively. and respectively denote the abscissa and ordinate of the first endpoint in the possible defect region c on the composite film image, and represent the abscissa and ordinate of the first endpoint of the possible defect region c on the image, respectively, and respectively represent the abscissa and ordinate of the kth end point of other possible defect regions on the image, and Respectively represent the abscissa and ordinate of the o-th endpoint of other possible defect regions on the image.
和均表示在当前可能缺陷区域内的端点与其他可能缺陷区域内端点之间的距离的最小值。当不同的可能缺陷区域对应的端点之间的最小距离小于指标阈值时,则说明不同的可能缺陷区域之间存在一定的连通性,需要将其连接起来。也即端点之间的距离的最小值取值越小,说明可能缺陷区域之间的连通性越大,则该可能缺陷区域对应的非连通性指标越小。 and Both represent the minimum value of the distance between the endpoints in the current possible defect region and the endpoints in other possible defect regions. When the minimum distance between the endpoints corresponding to different possible defect regions is less than the index threshold, it indicates that there is a certain connectivity between different possible defect regions, and they need to be connected. That is, the smaller the minimum value of the distance between the endpoints, the greater the connectivity between the possible defect regions, and the smaller the non-connectivity index corresponding to the possible defect regions.
同时,考虑到可能会存在位于边缘的褶皱部分,故需计算各可能缺陷区域对应的两个端点到复合薄膜图像的边缘的最短距离,分别记为第一非边缘性指标和第二非边缘性指标,所述最短距离越小,说明端点距离图像边缘越近,则对应的非边缘性指标的取值越小。At the same time, considering that there may be folds on the edge, it is necessary to calculate the shortest distance from the two endpoints corresponding to each possible defect area to the edge of the composite film image, which are respectively recorded as the first non-edge index and the second non-edge index The smaller the shortest distance, the closer the endpoint is to the edge of the image, and the smaller the value of the corresponding non-edge index.
进一步的,根据非连通性指标和指标阈值确定连通区域,当可能缺陷区域的端点对应的非连通性指标均小于指标阈值时,即该区域的两个端点对应的第一非连通性指标和第二非连通性指标均小于指标阈值,将该可能缺陷区域与非连通性指标小于指标阈值对应的可能缺陷区域连接起来,即将该区域与第一非连通性指标对应端点所在可能缺陷区域进行连接,将该区域与第二非连通性指标对应端点所在可能缺陷区域进行连接,连接后的区域为连通区域。Further, the connected area is determined according to the non-connectivity index and the index threshold. When the non-connectivity index corresponding to the endpoint of the possible defect area is less than the index threshold, that is, the first non-connectivity index and the second non-connectivity index corresponding to the two endpoints of the area The two non-connectivity indexes are both less than the index threshold, and the possible defect area is connected with the possible defect area corresponding to the non-connectivity index less than the index threshold, that is, the area is connected with the possible defect area where the endpoint corresponding to the first non-connectivity index is located, This area is connected with the possible defect area where the endpoint corresponding to the second non-connectivity index is located, and the connected area is a connected area.
当只存在可能缺陷区域的一个端点对应的非连通性指标小于阈值时,计算另一个端点到复合薄膜图像的边缘的最短距离,所述最短距离为端点对应的非边缘性指标,若所述非边缘性指标小于指标阈值,则将该可能缺陷区域与非连通性指标小于阈值对应的可能缺陷区域连接起来,连接后的区域为连通区域,若所述最短距离大于或者等于指标阈值,则将该可能缺陷区域舍去,不进行连接。When there is only the non-connectivity index corresponding to one endpoint of the possible defect region less than the threshold value, calculate the shortest distance from the other endpoint to the edge of the composite film image, the shortest distance is the non-edge index corresponding to the endpoint, if the non- If the marginality index is less than the index threshold, connect the possible defect area with the possible defect area corresponding to the non-connectivity index less than the threshold, and the connected area is a connected area. If the shortest distance is greater than or equal to the index threshold, then the Possibly defective regions are discarded and not connected.
例如,可能缺陷区域的两个端点中,第一个端点对应的第一非连通性指标小于指标阈值,第二个端点对应的第二非连通性指标大于指标阈值,则比较第二个端点对应的第二非边缘性指标与指标阈值的大小,若大于或者等于,则说明该可能缺陷区域可能为离散的区域,故需将其舍去,不进行连接,若小于,则说明该可能缺陷区域一侧与其他可能缺陷区域相连,另一侧靠近图像边缘,故需将该可能缺陷区域与第一非连通性指标对应端点所在可能缺陷区域进行连接。For example, among the two endpoints of the possible defect area, if the first non-connectivity index corresponding to the first endpoint is less than the index threshold, and the second non-connectivity index corresponding to the second endpoint is greater than the index threshold, then compare the corresponding The size of the second non-marginal index and the index threshold, if greater than or equal to, indicates that the possible defect area may be a discrete area, so it needs to be discarded and not connected, if it is less than, it indicates the possible defect area One side is connected to other possible defect areas, and the other side is close to the edge of the image, so the possible defect area needs to be connected to the possible defect area where the endpoint corresponding to the first non-connectivity index is located.
当均不存在可能缺陷区域的端点对应的非连通性指标小于指标阈值时,即该区域的两个端点对应的第一非连通性指标和第二非连通性指标均不小于指标阈值,则说明该可能缺陷区域与其他可能缺陷区域之间均不存在连通性,该可能缺陷区域是离散的区域,将该可能缺陷区域舍去,不进行连接。When the disconnection index corresponding to the endpoints of no possible defect area is less than the index threshold, that is, the first disconnection index and the second disconnection index corresponding to the two endpoints of the area are not less than the index threshold, then it means There is no connectivity between the possible defect region and other possible defect regions, and the possible defect region is a discrete region, so the possible defect region is discarded and not connected.
其中,在本实施例中,指标阈值的取值为4,实施者可根据实际情况进行设置。Wherein, in this embodiment, the value of the index threshold is 4, and the implementer can set it according to the actual situation.
按照上述方法对所有可能缺陷区域进行判断,将需要连接的可能缺陷区域进行连接,所有连接后的区域构成连通区域,根据连通区域对复合薄膜图像进行分割,进而识别复合薄膜的缺陷。在本实施例中,将连通区域内像素点的像素值设置为255,其他像素点的像素值设置为0,进而对复合薄膜图像进行分割,利用分割后的图像进行缺陷识别得到识别结果。其中,对图像进行分割的方法以及对缺陷进行识别的方法均是多种多样的,实施者可根据实际情况进行选择。All possible defect areas are judged according to the above method, and the possible defect areas that need to be connected are connected, and all connected areas form a connected area, and the composite film image is segmented according to the connected area, and then the defects of the composite film are identified. In this embodiment, the pixel values of the pixels in the connected area are set to 255, and the pixel values of other pixels are set to 0, and then the composite film image is segmented, and the segmented image is used for defect recognition to obtain the recognition result. Among them, there are various methods for segmenting images and identifying defects, and implementers can choose according to actual conditions.
需要说明的是,本发明先分析像素点为皱褶区域像素点的可能性,进而生长了可能皱褶连通域,分析了可能皱褶连通域构成隧道的可能性,从而识别出完整的皱褶区域,克服了阈值分割对于灰度差异细微的皱褶无法识别的困难。It should be noted that the present invention first analyzes the possibility that the pixel points are pixels in the wrinkle area, and then grows the possible wrinkle connected domain, and analyzes the possibility that the possible wrinkle connected domain forms a tunnel, thereby identifying the complete wrinkle region, which overcomes the difficulty that threshold segmentation cannot identify wrinkles with subtle grayscale differences.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围,均应包含在本申请的保护范围之内。The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still implement the foregoing embodiments Modifications to the technical solutions recorded in the examples, or equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of each embodiment of the application, and should be included in the scope of the technical solutions of the embodiments of the application. within the scope of protection.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211336527.2A CN115631173B (en) | 2022-10-28 | 2022-10-28 | A Composite Thin Film Defect Identification Method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211336527.2A CN115631173B (en) | 2022-10-28 | 2022-10-28 | A Composite Thin Film Defect Identification Method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115631173A CN115631173A (en) | 2023-01-20 |
CN115631173B true CN115631173B (en) | 2023-04-18 |
Family
ID=84908719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211336527.2A Active CN115631173B (en) | 2022-10-28 | 2022-10-28 | A Composite Thin Film Defect Identification Method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115631173B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116433623B (en) * | 2023-03-31 | 2024-07-19 | 杭州数创自动化控制技术有限公司 | Defect position marking and identifying method, system, equipment and medium |
CN116091499B (en) * | 2023-04-07 | 2023-06-20 | 山东中胜涂料有限公司 | Abnormal paint production identification system |
CN116246174B (en) * | 2023-04-26 | 2023-08-08 | 山东金诺种业有限公司 | Sweet potato variety identification method based on image processing |
CN116228775B (en) * | 2023-05-10 | 2023-07-04 | 实德电气集团有限公司 | Contactor integrity detection method based on machine vision |
CN116858854A (en) * | 2023-09-04 | 2023-10-10 | 季华实验室 | Doping concentration correction method, device, electronic equipment and storage medium |
CN116977335B (en) * | 2023-09-22 | 2023-12-12 | 山东贞元汽车车轮有限公司 | Intelligent detection method for pitting defects on surface of mechanical part |
CN118521584B (en) * | 2024-07-23 | 2025-05-16 | 深圳市永葆利光学有限公司 | High-precision microscopic quality detection method for optical film |
CN118864466B (en) * | 2024-09-25 | 2024-11-29 | 青岛天仁微纳科技有限责任公司 | A method for intelligently identifying surface defects of nanoimprint wafers |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004233222A (en) * | 2003-01-30 | 2004-08-19 | Mitsubishi Heavy Ind Ltd | Inspection device and inspection method of printed matter |
CN115100208A (en) * | 2022-08-26 | 2022-09-23 | 南通三信塑胶装备科技股份有限公司 | Film surface defect evaluation method based on histogram and dynamic light source |
CN115170576A (en) * | 2022-09-09 | 2022-10-11 | 山东中发新材料科技有限公司 | Aluminum pipe surface defect detection method based on machine vision |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3190897B2 (en) * | 1998-10-28 | 2001-07-23 | 大分日本電気株式会社 | Defect inspection device and defect inspection method |
JP4233397B2 (en) * | 2002-10-01 | 2009-03-04 | 株式会社東京精密 | Image defect inspection method, image defect inspection apparatus, and appearance inspection apparatus |
JP2006292503A (en) * | 2005-04-08 | 2006-10-26 | Sumitomo Electric Ind Ltd | Defect inspection method and defect inspection apparatus |
CN103499585B (en) * | 2013-10-22 | 2015-07-29 | 常州工学院 | Based on noncontinuity lithium battery film defect inspection method and the device thereof of machine vision |
CN112651923A (en) * | 2020-11-11 | 2021-04-13 | 北京平恒智能科技有限公司 | Adhesive film wrinkle defect detection method capable of removing fine residues based on area ratio |
CN115100171A (en) * | 2022-07-11 | 2022-09-23 | 常宝云 | Steel die welding defect detection method and system based on machine vision |
CN115131354B (en) * | 2022-08-31 | 2022-11-25 | 江苏森信达生物科技有限公司 | Laboratory plastic film defect detection method based on optical means |
CN115170572B (en) * | 2022-09-08 | 2022-11-08 | 山东瑞峰新材料科技有限公司 | BOPP composite film surface gluing quality monitoring method |
-
2022
- 2022-10-28 CN CN202211336527.2A patent/CN115631173B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004233222A (en) * | 2003-01-30 | 2004-08-19 | Mitsubishi Heavy Ind Ltd | Inspection device and inspection method of printed matter |
CN115100208A (en) * | 2022-08-26 | 2022-09-23 | 南通三信塑胶装备科技股份有限公司 | Film surface defect evaluation method based on histogram and dynamic light source |
CN115170576A (en) * | 2022-09-09 | 2022-10-11 | 山东中发新材料科技有限公司 | Aluminum pipe surface defect detection method based on machine vision |
Also Published As
Publication number | Publication date |
---|---|
CN115631173A (en) | 2023-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115631173B (en) | A Composite Thin Film Defect Identification Method | |
CN115578389B (en) | Defect detection method of groove MOS device | |
CN103871053B (en) | Vision conspicuousness-based cloth flaw detection method | |
CN109242853B (en) | An intelligent detection method for PCB defects based on image processing | |
Yu et al. | Automatic grading of apples based on multi-features and weighted K-means clustering algorithm | |
CN114419025A (en) | Fiberboard quality evaluation method based on image processing | |
CN108181316B (en) | Bamboo strip defect detection method based on machine vision | |
Lu et al. | Histogram-based automatic thresholding for bruise detection of apples by structured-illumination reflectance imaging | |
CN107346545A (en) | Improved confinement growing method for the segmentation of optic cup image | |
CN115861317B (en) | Plastic mold production defect detection method based on machine vision | |
CN113362306A (en) | Packaged chip defect detection method based on deep learning | |
CN115049669A (en) | Metal defect identification method | |
CN115511842A (en) | A method for detecting cable insulation skin damage based on machine vision | |
CN108615239B (en) | Tongue Image Segmentation Method Based on Thresholding Technique and Grayscale Projection | |
CN104599271A (en) | CIE Lab color space based gray threshold segmentation method | |
CN103364410A (en) | Crack detection method of hydraulic concrete structure underwater surface based on template search | |
CN114897896A (en) | Building wood defect detection method based on gray level transformation | |
CN106355599A (en) | Non-fluorescent eye fundus image based automatic segmentation method for retinal blood vessels | |
CN108038838A (en) | A kind of cotton fibriia species automatic testing method and system | |
CN116703894B (en) | Lithium battery diaphragm quality detection system | |
CN117830312B (en) | Alloy crack nondestructive testing method based on machine vision | |
CN114119603A (en) | Image processing-based snack box short shot defect detection method | |
CN115511907B (en) | Scratch detection method for LED screen | |
CN114155202A (en) | Thyroid nodule ultrasound image classification method based on feature fusion and transfer learning | |
CN118762246A (en) | An intelligent classification method for ENT lesion images |
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 |