[go: up one dir, main page]

CN116152208A - Defect detection method, device, equipment and storage medium - Google Patents

Defect detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN116152208A
CN116152208A CN202310172014.0A CN202310172014A CN116152208A CN 116152208 A CN116152208 A CN 116152208A CN 202310172014 A CN202310172014 A CN 202310172014A CN 116152208 A CN116152208 A CN 116152208A
Authority
CN
China
Prior art keywords
point cloud
component
template
measured
depth map
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310172014.0A
Other languages
Chinese (zh)
Inventor
李飞
张伟
赵兵
武春杰
左唯
陈红艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
LCFC Hefei Electronics Technology Co Ltd
Original Assignee
Hefei Lianbao Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hefei Lianbao Information Technology Co Ltd filed Critical Hefei Lianbao Information Technology Co Ltd
Priority to CN202310172014.0A priority Critical patent/CN116152208A/en
Publication of CN116152208A publication Critical patent/CN116152208A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • G06T7/337Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods involving reference images or patches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

本公开提供了一种缺陷检测方法、装置、设备及存储介质,通过获取部件待测点云以及获取目标部件模板点云,其中,所述目标部件模板点云为判断所述部件待测点云是否存在贴附缺陷的参考模板点云;分别将所述部件待测点云和所述目标部件模板点云重建为部件待测深度图和目标部件模板深度图;通过对所述部件待测深度图和所述目标部件模板深度图进行二值化处理以及Blob分析,确定所述部件待测点云是否存在贴附缺陷,不仅有效的提高了缺陷检测率,而且还节省了大量的人力物力。

Figure 202310172014

The present disclosure provides a defect detection method, device, equipment, and storage medium, by obtaining a point cloud of a component to be tested and a point cloud of a target component template, wherein the target component template point cloud is a point cloud for judging the component to be tested Whether there is a reference template point cloud of the attachment defect; respectively rebuilding the part to be measured point cloud and the target part template point cloud into a part to be measured depth map and a target part template depth map; by analyzing the part to be measured depth The image and the target component template depth image are subjected to binarization processing and Blob analysis to determine whether there is an attachment defect in the point cloud of the component to be tested, which not only effectively improves the defect detection rate, but also saves a lot of manpower and material resources.

Figure 202310172014

Description

缺陷检测方法、装置、设备及存储介质Defect detection method, device, equipment and storage medium

技术领域technical field

本公开涉及计算机技术领域,尤其涉及一种缺陷检测方法、装置、设备及存储介质。The present disclosure relates to the field of computer technology, and in particular to a defect detection method, device, equipment and storage medium.

背景技术Background technique

基于3D视觉的笔记本内结构的缺陷检测方法可理解为点云缺陷检测问题,具体为基于模板图像中的指定区域通过点云配准方法,在待测图像中寻找对应匹配区域,并进行缺陷检测。现有技术常使用针对3D视觉检测方法有:基于深度学习的缺陷检测方法和基于模板对比的缺陷检测方法。The defect detection method of the notebook internal structure based on 3D vision can be understood as a point cloud defect detection problem. Specifically, based on the specified area in the template image, the point cloud registration method is used to find the corresponding matching area in the image to be tested and perform defect detection. . Commonly used methods for 3D visual inspection in the prior art include: a defect detection method based on deep learning and a defect detection method based on template comparison.

其中,基于3D点云的神经网络训练方法虽然理论上针对缺陷检测有一定的效果,但是在实际实现过程中,收集大量缺陷样本十分困难,导致检测准确性降低。Among them, although the neural network training method based on 3D point cloud has a certain effect on defect detection in theory, it is very difficult to collect a large number of defect samples in the actual implementation process, resulting in a decrease in detection accuracy.

而基于3D点云的模板对比缺陷检测方法,是提取标准模板和待测点云中的部件位置进行点云信息对比,从而判断部件是否存在贴附缺陷的问题。该方法存在漏检和误检的问题,尤其是针对贴附部件位置附近存在有高度突起的现象或者贴附部件存在少许偏移的现象时,其缺陷检测效果很差。The template comparison defect detection method based on 3D point cloud is to extract the standard template and the position of the component in the point cloud to be tested for point cloud information comparison, so as to judge whether there is an attachment defect in the component. This method has the problem of missed detection and false detection, especially when there is a high protrusion near the position of the attached part or a slight deviation of the attached part, the defect detection effect is very poor.

发明内容Contents of the invention

本公开提供了一种缺陷检测方法、装置、设备及存储介质,以至少解决现有技术中存在的以上技术问题。The present disclosure provides a defect detection method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.

根据本公开的第一方面,提供了一种缺陷检测方法,所述方法包括:According to a first aspect of the present disclosure, a defect detection method is provided, the method comprising:

获取部件待测点云以及获取目标部件模板点云,其中,所述目标部件模板点云为判断所述部件待测点云是否存在贴附缺陷的参考模板点云;Obtaining the component to-be-tested point cloud and acquiring the target component template point cloud, wherein the target component template point cloud is a reference template point cloud for judging whether the component to-be-tested point cloud has an attachment defect;

分别将所述部件待测点云和所述目标部件模板点云重建为部件待测深度图和目标部件模板深度图;Respectively reconstructing the point cloud of the part to be measured and the point cloud of the target part template into a depth map of the part to be measured and a depth map of the target part template;

通过对所述部件待测深度图和所述目标部件模板深度图进行二值化处理以及Blob分析,确定所述部件待测点云是否存在贴附缺陷。By performing binarization processing and Blob analysis on the depth map of the part to be tested and the depth map of the target part template, it is determined whether there is an attachment defect in the point cloud of the part to be tested.

在一可实施方式中,所述通过对所述部件待测深度图和所述目标部件模板深度图进行二值化处理以及Blob分析,确定所述部件待测点云是否存在贴附缺陷,包括:In a possible implementation manner, the step of determining whether there is an attachment defect in the point cloud of the part to be tested by performing binarization processing and Blob analysis on the depth map of the part to be tested and the depth map of the target part template includes: :

基于部件模板点云所对应的深度均值,分别将所述部件待测深度图和目标部件模板深度图进行二值化处理,得到部件待测二值图和目标部件模板二值图;Based on the depth mean value corresponding to the component template point cloud, the component to-be-measured depth map and the target component template depth map are respectively binarized to obtain the component to-be-tested binary map and the target component template binary map;

分别获取所述部件待测二值图内的第一预设区域和所述目标部件模板二值图内的第二预设区域;Respectively acquire a first preset area in the binary image of the component to be tested and a second preset area in the binary image of the target component template;

将所述第一预设区域和所述第二预设区域的区域信息进行比较,确定所述部件待测点云是否存在贴附缺陷,其中,所述区域信息包含以下至少之一:宽、高以及面积。Comparing the area information of the first preset area and the second preset area to determine whether there is an attachment defect in the point cloud of the component to be tested, wherein the area information includes at least one of the following: width, height and area.

在一可实施方式中,所述将所述第一预设区域和所述第二预设区域的区域信息进行比较,确定所述部件待测点云是否存在贴附缺陷,包括:In a possible implementation manner, the comparing the area information of the first preset area and the second preset area to determine whether there is an attachment defect in the point cloud of the component to be tested includes:

当所述第一预设区域和所述第二预设区域的宽差值小于预设宽阈值、所述第一预设区域和所述第二预设区域的高差值小于预设高阈值以及所述第一预设区域和所述第二预设区域的面积差值小于预设面积阈值时,确定所述部件待测点云不存在贴附缺陷;否则,确定所述部件待测点云存在贴附缺陷。When the width difference between the first preset area and the second preset area is less than a preset width threshold, the height difference between the first preset area and the second preset area is less than a preset high threshold And when the area difference between the first preset area and the second preset area is less than a preset area threshold, it is determined that there is no attachment defect in the component to-be-tested point cloud; otherwise, it is determined that the component to-be-tested point cloud The cloud has an attachment flaw.

在一可实施方式中,所述获取目标部件模板点云,包括:In a possible implementation manner, the acquisition of the target component template point cloud includes:

获取包含有至少一个待测贴附部件的待测点云和获取样本贴附部件的模板点云,其中,所述模板点云内标记有各个样本贴附部件的标签;Obtaining a point cloud to be measured that includes at least one attached part to be tested and a template point cloud of the sample attached part, wherein the template point cloud is marked with a label of each sample attached part;

基于点云配准算法和所述包含有至少一个待测贴附部件的待测点云,将所述模板点云进行校准,得到校正后的模板点云;Based on the point cloud registration algorithm and the point cloud to be measured containing at least one attached part to be tested, the template point cloud is calibrated to obtain a corrected template point cloud;

在所述校正后的模板点云上,确定至少一个样本部件模板点云,并依次将每个样本部件模板点云作为目标部件模板点云。On the corrected template point cloud, at least one sample part template point cloud is determined, and each sample part template point cloud is sequentially used as a target part template point cloud.

在一可实施方式中,所述获取样本贴附部件的模板点云,包括:In a possible implementation manner, said acquiring the template point cloud of the sample attachment part includes:

通过所述样本贴附部件的原始3D设计图或者通过3D相机拍摄所述样本贴附部件,确定所述样本贴附部件的源点云数据;Determining the source point cloud data of the sample attachment part by using the original 3D design drawing of the sample attachment part or photographing the sample attachment part by a 3D camera;

将所述样本贴附部件的源点云数据进行建模,得到所述样本贴附部件的模板点云。Modeling the source point cloud data of the sample attachment component to obtain a template point cloud of the sample attachment component.

在一可实施方式中,所述获取部件待测点云,包括:In a possible implementation manner, the acquiring point cloud of the component to be measured includes:

将所述校正后的模板点云和所述包含有至少一个待测贴附部件的待测点云进行降维处理,得到降维模板点云和降维待测点云;performing dimensionality reduction processing on the corrected template point cloud and the measured point cloud containing at least one attached component to be measured, to obtain a dimensionality-reduced template point cloud and a dimensionality-reduced point cloud to be measured;

