CN114782451B - Workpiece defect detection method and device, electronic equipment and readable storage medium - Google Patents
Workpiece defect detection method and device, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN114782451B CN114782451B CN202210715388.8A CN202210715388A CN114782451B CN 114782451 B CN114782451 B CN 114782451B CN 202210715388 A CN202210715388 A CN 202210715388A CN 114782451 B CN114782451 B CN 114782451B
- Authority
- CN
- China
- Prior art keywords
- workpiece
- polarization
- information
- light intensity
- defect detection
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
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
- 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/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/21—Polarisation-affecting properties
-
- 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
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Biochemistry (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- General Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Signal Processing (AREA)
- Quality & Reliability (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本申请涉及工业检测领域,尤其涉及一种工件缺陷检测方法、装置、电子设备及可读存储介质。The present application relates to the field of industrial inspection, and in particular, to a method, device, electronic device and readable storage medium for workpiece defect detection.
背景技术Background technique
随着工业检测的不断发展,工件缺陷检测技术的应用也越来越广泛,机械工件在加工时会因碰撞刮擦以及工艺自身等原因产生各种缺陷,工件的缺陷会影响一些精密机器的使用,因此需要对工件缺陷进行检测。目前,工厂中检测这些缺陷的方法主要是光电式非接触式检测,例如采用工业相机和智能算法配合识别工件缺陷,但工厂洁净度较低,加工冷却液和机油等液体会污染工件,从而工件表面的污渍和缺陷在图像中无法分辨,导致工件缺陷检测准确度偏低。With the continuous development of industrial inspection, the application of workpiece defect detection technology has become more and more extensive. Mechanical workpieces will have various defects during processing due to collisions, scratches and the process itself. The defects of workpieces will affect the use of some precision machines. , so it is necessary to detect workpiece defects. At present, the method of detecting these defects in the factory is mainly photoelectric non-contact inspection, such as using industrial cameras and intelligent algorithms to identify workpiece defects, but the cleanliness of the factory is low, and liquids such as processing coolant and oil will contaminate the workpiece, thereby causing the workpiece The stains and defects on the surface cannot be distinguished in the image, resulting in low accuracy of workpiece defect detection.
发明内容SUMMARY OF THE INVENTION
本申请的主要目的在于提供一种工件缺陷检测方法、装置、电子设备及可读存储介质,旨在解决工件缺陷检测准确度低的技术问题。The main purpose of the present application is to provide a workpiece defect detection method, device, electronic device and readable storage medium, which aims to solve the technical problem of low workpiece defect detection accuracy.
为实现上述目的,本申请提供一种工件缺陷检测方法,所述工件缺陷检测方法包括:In order to achieve the above purpose, the present application provides a workpiece defect detection method, the workpiece defect detection method includes:
获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息;Obtaining the polarized light intensity information of the workpiece to be measured, and determining the total light intensity information, the corresponding polarization degree information and the corresponding polarization angle information corresponding to the workpiece to be tested according to the polarized light intensity information;
对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像;Weighted aggregation is performed on the total light intensity information, the polarization degree information and the polarization angle information to obtain a workpiece polarization characteristic image;
对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息;Performing workpiece edge contour detection on the workpiece polarization feature image to obtain edge contour feature information;
依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果。According to the edge profile feature information, workpiece defect detection is performed on the workpiece to be tested, and a workpiece defect detection result is obtained.
本申请还提供一种工件缺陷检测装置,所述工件缺陷检测装置应用于工件缺陷检测设备,所述工件缺陷检测装置包括:The application also provides a workpiece defect detection device, the workpiece defect detection device is applied to workpiece defect detection equipment, and the workpiece defect detection device includes:
光强获取模块,用于获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息;The light intensity acquisition module is used to obtain the polarized light intensity information of the workpiece to be tested, and according to the polarized light intensity information, determine the total light intensity information, the corresponding polarization degree information and the corresponding polarization angle information corresponding to the workpiece to be tested;
加权聚合模块,用于对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像;a weighted aggregation module for performing weighted aggregation on the total light intensity information, the polarization degree information and the polarization angle information to obtain a workpiece polarization characteristic image;
轮廓检测模块,用于对所述待测工件偏振图像信息中的特征图像矩阵进行轮廓检测,得到边缘轮廓特征信息;a contour detection module, configured to perform contour detection on the feature image matrix in the polarization image information of the workpiece to be tested to obtain edge contour feature information;
缺陷检测模块,用于依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果。The defect detection module is configured to perform workpiece defect detection on the workpiece to be tested according to the edge profile feature information, and obtain a workpiece defect detection result.
本申请还提供一种电子设备,所述电子设备为实体设备,所述电子设备包括:存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的所述工件缺陷检测方法的程序,所述工件缺陷检测方法的程序被处理器执行时可实现如上述的工件缺陷检测方法的步骤。The present application also provides an electronic device, the electronic device is a physical device, and the electronic device includes: a memory, a processor, and the workpiece defect detection method stored on the memory and executable on the processor The program of the workpiece defect detection method can realize the steps of the workpiece defect detection method as described above when the program of the workpiece defect detection method is executed by the processor.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有实现工件缺陷检测方法的程序,所述工件缺陷检测方法的程序被处理器执行时实现如上述的工件缺陷检测方法的步骤。The present application also provides a computer-readable storage medium, where a program for implementing the workpiece defect detection method is stored on the computer-readable storage medium, and when the program of the workpiece defect detection method is executed by a processor, the above-mentioned workpiece defect detection is realized steps of the method.
本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述的工件缺陷检测方法的步骤。The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned workpiece defect detection method when the computer program is executed by a processor.
本申请提供了一种工件缺陷检测方法、装置、电子设备及可读存储介质,首先获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息,再对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像,其中,由于所述总光强信息、所述偏振度信息以及所述偏振角信息均为光学偏振信息,不受工件表面污渍干扰,从而所述工件偏振特征图像可以反应不受工件表面污渍干扰的真实表面轮廓信息,从而依据工件偏振特征图像,对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息,依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果,可实现依据不受工件表面污渍干扰的真实表面轮廓信息进行工件缺陷检测的目的,所以克服了加工冷却液和机油等液体会污染工件,从而工件表面的污渍和缺陷在图像中无法分辨,导致工件缺陷检测准确度偏低的技术缺陷,提高了工件缺陷检测的准确度。The present application provides a workpiece defect detection method, device, electronic device and readable storage medium. First, the polarized light intensity information of the workpiece to be tested is obtained, and the total light intensity information corresponding to the workpiece to be tested is determined according to the polarized light intensity information. , the corresponding polarization degree information and the corresponding polarization angle information, and then weighted aggregation is performed on the total light intensity information, the polarization degree information and the polarization angle information to obtain a workpiece polarization characteristic image, wherein, due to the total light intensity The intensity information, the polarization degree information and the polarization angle information are all optical polarization information, which are not disturbed by stains on the surface of the workpiece, so that the polarization characteristic image of the workpiece can reflect the real surface profile information that is not disturbed by the stains on the surface of the workpiece. The polarization feature image of the workpiece, the workpiece edge contour detection is performed on the workpiece polarization feature image, and the edge contour feature information is obtained. According to the edge contour feature information, the workpiece defect detection is performed on the workpiece to be tested, and the workpiece defect detection result is obtained, which can be To achieve the purpose of detecting workpiece defects based on the real surface profile information that is not disturbed by the surface stains of the workpiece, it overcomes the fact that liquids such as machining coolant and oil will contaminate the workpiece, so that the stains and defects on the surface of the workpiece cannot be distinguished in the image, resulting in workpiece defects. Detecting technical defects with low accuracy improves the accuracy of workpiece defect detection.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description serve to explain the principles of the application.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. In other words, on the premise of no creative labor, other drawings can also be obtained from these drawings.
图1为本申请工件缺陷检测方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of a workpiece defect detection method of the present application;
图2为本申请工件缺陷检测方法第一实施例中步骤S30中的偏导数算子示意图;2 is a schematic diagram of the partial derivative operator in step S30 in the first embodiment of the workpiece defect detection method of the present application;
图3为本申请实施例中工件缺陷检测方法涉及的硬件运行环境的设备结构示意图。FIG. 3 is a schematic diagram of a device structure of a hardware operating environment involved in a workpiece defect detection method according to an embodiment of the present application.
本申请目的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional features and advantages of the present application will be further described with reference to the accompanying drawings in conjunction with the embodiments.
具体实施方式Detailed ways
为使本发明的上述目的、特征和优点能够更加明显易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其它实施例,均属于本发明保护的范围。In order to make the above objects, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present invention.
实施例一Example 1
机械工件在加工时会因碰撞刮擦以及工艺自身等原因产生各种缺陷,工件的缺陷会影响一些精密机器的使用,因此需要对工件进行检测。目前在进行工件缺陷检测时,主要采用工业相机和智能算法配合识别工件缺陷,但由于工厂洁净度较低,加工冷却液和机油等液体会污染工件,从而工件表面的污渍和缺陷在图像中无法分辨,导致工件缺陷检测准确度偏低。Mechanical workpieces will have various defects during processing due to collisions, scratches and the process itself. The defects of the workpiece will affect the use of some precision machines, so the workpiece needs to be inspected. At present, when detecting workpiece defects, industrial cameras and intelligent algorithms are mainly used to identify workpiece defects. However, due to the low cleanliness of the factory, liquids such as machining coolant and oil will contaminate the workpiece, so the stains and defects on the surface of the workpiece cannot be seen in the image. Discrimination, resulting in low accuracy of workpiece defect detection.
本申请实施例提供一种工件缺陷检测方法,在本申请工件缺陷检测方法的第一实施例中,参照图1,所述工件缺陷检测方法包括:An embodiment of the present application provides a workpiece defect detection method. In the first embodiment of the workpiece defect detection method of the present application, referring to FIG. 1 , the workpiece defect detection method includes:
步骤S10,获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息;Step S10, obtaining polarized light intensity information of the workpiece to be measured, and determining the total light intensity information, corresponding polarization degree information and corresponding polarization angle information corresponding to the workpiece to be measured according to the polarized light intensity information;
在本实施例中,需要说明的是,所述偏振光强信息至少包括水平、倾斜以及垂直方向的光强分量中的一种,确定所述总光强信息、所述偏振度信息以及所述偏振角信息的方法可以通过斯托克斯参量表达式和偏振度和偏振角对应的定义表达式来计算,所述总光强信息包括工件总光强,所述偏振度信息包括工件偏振度,所述工件偏振角信息包括工件偏振角。In this embodiment, it should be noted that the polarized light intensity information includes at least one of horizontal, oblique, and vertical light intensity components, and the total light intensity information, the polarization degree information, and the The method of the polarization angle information can be calculated by the Stokes parameter expression and the definition expression corresponding to the polarization degree and the polarization angle, the total light intensity information includes the total light intensity of the workpiece, and the polarization degree information includes the polarization degree of the workpiece, The workpiece polarization angle information includes the workpiece polarization angle.
作为一种示例,步骤S10包括:通过偏振成像系统采集水平偏振方向光强、倾斜偏振方向光强以及垂直偏振方向光强;根据斯托克斯参量表达式、所述水平偏振方向光强、倾斜偏振方向光强以及垂直偏振方向光强,计算得到所述工件总光强、所述水平线偏振方向光强分量以及所述倾斜线偏振方向光强分量;再根据所述工件总光强、所述水平线偏振方向光强分量以及所述倾斜线偏振方向光强分量,计算得到所述工件偏振度以及所述工件偏振角。As an example, step S10 includes: collecting the light intensity in the horizontal polarization direction, the light intensity in the oblique polarization direction, and the light intensity in the vertical polarization direction by using a polarization imaging system; The light intensity in the polarization direction and the light intensity in the vertical polarization direction are calculated to obtain the total light intensity of the workpiece, the light intensity component in the horizontal linear polarization direction, and the light intensity component in the oblique linear polarization direction; The light intensity component in the horizontal linear polarization direction and the light intensity component in the oblique linear polarization direction are calculated to obtain the polarization degree of the workpiece and the polarization angle of the workpiece.
在本实施例中,需要说明的是,所述水平偏振方向光强分量、倾斜偏振方向光强分量以及垂直线偏振方向光强分量为各所述线偏振方向的光强矢量,所述水平线偏振方向光强分量为光的振动面只限于水平方向的光强矢量,所述倾斜线偏振方向光强分量为光的振动面只限于倾斜方向的光强矢量,所述垂直线偏振方向光强分量为光的振动面只限于垂直方向的光强矢量。In this embodiment, it should be noted that the light intensity component in the horizontal polarization direction, the light intensity component in the oblique polarization direction, and the light intensity component in the vertical linear polarization direction are the light intensity vectors of each of the linear polarization directions, and the horizontal linear polarization direction The directional light intensity component is the light intensity vector whose vibration plane is limited to the horizontal direction, the light intensity component in the oblique linear polarization direction is the light intensity vector whose vibration plane is limited to the oblique direction, and the vertical linear polarization direction light intensity component The vibration plane of light is limited to the light intensity vector in the vertical direction.
其中,所述依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息的步骤包括:Wherein, the step of determining the total light intensity information corresponding to the workpiece to be measured, the corresponding polarization degree information and the corresponding polarization angle information according to the polarized light intensity information includes:
步骤S11,根据各所述预设偏振方向的光强,确定所述待测工件对应的总光强信息、水平线偏振方向光强分量以及倾斜线偏振方向光强分量;Step S11, according to the light intensity of each preset polarization direction, determine the total light intensity information, the horizontal linear polarization direction light intensity component and the oblique linear polarization direction light intensity component corresponding to the workpiece to be tested;
步骤S12,根据所述水平线偏振方向光强分量以及所述倾斜线偏振方向光强分量,确定所述偏振度信息和所述偏振角信息。Step S12: Determine the polarization degree information and the polarization angle information according to the light intensity component in the horizontal linear polarization direction and the light intensity component in the oblique linear polarization direction.
在本实施例中,作为一种示例,所述预设偏振方向可以为水平、倾斜、反倾斜以及垂直四个方向中的一种或者多种,各所述预设偏振方向的光强为各所述预设偏振方向的偏振片透光轴透射光强度。In this embodiment, as an example, the preset polarization direction may be one or more of four directions of horizontal, oblique, reverse oblique, and vertical, and the light intensity of each preset polarization direction is each The light intensity transmitted by the light transmission axis of the polarizer in the preset polarization direction.
作为一种示例,步骤S11至步骤S12包括:计算所述光强分量中的水平偏振方向光强和垂直偏振方向光强的和,得到所述工件总光强;计算所述光强分量中的水平偏振方向光强和垂直偏振方向光强的差,得到所述水平线偏振方向光强分量;通过对所述倾斜线偏振方向光强分量的表达式的化简,根据所述光强分量中的倾斜偏振方向光强、所述水平方向偏振光强以及所述垂直偏振方向光强求值可以转换为根据所述倾斜偏振方向光强和所述反倾斜偏振方向光强求值,计算所述倾斜偏振方向光强和反倾斜偏振方向光强的差,得到所述倾斜线偏振方向光强分量;根据所述水平线偏振方向光强分量、所述倾斜线偏振方向光强分量以及所述工件总光强,计算得到所述工件偏振度;根据所述水平线偏振方向光强分量和所述倾斜线偏振方向光强分量,计算得到所述工件偏振角。As an example, steps S11 to S12 include: calculating the sum of the light intensity in the horizontal polarization direction and the light intensity in the vertical polarization direction in the light intensity component to obtain the total light intensity of the workpiece; calculating the light intensity in the light intensity component The difference between the light intensity in the horizontal polarization direction and the light intensity in the vertical polarization direction is to obtain the light intensity component in the horizontal linear polarization direction ; by simplifying the expression of the light intensity component in the oblique linear polarization direction, according to the The evaluation of the light intensity in the oblique polarization direction, the light intensity in the horizontal direction, and the light intensity in the vertical polarization direction can be converted into the evaluation of the light intensity in the oblique polarization direction and the light intensity in the reverse oblique polarization direction, and the oblique polarization direction is calculated. The difference between the light intensity and the light intensity in the reverse oblique polarization direction is to obtain the light intensity component in the oblique linear polarization direction; according to the horizontal linear polarization direction light intensity component , the light intensity component in the oblique linear polarization direction and the total light intensity of the workpiece, The degree of polarization of the workpiece is obtained by calculation; the polarization angle of the workpiece is obtained by calculation according to the light intensity component in the horizontal linear polarization direction and the light intensity component in the oblique linear polarization direction.
在本实施例中,需要说明的是,所述水平偏振方向可以为0°偏振方向,所述垂直偏振方向可以为90°偏振方向,所述倾斜偏振方向可以为45°偏振方向,所述反倾斜偏振方向可以为-45°偏振方向。In this embodiment, it should be noted that the horizontal polarization direction may be a 0° polarization direction, the vertical polarization direction may be a 90° polarization direction, the oblique polarization direction may be a 45° polarization direction, and the reverse polarization direction may be a 45° polarization direction. The oblique polarization direction may be the -45° polarization direction.
作为一种示例,所述根据所述水平线偏振方向光强分量、所述倾斜线偏振方向光强分量以及所述工件总光强,计算得到所述工件偏振度的步骤包括:计算所述水平线偏振方向光强分量的平方与所述倾斜线偏振方向光强分量的平方和,再计算所述平方和的算术平方根,求所述算术平方根与所述总光强的比值,得到所述工件偏振度。As an example, the step of calculating the degree of polarization of the workpiece according to the light intensity component in the horizontal linear polarization direction, the light intensity component in the oblique linear polarization direction, and the total light intensity of the workpiece includes: calculating the horizontal linear polarization The square of the directional light intensity component and the square sum of the light intensity component in the oblique linearly polarized direction, then calculate the arithmetic square root of the square sum, and find the ratio of the arithmetic square root to the total light intensity to obtain the workpiece polarization degree .
作为一种示例,所述根据所述水平线偏振方向光强分量和所述倾斜线偏振方向光强分量,计算得到所述工件偏振角的步骤包括:计算所述倾斜线偏振方向光强分量与水平线偏振方向光强分量的比值,取所述比值的反正切函数值,再计算所述反正切函数值的一半,得到所述工件偏振角。As an example, the step of calculating the polarization angle of the workpiece according to the light intensity component in the horizontal linear polarization direction and the light intensity component in the oblique linear polarization direction includes: calculating the light intensity component in the oblique linear polarization direction and the horizontal line For the ratio of the light intensity components in the polarization direction, the arc tangent function value of the ratio is taken, and then half of the arc tangent function value is calculated to obtain the workpiece polarization angle.
作为一种示例,计算所述总光强、所述水平线偏振方向光强分量以及所述倾斜线偏振方向光强分量相关表达式如下:As an example, the related expressions for calculating the total light intensity, the light intensity component in the horizontal linear polarization direction, and the light intensity component in the oblique linear polarization direction are as follows:
其中,I为总光强,Q为水平线偏振方向光强分量,U为倾斜线偏振方向光强分量,为水平方向的偏振片透光轴透射光强度,为倾斜方向的偏振片透光轴透射光强度,为垂直方向的偏振片透光轴透射光强度,通过化简,上式可以写成:Among them, I is the total light intensity, Q is the light intensity component in the horizontal linear polarization direction, U is the light intensity component in the oblique linear polarization direction, is the transmitted light intensity along the transmission axis of the polarizer in the horizontal direction, is the transmitted light intensity of the polarizer transmission axis in the inclined direction, is the transmitted light intensity of the transmission axis of the polarizer in the vertical direction. By simplification, the above formula can be written as:
作为一种示例,计算所述偏振度和所述偏振角相关表达式如下:As an example, the expression related to calculating the polarization degree and the polarization angle is as follows:
其中为所述工件偏振度,为所述工件偏振角。in is the polarization degree of the workpiece, is the polarization angle of the workpiece.
步骤S20,对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像;Step S20, performing weighted aggregation on the total light intensity information, the polarization degree information and the polarization angle information to obtain a workpiece polarization characteristic image;
在本实施例中,需要说明的是,所述工件偏振特征图像是用于表征所述待测工件的表面特征信息的伪彩图。In this embodiment, it should be noted that the polarization feature image of the workpiece is a pseudo-color image used to represent the surface feature information of the workpiece to be tested.
作为一种示例,步骤S20包括:将所述工件总光强、所述工件偏振度以及所述工件偏振角分别以对应的权重进行加权聚合,得到所述工件偏振特征图像包含的信息。As an example, step S20 includes: weighted aggregation of the total light intensity of the workpiece, the polarization degree of the workpiece, and the polarization angle of the workpiece with corresponding weights, respectively, to obtain information contained in the polarization characteristic image of the workpiece.
其中,所述对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像的步骤包括;Wherein, the described total light intensity information, the polarization degree information and the polarization angle information are weighted and aggregated, and the step of obtaining the polarization characteristic image of the workpiece includes;
步骤S21,获取权重系数,其中,所述权重系数根据所述待测工件的材料类型确定;Step S21, obtaining a weight coefficient, wherein, the weight coefficient is determined according to the material type of the workpiece to be measured;
步骤S22,依据所述权重系数,对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像。Step S22, according to the weight coefficient, weighted aggregation is performed on the total light intensity information, the polarization degree information, and the polarization angle information to obtain a polarization characteristic image of the workpiece.
作为一种示例,步骤S21至步骤S22包括:根据所述待测工件的材料类型确定权重系数,所述权重系数包括所述工件总光强、所述工件偏振度以及所述工件偏振角分别对应的权重系数,将所述工件总光强、所述工件偏振度以及所述工件偏振角分别与对应的权重系数的积作为所述特征图像矩阵的元素,形成工件偏振特征图像矩阵,根据所述工件偏振特征图像矩阵,得到所述工件偏振特征图像。As an example, steps S21 to S22 include: determining a weighting coefficient according to the material type of the workpiece to be tested, where the weighting coefficient includes the total light intensity of the workpiece, the polarization degree of the workpiece, and the polarization angle of the workpiece corresponding to The weighting coefficient of the workpiece, the product of the total light intensity of the workpiece, the polarization degree of the workpiece and the polarization angle of the workpiece and the corresponding weighting coefficient are respectively used as the elements of the feature image matrix to form the workpiece polarization feature image matrix, according to the The polarization characteristic image matrix of the workpiece is obtained, and the polarization characteristic image of the workpiece is obtained.
作为一种示例,计算所述工件偏振特征图像矩阵的表达式如下:As an example, the expression for calculating the polarization characteristic image matrix of the workpiece is as follows:
其中,为所述工件偏振特征图像对应的矩阵,分别为所述总光强、所述工件偏振度以及所述工件偏振角的对应的权重系数,“*”为点乘符号。in, is the matrix corresponding to the polarization characteristic image of the workpiece, are the total light intensity , the workpiece polarization degree and the workpiece polarization angle The corresponding weight coefficient of , "*" is the symbol of dot product.
在所述对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像的步骤之前,还包括:Before the step of performing weighted aggregation on the total light intensity information, the polarization degree information and the polarization angle information to obtain the polarization characteristic image of the workpiece, the method further includes:
步骤A10,获取目标测量体对应的材质偏振光强信息,根据所述材质偏振光强信息确定材质总光强信息、材质偏振度信息以及材质偏振角信息,所述目标测量体和所述待测工件所属的材料类型一致;Step A10: Obtain the material polarized light intensity information corresponding to the target measurement body, and determine the material total light intensity information, material polarization degree information, and material polarization angle information according to the material polarized light intensity information, the target measurement body and the material to be measured. The material type to which the workpiece belongs is the same;
步骤A20,分析所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息三者分别与所述目标测量体的表面特征的敏感度;Step A20, analyzing the sensitivity of the total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material to the surface features of the target measurement body, respectively;
步骤A30,根据各所述敏感度,确定所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息分别对应的权重系数。Step A30, according to each of the sensitivities, determine the weight coefficients corresponding to the total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material respectively.
在本实施例中,需要说明的是,所述目标测量体可以为平面板材,也可以为具有一定形状轮廓的工件,所述敏感度为所述目标测量体表面的材质、纹理、形变、平整度等特征的变化对于所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息的变化敏感度,所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息用于表征所述目标测量体的表面特征。In this embodiment, it should be noted that the target measurement body may be a flat plate or a workpiece with a certain shape and outline, and the sensitivity is the material, texture, deformation, and smoothness of the surface of the target measurement body. The change of characteristics such as degree is sensitive to the change of the total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material, the total light intensity information of the material, the polarization degree information of the material, and the material polarization information. The polarization angle information is used to characterize the surface features of the target measurement body.
作为一种示例,步骤A10至步骤A30包括:通过偏振成像系统采集目标测量体对应的偏振光强信息,并确定对应的材质总光强信息、材质偏振度信息以及材质偏振角信息,具体步骤与步骤S10中类似,在此不做赘述;获取至少一个与目标测量体同材质且不同表面特征的测量体对应的材质偏振光强信息,并确定对应的参考总光强信息、参考偏振度信息以及参考偏振角信息。通过计算所述参考总光强信息、所述参考偏振度信息以及所述参考偏振角信息相对于对应的所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息的变化幅值,根据计算各所述变化幅值与对应的所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息之间的比值,得到变化比例,计算所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息对应的变化比例之间的比值,得到各权重系数,各所述权重系数的和为1。As an example, steps A10 to A30 include: collecting polarized light intensity information corresponding to the target measurement body through a polarization imaging system, and determining the corresponding total light intensity information, material polarization degree information, and material polarization angle information. The specific steps are as follows: Step S10 is similar, and will not be repeated here; obtain at least one material polarized light intensity information corresponding to a measurement body of the same material as the target measurement body but with different surface features, and determine the corresponding reference total light intensity information, reference polarization degree information and Refer to polarization angle information. By calculating the changes of the reference total light intensity information, the reference polarization degree information, and the reference polarization angle information relative to the corresponding material total light intensity information, the material polarization degree information, and the material polarization angle information Amplitude, according to calculating the ratio between each of the change amplitudes and the corresponding total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material, the change ratio is obtained, and the total light intensity of the material is calculated. Each weight coefficient is obtained from the ratio between the intensity information, the material polarization degree information, and the change ratio corresponding to the material polarization angle information, and the sum of the weight coefficients is 1.
步骤S30,对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息;Step S30, performing workpiece edge contour detection on the workpiece polarization feature image to obtain edge contour feature information;
在本实施例中,需要说明的是,对所述工件偏振特征图像进行轮廓检测的方法具体可以采用canny边缘检测算法,所述边缘轮廓特征信息可以为已完成边缘增强的灰度图像。In this embodiment, it should be noted that the method for performing contour detection on the polarization feature image of the workpiece may specifically use a canny edge detection algorithm, and the edge contour feature information may be a grayscale image that has completed edge enhancement.
作为一种示例,步骤S30包括:将所述工件偏振特征图像进行灰度化,得到第一偏振综合图像,对所述第一偏振综合图像进行滤波处理,得到第二偏振综合图像;提取所述第二偏振综合图像中各像素点的梯度幅值与方向,得到各像素点梯度值和各像素点方向;根据所述第二偏振综合图像对应的图像梯度信息,对所述第二偏振综合图像进行非极大值抑制,以消除边缘检测带来的杂散响应,得到第三偏振综合图像;对所述第三偏振综合图像进行双阈值检测,并在所述第三偏振综合图像中完成边缘拟合,得到所述边缘轮廓特征信息,以完成偏振综合图像边缘增强。As an example, step S30 includes: graying the polarization characteristic image of the workpiece to obtain a first polarization integrated image, filtering the first polarization integrated image to obtain a second polarization integrated image; extracting the The gradient magnitude and direction of each pixel point in the second polarization integrated image are obtained, and the gradient value of each pixel point and the direction of each pixel point are obtained; according to the image gradient information corresponding to the second polarization integrated image, the second polarization integrated image Perform non-maximum suppression to eliminate spurious responses brought by edge detection, and obtain a third polarization integrated image; perform double-threshold detection on the third polarization integrated image, and complete the edge in the third polarization integrated image Fitting to obtain the edge contour feature information, so as to complete the polarization integrated image edge enhancement.
其中,所述对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息的步骤包括:Wherein, the step of performing workpiece edge contour detection on the workpiece polarization feature image to obtain edge contour feature information includes:
步骤S31,将所述工件偏振特征图像进行灰度化处理,得到第一偏振综合图像;Step S31, performing grayscale processing on the polarization characteristic image of the workpiece to obtain a first polarization comprehensive image;
步骤S32,对所述第一偏振综合图像进行滤波处理,得到第二偏振综合图像;Step S32, filtering the first polarization integrated image to obtain a second polarization integrated image;
步骤S33,依据所述第二偏振综合图像对应的图像梯度信息,对所述第二偏振综合图像进行非极大值抑制,得到第三偏振综合图像;Step S33, according to the image gradient information corresponding to the second polarization integrated image, non-maximum suppression is performed on the second polarization integrated image to obtain a third polarization integrated image;
步骤S34,对所述第三偏振综合图像进行双阈值检测,得到双阈值检测结果;Step S34, performing double-threshold detection on the third polarization integrated image to obtain a double-threshold detection result;
步骤S35,根据所述双阈值检测结果,在所述第三偏振综合图像中拟合所述待测工件的边缘轮廓,得到所述边缘轮廓特征信息。Step S35, according to the double-threshold detection result, fit the edge contour of the workpiece to be tested in the third polarization integrated image to obtain the edge contour feature information.
在本实施例中,需要说明的是,所述灰度化处理是将多种颜色像素点组成伪彩图转换为每个像素点只有一个值用于表示颜色深度的灰度图,所述滤波可以采用高斯滤波器,用于平滑图像,滤除噪声,所述像素点梯度幅值是指每个像素点与它相邻的各方向的邻域点的颜色深度差,所述非极大值抑制是指寻找像素点局部最大值,即消除非最大值,用于消除边缘检测带来的不可滤除的噪声,所述双阈值检测结果是指确定的高阈值和低阈值。In this embodiment, it should be noted that the grayscale processing is to convert a pseudo-color image composed of pixels of multiple colors into a grayscale image in which each pixel has only one value to represent the color depth, and the filter A Gaussian filter can be used to smooth the image and filter out noise. The gradient magnitude of the pixel point refers to the color depth difference between each pixel point and its neighbors in all directions. The non-maximum value Suppression refers to finding the local maximum value of a pixel point, that is, eliminating non-maximum values, for eliminating the non-filterable noise brought by edge detection, and the double-threshold detection result refers to the determined high threshold and low threshold.
作为一种示例,步骤S31至步骤S34包括:根据所述工件偏振特征图像中各像素点与各参量的映射关系,得到所述特征图像矩阵伪彩图中的每个像素点对应的灰度值,以将所述工件偏振特征图像转换为所述第一偏振综合图像,所述第一偏振综合图像是灰度图像;通过高斯滤波器,对所述第一偏振综合图像进行滤波处理,以完成滤波去噪,得到高斯滤波结果,并根据所述高斯滤波结果,得到所述第二偏振综合图像;根据所述各像素点梯度幅值和方向,对所述第二偏振综合图像进行极大值抑制,得到所述第三偏振综合图像;对所述第三偏振综合图像进行双阈值检测,从各所述像素点梯度幅值中选取一梯度幅值作为高阈值,获取预设比例,根据所述预设比例和所述高阈值,得到低阈值。As an example, steps S31 to S34 include: obtaining a grayscale value corresponding to each pixel in the feature image matrix pseudo-color image according to the mapping relationship between each pixel and each parameter in the workpiece polarization feature image , to convert the polarization characteristic image of the workpiece into the first polarization integrated image, which is a grayscale image; filter the first polarization integrated image through a Gaussian filter to complete Filtering and denoising to obtain a Gaussian filtering result, and obtaining the second polarization comprehensive image according to the Gaussian filtering result; performing a maximum value on the second polarization comprehensive image according to the gradient amplitude and direction of each pixel point Suppression to obtain the third polarization integrated image; double-threshold detection is performed on the third polarization integrated image, a gradient amplitude is selected from the gradient amplitudes of each pixel point as a high threshold, and a preset ratio is obtained, according to the The preset ratio and the high threshold are used to obtain a low threshold.
作为一种示例,所述根据所述工件偏振特征图像中各像素点与各参量的映射关系,得到所述特征图像矩阵伪彩图中的每个像素点对应的灰度值的步骤包括:将所述工件总光强、所述工件偏振度以及所述工件偏振角分别与对应的权重系数的积分别代入灰度化公式,得到各所述像素点的灰度值,进而得到所述所述第一偏振综合图像。As an example, the step of obtaining the gray value corresponding to each pixel in the feature image matrix pseudo-color image according to the mapping relationship between each pixel and each parameter in the workpiece polarization feature image includes: The product of the total light intensity of the workpiece, the polarization degree of the workpiece, and the polarization angle of the workpiece and the corresponding weight coefficients are respectively substituted into the grayscale formula to obtain the grayscale value of each pixel, and then the said First polarized composite image.
作为一种示例,各所述像素点可以为,其中“*”为点乘符号,计算各所述像素点灰度值的表达式如下:As an example, each of the pixel points may be , where "*" is the dot product symbol, and the expression for calculating the gray value of each pixel point is as follows:
其中为灰度值,其中的分别为彩色图像的三通道,通过将分别代入所述灰度化公式中的,计算得到所述第一偏振综合图像中各像素点的灰度值。in is the gray value, where are the three channels of the color image, respectively, by combining Substitute into the grayscale formula respectively , and calculate the gray value of each pixel in the first polarization integrated image.
作为一种示例,所述通过高斯滤波器,对所述第一偏振综合图像进行滤波处理,以完成滤波去噪,得到高斯滤波结果的步骤包括:选取一块矩形区域,本实施例中选取的是3*3的像素点图,以所述像素点图的中心点为原点,计算各像素点横纵坐标与原点横纵坐标的差值的平方值,再计算各所述像素点横纵坐标的方差的平方二倍值,求各所述像素横纵坐标对应的平方值分别与对应的二倍值的比值,得到各所述像素横纵坐标对应的比值之和,然后取所述比值之和的相反数,将所述相反数作为自然常数的指数,得到各所述像素点权值,计算所述像素点权值与所述像素点灰度值的积,得到所述高斯滤波结果,进而根据所述高斯滤波结果,得到所述第二偏振综合图像。As an example, the filtering process is performed on the first polarization integrated image through a Gaussian filter to complete filtering and denoising, and the steps of obtaining the Gaussian filtering result include: selecting a rectangular area, and in this embodiment, selecting 3*3 pixel point map, take the center point of the pixel point map as the origin, calculate the square value of the difference between the horizontal and vertical coordinates of each pixel point and the horizontal and vertical coordinates of the origin, and then calculate the horizontal and vertical coordinates of each pixel point. The squared double value of the variance, find the ratio of the square value corresponding to the horizontal and vertical coordinates of each pixel and the corresponding double value, obtain the sum of the ratios corresponding to the horizontal and vertical coordinates of each pixel, and then take the sum of the ratios The opposite number of , taking the opposite number as an index of a natural constant, obtaining the weight of each pixel point, calculating the product of the weight value of the pixel point and the gray value of the pixel point, and obtaining the Gaussian filtering result, and then According to the Gaussian filtering result, the second polarization integrated image is obtained.
作为一种示例,所述二维高斯函数表达式如下:As an example, the expression of the two-dimensional Gaussian function is as follows:
其中,为像素点灰度值,为自然常数e为底数的指数函数,为原点坐标,和为像素点方差,为像素点坐标。in, is the gray value of the pixel point, is an exponential function with the natural constant e as the base, is the origin coordinate, and is the pixel variance, are pixel coordinates.
作为一种示例,所述根据所述各像素点梯度幅值和方向,对所述第二偏振综合图像进行极大值抑制,得到所述第三偏振综合图像的步骤包括:提取所述第二偏振综合图像中各像素点的梯度幅值和方向,求各像素点的梯度幅值的过程中可以将所述第二偏振综合图像视为二维离散函数,求图像梯度幅值就是对所述二维离散函数求导,得到求导结果,计算像素点灰度值和水平方向下一个像素点灰度值的差值的相反数和像素点灰度值和垂直方向下一个像素点灰度值的差值的相反数,求所述水平方向的差值相反数和所述垂直方向的差值相反数之和,得到各所述像素点的图像梯度幅值,取所述图像梯度幅值的反正切函数值,得到各所述像素点的图像梯度幅值的方向;根据所述像素点图像梯度幅值和所述图像梯度幅值的方向,对所述第二偏振综合图像进行极大值抑制,得到第三偏振综合图像。As an example, the step of performing maximum suppression on the second polarization integrated image according to the gradient magnitude and direction of each pixel point to obtain the third polarization integrated image includes: extracting the second polarization integrated image. The gradient amplitude and direction of each pixel point in the polarization integrated image, the second polarization integrated image can be regarded as a two-dimensional discrete function in the process of finding the gradient amplitude of each pixel point, and the image gradient amplitude is calculated as the Derive the two-dimensional discrete function, get the derivation result, calculate the inverse of the difference between the gray value of the pixel point and the gray value of the next pixel point in the horizontal direction, and the gray value of the pixel point and the gray value of the next pixel point in the vertical direction Calculate the opposite number of the difference value in the horizontal direction and the opposite number of the difference value in the vertical direction, obtain the image gradient amplitude of each pixel point, and take the sum of the image gradient amplitude The arctangent function value is used to obtain the direction of the image gradient amplitude of each pixel point; according to the image gradient amplitude value of the pixel point and the direction of the image gradient amplitude, the maximum value is performed on the second polarization integrated image. Suppression, a third polarization composite image is obtained.
作为一种示例,计算灰度图图像梯度幅值的表达式如下:As an example, the expression for calculating the gradient magnitude of a grayscale image is as follows:
其中,是所述图像梯度幅值,即所述二维离散函数的导数,是图像像素的灰度值,为像素点的坐标,表示像素点坐标为的灰度值。in, is the image gradient magnitude, that is, the derivative of the two-dimensional discrete function, is the grayscale value of the image pixel , is the coordinates of the pixel point, Indicates that the pixel coordinates are the gray value of .
因此,各像素点梯度方向,为所述的方向。Therefore, the gradient direction of each pixel point , as stated direction.
将图像边缘的法线方向划分为当前像素邻域窗口的方向、45°方向、方向、135°方向四个方向,各像素点的梯度方向定位属于这四个方向之一,计算四个方向偏导数算子与各方向对应的所述像素点梯度幅值的积,得到四个方向上的各所述像素点梯度幅值一阶偏导数,从各所述像素点四个方向的一阶偏导数从选择出绝对值最大的一阶偏导数,得到各像素点的极大梯度幅值,将所述极大梯度幅度值作为所述像素点的梯度幅值,取所述极大梯度幅度值的方向作为所述像素点的梯度方向。Divide the normal direction of the edge of the image into the current pixel neighborhood window direction, 45° direction, direction, 135° direction four directions, the gradient direction positioning of each pixel belongs to one of these four directions, calculate the product of the four direction partial derivative operators and the gradient amplitudes of the pixel points corresponding to each direction, and obtain four The first-order partial derivative of the gradient amplitude of each pixel point in the direction, the first-order partial derivative with the largest absolute value is selected from the first-order partial derivative in the four directions of each pixel point, and the maximum gradient of each pixel point is obtained. The magnitude of the maximum gradient is taken as the gradient magnitude of the pixel point, and the direction of the maximum gradient magnitude value is taken as the gradient direction of the pixel point.
作为一种示例,计算各方向上的像素点梯度幅值一阶偏导数表达式如下:As an example, the expression of the first-order partial derivative of the gradient magnitude of the pixel point in each direction is calculated as follows:
计算各像素点的极大梯度幅值的表达式如下:The expression for calculating the maximum gradient magnitude of each pixel is as follows:
计算各像素点梯度方向的表达式如下:The expression for calculating the gradient direction of each pixel is as follows:
其中,为各方向偏导数算子,其中“*”为点乘符号,max为取各方向梯度幅值的绝对值的最大值,为像素点梯度幅度,所述偏导数算子选取参见图2,其中(a)为算子,(b)为45°算子,(c)为算子,(d)为135°算子。为max取值所对应的方向。各像素点的梯度方向确定后,将所述梯度幅值与它梯度方向上相邻像素的梯度幅值比较,若非局部极大值,就把当前像素点的梯度值设为0;否则,梯度值保留,经过非极大值抑制后的所述第二偏振综合图像为第三偏振综合图像。in, is the partial derivative operator in each direction, where "*" is the dot product symbol, max is the maximum value of the absolute value of the gradient amplitude in each direction, is the gradient magnitude of the pixel point, and the selection of the partial derivative operator is shown in Figure 2, where (a) is operator, (b) is the 45° operator, (c) is operator, (d) is a 135° operator. The direction corresponding to the max value. After the gradient direction of each pixel is determined, the gradient magnitude is Compared with the gradient magnitude of the adjacent pixels in its gradient direction, if it is not a local maximum value, the gradient value of the current pixel is used. Set to 0; otherwise, the gradient value is retained, and the second polarization integrated image after non-maximum suppression is the third polarization integrated image.
作为一种示例,所述对所述第三偏振综合图像进行双阈值检测,选取一梯度幅值为高阈值,获取预设比例,根据所述预设比例和所述高阈值,得到低阈值的步骤包括:经过非极大值抑制后的第二偏振综合图像用梯度幅值直方图来表示,所述直方图在零点附近会存在一个对应区域内梯度幅值的尖峰,在零点右侧会形成一系列梯度幅值的尖峰。As an example, performing double-threshold detection on the third polarization integrated image, selecting a gradient amplitude as a high threshold, obtaining a preset ratio, and obtaining a low threshold according to the preset ratio and the high threshold The steps include: the second polarization comprehensive image after non-maximum suppression is represented by a gradient amplitude histogram, the histogram will have a peak of the gradient amplitude in the corresponding area near the zero point, and will form on the right side of the zero point. A series of spikes of gradient magnitude.
在所述梯度幅值直方图零点右侧的一系列梯度幅值中选取一个占比最高的梯度幅值作为高阈值,获取预设比例,所述预设比例可以为1/2,计算所述高阈值与所述预设比例的积,得到低阈值。A gradient amplitude value with the highest proportion is selected from a series of gradient amplitude values on the right side of the zero point of the gradient amplitude value histogram as the high threshold, and a preset ratio is obtained. The preset ratio can be 1/2. The product of the high threshold and the preset ratio obtains the low threshold.
作为一种示例,步骤S35包括:通过所述高阈值和所述低阈值,将所述第三偏振综合图像中各像素点划分为强边缘点和弱边缘点,并在所述第三偏振综合图像中对所述强边缘点和弱边缘点进行拟合,以增强所述第三偏振综合图像的边缘,从而得到所述边缘轮廓特征信息。As an example, step S35 includes: dividing each pixel point in the third polarization integrated image into strong edge points and weak edge points by using the high threshold and the low threshold, and dividing each pixel in the third polarization integrated image into strong edge points and weak edge points, The strong edge point and the weak edge point are fitted in the image to enhance the edge of the third polarization integrated image, so as to obtain the edge contour feature information.
其中,所述对所述第三偏振综合图像进行双阈值检测及拟合,得到所述边缘轮廓特征信息的步骤包括:Wherein, the step of performing double-threshold detection and fitting on the third polarization integrated image to obtain the edge contour feature information includes:
步骤S351,根据所述双阈值检测结果,将所述第三偏振综合图像中的各像素点划分为强边缘点和弱边缘点;Step S351, according to the double-threshold detection result, divide each pixel point in the third polarization integrated image into a strong edge point and a weak edge point;
步骤S352,通过所述第三偏振综合图像中连接所述强边缘点和连续的弱边缘点,在所述第三偏振综合图像中拟合所述待测工件的边缘轮廓,得到所述边缘轮廓特征信息。Step S352, by connecting the strong edge point and the continuous weak edge point in the third polarization integrated image, fitting the edge contour of the workpiece to be tested in the third polarization integrated image to obtain the edge contour characteristic information.
在本实施例中,需要说明的是,所述强边缘点是确定为所述第三偏振综合图像边缘的点,弱边缘点是可能为所述第三偏振综合图像边缘的点,所述边缘轮廓特征信息用于表征所述待测工件的缺陷特征信息。In this embodiment, it should be noted that the strong edge point is a point determined as the edge of the third polarization integrated image, the weak edge point is a point that may be the edge of the third polarization integrated image, and the edge The contour feature information is used to characterize the defect feature information of the workpiece to be tested.
作为一种示例,步骤S351至步骤步骤S352包括:判断所述第三偏振综合图像中各像素点的梯度幅值与所述高阈值和所述低阈值的大小关系,若像素点梯度幅值不小于所述高阈值,则标记所述像素点为强边缘点;若像素点梯度幅值大于低阈值且小于高阈值,则标记所述像素点为弱边缘点;在所述第三偏振综合图像中连接所述强边缘点和连续的弱边缘点,舍去孤立的弱边缘点,以实现在所述第三偏振综合图像中拟合所述待测工件的边缘轮廓,得到所述边缘轮廓特征信息。As an example, step S351 to step S352 include: judging the relationship between the gradient amplitude of each pixel in the third polarization integrated image and the high threshold and the low threshold, if the gradient amplitude of the pixel is different is less than the high threshold value, the pixel point is marked as a strong edge point; if the gradient amplitude of the pixel point is greater than the low threshold value and less than the high threshold value, the pixel point is marked as a weak edge point; in the third polarization integrated image Connect the strong edge points and the continuous weak edge points in , and discard the isolated weak edge points, so as to fit the edge contour of the workpiece to be tested in the third polarization integrated image, and obtain the edge contour feature information.
步骤S40,依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果。Step S40, according to the edge profile feature information, perform workpiece defect detection on the workpiece to be tested, and obtain a workpiece defect detection result.
在本实施例中,需要说明的是,所述工件缺陷检测可以通过深度学习网络网络来实现,所述工件缺陷检测结果用于表征所述待测工件的缺陷信息。In this embodiment, it should be noted that the workpiece defect detection may be implemented through a deep learning network, and the workpiece defect detection result is used to represent defect information of the workpiece to be tested.
作为一种示例,步骤S40包括:对所述边缘轮廓特征信息进行特征降维,得到一维向量格式的边缘轮廓特征信息,再将所述一维向量格式的边缘轮廓特征信息输入工件缺陷检测模型,以完成所述待测工件的工件缺陷检测,得到所述工件缺陷检测结果。As an example, step S40 includes: performing feature dimension reduction on the edge contour feature information to obtain edge contour feature information in a one-dimensional vector format, and then inputting the edge contour feature information in the one-dimensional vector format into the workpiece defect detection model , so as to complete the workpiece defect detection of the workpiece to be tested, and obtain the workpiece defect detection result.
其中,所述依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果的步骤包括:Wherein, according to the edge profile feature information, the workpiece defect detection is performed on the workpiece to be tested, and the steps of obtaining the workpiece defect detection result include:
步骤S41,对所述边缘轮廓特征信息进行特征降维,得到边缘轮廓特征信息样本;Step S41, performing feature dimension reduction on the edge contour feature information to obtain edge contour feature information samples;
步骤S42,通过将所述边缘轮廓特征信息样本输入工件缺陷检测模型,对所述待测工件进行工件缺陷检测,得到所述工件缺陷检测结果。Step S42, by inputting the edge profile feature information sample into a workpiece defect detection model, and performing workpiece defect detection on the workpiece to be tested, to obtain the workpiece defect detection result.
在本实施例中,需要说明的是,所述工件缺陷检测模型可以为深度信念网络模型。In this embodiment, it should be noted that the workpiece defect detection model may be a deep belief network model.
作为一种示例,步骤S41至步骤S42包括:对所述边缘轮廓特征信息进行PCA(principal components analysis,主成分分析)降维处理,具体地,所述边缘轮廓特征信息包括边缘轮廓图像矩阵,得到所述边缘轮廓图像矩阵对应的协方差矩阵;根据所述协方差矩阵,得到所述协方差矩阵对应的各特征向量和各特征值;将各所述特征向量按对应的各特征值大小从左到右排列成一维矩阵,得到所述边缘轮廓特征信息样本,所述边缘轮廓特征信息样本用于表征一维向量格式下的边缘轮廓特征信息;将所述边缘轮廓特征信息样本输入所述深度信念网络模型中,完成对所述待测工件的工件缺陷检测,得到所述工件缺陷检测结果。As an example, steps S41 to S42 include: performing PCA (principal components analysis, principal component analysis) dimension reduction processing on the edge contour feature information. Specifically, the edge contour feature information includes an edge contour image matrix, and obtains The covariance matrix corresponding to the edge contour image matrix; according to the covariance matrix, obtain each eigenvector and each eigenvalue corresponding to the covariance matrix; Arrange to the right into a one-dimensional matrix to obtain the edge contour feature information sample, which is used to represent the edge contour feature information in a one-dimensional vector format; input the edge contour feature information sample into the depth belief In the network model, the workpiece defect detection of the workpiece to be tested is completed, and the workpiece defect detection result is obtained.
在所述通过将边缘轮廓特征信息样本输入工件缺陷检测模型,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果的步骤之前,还包括:Before the step of performing the workpiece defect detection on the workpiece to be tested by inputting the edge profile feature information sample into the workpiece defect detection model, and obtaining the workpiece defect detection result, the method further includes:
步骤B10,获取待训练工件缺陷检测模型,提取训练工件对应的训练边缘轮廓特征信息以及训练工件对应的真实缺陷标签;Step B10, obtaining the defect detection model of the workpiece to be trained, and extracting the training edge contour feature information corresponding to the training workpiece and the real defect label corresponding to the training workpiece;
步骤B20,基于所述训练边缘轮廓特征信息和所述真实缺陷标签,对所述待训练工件缺陷检测模型进行迭代训练优化,获得所述工件缺陷检测模型。Step B20, based on the training edge contour feature information and the real defect label, perform iterative training optimization on the workpiece defect detection model to be trained to obtain the workpiece defect detection model.
在本实施例中,需要说明的是,所述待训练工件缺陷检测模型为未训练好的工件缺陷检测模型,所述真实缺陷标签为训练工件的缺陷类型,缺陷程度等信息。In this embodiment, it should be noted that the workpiece defect detection model to be trained is an untrained workpiece defect detection model, and the real defect label is information such as defect type and defect degree of the training workpiece.
作为一种示例,步骤B10至步骤B20包括:获取未训练好的工件缺陷检测模型,提取至少一训练工件对应的边缘轮廓特征信息和对应的真实缺陷标签;通过将所述边缘轮廓特征信息输入待训练工件缺陷检测模型,对所述训练工件进行缺陷检测,获得缺陷检测结果,进而基于所述缺陷检测结果与所述真实缺陷标签之间的差异度,计算所述待训练工件缺陷检测模型的模型损失,进而判断所述模型损失是否收敛,若所述模型损失收敛,则将所述待训练工件缺陷检测模型作为所述工件缺陷检测模型,若所述模型损失未收敛,则基于所述模型损失计算的梯度,通过预设模型更新方法更新所述待训练工件缺陷检测模型,并返回执行步骤:提取训练工件对应的训练边缘轮廓特征信息以及训练工件对应的真实缺陷标签,其中,所述预设模型更新方法包括梯度下降法和梯度上升法等,进而实现了基于边缘轮廓特征信息构建工件缺陷检测模型的目的,使得所述工件缺陷检测模型可基于边缘轮廓特征信息,准确检测工件缺陷,提高工件缺陷检测的准确度。As an example, steps B10 to B20 include: acquiring an untrained workpiece defect detection model, extracting edge contour feature information and corresponding real defect labels corresponding to at least one training workpiece; Train a workpiece defect detection model, perform defect detection on the training workpiece, obtain a defect detection result, and then calculate the model of the workpiece defect detection model to be trained based on the degree of difference between the defect detection result and the real defect label loss, and then determine whether the model loss converges, if the model loss converges, the workpiece defect detection model to be trained is used as the workpiece defect detection model, if the model loss does not converge, based on the model loss Calculate the gradient, update the defect detection model of the workpiece to be trained by a preset model update method, and return to the execution step: extracting the training edge contour feature information corresponding to the training workpiece and the real defect label corresponding to the training workpiece, wherein the preset The model update methods include gradient descent method and gradient ascent method, etc., and then achieve the purpose of constructing a workpiece defect detection model based on edge contour feature information, so that the workpiece defect detection model can accurately detect workpiece defects based on edge contour feature information, and improve workpiece defects. Accuracy of defect detection.
本申请实施例提供了一种工件缺陷检测方法、装置、电子设备及可读存储介质,首先获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息,再对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像,其中,由于所述总光强信息、所述偏振度信息以及所述偏振角信息均为光学偏振信息,不受工件表面污渍干扰,从而所述工件偏振特征图像可以反映不受工件表面污渍干扰的真实表面轮廓信息,从而依据工件偏振特征图像,对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息,依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果,可实现依据不受工件表面污渍干扰的真实表面轮廓信息进行工件缺陷检测的目的,所以克服了加工冷却液和机油等液体会污染工件,从而工件表面的污渍和缺陷在图像中无法分辨,导致工件缺陷检测准确度偏低的技术缺陷,提高了工件缺陷检测的准确度。The embodiments of the present application provide a workpiece defect detection method, device, electronic device, and readable storage medium. First, polarized light intensity information of the workpiece to be tested is obtained, and the total light intensity corresponding to the workpiece to be tested is determined according to the polarized light intensity information. intensity information, the corresponding polarization degree information and the corresponding polarization angle information, and then weighted aggregation is performed on the total light intensity information, the polarization degree information, and the polarization angle information to obtain a workpiece polarization characteristic image, wherein, due to the The total light intensity information, the polarization degree information and the polarization angle information are all optical polarization information, which are not disturbed by stains on the surface of the workpiece, so that the polarization characteristic image of the workpiece can reflect the real surface profile information that is not disturbed by the stains on the surface of the workpiece, Therefore, according to the polarization feature image of the workpiece, the workpiece edge contour detection is performed on the workpiece polarization feature image to obtain edge contour feature information, and according to the edge contour feature information, workpiece defect detection is performed on the workpiece to be tested, and a workpiece defect detection result is obtained. , which can realize the purpose of workpiece defect detection based on the real surface profile information that is not disturbed by the stains on the workpiece surface, so it overcomes the fact that liquids such as machining coolant and oil will contaminate the workpiece, so that the stains and defects on the workpiece surface cannot be distinguished in the image, resulting in The technical defect of the workpiece defect detection accuracy is low, and the accuracy of the workpiece defect detection is improved.
实施例二
本申请实施例还提供一种工件缺陷检测装置,所述工件缺陷检测装置应用于工件缺陷检测设备,所述工件缺陷检测装置包括:The embodiment of the present application also provides a workpiece defect detection device, the workpiece defect detection device is applied to workpiece defect detection equipment, and the workpiece defect detection device includes:
光强获取模块,用于获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息;The light intensity acquisition module is used to obtain the polarized light intensity information of the workpiece to be tested, and according to the polarized light intensity information, determine the total light intensity information, the corresponding polarization degree information and the corresponding polarization angle information corresponding to the workpiece to be tested;
加权聚合模块,用于对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像;a weighted aggregation module for performing weighted aggregation on the total light intensity information, the polarization degree information and the polarization angle information to obtain a workpiece polarization characteristic image;
轮廓检测模块,用于对所述待测工件偏振图像信息中的特征图像矩阵进行轮廓检测,得到边缘轮廓特征信息;a contour detection module, configured to perform contour detection on the feature image matrix in the polarization image information of the workpiece to be tested to obtain edge contour feature information;
缺陷检测模块,用于依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果。The defect detection module is configured to perform workpiece defect detection on the workpiece to be tested according to the edge profile feature information, and obtain a workpiece defect detection result.
可选地,所述光强获取模块还用于:Optionally, the light intensity acquisition module is also used for:
根据各所述预设偏振方向的光强,确定所述待测工件对应的总光强信息、水平线偏振方向光强分量以及倾斜线偏振方向光强分量;According to the light intensity of each preset polarization direction, determine the total light intensity information, the horizontal linear polarization direction light intensity component and the oblique linear polarization direction light intensity component corresponding to the workpiece to be tested;
根据所述水平线偏振方向光强分量以及所述倾斜线偏振方向光强分量,确定所述工件偏振度信息和所述工件偏振角信息。According to the light intensity component in the horizontal linear polarization direction and the light intensity component in the oblique linear polarization direction, the workpiece polarization degree information and the workpiece polarization angle information are determined.
可选地,所述光强获取模块还用于:Optionally, the light intensity acquisition module is also used for:
获取权重系数,其中,所述权重系数根据所述待测工件的材料类型确定;obtaining a weight coefficient, wherein the weight coefficient is determined according to the material type of the workpiece to be tested;
依据所述权重系数,对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像。According to the weight coefficient, weighted aggregation is performed on the total light intensity information, the polarization degree information and the polarization angle information to obtain a polarization characteristic image of the workpiece.
可选地,所述光强获取模块还用于:Optionally, the light intensity acquisition module is also used for:
获取目标测量体对应的材质偏振光强信息,根据所述材质偏振光强信息确定材质总光强信息、材质偏振度信息以及材质偏振角信息,所述目标测量体和所述待测工件所属的材料类型一致;Obtain the material polarized light intensity information corresponding to the target measurement body, and determine the material total light intensity information, material polarization degree information and material polarization angle information according to the material polarized light intensity information. The target measurement body and the workpiece to be measured belong to Material type is the same;
分析所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息三者分别与所述目标测量体的表面特征的敏感度;Analyzing the sensitivity of the total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material to the surface features of the target measurement body respectively;
根据各所述敏感度,确定所述材质总光强信息、所述材质偏振度信息以及所述材质偏振角信息分别对应的权重系数。According to each of the sensitivities, weight coefficients corresponding to the total light intensity information of the material, the polarization degree information of the material, and the polarization angle information of the material, respectively, are determined.
可选地,所述轮廓检测模块还用于:Optionally, the contour detection module is also used for:
将所述工件偏振特征图像进行灰度化处理,得到第一偏振综合图像;Performing grayscale processing on the polarization characteristic image of the workpiece to obtain a first polarization comprehensive image;
对所述第一偏振综合图像进行滤波处理,得到第二偏振综合图像;filtering the first polarization integrated image to obtain a second polarization integrated image;
依据所述第二偏振综合图像对应的图像梯度信息,对所述第二偏振综合图像进行非极大值抑制,得到第三偏振综合图像;performing non-maximum suppression on the second polarization integrated image according to the image gradient information corresponding to the second polarization integrated image to obtain a third polarization integrated image;
对所述第三偏振综合图像进行双阈值检测,得到双阈值检测结果;performing double-threshold detection on the third polarization comprehensive image to obtain a double-threshold detection result;
根据所述双阈值检测结果,在所述第三偏振综合图像中拟合所述待测工件的边缘轮廓,得到所述边缘轮廓特征信息。According to the double-threshold detection result, the edge contour of the workpiece to be tested is fitted in the third polarization integrated image to obtain the edge contour feature information.
可选地,所述轮廓检测模块还用于;Optionally, the contour detection module is also used for;
根据所述双阈值检测结果,将所述第三偏振综合图像中的各像素点划分为强边缘点和弱边缘点;According to the double-threshold detection result, each pixel point in the third polarization integrated image is divided into strong edge points and weak edge points;
通过所述第三偏振综合图像中连接所述强边缘点和连续的弱边缘点,在所述第三偏振综合图像中拟合所述待测工件的边缘轮廓,得到所述边缘轮廓特征信息。By connecting the strong edge points and continuous weak edge points in the third polarization integrated image, and fitting the edge contour of the workpiece to be tested in the third polarization integrated image, the edge contour feature information is obtained.
可选地,所述缺陷检测模块还用于:Optionally, the defect detection module is also used for:
对所述边缘轮廓特征信息进行特征降维,得到边缘轮廓特征信息样本;Perform feature dimension reduction on the edge contour feature information to obtain edge contour feature information samples;
通过将所述边缘轮廓特征信息样本输入工件缺陷检测模型,对所述待测工件进行工件缺陷检测,得到所述工件缺陷检测结果。By inputting the edge profile feature information sample into the workpiece defect detection model, the workpiece defect detection is performed on the workpiece to be tested, and the workpiece defect detection result is obtained.
本发明提供的工件缺陷检测装置,采用上述实施例中的工件缺陷检测方法,解决了工件缺陷检测准确度低的技术问题。与现有技术相比,本发明实施例提供的工件缺陷检测装置的有益效果与上述实施例提供的工件缺陷检测方法的有益效果相同,且该工件缺陷检测装置中的其他技术特征与上一实施例方法公开的特征相同,在此不做赘述。The workpiece defect detection device provided by the present invention adopts the workpiece defect detection method in the above-mentioned embodiment, and solves the technical problem of low accuracy of workpiece defect detection. Compared with the prior art, the beneficial effects of the workpiece defect detection device provided by the embodiment of the present invention are the same as the beneficial effects of the workpiece defect detection method provided by the above-mentioned embodiments, and other technical features in the workpiece defect detection device are the same as those of the previous implementation. The disclosed features of the example method are the same, and are not repeated here.
实施例三Embodiment 3
本发明实施例提供一种电子设备,电子设备包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述实施例一中的工件缺陷检测方法。An embodiment of the present invention provides an electronic device, the electronic device includes: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor. The processor executes, so that at least one processor can execute the workpiece defect detection method in the first embodiment.
下面参考图3,其示出了适于用来实现本公开实施例的电子设备的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图3示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Referring next to FIG. 3 , it shows a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (eg, mobile terminals such as in-vehicle navigation terminals), etc., and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in FIG. 3 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
如图3所示,电子设备可以包括处理装置(例如中央处理器、图形处理器等),其可以根据存储在只读存储器(ROM)中的程序或者从存储装置加载到随机访问存储器(RAM)中的程序而执行各种适当的动作和处理。在RAM中,还存储有电子设备操作所需的各种程序和数据。处理装置、ROM以及RAM通过总线彼此相连。输入/输出(I/O)接口也连接至总线。As shown in FIG. 3, an electronic device may include processing means (eg, a central processing unit, a graphics processor, etc.), which may be loaded into a random access memory (RAM) according to a program stored in a read only memory (ROM) or from a storage device to execute various appropriate actions and processes. In the RAM, various programs and data necessary for the operation of the electronic device are also stored. The processing device, the ROM, and the RAM are connected to each other through a bus. Input/output (I/O) interfaces are also connected to the bus.
通常,以下系统可以连接至I/O接口:包括例如触摸屏、触摸板、键盘、鼠标、图像传感器、麦克风、加速度计、陀螺仪等的输入装置;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置;包括例如磁带、硬盘等的存储装置;以及通信装置。通信装置可以允许电子设备与其他设备进行无线或有线通信以交换数据。虽然图中示出了具有各种系统的电子设备,但是应理解的是,并不要求实施或具备所有示出的系统。可以替代地实施或具备更多或更少的系统。Typically, the following systems can be connected to the I/O interface: input devices including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCDs), speakers, vibrators output devices, etc.; storage devices including, for example, magnetic tapes, hard disks, etc.; and communication devices. Communication means may allow electronic devices to communicate wirelessly or by wire with other devices to exchange data. While the figures show electronic devices having various systems, it should be understood that not all of the systems shown are required to be implemented or available. More or fewer systems may alternatively be implemented or provided.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置从网络上被下载和安装,或者从存储装置被安装,或者从ROM被安装。在该计算机程序被处理装置执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via a communication device, or from a storage device, or from a ROM. When the computer program is executed by the processing apparatus, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
本发明提供的电子设备,采用上述实施例中的工件缺陷检测方法,解决了工件缺陷检测准确度低的技术问题。与现有技术相比,本发明实施例提供的电子设备的有益效果与上述实施例一提供的工件缺陷检测方法的有益效果相同,且该电子设备中的其他技术特征与上一实施例方法公开的特征相同,在此不做赘述。The electronic device provided by the present invention adopts the workpiece defect detection method in the above-mentioned embodiment, and solves the technical problem of low accuracy of workpiece defect detection. Compared with the prior art, the beneficial effects of the electronic device provided by the embodiment of the present invention are the same as those of the workpiece defect detection method provided by the above-mentioned first embodiment, and other technical features in the electronic device are disclosed with the method in the previous embodiment. The features are the same and will not be repeated here.
应当理解,本公开的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式的描述中,具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the foregoing description of the embodiments, the particular features, structures, materials or characteristics may be combined in any suitable manner in any one or more of the embodiments or examples.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention. should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
实施例四Embodiment 4
本实施例提供一种计算机可读存储介质,具有存储在其上的计算机可读程序指令,计算机可读程序指令用于执行上述实施例一中的工件缺陷检测的方法。This embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon, where the computer-readable program instructions are used to execute the workpiece defect detection method in the first embodiment.
本发明实施例提供的计算机可读存储介质例如可以是U盘,但不限于电、磁、光、电磁、红外线、或半导体的系统、系统或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、系统或者器件使用或者与其结合使用。计算机可读存储介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。The computer-readable storage medium provided by the embodiment of the present invention may be, for example, a U disk, but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system or device, or any combination of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. Program code embodied on a computer-readable storage medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
上述计算机可读存储介质可以是电子设备中所包含的;也可以是单独存在,而未装配入电子设备中。The above-mentioned computer-readable storage medium may be included in the electronic device; or may exist alone without being assembled into the electronic device.
上述计算机可读存储介质承载有一个或者多个程序,当上述一个或者多个程序被电子设备执行时,使得电子设备:获取待测工件的偏振光强信息,依据所述偏振光强信息,确定待测工件对应的总光强信息、对应的偏振度信息以及对应的偏振角信息;对所述总光强信息、所述偏振度信息以及所述偏振角信息进行加权聚合,得到工件偏振特征图像;对所述工件偏振特征图像进行工件边缘轮廓检测,得到边缘轮廓特征信息;依据所述边缘轮廓特征信息,对所述待测工件进行工件缺陷检测,得到工件缺陷检测结果。The above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the polarized light intensity information of the workpiece to be measured, and determines the polarized light intensity information according to the polarized light intensity information. The total light intensity information, the corresponding polarization degree information and the corresponding polarization angle information corresponding to the workpiece to be tested; weighted aggregation is performed on the total light intensity information, the polarization degree information and the polarization angle information to obtain a polarization characteristic image of the workpiece Performing workpiece edge contour detection on the polarization feature image of the workpiece to obtain edge contour feature information; according to the edge contour feature information, performing workpiece defect detection on the workpiece to be tested to obtain a workpiece defect detection result.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider via Internet connection).
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该单元本身的限定。The modules involved in the embodiments of the present disclosure may be implemented in software or hardware. Among them, the name of the module does not constitute a limitation of the unit itself under certain circumstances.
本发明提供的计算机可读存储介质,存储有用于执行上述工件缺陷检测方法的计算机可读程序指令,解决了工件缺陷检测准确度低的技术问题。与现有技术相比,本发明实施例提供的计算机可读存储介质的有益效果与上述实施例提供的工件缺陷检测方法的有益效果相同,在此不做赘述。The computer-readable storage medium provided by the present invention stores computer-readable program instructions for executing the above-mentioned workpiece defect detection method, and solves the technical problem of low workpiece defect detection accuracy. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the embodiments of the present invention are the same as those of the workpiece defect detection method provided by the above-mentioned embodiments, which will not be repeated here.
实施例五Embodiment 5
本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述的工件缺陷检测方法的步骤。The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned workpiece defect detection method when the computer program is executed by a processor.
本申请提供的计算机程序产品解决了工件缺陷检测准确度低的技术问题。与现有技术相比,本发明实施例提供的计算机程序产品的有益效果与上述实施例提供的工件缺陷检测方法的有益效果相同,在此不做赘述。The computer program product provided by the present application solves the technical problem of low workpiece defect detection accuracy. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiments of the present invention are the same as the beneficial effects of the workpiece defect detection method provided by the above-mentioned embodiments, which will not be repeated here.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利处理范围内。The above are only the preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present application, or directly or indirectly applied in other related technical fields , are similarly included within the scope of patent processing of this application.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210715388.8A CN114782451B (en) | 2022-06-23 | 2022-06-23 | Workpiece defect detection method and device, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210715388.8A CN114782451B (en) | 2022-06-23 | 2022-06-23 | Workpiece defect detection method and device, electronic equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114782451A CN114782451A (en) | 2022-07-22 |
CN114782451B true CN114782451B (en) | 2022-09-16 |
Family
ID=82422230
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210715388.8A Active CN114782451B (en) | 2022-06-23 | 2022-06-23 | Workpiece defect detection method and device, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114782451B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114943739B (en) * | 2022-07-26 | 2022-10-21 | 山东三微新材料有限公司 | A kind of aluminum tube quality detection method |
CN115753791B (en) * | 2022-11-10 | 2024-03-01 | 哈尔滨耐是智能科技有限公司 | Defect detection method, device and system based on machine vision |
CN117548377A (en) * | 2023-11-06 | 2024-02-13 | 河源职业技术学院 | Chickpea sorting system and device based on visual inspection and deep neural network |
CN117237747B (en) * | 2023-11-14 | 2024-01-26 | 深圳市明鸿五金制品有限公司 | Hardware defect classification and identification method based on artificial intelligence |
CN118898727B (en) * | 2024-10-09 | 2024-12-20 | 南通致远新能源科技有限公司 | Intelligent control method for plate gum dipping dryer |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105447833A (en) * | 2015-12-24 | 2016-03-30 | 合肥工业大学 | Foggy weather image reconstruction method based on polarization |
CN107340546A (en) * | 2017-07-24 | 2017-11-10 | 南京信息工程大学 | A kind of undersea detection divides the double CCD real-time polarizations imaging devices in aperture and method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10395113B2 (en) * | 2014-01-22 | 2019-08-27 | Polaris Sensor Technologies, Inc. | Polarization-based detection and mapping method and system |
CN111369545B (en) * | 2020-03-10 | 2023-04-25 | 创新奇智(重庆)科技有限公司 | Edge defect detection method, device, model, equipment and readable storage medium |
CN111583223B (en) * | 2020-05-07 | 2023-12-19 | 上海闻泰信息技术有限公司 | Defect detection method, defect detection device, computer equipment and computer readable storage medium |
-
2022
- 2022-06-23 CN CN202210715388.8A patent/CN114782451B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105447833A (en) * | 2015-12-24 | 2016-03-30 | 合肥工业大学 | Foggy weather image reconstruction method based on polarization |
CN107340546A (en) * | 2017-07-24 | 2017-11-10 | 南京信息工程大学 | A kind of undersea detection divides the double CCD real-time polarizations imaging devices in aperture and method |
Non-Patent Citations (3)
Title |
---|
Polarized image enhancement based on biological vision;Yifan He et al.;《Fourth International Conference On Photonics and Optical Engineering》;20210115;第117610Z-1-117610Z-8页 * |
偏光片细微外观缺陷偏振成像检测方法;黄广俊 等;《电子与信息学报》;20220531;第44卷(第5期);摘要、第1636-1639页 * |
基于Stokes矢量的双相机偏振成像技术研究;杨威;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20220215(第02期);第12-13、37-38、48-56页 * |
Also Published As
Publication number | Publication date |
---|---|
CN114782451A (en) | 2022-07-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114782451B (en) | Workpiece defect detection method and device, electronic equipment and readable storage medium | |
CN110322500B (en) | Optimization method and device for instant positioning and map construction, medium and electronic equipment | |
CN105740856B (en) | A kind of pointer instrument registration read method based on machine vision | |
CN109883533B (en) | Low-frequency vibration measurement method based on machine vision | |
CN103528617B (en) | A cockpit instrument automatic identification and detection method and device | |
CN103164692B (en) | A kind of special vehicle instrument automatic identification system based on computer vision and method | |
CN108414240B (en) | Method and device for detecting abnormal vibration of machine | |
CN110349212B (en) | Optimization method and device for instant positioning and map construction, medium and electronic equipment | |
CN108156452B (en) | Method, device and equipment for detecting sensor and storage medium | |
US20230278198A1 (en) | Method and Apparatus for Robot to Grab Three-Dimensional Object | |
WO2014090090A1 (en) | Angle measurement method and device | |
CN105809168A (en) | Image fuzzy identification method of standard constant temperature bath glass thermometer | |
CN116958145B (en) | Image processing method and device, visual detection system and electronic equipment | |
CN111723821A (en) | Method and device for detecting and identifying images of power plant instrumentation | |
CN113781481A (en) | Method, device and electronic device for non-contact measurement of shape and size of objects | |
CN115683431A (en) | Method, device and equipment for determining cable force of inhaul cable based on linear tracking algorithm | |
CN112419229A (en) | Display screen linear defect detection method and device and storage medium | |
CN117351063A (en) | Methods, devices, equipment and storage media for measuring the size of micro-nano devices | |
CN108876842A (en) | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle | |
CN116152208A (en) | Defect detection method, device, equipment and storage medium | |
CN118781113B (en) | Surface defect detection method, equipment and storage medium | |
JP2019090643A (en) | Inspection method, and inspection device | |
CN115641306A (en) | Product defect detection method and device, electronic equipment and readable storage medium | |
CN118521586B (en) | Product vision detection device and method based on machine vision | |
CN117788444A (en) | SMT patch offset detection method, SMT patch offset detection device and SMT patch offset detection system |
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 |