在所述降维模板点云内,确定与所述目标部件模板点云相对应的降维部件模板点云;In the dimension reduction template point cloud, determine a dimension reduction component template point cloud corresponding to the target component template point cloud;

基于邻域最小值法,在所述降维待测点云内,确定与所述降维部件模板点云相对应的降维部件点云,并通过所述降维待测点云和所述包含有至少一个待测贴附部件的待测点云之间的映射关系,在所述包含有至少一个待测贴附部件的待测点云上,确定与所述降维部件点云相对应的待测点云区域作为部件待测点云。Based on the neighborhood minimum value method, in the dimensionality reduction point cloud to be measured, determine the dimensionality reduction component point cloud corresponding to the dimensionality reduction component template point cloud, and pass the dimensionality reduction measurement point cloud and the The mapping relationship between the point clouds to be measured that contains at least one attached part to be tested, on the point cloud to be measured that contains at least one attached part to be tested, it is determined to correspond to the point cloud of the dimensionality reduction component The region of the point cloud to be measured is used as the point cloud of the component to be measured.

在一可实施方式中,所述分别将所述部件待测点云和所述目标部件模板点云重建为部件待测深度图和目标部件模板深度图,包括:In a possible implementation manner, the respectively reconstructing the point cloud of the component to be measured and the point cloud of the target component template into a depth map of the component to be measured and a depth map of the target component template includes:

分别获取所述部件待测点云和所述目标部件模板点云内各个体素的坐标,其中,所述坐标包括X值、Y值和Z值;Obtain the coordinates of each voxel in the point cloud of the component to be measured and the point cloud of the target component template respectively, wherein the coordinates include an X value, a Y value and a Z value;

将所述部件待测点云内各个体素的X值和Y值作为所述部件待测深度图的坐标值,并将Z值作为所述部件待测深度图的像素值,以重建所述部件待测深度图;Using the X value and Y value of each voxel in the part to be measured point cloud as the coordinate value of the part to be measured depth map, and using the Z value as the pixel value of the part to be measured depth map to reconstruct the The depth map of the component to be tested;

将所述目标部件模板点云内各个体素的X值和Y值作为所述目标部件模板深度图的坐标值,并将Z值作为所述目标部件模板深度图的像素值,以重建所述目标部件模板深度图。Using the X value and Y value of each voxel in the target part template point cloud as the coordinate value of the target part template depth map, and using the Z value as the pixel value of the target part template depth map to reconstruct the Target part template depth map.

根据本公开的第二方面,提供了一种缺陷检测装置,所述装置包括:According to a second aspect of the present disclosure, a defect detection device is provided, the device comprising:

点云获取模块,用于获取部件待测点云以及获取目标部件模板点云,其中,所述目标部件模板点云为判断所述部件待测点云是否存在贴附缺陷的参考模板点云;The point cloud acquisition module is used to acquire the point cloud of the component to be tested and the target component template point cloud, wherein the target component template point cloud is a reference template point cloud for judging whether the component to be tested point cloud has an attachment defect;

深度图重建模块,用于分别将所述部件待测点云和所述目标部件模板点云重建为部件待测深度图和目标部件模板深度图;A depth map reconstruction module, configured to reconstruct the part to-be-measured point cloud and the target part template point cloud into a part to-be-measured depth map and a target part template depth map;

缺陷分析模块,用于通过对所述部件待测深度图和所述目标部件模板深度图进行二值化处理以及Blob分析,确定所述部件待测点云是否存在贴附缺陷。The defect analysis module is configured to perform binarization processing and Blob analysis on the depth map of the part to be tested and the depth map of the target part template to determine whether there is an attachment defect in the point cloud of the part to be tested.

在一可实施方式中,缺陷分析模块,具体用于:In a possible implementation, the defect analysis module is specifically used for:

基于部件模板点云所对应的深度均值,分别将所述部件待测深度图和目标部件模板深度图进行二值化处理,得到部件待测二值图和目标部件模板二值图;Based on the depth mean value corresponding to the component template point cloud, the component to-be-measured depth map and the target component template depth map are respectively binarized to obtain the component to-be-tested binary map and the target component template binary map;

分别获取所述部件待测二值图内的第一预设区域和所述目标部件模板二值图内的第二预设区域;Respectively acquire a first preset area in the binary image of the component to be tested and a second preset area in the binary image of the target component template;

将所述第一预设区域和所述第二预设区域的区域信息进行比较,确定所述部件待测点云是否存在贴附缺陷,其中,所述区域信息包含以下至少之一:宽、高以及面积。Comparing the area information of the first preset area and the second preset area to determine whether there is an attachment defect in the point cloud of the component to be tested, wherein the area information includes at least one of the following: width, height and area.

在一可实施方式中,缺陷分析模块,还具体用于:In a possible implementation, the defect analysis module is also specifically used for:

当所述第一预设区域和所述第二预设区域的宽差值小于预设宽阈值、所述第一预设区域和所述第二预设区域的高差值小于预设高阈值以及所述第一预设区域和所述第二预设区域的面积差值小于预设面积阈值时,确定所述部件待测点云不存在贴附缺陷;否则,确定所述部件待测点云存在贴附缺陷。When the width difference between the first preset area and the second preset area is less than a preset width threshold, the height difference between the first preset area and the second preset area is less than a preset high threshold And when the area difference between the first preset area and the second preset area is less than a preset area threshold, it is determined that there is no attachment defect in the component to-be-tested point cloud; otherwise, it is determined that the component to-be-tested point cloud The cloud has an attachment flaw.

在一可实施方式中,点云获取模块,具体用于:In one possible implementation, the point cloud acquisition module is specifically used for:

获取包含有至少一个待测贴附部件的待测点云和获取样本贴附部件的模板点云,其中,所述模板点云内标记有各个样本贴附部件的标签;Obtaining a point cloud to be measured that includes at least one attached part to be tested and a template point cloud of the sample attached part, wherein the template point cloud is marked with a label of each sample attached part;

基于点云配准算法和所述包含有至少一个待测贴附部件的待测点云,将所述模板点云进行校准,得到校正后的模板点云;Based on the point cloud registration algorithm and the point cloud to be measured containing at least one attached part to be tested, the template point cloud is calibrated to obtain a corrected template point cloud;

在所述校正后的模板点云上,确定至少一个样本部件模板点云,并依次将每个样本部件模板点云作为目标部件模板点云。On the corrected template point cloud, at least one sample part template point cloud is determined, and each sample part template point cloud is sequentially used as a target part template point cloud.

在一可实施方式中,点云获取模块,还具体用于:In one possible implementation, the point cloud acquisition module is also specifically used for:

通过所述样本贴附部件的原始3D设计图或者通过3D相机拍摄所述样本贴附部件,确定所述样本贴附部件的源点云数据;Determining the source point cloud data of the sample attachment part by using the original 3D design drawing of the sample attachment part or photographing the sample attachment part by a 3D camera;

将所述样本贴附部件的源点云数据进行建模,得到所述样本贴附部件的模板点云。Modeling the source point cloud data of the sample attachment component to obtain a template point cloud of the sample attachment component.

在一可实施方式中,点云获取模块,还具体用于:In one possible implementation, the point cloud acquisition module is also specifically used for:

将所述校正后的模板点云和所述包含有至少一个待测贴附部件的待测点云进行降维处理,得到降维模板点云和降维待测点云;performing dimensionality reduction processing on the corrected template point cloud and the measured point cloud containing at least one attached component to be measured, to obtain a dimensionality-reduced template point cloud and a dimensionality-reduced point cloud to be measured;

在所述降维模板点云内,确定与所述目标部件模板点云相对应的降维部件模板点云;In the dimension reduction template point cloud, determine a dimension reduction component template point cloud corresponding to the target component template point cloud;

基于邻域最小值法,在所述降维待测点云内,确定与所述降维部件模板点云相对应的降维部件点云,并通过所述降维待测点云和所述包含有至少一个待测贴附部件的待测点云之间的映射关系,在所述包含有至少一个待测贴附部件的待测点云上,确定与所述降维部件点云相对应的待测点云区域作为部件待测点云。Based on the neighborhood minimum value method, in the dimensionality reduction point cloud to be measured, determine the dimensionality reduction component point cloud corresponding to the dimensionality reduction component template point cloud, and pass the dimensionality reduction measurement point cloud and the The mapping relationship between the point clouds to be measured that contains at least one attached part to be tested, on the point cloud to be measured that contains at least one attached part to be tested, it is determined to correspond to the point cloud of the dimensionality reduction component The region of the point cloud to be measured is used as the point cloud of the component to be measured.

在一可实施方式中,深度图重建模块,具体用于:In a possible implementation manner, the depth map reconstruction module is specifically used for:

分别获取所述部件待测点云和所述目标部件模板点云内各个体素的坐标,其中,所述坐标包括X值、Y值和Z值;Obtain the coordinates of each voxel in the point cloud of the component to be measured and the point cloud of the target component template respectively, wherein the coordinates include an X value, a Y value and a Z value;

将所述部件待测点云内各个体素的X值和Y值作为所述部件待测深度图的坐标值,并将Z值作为所述部件待测深度图的像素值,以重建所述部件待测深度图;Using the X value and Y value of each voxel in the part to be measured point cloud as the coordinate value of the part to be measured depth map, and using the Z value as the pixel value of the part to be measured depth map to reconstruct the The depth map of the component to be tested;

将所述目标部件模板点云内各个体素的X值和Y值作为所述目标部件模板深度图的坐标值,并将Z值作为所述目标部件模板深度图的像素值,以重建所述目标部件模板深度图。Using the X value and Y value of each voxel in the target part template point cloud as the coordinate value of the target part template depth map, and using the Z value as the pixel value of the target part template depth map to reconstruct the Target part template depth map.

根据本公开的第三方面,提供了一种电子设备,包括:According to a third aspect of the present disclosure, an electronic device is provided, including:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本公开所述的方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor, to enable the at least one processor to perform the methods described in the present disclosure.

根据本公开的第四方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行本公开所述的方法。According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method described in the present disclosure.

本公开的一种缺陷检测方法、装置、设备及存储介质,通过获取部件待测点云以及获取目标部件模板点云,其中,所述目标部件模板点云为判断所述部件待测点云是否存在贴附缺陷的参考模板点云;分别将所述部件待测点云和所述目标部件模板点云重建为部件待测深度图和目标部件模板深度图;通过对所述部件待测深度图和所述目标部件模板深度图进行二值化处理以及Blob分析,确定所述部件待测点云是否存在贴附缺陷,不仅有效的提高了缺陷检测率,而且还节省了大量的人力物力。A defect detection method, device, equipment, and storage medium of the present disclosure obtain a component to-be-tested point cloud and a target component template point cloud, wherein the target component template point cloud is used to determine whether the component to-be-tested point cloud is There is a reference template point cloud with an attachment defect; respectively rebuilding the part to be measured point cloud and the target part template point cloud into a part to be measured depth map and a target part template depth map; by analyzing the part to be measured depth map Performing binarization processing and Blob analysis with the depth map of the target component template to determine whether there is an attachment defect in the point cloud of the component to be tested, which not only effectively improves the defect detection rate, but also saves a lot of manpower and material resources.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood through the following description.

附图说明Description of drawings

通过参考附图阅读下文的详细描述,本公开示例性实施方式的上述以及其他目的、特征和优点将变得易于理解。在附图中,以示例性而非限制性的方式示出了本公开的若干实施方式,其中:The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the present disclosure are shown by way of illustration and not limitation, in which:

在附图中,相同或对应的标号表示相同或对应的部分。In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.

图1示出了本公开实施例一提供的一种缺陷检测方法的实现流程示意图;FIG. 1 shows a schematic diagram of the implementation flow of a defect detection method provided by Embodiment 1 of the present disclosure;

图2示出了本公开实施例二提供的一种缺陷检测方法的实现流程示意图;FIG. 2 shows a schematic flow diagram of a defect detection method provided by Embodiment 2 of the present disclosure;

图3示出了本公开实施例二提供的一种缺陷检测方法的实现流程框架图;FIG. 3 shows a framework diagram of the implementation process of a defect detection method provided by Embodiment 2 of the present disclosure;

图4示出了本公开实施例三提供的一种缺陷检测装置的结构示意图;FIG. 4 shows a schematic structural diagram of a defect detection device provided in Embodiment 3 of the present disclosure;

图5示出了本公开实施例一种电子设备的组成结构示意图。FIG. 5 shows a schematic diagram of the composition and structure of an electronic device according to an embodiment of the present disclosure.

具体实施方式Detailed ways

为使本公开的目的、特征、优点能够更加的明显和易懂,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而非全部实施例。基于本公开中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purpose, features, and advantages of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present disclosure. Obviously, the described The embodiments are only some of the embodiments of the present disclosure, but not all of them. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present disclosure.

实施例一Embodiment one

图1为本公开实施例一提供的一种缺陷检测方法的流程图,该方法可以由本公开实施例提供的一种缺陷检测装置来执行,该装置可采用软件和/或硬件的方式实现。该方法具体包括:FIG. 1 is a flow chart of a defect detection method provided in Embodiment 1 of the present disclosure. The method can be executed by a defect detection device provided in an embodiment of the present disclosure, and the device can be implemented in software and/or hardware. The method specifically includes:

S110、获取部件待测点云以及获取目标部件模板点云。S110. Obtain a point cloud of the component to be tested and a target component template point cloud.

其中,目标部件模板点云,可以是用于判断待测部件是否存在贴附缺陷的参考模板点云,记为ROI_model。部件待测点云,可以是使用3D相机对待测部件进行拍摄得到的点云,记为ROI_dst。Wherein, the target component template point cloud may be a reference template point cloud for judging whether there is an attachment defect in the component to be tested, which is recorded as ROI_model. The point cloud of the component to be tested can be a point cloud obtained by shooting the component to be tested with a 3D camera, which is recorded as ROI_dst.

具体的,笔记本内贴附位置不同,对贴附部件的种类要求不同,且其贴附位置本身的多样性和复杂性,会严重影响部件贴附检测效果。针对贴附部件的种类要求不同,例如,笔记本内的贴附部件可以是导电布、脚垫、铁片、铁杆、拉丝等种类,又由于生产厂家不同,易导致同种贴附部件存在不同的颜色;针对贴附位置的多样性和复杂性,例如,贴附位置可能是平坦位置、也可能是边角位置,还可能贴附位置周围存在干扰等,上述这些都会影响检测准确性。Specifically, different attachment positions in the notebook require different types of attachment components, and the diversity and complexity of the attachment positions themselves will seriously affect the effect of component attachment detection. There are different requirements for the types of attached parts. For example, the attached parts in the notebook can be conductive cloth, foot pads, iron sheets, iron rods, wire drawing, etc., and due to different manufacturers, it is easy to cause different differences in the same type of attached parts. Color; For the diversity and complexity of the attachment position, for example, the attachment position may be a flat position, or a corner position, and there may be interference around the attachment position, etc., all of which will affect the detection accuracy.

在本公开实施例中,获取目标部件模板点云,包括:获取包含有至少一个待测贴附部件的待测点云和获取样本贴附部件的模板点云,其中,模板点云内标记有各个样本贴附部件的标签;基于点云配准算法和包含有至少一个待测贴附部件的待测点云,将模板点云进行校准,得到校正后的模板点云;在校正后的模板点云上,确定至少一个样本部件模板点云,并依次将每个样本部件模板点云作为目标部件模板点云。In an embodiment of the present disclosure, obtaining the template point cloud of the target part includes: obtaining the point cloud to be measured containing at least one attached part to be tested and obtaining the template point cloud of the sample attached part, wherein the template point cloud is marked with The label of each sample attachment part; based on the point cloud registration algorithm and the test point cloud containing at least one test attachment part, the template point cloud is calibrated to obtain the corrected template point cloud; the corrected template On the point cloud, at least one sample part template point cloud is determined, and each sample part template point cloud is sequentially used as the target part template point cloud.

其中,点云配准算法,可以是基于体素分割匹配,用于提取特征点的算法,示例性的,本实施例采用的点云配准算法可以是最近点迭代算法(Iterative Closest Point,ICP)。模板点云,可以是还未进行校准的含有各个样本贴附部件标识的源点云,记为pt_model。待测点云为包含多个部件待测点云的点云,用于测量是否具有缺陷的点云,记为pt_dst。Wherein, the point cloud registration algorithm may be an algorithm based on voxel segmentation and matching for extracting feature points. Exemplarily, the point cloud registration algorithm adopted in this embodiment may be the closest point iterative algorithm (Iterative Closest Point, ICP ). The template point cloud can be a source point cloud that has not yet been calibrated and contains the identification of each sample attachment part, denoted as pt_model. The point cloud to be tested is a point cloud that includes multiple parts to be tested, and is used to measure whether there are defects in the point cloud, which is denoted as pt_dst.

具体的,为了得到精确的模板点云,本实施例需要先获取包含至少一个待测贴附部件的待测点云,以及带有各个样本贴附部件标识的模板点云。在理论上,模板点云和待测点云若是保证相同检测机构、相同位置、相同相机以及相同设计参数等条件下进行拍摄,则无需校正。但是,在实际操作过程中,由于上述各个环节可能存在的微小偏差,以及设计精准度偏差等因素的干扰,可能使得模板点云与待测点云存在偏差,因此本实施例为了解决上述问题,将该模板点云通过基于点云配准算法以及包含有至少一个待测贴附部件待测点云进行校准,使得模板点云根据待测点云进行校正,从而得到精确校准后的模板点云,记为pt_model’。Specifically, in order to obtain an accurate template point cloud, this embodiment needs to first obtain a test point cloud including at least one attachment part to be tested, and a template point cloud with the identification of each sample attachment part. In theory, if the template point cloud and the point cloud to be tested are taken under the conditions of the same detection mechanism, the same position, the same camera, and the same design parameters, no correction is required. However, in the actual operation process, due to the slight deviation that may exist in the above-mentioned various links, as well as the interference of factors such as design accuracy deviation, there may be deviations between the template point cloud and the point cloud to be measured. Therefore, in order to solve the above problems in this embodiment, The template point cloud is calibrated based on the point cloud registration algorithm and the measured point cloud containing at least one attached part to be tested, so that the template point cloud is corrected according to the measured point cloud, thereby obtaining an accurately calibrated template point cloud , denoted as pt_model'.

具体的,由于本实施例在校准后的模板点云上存在至少一个样本贴附部件点云,因此本实施例可以依次提取并分割各个样本贴附部件点云,将分割后的独立部件依次作为目标部件模板点云,方便后续与其对应的待测贴附部件点云进行比对。Specifically, since there is at least one sample attachment part point cloud on the calibrated template point cloud in this embodiment, this embodiment can sequentially extract and segment each sample attachment part point cloud, and use the divided independent parts as The point cloud of the target part template is convenient for subsequent comparison with the point cloud of the corresponding attached part to be tested.

在本公开实施例中,获取样本贴附部件的模板点云,包括:通过样本贴附部件的原始3D设计图或者通过3D相机拍摄样本贴附部件,确定样本贴附部件的源点云数据;将样本贴附部件的源点云数据进行建模,得到样本贴附部件的模板点云。In the embodiment of the present disclosure, obtaining the template point cloud of the sample attachment part includes: determining the source point cloud data of the sample attachment part through the original 3D design drawing of the sample attachment part or by taking pictures of the sample attachment part through a 3D camera; The source point cloud data of the sample-attached part is modeled to obtain the template point cloud of the sample-attached part.

其中,源点云数据可以是通过3D相机或者3D设计图得到的,含有全部样本贴附部件的点云数据。Wherein, the source point cloud data can be obtained through a 3D camera or a 3D design drawing, and contains point cloud data of all sample attachment parts.

具体的,为了得到样本贴附部件的模板点云,本实施例通过样本贴附部件的原始3D设计图或者通过3D相机拍摄的样本贴附部件,可以得到含有全部样本贴附部件的源点云数据,再将得到的该源点云数据通过建模处理,从而得到含有各个贴附部件的模板点云,即样本贴附部件的模板点云,再将各个样本贴附部件进行标记,以方便后续进行分割比较。示例性的,在本实施例中,若获取样本贴附部件源点云数据的方式为通过3D相机直接拍摄,则可以通过手动方式进行建模,对各个待测贴附部件进行标记。Specifically, in order to obtain the template point cloud of the sample attachment part, in this embodiment, the source point cloud containing all the sample attachment parts can be obtained through the original 3D design drawing of the sample attachment part or the sample attachment part photographed by a 3D camera Data, and then the obtained source point cloud data is processed by modeling to obtain the template point cloud containing each attached part, that is, the template point cloud of the sample attached part, and then mark each sample attached part to facilitate Subsequent segmentation comparisons are performed. Exemplarily, in this embodiment, if the source point cloud data of the attached parts of the sample is obtained by directly shooting with a 3D camera, modeling can be performed manually, and each attached part to be tested can be marked.

在本公开实施例中,获取部件待测点云,包括:将校正后的模板点云和包含有至少一个待测贴附部件的待测点云进行降维处理,得到降维模板点云和降维待测点云;在降维模板点云内,确定与目标部件模板点云相对应的降维部件模板点云;基于邻域最小值法,在降维待测点云内,确定与降维部件模板点云相对应的降维部件点云,并通过降维待测点云和包含有至少一个待测贴附部件的待测点云之间的映射关系,在包含有至少一个待测贴附部件的待测点云上,确定与降维部件点云相对应的待测点云区域作为部件待测点云。In an embodiment of the present disclosure, obtaining the point cloud of the component to be measured includes: performing dimensionality reduction processing on the corrected template point cloud and the point cloud to be measured containing at least one attached component to be tested, to obtain the dimensionality reduction template point cloud and Reduce the dimensionality of the point cloud to be measured; in the dimensionality reduction template point cloud, determine the dimensionality reduction component template point cloud corresponding to the target component template point cloud; based on the neighborhood minimum method, in the dimensionality reduction point cloud to be measured, determine and The dimensionality reduction part point cloud corresponding to the dimensionality reduction part template point cloud, and through the mapping relationship between the dimensionality reduction point cloud to be measured and the point cloud to be measured containing at least one attached part to be On the point cloud of the component to be measured, determine the area of the point cloud to be measured corresponding to the point cloud of the dimensionality reduction component as the point cloud of the component to be measured.

其中,降维模板点云可以是Z轴坐标值为0的模板点云,记为pt_model”。降维待测点云,可以是Z轴坐标值为0的待测点云,记为pt_dst”。邻域最小值法,可以是用于将降维的待测点云和与相对应的降维部件模板点云进行匹配的方法,示例性的,本实施例采用的邻域最小值法为8邻域最小值法。降维部件模板点云指的是在降维模板点云内分割出来的独立部件区域,记为ROI_model”[N]。降维部件点云,可以是Z轴坐标值为0的贴附部件点云,与降维部件模板点云相对应,记为ROI_dst”[N]。部件待测点云可以是在待测点云上与降维部件点云相对应的点云区域,记为ROI_dst[N]。Among them, the dimensionality reduction template point cloud can be a template point cloud with a Z-axis coordinate value of 0, which is recorded as pt_model". . The neighborhood minimum method can be a method for matching the dimensionality-reduced point cloud to be measured with the corresponding dimensionality reduction component template point cloud. Exemplarily, the neighborhood minimum method used in this embodiment is 8 Neighborhood minimum method. The dimension reduction part template point cloud refers to the independent part area segmented in the dimension reduction template point cloud, which is recorded as ROI_model”[N]. The dimension reduction part point cloud can be an attached part point with a Z-axis coordinate value of 0 cloud, corresponding to the point cloud of the dimensionality reduction part template, denoted as ROI_dst”[N]. The point cloud of the component to be tested may be a point cloud area corresponding to the point cloud of the dimensionality-reduced component on the point cloud to be tested, which is denoted as ROI_dst[N].

具体的,由于点云的信息量大,导致系统运算速度慢,还由于笔记本内结构本身高度差的干扰,容易造成系统判断误差,因此为了提高系统的运行效率以及降低系统的判断误差率,本实施例将得到的校正后的模板点云和包含有至少一个待测贴附部件的待测点云进行降维处理,即将这些点云的Z轴坐标值设置为0,从而得到Z轴坐标值为0的模板点云,以及Z轴坐标值为0的包含有至少一个待测贴附部件的待测点云,得到降维模板点云和降维待测点云。由于降维模板点云为整体性模板,因此在降维模板点云内,可以根据选取局部的目标部件模板点云,确定与其对应的降维部件模板点云。在降维待测点云内,本实施例利用邻域最小值法,根据降维部件模板点云和降维部件点云的X坐标与Y坐标,从而得到与降维部件模板点云所对应的降维部件点云。然后本实施例再根据降维待测点云和包含有至少一个待测贴附部件的待测点云之间的映射关系,从而在待测点云上,确定与降维部件点云相对应的待测点云区域,即部件待测点云。Specifically, due to the large amount of information in the point cloud, the system operation speed is slow, and because of the interference of the height difference in the notebook structure itself, it is easy to cause system judgment errors. Therefore, in order to improve the operating efficiency of the system and reduce the judgment error rate of the system, this paper Embodiment The obtained corrected template point cloud and the point cloud to be measured containing at least one attached part to be tested are subjected to dimensionality reduction processing, that is, the Z-axis coordinate values of these point clouds are set to 0, thereby obtaining the Z-axis coordinate value The template point cloud with a value of 0, and the point cloud to be measured containing at least one attached part to be tested with a Z-axis coordinate value of 0, to obtain a reduced-dimensional template point cloud and a reduced-dimensional measured point cloud. Since the dimensionality reduction template point cloud is a holistic template, in the dimensionality reduction template point cloud, the corresponding dimensionality reduction component template point cloud can be determined according to the selected local target component template point cloud. In the dimensionality reduction point cloud to be measured, this embodiment uses the neighborhood minimum value method, according to the dimensionality reduction component template point cloud and the X coordinate and Y coordinate of the dimensionality reduction component point cloud, thereby obtaining the corresponding value of the dimensionality reduction component template point cloud The dimensionality reduction part point cloud of . Then in this embodiment, according to the mapping relationship between the dimensionality reduction point cloud to be measured and the point cloud to be measured that contains at least one attached component to be measured, on the point cloud to be measured, it is determined that the point cloud corresponding to the dimensionality reduction component The area of the point cloud to be tested, that is, the point cloud of the component to be tested.

本实施例通过在降维处理后的降维模板点云上获取需要进行匹配的降维部件模板点云,再通过二维配比得到降维部件点云,最后再通过降维部件点云与三维的待测点云的映射关系,确定部件待测点云,能够消除笔记本内结构本身高度的干扰,同时降低了出现判断误差的可能性。In this embodiment, the dimensionality reduction component template point cloud that needs to be matched is acquired on the dimensionality reduction template point cloud after dimensionality reduction processing, and then the dimensionality reduction component point cloud is obtained through two-dimensional matching, and finally the dimensionality reduction component point cloud is combined with The mapping relationship of the three-dimensional point cloud to be measured and the point cloud of the component to be measured can be determined, which can eliminate the interference of the height of the structure itself in the notebook, and at the same time reduce the possibility of judgment errors.

S120、分别将部件待测点云和目标部件模板点云重建为部件待测深度图和目标部件模板深度图。S120. Reconstruct the point cloud of the part to be tested and the point cloud of the target part template into a depth map of the part to be tested and a depth map of the target part template, respectively.

其中,部件待测深度图可以是通过部件待测点云得到的,用于生成部件待测二值图的图像,记为dep_dst。目标部件模板深度图,可以是通过目标部件模板点云得到的,用于生成目标部件模板二值图的图像,记为dep_model。Wherein, the depth map of the part to be tested can be obtained through the point cloud of the part to be tested, and is used to generate the image of the binary image of the part to be tested, denoted as dep_dst. The depth map of the target part template can be obtained through the point cloud of the target part template, and is used to generate the image of the binary image of the target part template, denoted as dep_model.

在本公开实施例中,分别将部件待测点云和目标部件模板点云重建为部件待测深度图和目标部件模板深度图,包括:分别获取部件待测点云和目标部件模板点云内各个体素的坐标,其中,坐标包括X值、Y值和Z值;将部件待测点云内各个体素的X值和Y值作为部件待测深度图的坐标值,并将Z值作为部件待测深度图的像素值,以重建部件待测深度图;将目标部件模板点云内各个体素的X值和Y值作为目标部件模板深度图的坐标值,并将Z值作为目标部件模板深度图的像素值,以重建目标部件模板深度图。In the embodiment of the present disclosure, respectively rebuilding the point cloud of the part to be measured and the point cloud of the target part template into the depth map of the part to be measured and the depth map of the target part template, including: respectively obtaining the point cloud of the part to be measured and the point cloud of the target part template The coordinates of each voxel, wherein the coordinates include X value, Y value and Z value; the X value and Y value of each voxel in the part to be measured point cloud are used as the coordinate value of the part to be measured depth map, and the Z value is used as The pixel value of the depth map of the part to be measured is used to reconstruct the depth map of the part to be measured; the X value and the Y value of each voxel in the point cloud of the target part template are used as the coordinate values of the depth map of the target part template, and the Z value is used as the target part Pixel values of the stencil depth map to reconstruct the target part stencil depth map.

具体的,为了判断待测部件是否存在贴附异常,本实施例需要先将部件待测点云和目标部件模板点云转换为能够进行二值化处理以及Blob分析运算的部件待测深度图和目标部件模板深度图。具体为,首先通过部件待测点云和目标部件模板点云,得到与其对应的各个体素的X、Y以及Z轴的坐标值,然后将部件待测点云内各个体素的X、Y轴坐标值作为降维后的部件待测深度图坐标值,并将各个体素的Z轴坐标值作为该部件待测深度图的像素值,从而得到重建后的部件待测深度图。同理,本实施例将目标部件模板点云内各个体素的X、Y轴坐标值作为降维后的目标部件模板深度图的坐标值,并将各个体素的Z轴坐标值作为该目标部件模板深度图的像素值,从而得到重建后的目标部件模板深度图。Specifically, in order to determine whether there is an abnormality in the attachment of the component to be tested, this embodiment needs to first convert the point cloud of the component to be tested and the point cloud of the target component template into a component to be tested depth map and Target part template depth map. Specifically, firstly, through the point cloud of the part to be measured and the point cloud of the target part template, the coordinate values of the X, Y, and Z axes of each voxel corresponding to it are obtained, and then the X, Y coordinates of each voxel in the part to be measured point cloud are obtained The axis coordinate value is used as the coordinate value of the component to be measured depth map after dimensionality reduction, and the Z-axis coordinate value of each voxel is used as the pixel value of the component to be measured depth map, so as to obtain the reconstructed component to be measured depth map. Similarly, in this embodiment, the X and Y axis coordinate values of each voxel in the point cloud of the target component template are used as the coordinate values of the depth map of the target component template after dimensionality reduction, and the Z axis coordinate values of each voxel are used as the target The pixel value of the depth map of the part template, so as to obtain the reconstructed depth map of the target part template.

S130、通过对部件待测深度图和目标部件模板深度图进行二值化处理以及Blob分析,确定部件待测点云是否存在贴附缺陷。S130. By performing binarization processing and Blob analysis on the depth map of the part to be tested and the depth map of the target part template, determine whether there is an attachment defect in the point cloud of the part to be tested.

其中,二值化处理可以是将部件待测深度图和目标部件模板深度图转换为灰度图的操作。Blob分析,可以是对部件待测二值图和目标部件模板二值图的宽、高以及面积等物理特征进行分析的操作,其中,本实施例采用的Blob分析方法可以是Open cv算法库内的FindContours。Wherein, the binarization process may be an operation of converting the depth image of the component to be tested and the depth image of the template of the target component into a grayscale image. Blob analysis can be the operation of analyzing physical characteristics such as the width, height and area of the binary image of the component to be tested and the binary image of the target component template. Wherein, the Blob analysis method adopted in this embodiment can be in the Open cv algorithm library FindContours.

具体的,为了确定部件待测点云是否存在贴附缺陷,本实施例将得到的部件待测深度图和目标部件模板深度图,通过二值化处理的方式,从而得到部件待测二值图和目标部件模板二值图,再将得到的部件待测二值图和目标部件模板二值图,通过Blob分析的方式,进而确定部件待测点云是否存在贴附缺陷。Specifically, in order to determine whether there is an attachment defect in the point cloud of the component to be tested, the obtained depth map of the component to be tested and the depth map of the target component template are obtained in this embodiment through binarization processing, thereby obtaining the binary image of the component to be tested and the binary image of the target component template, and then use the obtained binary image of the component to be tested and the binary image of the target component template to determine whether there is an attachment defect in the point cloud of the component to be tested by means of Blob analysis.

现有的缺陷检测方法为基于3D点云的神经网络训练方法,该方法针对是否存在贴附缺陷检测有一定的效果,但需要大量人力对样本进行收集、标注、训练,该方法不仅费时费力且不便于操作。此外,该方法对标准贴附且贴附位置周围无高度突起的部件缺陷检测效果较好,但对于贴附位置附近存在高度突起或者贴附少许偏移的情况,其缺陷检测效果较差。而本实施例采用的方法,不仅有效的解决了当贴附部件位置附近存在高度突起或者贴附部件存在少许偏移时,其检测准确性低的问题,还弥补基于3D点云的神经网络训练方法浪费大量人力、物力的缺点,此外还有效的提升了算法检测的速度。The existing defect detection method is a neural network training method based on 3D point cloud. This method has a certain effect on the detection of whether there is an attachment defect, but it requires a lot of manpower to collect, label and train samples. This method is not only time-consuming and laborious but also Not easy to operate. In addition, this method has a good detection effect on standard attachment and no high protrusions around the attachment position, but it has a poor defect detection effect on the presence of high protrusions near the attachment position or a small deviation in attachment. The method adopted in this embodiment not only effectively solves the problem of low detection accuracy when there is a high protrusion near the position of the attached part or the attached part has a slight offset, but also makes up for the neural network training based on 3D point cloud. The method has the disadvantage of wasting a lot of manpower and material resources, and also effectively improves the speed of algorithm detection.

实施例二Embodiment two

图2为本公开实施例二提供的一种缺陷检测方法的流程图,本公开实施例在上述实施例的基础上,其中,通过对部件待测深度图和目标部件模板深度图进行二值化处理以及Blob分析,确定部件待测点云是否存在贴附缺陷,包括:基于部件模板点云所对应的深度均值,分别将部件待测深度图和目标部件模板深度图进行二值化处理,得到部件待测二值图和目标部件模板二值图;分别获取部件待测二值图内的第一预设区域和目标部件模板二值图内的第二预设区域;将第一预设区域和第二预设区域的区域信息进行比较,确定部件待测点云是否存在贴附缺陷,其中,区域信息包含以下至少之一:宽、高以及面积,该方法具体包括:Fig. 2 is a flow chart of a defect detection method provided by Embodiment 2 of the present disclosure. The embodiment of the present disclosure is based on the above-mentioned embodiments, wherein the depth map of the component to be tested and the depth map of the target component template are binarized processing and Blob analysis to determine whether there is an attachment defect in the point cloud of the part to be tested, including: based on the mean value of the depth corresponding to the point cloud of the part template, the depth map of the part to be tested and the depth map of the target part template are binarized respectively to obtain The binary image of the part to be tested and the binary image of the target part template; respectively obtain the first preset area in the binary image of the part to be tested and the second preset area in the binary image of the target part template; the first preset area Compared with the area information of the second preset area, it is determined whether there is an attachment defect in the point cloud of the component to be tested, wherein the area information includes at least one of the following: width, height, and area. The method specifically includes:

S210、获取部件待测点云以及获取目标部件模板点云。S210. Obtain a point cloud of the component to be tested and a target component template point cloud.

S220、分别将部件待测点云和目标部件模板点云重建为部件待测深度图和目标部件模板深度图。S220. Reconstruct the point cloud of the part to be tested and the point cloud of the target part template into a depth map of the part to be tested and a depth map of the target part template, respectively.

S230、基于部件模板点云所对应的深度均值,分别将部件待测深度图和目标部件模板深度图进行二值化处理,得到部件待测二值图和目标部件模板二值图。S230. Based on the average depth value corresponding to the point cloud of the part template, perform binarization processing on the depth map of the part to be tested and the depth map of the target part template, respectively, to obtain the binary map of the part to be tested and the binary map of the target part template.

其中,部件待测二值图可以是部件待测点云通过二值化处理得到的灰度图,记为bin_dep_model。目标部件模板二值图,可以是目标部件模板点云通过二值化处理得到的灰度图,记为bin_dep_dst。Wherein, the binary image of the component to be tested may be a grayscale image obtained by binarizing the point cloud of the component to be tested, which is recorded as bin_dep_model. The binary image of the target part template can be a grayscale image obtained by binarizing the point cloud of the target part template, which is denoted as bin_dep_dst.

具体的,为了简化操作、提高工作效率,本实施例获取部件模板点云的Z轴坐标值,从而可以得到部件模板点云所对应的深度均值,再基于部件模板点云的深度均值,对得到的部件待测深度图和目标部件模板深度图通过二值化处理,从而得到与其对应的部件待测二值图以及目标部件模板二值图。其中,部件待测二值图和目标部件模板二值图为黑白色的灰度图。Specifically, in order to simplify operations and improve work efficiency, this embodiment obtains the Z-axis coordinate value of the point cloud of the part template, so that the mean depth value corresponding to the point cloud of the part template can be obtained, and then based on the mean value of the depth of the point cloud of the part template, the obtained The component-to-be-tested depth map and the target part template depth map are binarized to obtain the corresponding component-to-be-tested binary map and the target part template binary map. Wherein, the binary image of the component to be tested and the binary image of the target component template are grayscale images of black and white.

S240、分别获取部件待测二值图内的第一预设区域和目标部件模板二值图内的第二预设区域。S240. Respectively acquire a first preset area in the binary image of the component to be tested and a second preset area in the binary image of the target component template.

其中,第一预设区域可以是部件待测二值图内的白色区域。第二预设区域,可以是目标部件模板二值图内的白色区域。Wherein, the first preset area may be a white area in the binary image of the component to be tested. The second preset area may be a white area in the binary image of the target component template.

本实施例以部件模板点云所对应的深度均值作为基准,转化为部件待测二值图和目标部件模板二值图。由于贴附部件区域会高于笔记本内部结构的区域,因此,在上述二值图内会显示为白色区域。本实施例可以直接将部件待测二值图内的白色区域作为第一预设区域。将目标部件模板二值图内的白色区域作为第二预设区域。In this embodiment, the mean value of the depth corresponding to the point cloud of the component template is used as a reference, and converted into a binary image of the component to be tested and a binary image of the target component template. Since the attached component area will be higher than the area of the internal structure of the notebook, it will be displayed as a white area in the above binary image. In this embodiment, the white area in the binary image of the component to be tested can be directly used as the first preset area. The white area in the binary image of the target component template is used as the second preset area.

S250、将第一预设区域和第二预设区域的区域信息进行比较,确定部件待测点云是否存在贴附缺陷。S250. Comparing the area information of the first preset area and the second preset area to determine whether there is an attachment defect in the point cloud of the component to be tested.

其中,区域信息包含以下至少之一:宽、高以及面积。Wherein, the area information includes at least one of the following: width, height and area.

具体的,本实施例将得到的部件待测二值图中的第一预设区域,和目标部件模板二值图中的第二预设区域,通过Blob分析的方式进行比较,即对第一预设区域以及第二预设区域中白色区域的宽、高以及面积等进行比较,从而确定部件待测二值图中贴附部件是否存在缺陷,进而确定部件待测点云是否存在贴附缺陷。Specifically, this embodiment compares the first preset area in the binary image of the component to be tested with the second preset area in the binary image of the target component template through Blob analysis, that is, the first Compare the width, height and area of the white area in the preset area and the second preset area, so as to determine whether there is a defect in the attached part in the binary image of the part to be tested, and then determine whether there is an attachment defect in the point cloud of the part to be tested .

在本公开实施例中,将第一预设区域和第二预设区域的区域信息进行比较,确定部件待测点云是否存在贴附缺陷,包括:当第一预设区域和第二预设区域的宽差值小于预设宽阈值、第一预设区域和第二预设区域的高差值小于预设高阈值以及第一预设区域和第二预设区域的面积差值小于预设面积阈值时,确定部件待测点云不存在贴附缺陷;否则,确定部件待测点云存在贴附缺陷。In an embodiment of the present disclosure, the area information of the first preset area and the second preset area are compared to determine whether there is an attachment defect in the point cloud of the component to be tested, including: when the first preset area and the second preset area The width difference of the area is less than the preset width threshold, the height difference between the first preset area and the second preset area is less than the preset high threshold, and the area difference between the first preset area and the second preset area is less than the preset When the area threshold is , it is determined that there is no attachment defect in the point cloud of the part to be tested; otherwise, it is determined that there is an attachment defect in the point cloud of the part to be tested.

其中,预设宽阈值、预设高阈值以及预设面积阈值可以是根据实际情况而设定的任意值,本实施例不对其进行限定。Wherein, the preset wide threshold, the preset high threshold, and the preset area threshold may be any values set according to actual conditions, which are not limited in this embodiment.

具体的,本实施例将得到的第一预设区域中白色区域的宽、高以及面积,分别和第二预设区域中白色区域的宽、高以及面积进行比较,若第一预设区域和与其对应的第二预设区域中白色区域的宽、高以及面积的差值,均小于与其对应的预设阈值时,则判定为该部件待测点云不存在贴附缺陷。若第一预设区域和与其对应的第二预设区域中白色区域的宽、高以及面积的差值,其中任意一个大于或等于与其对应的预设阈值时,则判定为该部件待测点云存在贴附缺陷。Specifically, this embodiment compares the obtained width, height and area of the white area in the first preset area with the width, height, and area of the white area in the second preset area, if the first preset area and When the differences of the width, height and area of the white area in the corresponding second preset area are all smaller than the corresponding preset threshold, it is determined that there is no attachment defect in the point cloud of the component to be measured. If the difference between the width, height and area of the white area in the first preset area and the corresponding second preset area, any one of which is greater than or equal to the corresponding preset threshold, it is determined that the component is to be tested. The cloud has an attachment flaw.

图3为本公开实施例二提供的一种缺陷检测方法的实现流程框架图,由于现有的缺陷检测方法对标准贴附且贴附位置周围无高度突起的部件缺陷检测效果较好,但对于贴附位置附近存在高度突起或者贴附少许偏移时,其缺陷检测效果较差,因此本实施例针对上述问题,提供了有效的解决方法,详细步骤如下所示:Fig. 3 is a frame diagram of the implementation process of a defect detection method provided by Embodiment 2 of the present disclosure. Since the existing defect detection method has a good detection effect on standard attachment and parts with no high protrusions around the attachment position, but for When there is a high protrusion near the attachment position or when the attachment is slightly offset, the defect detection effect is poor. Therefore, this embodiment provides an effective solution to the above problems. The detailed steps are as follows:

1.读取3D模板点云pt_model作为源点云,读取3D待测点云pt_dst作为目标点云,进行点云配准,得到3D转换矩阵T;1. Read the 3D template point cloud pt_model as the source point cloud, read the 3D test point cloud pt_dst as the target point cloud, and perform point cloud registration to obtain the 3D transformation matrix T;

2.将3D模板点云pt_model和3D转换矩阵T进行叉乘,获得校正后的模板点云pt_model’,如公式[1]所示;2. Cross-multiply the 3D template point cloud pt_model and the 3D transformation matrix T to obtain the corrected template point cloud pt_model', as shown in formula [1];

pt_model'=pt_model×T[1]pt_model'=pt_model×T[1]

3.提取模板点云pt_model’的贴附部件区域,并分割为一个个独立的部件区ROI_model[N](即目标部件模板点云),其中,N为模板信息中包含的独立部件区总个数;3. Extract the attached part area of the template point cloud pt_model', and divide it into independent part areas ROI_model[N] (ie, the target part template point cloud), where N is the total number of independent part areas contained in the template information number;

4.分别将模板点云pt_model’和待测点云pt_dst,进行降维处理,即将z坐标数值设置为0,得到降维模板点云pt_model”和降维待测点云pt_dst”;4. Perform dimensionality reduction processing on the template point cloud pt_model’ and the point cloud to be measured pt_dst respectively, that is, set the z coordinate value to 0 to obtain the dimensionality reduction template point cloud pt_model” and the dimensionality reduction point cloud pt_dst” to be measured;

5.提取降维模板点云pt_model”的贴附部件区域,并分割为一个个独立的部件区ROI_model”[N](即降维部件模板点云),N为模板信息中包含的独立部件区总个数;5. Extract the attached part area of the dimension reduction template point cloud pt_model", and divide it into independent part areas ROI_model"[N] (ie, the dimension reduction part template point cloud), N is the independent part area contained in the template information The total number of;

6.基于各个独立部件ROI_model”[N],通过8邻域最小值法,在降维待测点云pt_dst”中获取对应的部件点云ROI_dst”[N](即降维部件点云),进一步映射到待测点云pt_dst中,即可获取到和目标部件模板点云ROI_model[N]相对应的部件待测点云ROI_dst[N];6. Based on each independent component ROI_model”[N], through the 8-neighborhood minimum method, obtain the corresponding component point cloud ROI_dst”[N] (that is, the dimensionality reduction component point cloud) in the dimensionality reduction point cloud pt_dst”, By further mapping to the point cloud pt_dst to be measured, the point cloud ROI_dst[N] corresponding to the point cloud ROI_model[N] of the target component template can be obtained;

7.分别将目标部件模板点云ROI_model[i]和部件待测点云ROI_dst[i]转换为深度图dep_model[i](即目标部件模板深度图)和dep_dst[i](即部件待测深度图),其中,i为任意一个独立部件区。7. Convert the target part template point cloud ROI_model[i] and the component to be measured point cloud ROI_dst[i] into depth maps dep_model[i] (ie, the depth map of the target part template) and dep_dst[i] (ie, the depth of the component to be measured ), where i is any independent component area.

8.基于目标部件模板点云ROI_model[i]内的深度,对目标部件模板深度图dep_model[i]和部件待测深度图dep_dst[i]进行二值化,获得部件待测二值图bin_dep_model[i]和目标部件模板二值图bin_dep_dst[i]。其计算方法如式[2]、[3]:8. Based on the depth in the target part template point cloud ROI_model[i], binarize the target part template depth map dep_model[i] and the part to-be-tested depth map dep_dst[i] to obtain the part to-be-tested binary map bin_dep_model[ i] and target component template binary map bin_dep_dst[i]. Its calculation method is as formula [2], [3]:

Figure BDA0004102102540000151
Figure BDA0004102102540000151

Figure BDA0004102102540000152
Figure BDA0004102102540000152

其中bin_dep_model[i](x,y)为模板深度二值图对应的像素值,bin_dep_dst[i](x,y)为待测深度二值图对应的像素值,ROI_model[i]_z为目标部件模板点云z轴深度值,dep_dst[i](x,y)为部件待测深度图中各个像素点的深度值,mean表示平均值;Where bin_dep_model[i](x,y) is the pixel value corresponding to the template depth binary image, bin_dep_dst[i](x,y) is the pixel value corresponding to the depth binary image to be measured, and ROI_model[i]_z is the target component The z-axis depth value of the template point cloud, dep_dst[i](x,y) is the depth value of each pixel in the depth map of the component to be measured, and mean represents the average value;

9.分别对bin_dep_model[i]二值图和bin_dep_dst[i]二值图进行Blob分析,分别获取白色区域的宽、高、面积等信息;9. Perform Blob analysis on the bin_dep_model[i] binary image and bin_dep_dst[i] binary image respectively, and obtain information such as the width, height, and area of the white area;

10.当模板和待测二值图白色区域的宽、高和面积等信息均相差较小时,则认为待测区域为部件正常贴附;否则认为待测区域部件未贴附,其计算方法如式[4];10. When the information such as the width, height and area of the white area of the template and the binary image to be tested are all relatively small, it is considered that the area to be tested is normally attached to the component; otherwise, the component in the area to be tested is considered to be not attached, and the calculation method is as follows Formula [4];

Figure BDA0004102102540000161
Figure BDA0004102102540000161

其中flag_pass为是否正常标志位,0表示异常,1表示正常,w_mdl、h_mdl、area_mdl分别为模板深度二值图白色区域宽度、高度和面积,w_dst、h_dst、area_dst分别为待测深度二值图白色区域宽度、高度和面积,T_w、T_h、T_area分别为二值图白色区域宽度阈值、高度阈值和面积阈值。Among them, flag_pass is the normal flag, 0 means abnormal, 1 means normal, w_mdl, h_mdl, area_mdl are the width, height and area of the white area of the template depth binary image respectively, w_dst, h_dst, area_dst are the white color of the depth binary image to be tested respectively Area width, height, and area, T_w, T_h, and T_area are the width threshold, height threshold, and area threshold of the white area of the binary image, respectively.

本实施例不仅有效的解决了当贴附部件位置附近存在高度突起或者贴附部件存在少许偏移时,其检测准确性低的问题,还弥补基于3D点云的神经网络训练方法浪费大量人力、物力的缺点,提高检测效率。This embodiment not only effectively solves the problem of low detection accuracy when there is a high protrusion near the position of the attached part or the attached part is slightly offset, but also makes up for the waste of a lot of manpower and the time spent on the neural network training method based on the 3D point cloud. The shortcomings of material resources can improve the detection efficiency.

实施例三Embodiment three

图4是本公开实施例提供的一种缺陷检测装置的结构示意图,该装置具体包括:Fig. 4 is a schematic structural diagram of a defect detection device provided by an embodiment of the present disclosure, the device specifically includes:

点云获取模块410,用于获取部件待测点云以及获取目标部件模板点云,其中,目标部件模板点云为判断部件待测点云是否存在贴附缺陷的参考模板点云;The point cloud acquisition module 410 is used to acquire the point cloud of the component to be tested and the target component template point cloud, wherein the target component template point cloud is a reference template point cloud for judging whether the component to be tested point cloud has an attachment defect;

深度图重建模块420,用于分别将部件待测点云和目标部件模板点云重建为部件待测深度图和目标部件模板深度图;Depth map reconstruction module 420, for respectively reconstructing the point cloud of the part to be measured and the point cloud of the target part template into a depth map of the part to be measured and a depth map of the target part template;

缺陷分析模块430,用于通过对部件待测深度图和目标部件模板深度图进行二值化处理以及Blob分析,确定部件待测点云是否存在贴附缺陷。The defect analysis module 430 is configured to perform binarization processing and Blob analysis on the depth map of the part to be tested and the depth map of the target part template to determine whether there is an attachment defect in the point cloud of the part to be tested.

在一可实施方式中,缺陷分析模块430,具体用于:In a possible implementation manner, the defect analysis module 430 is specifically used for:

基于部件模板点云所对应的深度均值,分别将部件待测深度图和目标部件模板深度图进行二值化处理,得到部件待测二值图和目标部件模板二值图;Based on the mean value of the depth corresponding to the part template point cloud, the depth map of the part to be tested and the depth map of the target part template are respectively binarized to obtain the binary map of the part to be tested and the binary map of the target part template;

分别获取部件待测二值图内的第一预设区域和目标部件模板二值图内的第二预设区域;Respectively obtain a first preset area in the binary image of the component to be tested and a second preset area in the binary image of the target component template;

将第一预设区域和第二预设区域的区域信息进行比较,确定部件待测点云是否存在贴附缺陷,其中,区域信息包含以下至少之一:宽、高以及面积。Comparing the area information of the first preset area and the second preset area to determine whether there is an attachment defect in the point cloud of the part to be tested, wherein the area information includes at least one of the following: width, height and area.

在一可实施方式中,缺陷分析模块430,还具体用于:In a possible implementation manner, the defect analysis module 430 is also specifically used for:

当第一预设区域和第二预设区域的宽差值小于预设宽阈值、第一预设区域和第二预设区域的高差值小于预设高阈值以及第一预设区域和第二预设区域的面积差值小于预设面积阈值时,确定部件待测点云不存在贴附缺陷;否则,确定部件待测点云存在贴附缺陷。When the width difference between the first preset area and the second preset area is less than the preset width threshold, the height difference between the first preset area and the second preset area is less than the preset high threshold, and the first preset area and the second preset area When the area difference between the two preset areas is less than the preset area threshold, it is determined that there is no attachment defect in the point cloud of the part to be tested; otherwise, it is determined that there is an attachment defect in the point cloud of the part to be tested.

在一可实施方式中,点云获取模块410,具体用于:In a possible implementation manner, the point cloud acquisition module 410 is specifically used for:

获取包含有至少一个待测贴附部件的待测点云和获取样本贴附部件的模板点云,其中,模板点云内标记有各个样本贴附部件的标签;Obtaining a point cloud to be measured containing at least one attached part to be tested and a template point cloud of the sample attached part, wherein the template point cloud is marked with labels of each sample attached part;

基于点云配准算法和包含有至少一个待测贴附部件的待测点云,将模板点云进行校准,得到校正后的模板点云;Calibrate the template point cloud based on the point cloud registration algorithm and the point cloud to be measured including at least one attached part to be tested to obtain a corrected template point cloud;

在校正后的模板点云上,确定至少一个样本部件模板点云,并依次将每个样本部件模板点云作为目标部件模板点云。On the corrected template point cloud, at least one sample part template point cloud is determined, and each sample part template point cloud is sequentially used as a target part template point cloud.

在一可实施方式中,点云获取模块410,还具体用于:In a possible implementation manner, the point cloud acquisition module 410 is also specifically used for:

通过样本贴附部件的原始3D设计图或者通过3D相机拍摄样本贴附部件,确定样本贴附部件的源点云数据;Determine the source point cloud data of the sample-attached part through the original 3D design drawing of the sample-attached part or take pictures of the sample-attached part through a 3D camera;

将样本贴附部件的源点云数据进行建模,得到样本贴附部件的模板点云。The source point cloud data of the sample-attached part is modeled to obtain the template point cloud of the sample-attached part.

在一可实施方式中,点云获取模块410,还具体用于:In a possible implementation manner, the point cloud acquisition module 410 is also specifically used for:

将校正后的模板点云和包含有至少一个待测贴附部件的待测点云进行降维处理,得到降维模板点云和降维待测点云;performing dimensionality reduction processing on the corrected template point cloud and the point cloud to be measured containing at least one attached part to be tested, to obtain the dimensionality reduction template point cloud and the dimensionality reduction point cloud to be measured;

在降维模板点云内,确定与目标部件模板点云相对应的降维部件模板点云;In the dimension reduction template point cloud, determine the dimension reduction component template point cloud corresponding to the target component template point cloud;

基于邻域最小值法,在降维待测点云内,确定与降维部件模板点云相对应的降维部件点云,并通过降维待测点云和包含有至少一个待测贴附部件的待测点云之间的映射关系,在包含有至少一个待测贴附部件的待测点云上,确定与降维部件点云相对应的待测点云区域作为部件待测点云。Based on the neighborhood minimum method, in the dimensionality reduction point cloud to be measured, determine the dimensionality reduction component point cloud corresponding to the dimensionality reduction component template point cloud, and through the dimensionality reduction to be measured point cloud and at least one to-be-tested attachment The mapping relationship between the point clouds to be measured of the parts, on the point cloud to be measured that contains at least one attached part to be tested, determine the area of the point cloud to be measured corresponding to the point cloud of the dimensionality-reduced part as the point cloud to be measured of the part .

在一可实施方式中,深度图重建模块420,具体用于:In a possible implementation manner, the depth map reconstruction module 420 is specifically used for:

分别获取部件待测点云和目标部件模板点云内各个体素的坐标,其中,坐标包括X值、Y值和Z值;Respectively obtain the coordinates of each voxel in the point cloud of the part to be measured and the point cloud of the target part template, wherein the coordinates include X value, Y value and Z value;

将部件待测点云内各个体素的X值和Y值作为部件待测深度图的坐标值,并将Z值作为部件待测深度图的像素值,以重建部件待测深度图;Using the X value and Y value of each voxel in the part to be measured point cloud as the coordinate value of the part to be measured depth map, and using the Z value as the pixel value of the part to be measured depth map to reconstruct the part to be measured depth map;

将目标部件模板点云内各个体素的X值和Y值作为目标部件模板深度图的坐标值,并将Z值作为目标部件模板深度图的像素值,以重建目标部件模板深度图。The X value and Y value of each voxel in the point cloud of the target part template are used as the coordinate value of the depth map of the target part template, and the Z value is used as the pixel value of the depth map of the target part template to reconstruct the depth map of the target part template.

根据本公开的实施例,本公开还提供了一种电子设备和一种可读存储介质。According to the embodiments of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

图5示出了可以用来实施本公开的实施例的示例电子设备500的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。FIG. 5 shows a schematic block diagram of an example electronic device 500 that may be used to implement embodiments of the present disclosure. Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.

如图5所示,设备500包括计算单元501,其可以根据存储在只读存储器(ROM)502中的计算机程序或者从存储单元508加载到随机访问存储器(RAM)503中的计算机程序,来执行各种适当的动作和处理。在RAM 503中,还可存储设备500操作所需的各种程序和数据。计算单元501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。As shown in FIG. 5 , the device 500 includes a computing unit 501 that can execute according to a computer program stored in a read-only memory (ROM) 502 or loaded from a storage unit 508 into a random-access memory (RAM) 503. Various appropriate actions and treatments. In the RAM 503, various programs and data necessary for the operation of the device 500 can also be stored. The computing unit 501 , ROM 502 and RAM 503 are connected to each other through a bus 504 . An input/output (I/O) interface 505 is also connected to the bus 504 .

设备500中的多个部件连接至I/O接口505,包括:输入单元506,例如键盘、鼠标等;输出单元507,例如各种类型的显示器、扬声器等;存储单元508,例如磁盘、光盘等;以及通信单元509,例如网卡、调制解调器、无线通信收发机等。通信单元509允许设备500通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 500 are connected to the I/O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, an optical disk, etc. ; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 509 allows the device 500 to exchange information/data with other devices over a computer network such as the Internet and/or various telecommunication networks.

计算单元501可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元501的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元501执行上文所描述的各个方法和处理,例如缺陷检测方法。例如,在一些实施例中,缺陷检测方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元508。在一些实施例中,计算机程序的部分或者全部可以经由ROM 502和/或通信单元509而被载入和/或安装到设备500上。当计算机程序加载到RAM503并由计算单元501执行时,可以执行上文描述的缺陷检测方法的一个或多个步骤。备选地,在其他实施例中,计算单元501可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行缺陷检测方法。The computing unit 501 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 501 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 executes various methods and processes described above, such as a defect detection method. For example, in some embodiments, the defect detection method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 508 . In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509 . When the computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of the defect detection method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the defect detection method in any other suitable manner (for example, by means of firmware).

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above herein may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chips ( SOC), Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor Can be special-purpose or general-purpose programmable processor, can receive data and instruction from storage system, at least one input device, and at least one output device, and transmit data and instruction to this storage system, this at least one input device, and this at least one output device an output device.

用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide for interaction with the user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,也可以为分布式系统的服务器,或者是结合了区块链的服务器。A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或隐含地包括至少一个该特征。在本公开的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of these features. In the description of the present disclosure, "plurality" means two or more, unless otherwise specifically defined.

以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以权利要求的保护范围为准。The above is only a specific implementation of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope of the present disclosure. should fall within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be determined by the protection scope of the claims.

Claims (10)

1. A method of defect detection, the method comprising:
acquiring a part to-be-measured point cloud and a target part template point cloud, wherein the target part template point cloud is a reference template point cloud for judging whether the part to-be-measured point cloud has an attachment defect or not;
reconstructing the component to-be-measured point cloud and the target component template point cloud into a component to-be-measured depth map and a target component template depth map respectively;
and determining whether the cloud of the part to be measured point has an attachment defect or not by carrying out binarization processing and Blob analysis on the part to be measured depth map and the target part template depth map.
2. The method according to claim 1, wherein the determining whether the component to-be-measured point cloud has an attachment defect by performing binarization processing and Blob analysis on the component to-be-measured depth map and the target component template depth map includes:
respectively carrying out binarization processing on the part to-be-detected depth map and the target part template depth map based on the depth mean value corresponding to the part template point cloud to obtain a part to-be-detected binary map and a target part template binary map;
respectively acquiring a first preset area in the binary image to be tested of the component and a second preset area in the binary image of the target component template;
Comparing the area information of the first preset area with the area information of the second preset area to determine whether the cloud of the part to be measured points has an attachment defect, wherein the area information comprises at least one of the following components: wide, high, and area.
3. The method of claim 2, wherein comparing the area information of the first preset area and the second preset area to determine whether the component-to-be-measured-point cloud has an attachment defect comprises:
when the width difference value of the first preset area and the second preset area is smaller than a preset width threshold value, the height difference value of the first preset area and the second preset area is smaller than a preset height threshold value, and the area difference value of the first preset area and the second preset area is smaller than a preset area threshold value, determining that the cloud to be tested of the component has no attachment defect; otherwise, determining that the cloud of the part to be measured points has attachment defects.
4. A method according to claim 1 or 3, wherein the obtaining a target part template point cloud comprises:
acquiring a point cloud to be detected comprising at least one attaching part to be detected and a template point cloud of a sample attaching part, wherein labels of all the sample attaching parts are marked in the template point cloud;
Calibrating the template point cloud based on a point cloud registration algorithm and the point cloud to be detected comprising at least one attached component to be detected, so as to obtain a corrected template point cloud;
and determining at least one sample part template point cloud on the corrected template point cloud, and taking each sample part template point cloud as a target part template point cloud in sequence.
5. The method of claim 4, wherein the obtaining a template point cloud of the sample application component comprises:
determining source point cloud data of the sample attached component by shooting the sample attached component through an original 3D design drawing of the sample attached component or through a 3D camera;
modeling the source point cloud data of the sample attached component to obtain a template point cloud of the sample attached component.
6. The method of claim 5, wherein the acquiring the component-to-be-measured point cloud comprises:
performing dimension reduction processing on the corrected template point cloud and the point cloud to be measured containing at least one attached component to be measured to obtain dimension reduction template point cloud and dimension reduction point cloud to be measured;
determining a dimension reduction component template point cloud corresponding to the target component template point cloud in the dimension reduction template point cloud;
And determining a dimension reduction component point cloud corresponding to the dimension reduction component template point cloud in the dimension reduction component point cloud based on a neighborhood minimum method, and determining a to-be-measured point cloud area corresponding to the dimension reduction component point cloud as a component to-be-measured point cloud on the to-be-measured point cloud containing at least one to-be-measured attachment component through a mapping relation between the dimension reduction to-be-measured point cloud and the to-be-measured point cloud containing at least one to-be-measured attachment component.
7. The method of claim 6, wherein reconstructing the component-to-be-measured point cloud and the target component template point cloud into a component-to-be-measured depth map and a target component template depth map, respectively, comprises:
respectively acquiring coordinates of each voxel in the component to-be-measured point cloud and the target component template point cloud, wherein the coordinates comprise an X value, a Y value and a Z value;
taking the X value and the Y value of each voxel in the component to-be-measured point cloud as coordinate values of the component to-be-measured depth map, and taking the Z value as pixel values of the component to-be-measured depth map to reconstruct the component to-be-measured depth map;
and taking the X value and the Y value of each voxel in the target component template point cloud as coordinate values of the target component template depth map, and taking the Z value as pixel values of the target component template depth map so as to reconstruct the target component template depth map.
8. A defect detection apparatus, the apparatus comprising:
the device comprises a point cloud acquisition module, a target component template point cloud, a target component detection module and a target component detection module, wherein the point cloud acquisition module is used for acquiring a component to-be-detected point cloud and acquiring the target component template point cloud, wherein the target component template point cloud is a reference template point cloud for judging whether the component to-be-detected point cloud has an attachment defect or not;
the depth map reconstruction module is used for reconstructing the component to-be-measured point cloud and the target component template point cloud into a component to-be-measured depth map and a target component template depth map respectively;
and the defect analysis module is used for determining whether the cloud of the part to be measured points has attachment defects or not by carrying out binarization processing and Blob analysis on the part to be measured depth map and the target part template depth map.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1-7.
CN202310172014.0A 2023-02-23 2023-02-23 Defect detection method, device, equipment and storage medium Pending CN116152208A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310172014.0A CN116152208A (en) 2023-02-23 2023-02-23 Defect detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310172014.0A CN116152208A (en) 2023-02-23 2023-02-23 Defect detection method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116152208A true CN116152208A (en) 2023-05-23

Family

ID=86338874

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310172014.0A Pending CN116152208A (en) 2023-02-23 2023-02-23 Defect detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116152208A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116486126A (en) * 2023-06-25 2023-07-25 合肥联宝信息技术有限公司 Template determination method, device, equipment and storage medium
CN116862898A (en) * 2023-07-27 2023-10-10 小米汽车科技有限公司 Defect detection method and device for parts, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112730251A (en) * 2020-12-30 2021-04-30 凌云光技术股份有限公司 Device and method for detecting color defects of screen
CN112734760A (en) * 2021-03-31 2021-04-30 惠州高视科技有限公司 Semiconductor bump defect detection method, electronic device, and storage medium
CN113344917A (en) * 2021-07-28 2021-09-03 浙江华睿科技股份有限公司 Detection method, detection device, electronic equipment and storage medium
CN115035031A (en) * 2022-05-07 2022-09-09 浙江华睿科技股份有限公司 Defect detection method and device for PIN (personal identification number) PIN, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112730251A (en) * 2020-12-30 2021-04-30 凌云光技术股份有限公司 Device and method for detecting color defects of screen
CN112734760A (en) * 2021-03-31 2021-04-30 惠州高视科技有限公司 Semiconductor bump defect detection method, electronic device, and storage medium
CN113344917A (en) * 2021-07-28 2021-09-03 浙江华睿科技股份有限公司 Detection method, detection device, electronic equipment and storage medium
CN115035031A (en) * 2022-05-07 2022-09-09 浙江华睿科技股份有限公司 Defect detection method and device for PIN (personal identification number) PIN, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116486126A (en) * 2023-06-25 2023-07-25 合肥联宝信息技术有限公司 Template determination method, device, equipment and storage medium
CN116486126B (en) * 2023-06-25 2023-10-27 合肥联宝信息技术有限公司 Template determination method, device, equipment and storage medium
CN116862898A (en) * 2023-07-27 2023-10-10 小米汽车科技有限公司 Defect detection method and device for parts, storage medium and electronic equipment
CN116862898B (en) * 2023-07-27 2024-08-20 小米汽车科技有限公司 Defect detection method and device for parts, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN112581463B (en) Image defect detection method and device, electronic equipment, storage medium and product
WO2023077404A1 (en) Defect detection method, apparatus and system
US12347038B2 (en) Crack detection, assessment and visualization using deep learning with 3D mesh model
WO2024002187A1 (en) Defect detection method, defect detection device, and storage medium
CN116152208A (en) Defect detection method, device, equipment and storage medium
CN112308854B (en) Automatic detection method and system for chip surface flaws and electronic equipment
CN104634242A (en) Point adding system and method of probe
CN115661160B (en) Panel defect detection method, system, device and medium
CN114445318A (en) A defect detection method, device, electronic device and storage medium
CN114897797A (en) Method, device and equipment for detecting defects of printed circuit board and storage medium
CN113744252A (en) Method, apparatus, storage medium and program product for marking and detecting defects
CN116205889A (en) Offset detection method, device, electronic equipment and storage medium
CN115422617A (en) A method, device and medium for measuring frame image size based on CAD
CN108876842A (en) A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle
CN115331132A (en) A detection method, device, electronic device and storage medium for automobile parts
CN112419244B (en) Concrete crack segmentation method and device
CN114821274A (en) A method and device for identifying the state of an opening and closing sign
CN119599941A (en) Method, device, electronic equipment and storage medium for detecting offset defects
CN116433661B (en) Method, device, equipment and medium for detecting semiconductor wafer by multitasking
CN117173223A (en) Standard template generation method, device, equipment and media for electric meter code breaking screen
CN117433966A (en) Non-contact measurement method and system for particle size of grinding particles
CN116486126A (en) Template determination method, device, equipment and storage medium
CN115035481A (en) Image object distance fusion method, device, equipment and storage medium
CN115526879A (en) A sludge sedimentation ratio detection method, device and online detection system
CN117746013A (en) A label detection method, device, equipment and storage medium

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20241226

Address after: 230601 No. 3188-1, Yungu Road, Hefei Economic and Technological Development Zone, Anhui Province (in the comprehensive bonded zone)

Applicant after: LCFC (HEFEI) ELECTRONICS TECHNOLOGY Co.,Ltd.

Country or region after: China

Address before: Room 1605, Lenovo Technology Port, No. 5899, Xiyou Road, Hefei Economic and Technological Development Zone, Anhui Province, 230000

Applicant before: HEFEI LCFC INFORMATION TECHNOLOGY Co.,Ltd.

Country or region before: China