CN118351097A - Method and device for detecting glue path quality, electronic equipment and storage medium - Google Patents
Method and device for detecting glue path quality, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN118351097A CN118351097A CN202410529407.7A CN202410529407A CN118351097A CN 118351097 A CN118351097 A CN 118351097A CN 202410529407 A CN202410529407 A CN 202410529407A CN 118351097 A CN118351097 A CN 118351097A
- Authority
- CN
- China
- Prior art keywords
- point
- glue
- sampling interval
- path
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
- G06T7/0006—Industrial image inspection using a design-rule based approach
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0639—Performance analysis of employees; Performance analysis of enterprise or organisation operations
- G06Q10/06395—Quality analysis or management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Business, Economics & Management (AREA)
- Human Resources & Organizations (AREA)
- Economics (AREA)
- Strategic Management (AREA)
- Quality & Reliability (AREA)
- Entrepreneurship & Innovation (AREA)
- Educational Administration (AREA)
- Development Economics (AREA)
- Marketing (AREA)
- Operations Research (AREA)
- Tourism & Hospitality (AREA)
- Game Theory and Decision Science (AREA)
- General Business, Economics & Management (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the application provides a method, a device, electronic equipment and a storage medium for detecting the quality of a rubber path, wherein the method comprises the following steps: obtaining an image to be detected of a target product to be subjected to glue quality detection, and carrying out region segmentation on the image to be detected to obtain a binarized image comprising a glue region obtained by segmentation in the image to be detected; carrying out refinement treatment on the binarized image, and determining each skeleton contour point of the glue area obtained by the refinement treatment; sequencing each skeleton contour point according to a preset sequencing rule matched with the glue path shape of the target product to obtain a glue path of the glue area; and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value. By applying the scheme provided by the embodiment of the application, the gum path quality detection can be realized on the premise of not modeling the gum path in advance, and the gum path quality detection flow is simplified.
Description
Technical Field
The present application relates to the field of machine vision, and in particular, to a method and apparatus for detecting quality of a rubber path, an electronic device, and a storage medium.
Background
The gluing is widely applied to the processes of component packaging, bonding, sealing, filling and sealing, coating and the like in the industries of 3C electronics, automobiles, medical treatment, new energy sources and the like, and is an important link in the product assembly process. When the glue spreading path is uneven and the quality problems of glue overflow, glue shortage, glue breaking, glue shortage and the like exist, the performance and the quality of the product can be greatly influenced, so that the quality of the glue path of the product needs to be detected. Wherein, the 3C electronics refer to "Computer (Communication), communication (Communication) and consumer electronics (Consumer Electronics)".
The glue path is the path formed by glue on the product after the product is glued. In the related art, modeling of a gum path of a product by a technician is often required before gum quality testing of the product. And when the glue path quality detection is carried out on the product, the glue path of the product can be determined according to the glue path obtained by modeling, and then the glue path width of the glue path on the product is determined according to the glue path of the product, and then whether the glue path on the product has quality problems is determined by comparing the glue path width with a preset width threshold value.
Therefore, in the related art, when the glue path quality detection is performed on the product, the glue path needs to be modeled in advance, and the glue path quality detection flow is complex.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device, electronic equipment and a storage medium for detecting the quality of a rubber path, so that the quality of the rubber path is detected on the premise of not modeling the path of the rubber path in advance, and the quality detection flow of the rubber path is simplified. The specific technical scheme is as follows:
In a first aspect, an embodiment of the present application provides a method for detecting a quality of a rubber channel, where the method includes:
Obtaining an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by dividing the image to be detected by dividing the area of the image to be detected;
Refining the binarized image, and determining each skeleton contour point of the glue area obtained by the refining;
sequencing the skeleton contour points according to a preset sequencing rule matched with the glue path shape of the target product to obtain a glue path of the glue area;
and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
Optionally, in a specific implementation manner, the determining each skeleton contour point of the glue area obtained by the thinning processing includes:
And determining the pixel points with gray values meeting the requirements of the appointed gray values as the skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
Optionally, in a specific implementation manner, the determining, according to the glue path, the glue path width of the glue area includes:
Starting from the starting point of the gum path, determining each sampling interval section on the gum path according to a preset sampling interval;
determining the growth direction and the mass center point of the gum path in each sampling interval according to the coordinates of each skeleton contour point in the sampling interval;
In the target gray level diagram, setting a corresponding rectangular area for each sampling interval section; if the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not a gray level image, the target gray level image is a gray level image obtained by converting the gray level image of the image to be detected; the height direction of the rectangular area corresponding to each sampling interval section is vertical to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not more than the preset width of the sampling interval, and the height is the preset height;
And determining the glue path width of the glue area in each sampling interval according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval in the target gray map.
Optionally, in a specific implementation manner, the determining, according to coordinates of each skeleton contour point in each sampling interval section, a growth direction and a centroid point of a gum path in the sampling interval section includes:
For each sampling interval section, performing straight line fitting on each skeleton contour point in the sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the rubber path in the sampling interval section;
And calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under an image coordinate system of the image to be detected, and determining a point with an abscissa under the image coordinate system being the abscissa average value and an ordinate being the ordinate average value as a centroid point of a gum path in the sampling interval.
Optionally, in a specific implementation manner, the determining, according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray map, the glue path width of the glue area in the sampling interval section includes:
Determining each reference projection point which is positioned on the same straight line with the centroid point of the gum path in the sampling interval section and has a specified interval between each two reference projection points along the vertical direction of the growth direction of the gum path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map; wherein each reference proxel comprises: centroid points of the glue path in the sampling interval section;
Determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section aiming at each reference projection point, wherein the growth direction and the reference projection point are positioned on the same straight line, and the distance between the target projection points is the appointed distance; wherein each target projection point comprises: the reference projection point;
Determining the gray value of each target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image; the gray value of each pixel point in the one-dimensional projection signal image is as follows: the gray value average value of each target projection point of the pixel point is obtained through projection;
Filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining extreme points of which the gradient response amplitude is within a preset threshold range in the gradient response signal as candidate extreme points;
Aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to a neighboring point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining an intersection point of a straight line parallel to the projection direction where the sub-pixel extreme point is positioned and a perpendicular bisector of a rectangular area corresponding to the sampling interval section as a sub-pixel edge point corresponding to the candidate extreme point; the perpendicular bisector passes through the centroid point of the rubber path in the sampling interval section and is perpendicular to the growth direction of the rubber path in the sampling interval section;
Determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair; for each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a negative number, the polarity of the edge where the sub-pixel edge point is located is a second polarity;
Determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair; wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference;
and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
In a second aspect, an embodiment of the present application provides a device for detecting a quality of a rubber path, where the device includes:
the image acquisition module is used for acquiring an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by segmentation in the image to be detected by carrying out area segmentation on the image to be detected;
the image processing module is used for carrying out refinement processing on the binarized image and determining each skeleton contour point of the glue area obtained by the refinement processing;
the contour point ordering module is used for ordering the contour points of each skeleton according to a preset ordering rule matched with the glue path shape of the target product to obtain a glue path of the glue area;
The width determining module is used for determining the glue path width of the glue area according to the glue path and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
Optionally, in a specific implementation manner, the image processing module is specifically configured to:
And determining the pixel points with gray values meeting the requirements of the appointed gray values as the skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
Optionally, in a specific implementation manner, the width determining module includes:
The interval section determining submodule is used for determining each sampling interval section on the gum path according to a preset sampling interval from the starting point of the gum path;
the centroid point determining submodule is used for determining the growth direction and centroid point of the gum path in each sampling interval section according to the coordinates of each skeleton contour point in the sampling interval section;
The region setting submodule is used for setting a corresponding rectangular region for each sampling interval in the target gray level diagram; if the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not a gray level image, the target gray level image is a gray level image obtained by converting the gray level image of the image to be detected; the height direction of the rectangular area corresponding to each sampling interval section is vertical to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not more than the preset width of the sampling interval, and the height is the preset height;
the width determining submodule is used for determining the glue path width of the glue area in each sampling interval section according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray map.
Optionally, in a specific implementation manner, the centroid point determination submodule is specifically configured to:
For each sampling interval section, performing straight line fitting on each skeleton contour point in the sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the rubber path in the sampling interval section;
And calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under an image coordinate system of the image to be detected, and determining a point with an abscissa under the image coordinate system being the abscissa average value and an ordinate being the ordinate average value as a centroid point of a gum path in the sampling interval.
Optionally, in a specific implementation manner, the width determining submodule is specifically configured to:
Determining each reference projection point which is positioned on the same straight line with the centroid point of the gum path in the sampling interval section and has a specified interval between each two reference projection points along the vertical direction of the growth direction of the gum path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map; wherein each reference proxel comprises: centroid points of the glue path in the sampling interval section;
Determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section aiming at each reference projection point, wherein the growth direction and the reference projection point are positioned on the same straight line, and the distance between the target projection points is the appointed distance; wherein each target projection point comprises: the reference projection point;
Determining the gray value of each target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image; the gray value of each pixel point in the one-dimensional projection signal image is as follows: the gray value average value of each target projection point of the pixel point is obtained through projection;
Filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining extreme points of which the gradient response amplitude is within a preset threshold range in the gradient response signal as candidate extreme points;
Aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to a neighboring point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining an intersection point of a straight line parallel to the projection direction where the sub-pixel extreme point is positioned and a perpendicular bisector of a rectangular area corresponding to the sampling interval section as a sub-pixel edge point corresponding to the candidate extreme point; the perpendicular bisector passes through the centroid point of the rubber path in the sampling interval section and is perpendicular to the growth direction of the rubber path in the sampling interval section;
Determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair; for each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a negative number, the polarity of the edge where the sub-pixel edge point is located is a second polarity;
Determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair; wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference;
and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing a computer program;
and the processor is used for realizing any one of the above gum path quality detection methods when executing the programs stored in the memory.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where a computer program is stored in the computer readable storage medium, where the computer program when executed by a processor implements any one of the above-mentioned method for detecting a quality of a rubber path.
In a fifth aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the above-described gum road quality detection methods.
The embodiment of the application has the beneficial effects that:
The above can show that, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, the image to be detected of the target product to be subjected to the detection of the glue path quality can be obtained first. And then, carrying out region segmentation on the acquired image to be detected to obtain a binarized image comprising the glue region segmented from the image to be detected. And further, carrying out refinement treatment on the obtained binarized image, determining each skeleton contour point of the glue area obtained by the refinement treatment, and sequencing each skeleton contour point according to a preset sequencing rule matched with the glue path shape of the target product, so as to obtain the glue path of the glue area. After the glue path of the glue area is obtained, the glue path width of the glue area can be determined according to the glue path of the glue area, and then, the glue path quality detection result of the target product can be determined based on the comparison result of the glue path width and the preset width threshold value.
Based on the above, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, after the image to be detected of the target product is obtained, the glue path of the glue area on the target product can be determined through operations such as area segmentation, refinement treatment, skeleton contour point ordering and the like, without modeling the glue path in advance or planning the glue path in advance. Therefore, by applying the scheme provided by the embodiment of the application, the gum road quality detection flow can be simplified, the complexity of the gum road quality detection flow is obviously degraded, the deployment and debugging efficiency of the gum road quality detection flow is improved, and the gum road quality detection efficiency is improved.
In addition, the scheme provided by the embodiment of the application has no limitation on the area shape of the glue area and the shape of the glue route formed by gluing, can identify the glue route of the glue area with any shape and glue route, has strong applicability and has wider application scene. In addition, for the glue area with a complex shape in a complex glue application scene, the glue path of the glue area can be automatically identified by adopting the scheme provided by the embodiment of the application, the width of each glue path can be accurately and stably detected, and the detection precision of the width of the glue path can reach 1/16 pixel through practical test. Therefore, the scheme provided by the embodiment of the application can improve the accuracy of the glue path of the determined glue area, thereby improving the accuracy and stability of the glue path width of the determined glue area and improving the accuracy and stability of the glue path quality detection.
Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the application, and other embodiments may be obtained according to these drawings to those skilled in the art.
Fig. 1 is a schematic flow chart of a method for detecting quality of a rubber path according to an embodiment of the present application;
Fig. 2 is an image to be detected obtained by the method for detecting the quality of a rubber path according to the embodiment of the present application;
FIG. 3 is a binarized image obtained by the method for detecting gum road quality according to the embodiment of the present application;
FIG. 4 is an image obtained by refinement processing obtained by the gum road quality detection method according to the embodiment of the present application;
FIG. 5 is a schematic diagram of skeleton contour points according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a four-neighborhood of pixel points (x, y) according to an embodiment of the present application;
FIG. 7 is a schematic diagram of eight neighborhoods of pixel points (x, y) according to an embodiment of the present application;
FIG. 8 (a) is a visual result of the growth direction of a glue path according to an embodiment of the application;
fig. 8 (b) is an enlarged image of a rectangular region indicated by reference numeral 1 in fig. 8 (a);
FIG. 9 is a visual result of the growth direction of the determined glue path when the sampling interval is 20 pixels according to the embodiment of the present application;
Fig. 10 is a visual result of a rectangular area set by the gum road quality detection method according to the embodiment of the present application;
FIG. 11 is a schematic diagram of a method for detecting quality of a rubber path according to an embodiment of the present application for determining a one-dimensional projection signal;
FIG. 12 is a schematic diagram of determining a gray value of a target projection point by using a nearest neighbor interpolation method according to an embodiment of the present application;
Fig. 13 (a) is a schematic diagram of determining a gray value f (x, y) of a target projection point (x, y) by using bilinear interpolation according to an embodiment of the present application;
fig. 13 (b) is a schematic diagram of another method for determining the gray value f (x, y) of the target projection point (x, y) by using bilinear interpolation according to an embodiment of the present application;
FIG. 14 is a schematic diagram of a gradient response signal obtained by processing a one-dimensional projection signal image using a Gaussian differential filter according to an embodiment of the present application;
Fig. 15 is a schematic diagram of determining a sub-pixel edge point according to a sub-pixel extreme point according to an embodiment of the present application;
FIG. 16 is a schematic diagram of a sub-pixel interpolation process for candidate extremum points using a parabolic interpolation method according to an embodiment of the present application;
FIG. 17 is a schematic diagram of edge 0 and edge 1 in a rectangular area according to an embodiment of the present application;
FIG. 18 is a diagram showing the result of a numerical result of a glue path width determined by the glue path quality detection method according to the embodiment of the present application;
fig. 19 is a schematic diagram of a result of a gum quality detection result determined by the gum quality detection method according to an embodiment of the present application;
FIG. 20 is a diagram showing the result of a gum quality test when the X-direction offset is-20 pix and the Y-direction offset is-20 pix;
FIG. 21 is a diagram showing a result of a gum quality test when the X-direction offset is 10pix and the Y-direction offset is 10 pix;
FIG. 22 is another image to be detected obtained by the method for detecting the quality of a rubber road according to the embodiment of the present application;
FIG. 23 is another binarized image obtained by the gum road quality detection method according to the embodiment of the present application;
FIG. 24 is an image obtained by another refinement process according to the method for detecting gum road quality according to the embodiment of the present application;
FIG. 25 is a graph showing the result of visualizing the growth direction of another glue path according to an embodiment of the application;
fig. 26 is a visual result of a rectangular area set by the gum road quality detection method according to the embodiment of the present application;
FIG. 27 is a diagram showing the result of a numerical result of a glue path width determined by the glue path quality detection method according to the embodiment of the present application;
fig. 28 is a schematic diagram of a result of a gum quality detection result determined by the gum quality detection method according to an embodiment of the present application;
Fig. 29 is a schematic structural view of a template determining device according to an embodiment of the present application;
fig. 30 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by the person skilled in the art based on the present application are included in the scope of protection of the present application.
In the related art, modeling of a gum path of a product by a technician is often required before gum quality testing of the product. And when the glue path quality detection is carried out on the product, the glue path of the product can be determined according to the glue path obtained by modeling, and then the glue path width of the glue path on the product is determined according to the glue path of the product, and then whether the glue path on the product has quality problems is determined by comparing the glue path width with a preset width threshold value. Therefore, in the related art, when the glue path quality detection is performed on the product, the glue path needs to be modeled in advance, and the glue path quality detection flow is complex.
In order to solve the above problems, the embodiment of the application provides a method for detecting the quality of a rubber path.
The method can be applied to scenes of detecting the quality of the rubber path of various products. For example, after the battery is packaged by gluing, a glue path quality detection scene is carried out on a glue area on the battery; after the camera module is encapsulated by gluing, a scene of glue path quality detection is performed on a glue area on the camera module, and the like. The specific application scenario of the embodiment of the present application is not specifically limited herein.
Further, the execution subject of the method may be various electronic devices that can acquire image data and perform data processing. The electronic device may be a device having an image capturing function and a data processing function, for example, a computer having an image capturing function, a camera having a data processing function, or the like; the electronic device may also be a device with data processing functionality in communication with the image capturing device, for example a notebook computer, a desktop computer or the like in communication with the image capturing device. The electronic device may be a stand-alone electronic device or a device cluster including a plurality of electronic devices. The embodiment of the present application is not particularly limited, and is hereinafter referred to as an electronic device.
The method for detecting the quality of the rubber path provided by the embodiment of the application can comprise the following steps:
Obtaining an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by dividing the image to be detected by dividing the area of the image to be detected;
Refining the binarized image, and determining each skeleton contour point of the glue area obtained by the refining;
sequencing the skeleton contour points according to a preset sequencing rule matched with the glue path shape of the target product to obtain a glue path of the glue area;
and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
The above can show that, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, the image to be detected of the target product to be subjected to the detection of the glue path quality can be obtained first. And then, carrying out region segmentation on the acquired image to be detected to obtain a binarized image comprising the glue region segmented from the image to be detected. And further, carrying out refinement treatment on the obtained binarized image, determining each skeleton contour point of the glue area obtained by the refinement treatment, and sequencing each skeleton contour point according to a preset sequencing rule matched with the glue path shape of the target product, so as to obtain the glue path of the glue area. After the glue path of the glue area is obtained, the glue path width of the glue area can be determined according to the glue path of the glue area, and then, the glue path quality detection result of the target product can be determined based on the comparison result of the glue path width and the preset width threshold value.
Based on the above, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, after the image to be detected of the target product is obtained, the glue path of the glue area on the target product can be determined through operations such as area segmentation, refinement treatment, skeleton contour point ordering and the like, without modeling the glue path in advance or planning the glue path in advance. Therefore, by applying the scheme provided by the embodiment of the application, the gum road quality detection flow can be simplified, the complexity of the gum road quality detection flow is obviously degraded, the deployment and debugging efficiency of the gum road quality detection flow is improved, and the gum road quality detection efficiency is improved.
In addition, the scheme provided by the embodiment of the application has no limitation on the area shape of the glue area and the shape of the glue route formed by gluing, can identify the glue route of the glue area with any shape and glue route, has strong applicability and has wider application scene. In addition, for the glue area with a complex shape in a complex glue application scene, the glue path of the glue area can be automatically identified by adopting the scheme provided by the embodiment of the application, the width of each glue path can be accurately and stably detected, and the detection precision of the width of the glue path can reach 1/16 pixel through practical test. Therefore, the scheme provided by the embodiment of the application can improve the accuracy of the glue path of the determined glue area, thereby improving the accuracy and stability of the glue path width of the determined glue area and improving the accuracy and stability of the glue path quality detection.
The following describes a method for detecting the quality of a rubber path according to an embodiment of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a method for detecting quality of a rubber channel according to an embodiment of the present application, as shown in fig. 1, the method may include the following steps S101 to S104.
S101: obtaining an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by segmentation in the image to be detected by carrying out area segmentation on the image to be detected.
The gluing process can realize packaging, bonding, sealing, potting and the like of the product by coating glue on the product, and the area coated with the glue on the product can be called as a glue area. Since the glue areas are usually strip-shaped areas like roads, the glue areas are also referred to as roads. The target product is the product to be subjected to the gum path quality detection. In order to detect the glue path quality of the target product, image acquisition equipment such as a camera can be utilized to acquire images of the positions, including the glue areas, on the target product, so as to obtain images to be detected. The electronic equipment can acquire the image to be detected acquired by the image acquisition equipment, and the glue area and the non-glue area in the image to be detected are distinguished by carrying out area segmentation on the image to be detected, so that a binarized image comprising the glue area obtained by segmentation in the image to be detected is obtained.
That is, by performing region segmentation on the image to be detected, the glue region in the image to be detected can be segmented from the background region, so that the glue region in the image to be detected is distinguished from the non-glue region, and a binarized image including the glue region is obtained.
Optionally, in a specific implementation manner, the image to be detected is a gray scale image, and in the step S101, the area segmentation of the image to be detected may include the following step 11.
Step 11: and carrying out region segmentation on the image to be detected by using a preset threshold segmentation algorithm.
When the image to be detected is a gray level image, the pixel points in the glue area and the pixel points in the non-glue area in the image to be detected generally have different gray level values, so that a threshold segmentation algorithm can be adopted to segment the image to be detected, and the glue area and the non-glue area in the image to be detected are distinguished.
The threshold segmentation algorithm can set the gray value of the pixel point in the gray map to be 0 or 255 through a preset gray threshold, so that a binary map capable of reflecting the whole and partial characteristics of the gray map is obtained. The threshold segmentation algorithm may include, but is not limited to, a fixed threshold method, a global threshold method (e.g., the oxford method), a local adaptive threshold method (e.g., the sauvola algorithm), etc., and the embodiment of the present application does not specifically limit the threshold segmentation algorithm.
When the image to be detected is a gray level image, the image to be detected may be directly acquired by using an image acquisition device with a gray level image acquisition function, or may be obtained by converting a gray level image of a color image acquired by the image acquisition device. The embodiment of the application does not limit the specific acquisition mode of the gray level map.
For example, when the glue quality detection is performed on a certain target product, the obtained image to be detected (gray level image) may be shown in fig. 2, because in the gray level image of the target product of the model, the gray level value of the glue area is generally smaller than the gray level value a, so that the related technician may set the gray level value a as a threshold value, and further, when the electronic device uses the fixed threshold method to divide the area of the image to be detected shown in fig. 2, the gray level value of the pixel point of the image to be detected, which is shown in fig. 2, with the gray level value smaller than a may be set as 255, and the gray level value of the pixel point of the gray level value greater than or equal to a is set as 0, so as to obtain the binary image shown in fig. 3, where in fig. 3, the white area is the glue area, and the black area is the non-glue area.
Alternatively, in another specific implementation manner, the neural network model may be trained by using a plurality of sample images marked with glue areas in advance, and then after the image to be detected is obtained, the image to be detected may be input into the trained neural network model, and the glue areas in the image to be detected output by the neural network model may be obtained. Finally, setting the gray value of the pixel in the glue area in the image to be detected as 0, and setting the gray value of the pixel in the non-glue area in the image to be detected as 255; or the gray value of the pixel in the glue area in the image to be detected is set to 255, and the gray value of the pixel in the non-glue area in the image to be detected is set to 0, so that the binarized image can be obtained.
The neural network model may be a target detection model, a semantic segmentation model, an instance segmentation model, or other models capable of distinguishing a glue area and a non-glue area in an image to be detected, and the embodiment of the application does not specifically limit the neural network model.
S102: and carrying out refinement treatment on the binarized image, and determining each skeleton contour point of the glue area obtained by the refinement treatment.
After the binarized image is obtained, refining treatment can be carried out on the binarized image, and each skeleton contour point of the glue area obtained by the refining treatment is determined.
The skeleton of the object can be understood as the central axis of the object. For example, a rectangular skeleton is its central axis in the longitudinal direction, and a straight skeleton is itself. The skeleton of the object is obtained, which is equivalent to highlighting the main structure and shape information of the object, and removing redundant information. According to the skeleton of the object in the image, feature points such as end points, crossing points and inflection points of the object in the image can be detected.
Image refinement is typically an operation that skeletons a binarized image. The thinning process is short for a process of reducing lines with multiple pixel widths in an image to single pixel widths, wherein the obtained lines with single pixel widths are a skeleton of the lines with multiple pixel widths. And carrying out refinement treatment on the image with the lines with the multi-pixel width in the glue area, namely obtaining the skeleton of the lines in the image by stripping the pixel points belonging to the lines in the image under the condition of keeping the shape of the lines in the image unchanged.
The glue areas in the binarized image are typically multi-pixel width lines, illustratively, the glue areas in fig. 3 are multi-pixel width lines. After the binarized image is obtained, the binarized image is subjected to refinement treatment, so that the line width in the binarized image can be reduced from the multi-pixel width to the single-pixel width, and the line with the single-pixel width is displayed, so that the skeleton of the image is obtained. Furthermore, the electronic equipment can determine points belonging to lines with single pixel width in the image obtained by refinement processing, and the points are used as skeleton contour points of the glue area. Wherein skeleton contour points of the glue area belong to each pixel point of the skeleton of the glue area.
The specific algorithm for implementing the refinement process can be selected by those skilled in the art according to practical application, and the embodiment of the application is not particularly limited.
Optionally, in a specific implementation manner, in the step S102, the thinning processing is performed on the binarized image, which may include the following step 21.
Step 21: and refining the binarized image by using a specified algorithm.
The above-mentioned specific algorithm may be various refinement algorithms such as Zhang-sun refinement algorithm, image morphology algorithm, deutch refinement algorithm, hildinich refinement algorithm, pavlidis refinement algorithm, rosenfeld refinement algorithm, etc., which are not limited in the embodiment of the present application.
Optionally, in a specific implementation manner, in the step S102, determining each skeleton contour point of the glue area obtained by the thinning process may include the following step 31.
Step 31: and determining the pixel points with gray values meeting the requirements of the designated gray values as skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
After the binarization image is obtained by carrying out region segmentation on the image to be detected, the gray values of the pixels of the glue region and the non-glue region in the binarization image are respectively two different gray values. After the binarization image is subjected to thinning processing, the gray value of the single-pixel width line in the image obtained by the thinning processing is the same as the gray value of the glue area in the binarization image, and the gray value of the pixel points except the single-pixel width line is the same as the gray value of the non-glue area in the binarization image, so that the pixel points belonging to the single-pixel width line in the image obtained by the thinning processing can be selected by using the appointed gray value to serve as the skeleton contour points of the glue area.
Optionally, the electronic device may traverse each pixel point in the image obtained by the refinement process, and determine, as the skeleton contour point, the pixel point whose traversed gray value meets the requirement of the specified gray value.
As shown in fig. 3, the gray value of the pixel of the glue area in the binarized image is 255 (white color), and the gray value of the pixel of the non-glue area is 0 (black color). The binarized image shown in fig. 3 is subjected to refinement processing to obtain fig. 4. It can be seen that, in fig. 4, a gray value of a part of the pixel points is 255 (the color is white), and a gray value of another part of the pixel points is 0 (the color is black). In this way, the specified gray value may be set to 255, and the electronic device may traverse each pixel point in fig. 4 and determine the pixel point having the traversed gray value of 255 as the skeleton contour point.
The traversing manner of each pixel point may be: and traversing each row of pixel points from top to bottom from the top row of pixel points in the image, and traversing each pixel point in each row of pixel points in sequence from left to right aiming at each row of pixel points. It can also be: each column of pixel points is traversed from left to right starting from the leftmost row of pixel points in the image, and each pixel point in each column of pixel points is traversed from top to bottom in sequence. The traversing manner of each pixel point can be set by a person skilled in the art according to actual application conditions, and the embodiment of the application is not particularly limited to the traversing manner of each pixel point.
S103: and ordering all skeleton contour points according to a preset ordering rule matched with the glue path shape of the target product to obtain the glue path of the glue area.
In the step S102, after determining each skeleton contour point of the glue area, the electronic device determines the position of each skeleton contour point in the image obtained by refinement, but only knows the position of the skeleton contour point, but does not know the arrangement sequence of the skeleton contour points, so that the extending direction of the glue area, that is, the glue path of the glue area, cannot be determined. Therefore, after determining each skeleton contour point, the electronic device can sort each skeleton contour point according to a preset sorting rule matched with the glue path shape of the target product, so as to obtain the glue path of the glue area.
Optionally, before the gum quality detection is performed on each model of the target product, a person skilled in the art may set the preset sorting rule according to the gum shape of the model of the target product.
Alternatively, the person skilled in the art may set preset ordering rules corresponding to the products of each model according to the gum path shape of the products of each model in advance, and then, when the gum path quality detection is performed on the target product, the electronic device may determine the preset ordering rules corresponding to the target product by identifying the model of the target product.
The preset ordering rule may be set by a person skilled in the art according to actual application conditions, and the embodiment of the present application is not specifically limited.
Optionally, in a specific implementation manner, the step S103 may include the following steps 41-42.
Step 41: if the glue path shape of the target product is a closed shape, taking any skeleton contour point as a starting point, and sequencing all skeleton contour points according to the clockwise direction or the anticlockwise direction to obtain the glue path of the glue area.
When the glue path shape of the target product is a closed shape such as a circle, a rectangle, etc., the skeleton contour points of the skeleton of the glue area can be regarded as being arranged and distributed in a clockwise direction or a counterclockwise direction, so that in this case, by taking any skeleton contour point as a starting point and ordering the skeleton contour points in the clockwise direction or the counterclockwise direction, the arrangement sequence of the skeleton contour points can be determined, and the glue path of the glue area is obtained.
Step 42: and if the glue path shape of the target product is a non-closed shape, sequencing the skeleton contour points according to the appointed sequence of the appointed coordinates of the skeleton contour points in the image coordinates of the image to be detected, so as to obtain the glue path of the glue area.
Wherein the specified sequence includes: from small to large or from large to small.
Since the operations of region segmentation, refinement and the like just change the gray value of the pixels in the image, but do not change the relative positions of the pixel points in the image, the positions of the skeleton contour points in the image to be detected and the binarized image are the same as the positions of the skeleton contour points in the image after refinement. The positions of the skeleton contour points are represented by image coordinates of the skeleton contour points under an image coordinate system of an image to be detected, and when the gum path shape of a target product is a non-closed shape such as a straight line segment, a curve line segment and the like, the skeleton contour points are generally distributed in a specified order from small to large or from large to small according to specified coordinates in the image coordinates. Therefore, when the glue path shape of the target product is a non-closed shape, the arrangement sequence of the skeleton contour points can be determined by ordering the skeleton contour points according to the appointed sequence of the appointed coordinates of the skeleton contour points in the image coordinates of the image to be detected, so as to obtain the glue path of the glue area.
Illustratively, as shown in FIG. 5, points A, B, C, D, E are skeleton contour points determined by traversing each pixel point in the image resulting from the refinement process. Since the pixel points in the image obtained by the thinning process are traversed from top to bottom from the top row of pixel points in the image, and each pixel point in each row of pixel points is traversed from left to right in turn for each row of pixel points, the sequence of skeleton contour points determined by the traversing is A, B, C, D, E indicated by an arrow in fig. 5. Obviously, this sequence does not reflect the direction of extension of the glue areas. Therefore, the skeleton contour points A, B, C, D, E may be ordered in the order of decreasing abscissa of the skeleton contour points in the image coordinate system of the image to be processed, so as to obtain the order of the skeleton contour points: E. d, A, B, C.
Optionally, in a specific implementation manner, the step S103 may include the following steps 51-54.
Step 51: the designated contour point in the skeleton contour points is determined as the first current contour point.
If the glue path shape of the target product is a closed shape, designating the contour point as any skeleton contour point, and if the glue path shape of the target product is a non-closed shape, designating the contour point as a skeleton contour point with the largest or smallest designated coordinate in the image coordinates of the image to be detected under the image coordinate system.
When sorting the skeleton contour points, if the gum path shape of the target product is a closed shape, any skeleton contour point can be determined as a first current contour point, and if the gum path shape of the target product is a non-closed shape, the skeleton contour point with the largest or smallest designated coordinate in the image coordinates can be determined as the first current contour point under the image coordinate system of the image to be detected.
Step 52: in the specified neighborhood of the current contour point, the skeleton contour point which is closest to the current contour point and is not determined as the current contour point is searched.
After the current contour point is determined, a skeleton contour point closest to the current contour point and not determined as the current contour point may be found in a specified neighborhood of the current contour point. The designated neighborhood may be a four neighborhood, an eight neighborhood, etc., which is not specifically limited in the embodiment of the present application.
When the specified neighborhood is a four-neighborhood, the specified neighborhood of the current contour point is four pixel points adjacent to the current contour point in the upper, lower, left and right directions respectively. For example, as shown in fig. 6, for the pixel (x, y), four pixels of the four neighborhoods are: (x, y-1), (x, y+1), (x-1, y), (x+1, y).
When the specified neighborhood is eight neighbors, the specified neighborhood of the current contour point is eight pixels adjacent to the current contour point in the eight directions of up, down, left, right, left up, right up, left down and right down. For example, as shown in fig. 7, for a pixel (x, y), eight pixels of its eight neighbors are: (x, y-1), (x, y+1), (x-1, y), (x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1).
Step 53: if so, the found skeleton contour point is determined to be the new current contour point and step 52 is returned.
If a skeleton contour point closest to the current contour point and not determined as the current contour point is found in the specified neighborhood of the current contour point, the found skeleton contour point may be determined as a new current contour point, and the step of finding a skeleton contour point closest to the current contour point and not determined as the current contour point in the specified neighborhood of the current contour point is performed again.
Step 54: and if not, sequencing the skeleton contour points according to the sequence of the determined current contour points, so as to obtain a glue path of the glue area.
If the skeleton contour points which are not determined as the current contour points do not exist in the appointed neighbor of the current contour point, all the skeleton contour points can be determined as the current contour points, and then the skeleton contour points can be ordered according to the sequence of the skeleton contour points determined as the current contour points, so that a glue path of the glue area is obtained.
When the skeleton contour points A, B, C, D, E in fig. 5 are ordered, the skeleton contour point E with the smallest abscissa in the image coordinates of the image to be detected may be determined as the first current contour point, then in the specified neighborhood of the skeleton contour point E, the skeleton contour point B with the nearest distance to the skeleton contour point E and the undetermined current contour point is searched for, the skeleton contour point D is obtained, and the skeleton contour point D is determined as the new current contour point, so that in the specified neighborhood of the skeleton contour point D, the skeleton contour point closest to the skeleton contour point D and undetermined current contour point is searched for, and the skeleton contour point a is determined as the new current contour point, so that in the specified neighborhood of the skeleton contour point a, the skeleton contour point closest to the skeleton contour point a and undetermined current contour point is determined, so as to obtain the skeleton contour point B, and the skeleton contour point B is determined as the new current contour point, so that in the specified neighborhood of the skeleton contour point B, the skeleton contour point C is not determined as the current contour point C, and the current contour point C is not determined as the current contour point of the current contour point.
Optionally, if the skeleton contour point closest to the current contour point and not determined as the current contour point is not found in the specified neighborhood of the current contour point, it may be further determined whether there is still a skeleton contour point not determined as the current contour point, and if so, the skeleton contour point closest to the current contour point and not determined as the current contour point may be determined as the new current contour point, and further, the above step 52 is returned to complete the sorting of the skeleton contour points.
Optionally, if the skeleton contour point which is closest to the current contour point and is not determined as the current contour point is not found in the specified neighborhood of the current contour point, it may be further determined whether there is still a skeleton contour point which is not determined as the current contour point, and if so, the method provided in steps 41 to 42 may be used again to sequence the skeleton contour points, and determine the glue path of the glue area.
Based on the method, the situation that skeleton contour points are omitted in the sorting process can be reduced, and the accuracy of the determined arrangement sequence of the skeleton contour points is improved, so that the accuracy of the determined gum path is further improved.
S104: and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
After the glue path of the glue area is determined, the glue path width of the glue area can be determined according to the glue path, and then the glue path quality detection result of the target product is determined based on the comparison result of the glue path width and the preset width threshold value. The preset width threshold may be a range of values, or may be a specific value.
If the preset width threshold is a range of values, when determining the gum quality detection result of the target product based on the comparison result of the gum width and the preset width threshold, if the gum width of the gum area is within the preset width threshold, it may be determined that the gum quality detection result of the target product is qualified; if the glue path width of the glue area is smaller than the minimum value of the preset width threshold, determining that the glue path quality detection result of the target product is unqualified, and the glue area has the quality problem of less glue; if the glue path width of the glue area is larger than the maximum value of the preset width threshold, determining that the glue path quality detection result of the target product is unqualified, and the glue area has the quality problem of glue overflow; if the glue path width of the glue area at a certain position of the glue path is 0, it can be determined that the glue path quality detection result of the target product is unqualified, and the glue area has a glue breaking quality problem at the certain position of the glue path.
If the preset width threshold is a specific value, when determining the gum quality detection result of the target product based on the comparison result of the gum width and the preset width threshold, if the absolute value of the difference between the gum width of the gum area and the preset width threshold is smaller than the preset difference, determining that the gum quality detection result of the target product is qualified; if the glue path width of the glue area is smaller than the preset width threshold value, and the absolute value of the difference value between the glue path width of the glue area and the preset width threshold value is not smaller than the preset difference value, determining that the glue path quality detection result of the target product is unqualified, and the glue area has the quality problem of less glue; if the glue path width of the glue area is larger than the preset width threshold value, and the absolute value of the difference value between the glue path width of the glue area and the preset width threshold value is not smaller than the preset difference value, determining that the glue path quality detection result of the target product is unqualified, and the glue area has the quality problem of glue overflow; if the glue path width of the glue area at a certain position of the glue path is 0, it can be determined that the glue path quality detection result of the target product is unqualified, and the glue area has a glue breaking quality problem at the certain position of the glue path.
Based on the above, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, after the image to be detected of the target product is obtained, the glue path of the glue area on the target product can be determined through operations such as area segmentation, refinement treatment, skeleton contour point ordering and the like, without modeling the glue path in advance or planning the glue path in advance. Therefore, by applying the scheme provided by the embodiment of the application, the gum road quality detection flow can be simplified, the complexity of the gum road quality detection flow is obviously degraded, the deployment and debugging efficiency of the gum road quality detection flow is improved, and the gum road quality detection efficiency is improved.
In addition, the scheme provided by the embodiment of the application has no limitation on the area shape of the glue area and the shape of the glue route formed by gluing, can identify the glue route of the glue area with any shape and glue route, has strong applicability and has wider application scene. In addition, for the glue area with a complex shape in a complex glue application scene, the glue path of the glue area can be automatically identified by adopting the scheme provided by the embodiment of the application, the width of each glue path can be accurately and stably detected, and the detection precision of the width of the glue path can reach 1/16 pixel through practical test. Therefore, the scheme provided by the embodiment of the application can improve the accuracy of the glue path of the determined glue area, thereby improving the accuracy and stability of the glue path width of the determined glue area and improving the accuracy and stability of the glue path quality detection.
Optionally, in a specific implementation manner, in the step S104, determining the glue path width of the glue area according to the glue path may include the following steps 61-64.
Step 61: starting from the starting point of the glue path, determining each sampling interval section on the glue path according to a preset sampling interval.
Step 62: and determining the growth direction and the mass center point of the gum path in each sampling interval according to the coordinates of each skeleton contour point in the sampling interval.
When determining the glue path width of the glue area according to the glue path, starting from the starting point of the glue path, namely the first skeleton outline point in the arrangement sequence of skeleton outline points, determining each sampling interval section on the glue path according to a preset sampling interval, and then determining the growth direction and the mass center point of the glue path in each sampling interval section according to the coordinates of each skeleton outline point in each sampling interval section.
The sampling interval may be set according to practical application, and the embodiment of the present application is not specifically limited.
Alternatively, when the sampling interval is a specified number of skeleton contour points, starting from the start point of the gum path, each specified number of continuous skeleton contour points may be determined as one sampling interval section, so as to obtain each sampling interval section on the gum path.
For example, when the sampling interval is 10 skeleton contour points, starting from the start point of the gum path, that is, the 1 st skeleton contour point in the arrangement sequence of the skeleton contour points, the 1 st to 10 th skeleton contour points are determined as one sampling interval section, the 11 th to 20 th skeleton contour points are determined as one sampling interval section, the 21 st to 30 th skeleton contour points are determined as one sampling interval section, and so on, each sampling interval section on the gum path is finally obtained.
Optionally, when the sampling interval is a specified number of skeleton contour points, starting from the start point of the gum path, that is, the 1 st skeleton contour point in the arrangement sequence of the skeleton contour points, the specified number of skeleton contour points is set at each interval, and the specified number of continuous skeleton contour points is determined as one sampling interval section, so as to obtain each sampling interval section on the gum path.
For example, when the sampling interval is 10 skeleton contour points, starting from the 1 st skeleton contour point in the arrangement sequence of the skeleton contour points, the 1 st to 10 th skeleton contour points are determined as one sampling interval section, the 21 st to 30 th skeleton contour points are determined as one sampling interval section, the 41 st to 50 th skeleton contour points are determined as one sampling interval section, and so on, each sampling interval section on the glue path is finally obtained.
The smaller the sampling interval is, the closer the determined growth direction of the gum path is to the actual growth direction of the gum path; the larger the sampling interval is, the more the determined growth direction of the gum path deviates from the actual growth direction of the gum path.
Illustratively, when the sampling interval is 10 skeleton contour points, the visualization result of the growth direction of the determined gum path is shown in fig. 8 (a). Wherein each white arrow in fig. 8 (a) characterizes the growth direction of the glue path in the section of the sampling interval where the white arrow is located. The image shown in fig. 8 (b) can be obtained by enlarging the rectangular area indicated by the reference numeral 1 in fig. 8 (a), and it can be seen that each sampling interval section includes 10 skeleton contour points, and 10 skeleton contour points are spaced between every two adjacent sampling interval sections where the arrows for representing the growth direction are located.
For example, when the sampling interval is 20 skeleton contour points, the visualization result of the growth direction of the determined gum path is shown in fig. 9. Wherein, each white arrow in fig. 9 represents the growth direction of the gum path in the sampling interval section where the white arrow is located, and every two adjacent sampling interval sections where the white arrows are located are separated by 20 skeleton contour points.
However, when the glue path on the target product has a glue breaking defect, the glue breaking position cannot be determined as glue is not present, so that the growth direction of the glue path near the determined glue breaking position is not accurate enough. Therefore, in order to further improve the accuracy of the growth direction of the determined glue path, in an optional specific implementation manner, after each skeleton contour point is ordered, it may be determined whether the distance between every two adjacent skeleton contour points is greater than a preset distance (typically, in the case that no glue breaking defect exists, the distance between every two adjacent skeleton contour points is typically not greater than the preset distance), if so, it may be determined that a glue breaking defect exists between the two skeleton contour points, and then, according to the two skeleton contour points and the skeleton contour points near the two skeleton contour points, the glue breaking positions, that is, the positions between the two skeleton contour points, are filled with skeleton contour points, so that the growth direction of the glue path is determined based on the original skeleton contour points and the filled skeleton contour points, thereby making the determined growth direction of the glue path more accurate.
The preset distance may be determined according to an actual application situation, and the embodiment of the present application is not specifically limited. For each adjacent two skeleton-contour points, the skeleton-contour points near the two skeleton-contour points may be a preset number of consecutive skeleton-contour points that are located before the two skeleton-contour points and consecutive to the two skeleton-contour points, and a preset number of consecutive skeleton-contour points that are located after the two skeleton-contour points and consecutive to the two skeleton-contour points. And, the preset number can be set according to actual application conditions.
Optionally, when filling skeleton contour points according to the two skeleton contour points and skeleton contour points near the two skeleton contour points, curve fitting may be performed on the two skeleton contour points and the skeleton contour points near the two skeleton contour points to obtain a fitted curve, and then the skeleton contour points are filled on the fitted curve located between the two skeleton contour points.
For example, in the case of filling skeleton contour points, one skeleton contour point may be filled at a predetermined distance from one skeleton contour point of the two skeleton contour points in the direction of a fitted curve located between the two skeleton contour points.
For another example, when filling skeleton contour points, a target number of pixel points distributed equidistantly can be determined on a fitted curve between the two skeleton contour points, and the target number of pixel points can be used as skeleton contour points to be filled.
The specific distance and the target number may be determined according to actual application conditions, and the embodiment of the present application is not specifically limited.
The embodiment of the application is not limited to a specific method for determining the growth direction.
Alternatively, each skeleton contour point may be fitted to a smooth fitting curve, and the average value of the abscissa and the average value of the ordinate of each skeleton contour point in each sampling interval are calculated, and the point with the abscissa being the average value of the abscissa and the ordinate being the average value of the ordinate is determined as the centroid point in the sampling interval. Further, for each sampling interval, determining the specified direction of the tangent line of the fitting curve at the abscissa of the centroid point as the growth direction of the gum path in the sampling interval.
Optionally, in a specific implementation, step 62 above: determining the growth direction and centroid point of the gum path in each sampling interval segment based on the coordinates of the respective skeleton contour points in the sampling interval segment may include the following steps 71-72.
Step 71: and performing straight line fitting on each skeleton contour point in each sampling interval section aiming at each sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the gum path in the sampling interval section.
Based on the idea of calculus, any function curve can be approximated by a short straight line if a short segment is taken, i.e. any curve can be approximated by a straight line in a tiny part. Therefore, for each sampling interval segment, straight line fitting can be performed on each skeleton contour point in the sampling interval segment, and the designated direction of the obtained fitting straight line is determined as the growth direction of the gum path in the sampling interval segment.
Step 72: and calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under the image coordinate system of the image to be detected, and determining the point with the abscissa as the abscissa average value and the ordinate as the ordinate average value under the image coordinate system as the centroid point of the gum path in the sampling interval.
For each sampling interval section, calculating the average value of the abscissa of each skeleton contour point in the sampling interval section under the image coordinate system of the image to be detected, and taking the average value of the abscissa as the average value of the abscissa; calculating the average value of the ordinate of each skeleton contour point in the sampling interval section under the image coordinate system of the image to be detected, and taking the average value as the average value of the ordinate; and determining a point with the abscissa of the image coordinate system as an abscissa average value and the ordinate as an ordinate average value as a centroid point in the sampling interval section.
Step 63: in the target gradation chart, a corresponding rectangular region is set for each sampling interval section.
If the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not the gray level image, the target gray level image is the gray level image obtained after the gray level image conversion of the image to be detected. The height direction of the rectangular area corresponding to each sampling interval section is perpendicular to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not greater than the preset width of the sampling interval, and the height is the preset height.
If the image to be detected is a gray scale image, the image to be detected can be determined to be a target gray scale image; if the image to be detected is not the gray level image, the image to be detected can be converted into the gray level image by carrying out gray level image conversion on the image to be detected, so that the target gray level image is obtained. Since the above gray scale image conversion operation only changes the color of the pixels in the image, but does not change the relative position of each pixel point in the image, the image coordinate system of the image to be detected is the same as the image coordinate system of the target gray scale image, the positions of each skeleton contour point in the image to be detected and the target gray scale image are the same, and the coordinates of each skeleton contour point in the image coordinate system of the image to be detected and the image coordinate system of the target gray scale image are the same.
After determining the growth direction and the centroid point of the gum path in each sampling interval section, for each sampling interval section, the centroid point of the gum path in the sampling interval section can be taken as the center of a rectangular area, and a rectangular area with the height direction perpendicular to the growth direction of the gum path in the sampling interval section, the width not greater than the preset width of the sampling interval and the height being the preset height can be set in the target gray level diagram.
For example, when the sampling interval is 10 pixels, the visualized result of setting a corresponding rectangular area for each sampling interval section as shown in fig. 8 (a) may be as shown in fig. 10.
The preset width and the preset height may be set by those skilled in the art according to practical application, and the embodiment of the present application is not specifically limited. Since the rectangular area is an area where the width of the glue path needs to be measured, the height of the rectangular area should be larger than the maximum width of the glue path. The maximum width of the glue path is an empirical value, and can be determined by a person skilled in the art according to actual application conditions. When the edge of the glue area is poor in imaging or more in noise, the accuracy of the finally determined glue path width can be improved by properly increasing the width of the rectangular area.
Step 64: and determining the glue path width of the glue area in each sampling interval according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval in the target gray map.
After determining the rectangular area corresponding to each sampling interval section, determining the glue path width of the glue area in the sampling interval section according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray level diagram for each sampling interval section.
Optionally, the rectangular area may be used as an area to be measured of a caliper tool module in machine vision, and further, for each sampling interval, the caliper tool module may measure, according to a gray value of each pixel point in the rectangular area corresponding to the sampling interval in the target gray map, a glue path width of the glue area in the sampling interval. The caliper tool module is a visual tool for positioning or measuring edge characteristics such as edge positions, edge-to-edge intervals and the like. Unlike other vision tools, calliper tools require the user to explicitly desire the general area to measure or locate, the nature of the target object or edge, etc. The calliper tool may accomplish the positioning of the edge or edge pairs by selecting different edge modes.
Optionally, in a specific implementation manner, in the step 64, determining the glue path width of the glue area in the sampling interval section according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray map may include the following steps 81-88.
Step 81: and determining each reference projection point which is positioned on the same straight line with the centroid point of the glue path in the sampling interval section and is at a specified interval from each other in the rectangular area corresponding to the sampling interval section in the target gray scale map along the vertical direction of the growth direction of the glue path in the sampling interval section.
Wherein each reference proxel comprises: centroid points of the path of the gum within the sample interval segment.
For each sampling interval, a straight line perpendicular to the growth direction of the gum path in the sampling interval, where the centroid point of the gum path in the sampling interval is located, may be referred to as a perpendicular bisector of the rectangular region corresponding to the sampling interval. In the target gray level diagram, when determining the glue path width of the glue area in the sampling interval section according to the gray level value of each pixel point in the rectangular area corresponding to the sampling interval section, each reference projection point with the specified interval between the center of mass points on the middle vertical line of the rectangular area corresponding to the sampling interval section including the center of mass point can be determined in the rectangular area corresponding to the sampling interval section.
Step 82: for each reference projection point, determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section, wherein the target projection points are positioned on the same straight line with the reference projection points and are spaced at a specified interval.
Wherein each target proxel comprises: the reference proxel.
After each reference projection point is determined, the growth direction of the gum path along the sampling interval section can be determined for each reference projection point in the rectangular area corresponding to the sampling interval section, the growth direction and the reference projection point are in the same straight line, and the distance between the target projection points is the designated distance, including the reference projection point.
The specified interval may be set according to the actual application situation. Since the width and the height of the pixel point are 1pix (pixel) in a normal case, the above specified interval may be set to 1pix.
Step 83: and aiming at each target projection point, determining the gray value of the target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image.
The gray value of each pixel point in the one-dimensional projection signal image is as follows: and the gray value mean value of each target projection point of the pixel point is obtained through projection.
Since the centroid point coordinates of the gum path in each sampling interval are usually not integer coordinates, and the growth direction of the gum path in the sampling interval is usually at an angle to the coordinate axis of the image coordinate system of the image to be detected, the coordinates of the determined respective target projection points are usually not integer coordinates.
Since the electronic device generally only stores the pixel values at the integer coordinate positions, for each target projection point, the gray value of the target projection point can be determined according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to the preset interpolation method.
After the gray value of each target projection point is obtained, the growth direction of the gum path in the sampling interval section is taken as the projection direction, and each target projection point which is positioned on the same straight line along the projection direction is projected to obtain a one-dimensional projection signal image. The gray value of each pixel point in the one-dimensional projection signal image is as follows: and the gray value mean value of each target projection point of the pixel point is obtained through projection.
For example, as shown in fig. 11, for a rectangular area 1 corresponding to a certain sampling interval, a one-dimensional projection signal image 1 may be obtained after projection is performed on each target projection point in the rectangular area 1 along the projection direction 1.
Based on this, by projecting a two-dimensional image into a one-dimensional projection signal image by projection, it is possible to reduce data processing time and memory space, and enhance image edge information.
The method for presetting the difference value can comprise the following steps: nearest neighbor (Nearest Neighbour) interpolation, bilinear (Bilinear) interpolation, bicubic interpolation or lanczos interpolation, and so forth. The embodiment of the application does not specifically limit the preset difference method.
For example, a schematic diagram of determining the gray value P of the target projection point (x, y) using nearest neighbor interpolation may be shown in fig. 12. Wherein (x 0,y0)、(x0,y1)、(x1,y0)、(x1,y1) is an integer coordinate point in an image coordinate system of the target gray scale map, and gray scale values respectively correspond to Q11, Q12, Q21 and Q22. Further, since the target projection point (x, y) is closest to the integer coordinate point (x 0,y0), the gray value P of the target projection point (x, y) can be determined to be equal to Q11 according to the nearest neighbor difference method.
For example, schematic diagrams of determining the gray value f (x, y) of the target projection point (x, y) using bilinear interpolation may be as shown in fig. 13 (a) and 13 (b). Wherein (x 0,y0)、(x0,y1)、(x1,y0)、(x1,y1) is an integer coordinate point in an image coordinate system of the target gray map, gray values are respectively corresponding to f(x0,y0)、f(x0,y1)、f(x1,y0)、f(x1,y1)., and when the gray value f (x, y) of the target projection point (x, y) is determined by using a bilinear difference method, three first-order linear interpolation can be performed.
First, f (x, y 0) and f (x, y 1) are obtained by one-dimensional linear interpolation in the x direction by equation 1 and equation 2.
Equation 1:
Equation 2:
then, f (x, y) is obtained by one-dimensional linear interpolation in the y direction by equation 3.
Equation 3:
Finally, combining the above formula 1, formula 2 and formula 3 to obtain a bilinear interpolation calculation formula of the gray value f (x, y) of the final target projection point (x, y):
step 84: and filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining an extreme point of which the gradient response amplitude is within a preset threshold range in the gradient response signal as a candidate extreme point.
After the one-dimensional projection signal is obtained, a preset filtering algorithm can be utilized to carry out filtering processing on the one-dimensional projection signal image, so that a gradient response signal is obtained. Since the edge points in the one-dimensional projection signal generally correspond to the extreme points in the gradient response signal, in which the gradient response amplitude is within the preset threshold range, can be determined as candidate extreme points.
When the one-dimensional projection signal image is subjected to filtering processing by using a preset filtering algorithm, a differential filter can be used. The differential filter may act to enhance edges of interest and suppress noise in a one-dimensional projection signal image. The differential filter may be a first-order gaussian differential filter, a first-order sobel filter, other first-order differential filters or first-order derivative filters, or the like, which is not specifically limited in the embodiment of the present application.
Exemplary, a schematic diagram of the gradient response signal obtained by processing the one-dimensional projection signal image with a gaussian differential filter may be shown in fig. 14.
As shown in fig. 14, after the one-dimensional projection signal image is obtained, the one-dimensional projection signal image may be processed by using a first-order gaussian differential filter and using a filter kernel (-1-1 01 1) having a half-width of 3. For example, for the third column of pixels (gray value is 10) of the one-dimensional projection signal image in fig. 14, filtering the pixels according to the above filtering check may obtain a filtering result of 20× (-1) +20× (-1) +10×0+0×1+0×1= -40, and performing the above filtering process on gray values of pixels of all columns in the one-dimensional projection signal image in fig. 14 may obtain a filtering result of (-40, -30, -10, 10, 30, 40, 30, 10, -10, -10, -10,0,0, -10, -20,0, 20) shown in fig. 14.
In general, the larger the size of the filter kernel, the stronger the noise suppression capability, but also the blurring of the edge contour of the image may be caused, and further, when the size of the filter kernel is large, the accuracy of the extreme points determined based on the gradient response signal may be deteriorated. Therefore, the user can set the filter kernel size according to the actual accuracy requirement and the image quality of the target gray scale. For example, when there is less noise at the edge position of the glue area in the target gray scale image, a filtering kernel with a smaller size may be used to perform filtering processing to obtain an accurate extreme point position; when more noise exists at the edge position of the glue area in the target gray scale image, filtering processing can be performed by adopting a filtering core with larger size so as to reduce the influence of the noise as much as possible.
Step 85: and aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to the adjacent point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining the intersection point of the straight line parallel to the projection direction where the sub-pixel extreme point is positioned and the perpendicular bisector of the rectangular area corresponding to the sampling interval section as the sub-pixel edge point corresponding to the candidate extreme point.
The perpendicular bisector passes through the centroid point of the gum path in the sampling interval section and is perpendicular to the growth direction of the gum path in the sampling interval section.
In the image coordinate system of the one-dimensional projection signal image, the coordinates of the candidate extremum point are usually integer coordinates, and a plurality of decimal coordinates can exist between every two adjacent integer coordinates, so as to further improve the determination accuracy of the extremum point, after the candidate extremum point is determined, sub-pixel interpolation processing can be performed on the candidate extremum point according to the adjacent point adjacent to the candidate extremum point in the gradient response signal, and the sub-pixel extremum point corresponding to the candidate extremum point is obtained. Because the filtering processing and the screening of the extreme point are carried out on the one-dimensional projection signal image, the obtained sub-pixel extreme point has only one-dimensional information, after the sub-pixel extreme point is obtained, a straight line parallel to the projection direction where the sub-pixel extreme point is located and a center of mass point of a glue path in the sampling interval section and a perpendicular bisector which is perpendicular to the growth direction of the glue path in the sampling interval section can be determined, and then the intersection point of the straight line and the perpendicular bisector is determined as the sub-pixel edge point corresponding to the candidate extreme point.
For example, as shown in fig. 15, after the sub-pixel extremum point P is obtained, a straight line parallel to the projection direction where the sub-pixel extremum point P is located and a perpendicular bisector passing through the centroid point of the glue path in the sampling interval section and perpendicular to the growth direction of the glue path in the sampling interval section may be determined, and then an intersection point P' of the straight line and the perpendicular bisector may be determined as the sub-pixel edge point corresponding to the candidate extremum point.
Alternatively, in the sub-pixel interpolation processing for the candidate extremum points, a quadratic interpolation method (parabolic interpolation method) may be employed. For example, as shown in fig. 16, the candidate extremum point may be subjected to sub-pixel interpolation processing by using a parabolic interpolation method according to the adjacent points on both sides of the candidate extremum point, so that a point corresponding to a maximum value of a parabola fitted by using two adjacent points and the candidate extremum point is determined as a sub-pixel extremum point.
Step 86: and determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair.
For each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is negative, the polarity of the edge where the sub-pixel edge point is located is the second polarity.
Aiming at each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is positive, the polarity of the edge of the sub-pixel edge point is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is negative, the polarity of the edge where the sub-pixel edge point is located is the second polarity. Illustratively, in the rectangular region as shown in fig. 17, the pixels at the edge 1 having the polarity of the first polarity may be changed from black to white in the left-to-right direction, and the gradient response amplitude of the point on the edge 1 is a positive number; the pixels at edge 0, which are the second polarity in polarity, may be changed from white to black, with the gradient response amplitude of the point on edge 0 being negative.
For the rectangular area corresponding to each sampling interval section, the distance between two edge points of the glue area in the rectangular area can be used as the width of the glue area in the sampling interval section, and the distance between the two edge points can be represented by the distance between the two edge points respectively positioned on the two edge points. Since the polarities of the two edge lines of the glue area in each rectangular area are different, for each sampling interval section, the width of the glue area in the sampling interval section can be determined by two edge points with different polarities. Further, after each sub-pixel edge point is determined, two sub-pixel edge points with different polarities and a distance within a preset distance range may be determined as a sub-pixel edge point pair, and at least one sub-pixel edge point pair is obtained.
The foregoing preset distance range may be set by a person skilled in the art according to a range of the gum road width in an actual application, and the embodiment of the present application is not specifically limited.
Optionally, when determining the sub-pixel edge point pairs according to the edge polarity and the preset distance range, for each sub-pixel edge point belonging to the edge of the first polarity, the distance between the sub-pixel edge point and each sub-pixel edge point belonging to the edge of the second polarity may be calculated, and two sub-pixel edge points with the distance within the preset distance range may be determined as the sub-pixel edge point pairs.
Step 87: and determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair.
Wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference.
After each sub-pixel edge point pair is determined, the score of the sub-pixel edge point pair can be determined according to the designated parameter of each sub-pixel edge point pair, and the sub-pixel edge point pair with the score meeting the preset requirement is determined as the target edge point pair.
Wherein, the above specified parameters may include, but are not limited to: edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference, and the like.
For example, when the above specified parameter is a position, the determination of the score of each sub-pixel edge point pair may include: the center point of the connecting line of the sub-pixel edge point pair is different from the position of the centroid point of the rectangular area where the sub-pixel edge point pair is positioned.
For example, when the above specified parameter is a pitch, the determination of the score of each sub-pixel edge point pair may include: the ratio of the distance between two sub-pixel edge points in the sub-pixel edge point pair to the preset edge-to-distance.
Step 88: and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
After the target edge point pair is determined, the distance between the target edge point pair can be determined as the glue path width of the glue area in the sampling interval section.
Optionally, after determining the target edge point pair, coordinate values of two target edge points included in the target edge point pair may be determined, and according to the coordinate values of the two target edge points included in the target edge point pair, a distance between the target edge point pair is determined, and the distance is used as a glue path width of the glue area in a sampling interval section where the target edge point pair is located.
For example, when the electronic device performs the glue path quality detection on a certain target product, the coordinate values of the target edge points included in each determined target edge point pair and the numerical result of the glue path width of the glue area in the sampling interval section where the target edge point pair is located according to the determined target edge point pair may be as shown in fig. 18. It can be seen that the maximum glue width (maximum glue width) of the glue area on the target product is 30.3pix (pixels), the minimum glue width (minimum glue width) is 13.27pix, and the average glue width (average glue width) is 19.97pix.
Based on the specific implementation manner shown in the above steps 61-64, optionally, in a specific implementation manner, the step S104 of determining the glue quality detection result of the target product based on the comparison result of the glue width and the preset width threshold may include the following step 91.
Step 91: and determining a glue path quality detection result of the target product according to a comparison result of the glue path width of the glue area in each sampling interval section and a preset width threshold value.
After the glue path width of the glue area in each sampling interval section is determined, the glue path quality detection result of the target product can be determined according to the comparison result of the glue path width of the glue area in each sampling interval section and the preset width threshold value.
The preset width threshold may be a range of values, or may be a specific value.
If the preset width threshold is within the numerical value range, determining that the glue quality detection result of the target product is qualified if the number of the sampling interval sections of the glue area outside the preset width threshold is smaller than the preset number when determining the glue quality detection result of the target product according to the comparison result of the glue width of the glue area in each sampling interval section and the preset width threshold; if the number of sampling interval sections of the glue path width of the glue area outside the preset width threshold is not smaller than the preset number, determining that the glue path quality detection result of the target product is unqualified.
If the preset width threshold is a specific value, determining that the glue quality detection result of the target product is qualified if the number of sampling interval sections, in which the difference between the glue width of the glue area and the preset width threshold is greater than the preset difference, is less than the preset number when determining the glue quality detection result of the target product according to the comparison result of the glue width of the glue area in each sampling interval section and the preset width threshold; if the number of sampling interval sections with the difference value between the glue path width of the glue area and the preset width threshold value being larger than the preset difference value is not smaller than the preset number, determining that the glue path quality detection result of the target product is unqualified.
The preset number and the preset difference may be set by those skilled in the art according to actual application conditions, and the embodiment of the present application is not specifically limited.
Optionally, for each sampling interval, the glue path width of the glue area in the sampling interval can be compared with a preset width threshold value to determine a glue path quality detection result of the sampling interval. For example, as shown in fig. 19, the border of the rectangular area corresponding to the sampling interval section with the unqualified detection result of the gum quality may be rendered into a darker color, so that the border of the rectangular area corresponding to each sampling interval section is rendered into a different color, and the gum quality detection result of each sampling interval section is output.
In some glue application scenarios, the glue coating device needs to offset a specified offset to a specified direction along a preset glue path to glue a target product. In the above scenario, optionally, in a specific implementation manner, when the glue quality detection method provided by the embodiment of the present application is applied to perform glue quality detection, a user may input the specified offset in the specified direction into the electronic device in advance, and the electronic device may determine a glue path of a glue area on the detected target product according to the specified offset in the specified direction input by the user, so that each rectangular area is set in the target gray scale according to the determined glue path of the glue area.
Wherein, the specified direction and the specified offset may include: presetting offset of a glue path in each sampling interval section in a target gray scale graph along a direction vector and/or a normal vector of each sampling interval section; the direction vector of each sampling interval segment may be generally referred to as an X-axis direction, and the normal vector of each sampling interval segment may be generally referred to as a Y-axis direction.
For example, when the offset of the preset path along the X-axis direction of each sampling interval in the target gray scale is 20pix and the offset along the Y-axis direction of each sampling interval in the target gray scale is-20 pix, the visualization result of each rectangular region set in the target gray scale may be as shown in fig. 20.
For example, when the offset of the preset glue path along the X-axis direction of each sampling interval segment in the target gray scale map is 10pix and the offset along the Y-axis direction of each sampling interval segment in the target gray scale map is 10pix, the visualization result of each rectangular region set in the target gray scale map may be as shown in fig. 21.
Based on the above, in a scenario that the glue coating device shifts a specified offset to a specified direction along a preset glue path to carry out glue coating on a target product, the specific implementation manner can determine a glue path of a glue area on the target product according to the specified offset and the specified direction, so as to realize offset identification of the glue path and detection of a glue width of the glue area.
In order to better understand the method for detecting the quality of a rubber path provided by the embodiment of the present application, optionally, in a specific implementation manner, the method for detecting the quality of a rubber path provided by the embodiment of the present application may include the following steps 1001 to 1016.
Step 1001: obtaining an image to be detected of a target product to be subjected to glue quality detection, and performing region segmentation on the image to be detected by using a preset threshold segmentation algorithm to obtain a binarized image comprising a glue region segmented from the image to be detected.
Wherein the image to be detected is a gray scale image.
In order to detect the glue path quality of the target product, image acquisition equipment such as a camera can be utilized to acquire images of the positions, including the glue areas, on the target product, so as to obtain images to be detected. The electronic equipment can acquire the image to be detected acquired by the image acquisition equipment, and adopts a threshold segmentation algorithm to segment the image to be detected to obtain a binarized image comprising the glue area segmented from the image to be detected.
For example, the image to be detected acquired by the electronic device may be as shown in fig. 22, and the image to be detected as shown in fig. 22 may be subjected to region segmentation, so as to obtain a binarized image as shown in fig. 23.
Step 1002: and refining the binarized image by using a specified algorithm.
The above-mentioned specific algorithm may be various refinement algorithms such as Zhang-sun refinement algorithm, image morphology algorithm, deutch refinement algorithm, hildinich refinement algorithm, pavlidis refinement algorithm, rosenfeld refinement algorithm, etc., which are not limited in the embodiment of the present application.
Since step 1002 is the same as step 21, step 1002 will not be described in detail here.
Illustratively, the binarized image shown in fig. 23 is subjected to thinning processing, and an image shown in fig. 24 can be obtained.
Step 1003: and traversing each pixel point in the image obtained by refinement processing, and determining the pixel points with the traversed gray values meeting the requirement of the appointed gray values as each skeleton contour point of the glue area.
After the binarization image is subjected to refinement, each pixel point in the image obtained by the refinement can be traversed, and the pixel points with the traversed gray values meeting the requirements of the specified gray values are determined to be each skeleton contour point of the glue area.
Step 1004: and ordering all skeleton contour points according to a preset ordering rule matched with the glue path shape of the target product to obtain the glue path of the glue area.
Since step 1004 is the same as step S103, step 1004 will not be described in detail here.
Step 1005: starting from the starting point of the glue path, determining each sampling interval section on the glue path according to a preset sampling interval.
Since step 1005 is the same as step 61, step 1005 will not be described in detail here.
Step 1006: and determining the growth direction and the mass center point of the gum path in each sampling interval according to the coordinates of each skeleton contour point in the sampling interval.
Since step 1006 is the same as step 62 described above, step 1006 will not be described in detail herein.
For example, for the image obtained after the thinning process shown in fig. 24, the result of visualizing the growth direction of the determined gum path after going through the above steps 1003 to 1006 may be shown in fig. 25.
Step 1007: in the target gradation chart, a corresponding rectangular region is set for each sampling interval section.
If the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not the gray level image, the target gray level image is the gray level image obtained after the gray level image conversion of the image to be detected. The height direction of the rectangular area corresponding to each sampling interval section is perpendicular to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not greater than the preset width of the sampling interval, and the height is the preset height.
Since step 1007 is the same as step 63 described above, step 1007 is not described in detail here.
For example, the visualized result of setting a corresponding rectangular area for each sampling interval segment based on the respective growth directions caused by fig. 25 may be as shown in fig. 26.
Step 1008: for each sampling interval section, determining each reference projection point which is positioned on the same straight line with the centroid point of the glue path in the sampling interval section and has a specified interval with the centroid point of the glue path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map, wherein the vertical direction along the growth direction of the glue path in the sampling interval section is determined.
Wherein each reference proxel comprises: centroid points of the path of the gum within the sample interval segment.
After each rectangular region is set, for each sampling interval section, determining each reference projection point which is positioned on the same straight line with the centroid point of the glue path in the sampling interval section and has a specified interval with the centroid point of the glue path in the sampling interval section in the rectangular region corresponding to the sampling interval section in the target gray scale image.
Step 1009: for each reference projection point, determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section, wherein the target projection points are positioned on the same straight line with the reference projection points and are spaced at a specified interval.
Wherein each target proxel comprises: the reference proxel.
Since step 1009 is the same as step 82, step 1009 is not described in detail here.
Step 1010: and aiming at each target projection point, determining the gray value of the target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image.
The gray value of each pixel point in the one-dimensional projection signal image is as follows: and the gray value mean value of each target projection point of the pixel point is obtained through projection.
Since step 1010 is the same as step 83 described above, step 1010 will not be described in detail here.
Step 1011: and filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining an extreme point of which the gradient response amplitude is within a preset threshold range in the gradient response signal as a candidate extreme point.
Since step 1011 is the same as step 84 described above, step 1011 will not be described in detail here.
Step 1012: and aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to the adjacent point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining the intersection point of the straight line parallel to the projection direction where the sub-pixel extreme point is positioned and the perpendicular bisector of the rectangular area corresponding to the sampling interval section as the sub-pixel edge point corresponding to the candidate extreme point.
The perpendicular bisector passes through the centroid point of the gum path in the sampling interval section and is perpendicular to the growth direction of the gum path in the sampling interval section.
Since step 1012 is the same as step 85 described above, step 1012 is not specifically described herein.
Step 1013: and determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair.
For each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is negative, the polarity of the edge where the sub-pixel edge point is located is the second polarity.
Since step 1013 is the same as step 86, step 1013 is not described in detail here.
Step 1014: and determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair.
Wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference.
Since step 1014 is the same as step 87 described above, step 1014 will not be described in detail herein.
Step 1015: and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
Since step 1015 is the same as step 88 described above, step 1015 is not described in detail herein.
For example, when the electronic device performs the glue quality detection on the target product corresponding to the image to be detected as shown in fig. 22, the determined coordinate values of the target edge points included in each target edge point pair and the numerical result of the glue width of the glue area in the sampling interval section where the target edge point pair is located according to the target edge point pair may be shown in fig. 27. It can be seen that the maximum glue width (maximum glue width) of the glue area on the target product is 32.26pix (pixels), the minimum glue width (minimum glue width) is 27.67pix, and the average glue width (average glue width) is 29.74pix.
Step 1016: and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
Since step 1016 is the same as step S104 described above, step 1016 is not described in detail herein.
Optionally, for each sampling interval, the glue path width of the glue area in the sampling interval can be compared with a preset width threshold value to determine a glue path quality detection result of the sampling interval. For example, as shown in fig. 28, the border of the rectangular area corresponding to the sampling interval section with the unqualified detection result of the gum quality may be rendered into a darker color, so that the border of the rectangular area corresponding to each sampling interval section is rendered into a different color, and the gum quality detection result of each sampling interval section is output.
Corresponding to the method for detecting the quality of the rubber path provided by the embodiment of the present application, the embodiment of the present application also provides a device for detecting the quality of the rubber path, as shown in fig. 29, where the device for detecting the quality of the rubber path provided by the embodiment of the present application may include:
The image acquisition module 2901 is used for acquiring an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by segmentation in the image to be detected by carrying out area segmentation on the image to be detected;
an image processing module 2902, configured to refine the binarized image, and determine each skeleton contour point of the glue area obtained by the refinement;
The contour point ordering module 2903 is configured to order the contour points of each skeleton according to a preset ordering rule matched with the glue path shape of the target product, so as to obtain a glue path of the glue area;
The width determining module 2904 is configured to determine a glue path width of the glue area according to the glue path, and determine a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold.
Based on the above, when the scheme provided by the embodiment of the application is applied to the detection of the glue path quality of the target product, after the image to be detected of the target product is obtained, the glue path of the glue area on the target product can be determined through operations such as area segmentation, refinement treatment, skeleton contour point ordering and the like, without modeling the glue path in advance or planning the glue path in advance. Therefore, by applying the scheme provided by the embodiment of the application, the gum road quality detection flow can be simplified, the complexity of the gum road quality detection flow is obviously degraded, the deployment and debugging efficiency of the gum road quality detection flow is improved, and the gum road quality detection efficiency is improved.
In addition, the scheme provided by the embodiment of the application has no limitation on the area shape of the glue area and the shape of the glue route formed by gluing, can identify the glue route of the glue area with any shape and glue route, has strong applicability and has wider application scene. In addition, for the glue area with a complex shape in a complex glue application scene, the glue path of the glue area can be automatically identified by adopting the scheme provided by the embodiment of the application, the width of each glue path can be accurately and stably detected, and the detection precision of the width of the glue path can reach 1/16 pixel through practical test. Therefore, the scheme provided by the embodiment of the application can improve the accuracy of the glue path of the determined glue area, thereby improving the accuracy and stability of the glue path width of the determined glue area and improving the accuracy and stability of the glue path quality detection.
Optionally, in one specific implementation, the image processing module 2902 is specifically configured to:
And determining the pixel points with gray values meeting the requirements of the appointed gray values as the skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
Optionally, in a specific implementation, the width determining module 2904 includes:
The interval section determining submodule is used for determining each sampling interval section on the gum path according to a preset sampling interval from the starting point of the gum path;
the centroid point determining submodule is used for determining the growth direction and centroid point of the gum path in each sampling interval section according to the coordinates of each skeleton contour point in the sampling interval section;
The region setting submodule is used for setting a corresponding rectangular region for each sampling interval in the target gray level diagram; if the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not a gray level image, the target gray level image is a gray level image obtained by converting the gray level image of the image to be detected; the height direction of the rectangular area corresponding to each sampling interval section is vertical to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not more than the preset width of the sampling interval, and the height is the preset height;
the width determining submodule is used for determining the glue path width of the glue area in each sampling interval section according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray map.
Optionally, in a specific implementation manner, the centroid point determination submodule is specifically configured to:
For each sampling interval section, performing straight line fitting on each skeleton contour point in the sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the rubber path in the sampling interval section;
And calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under an image coordinate system of the image to be detected, and determining a point with an abscissa under the image coordinate system being the abscissa average value and an ordinate being the ordinate average value as a centroid point of a gum path in the sampling interval.
Optionally, in a specific implementation manner, the width determining submodule is specifically configured to:
Determining each reference projection point which is positioned on the same straight line with the centroid point of the gum path in the sampling interval section and has a specified interval between each two reference projection points along the vertical direction of the growth direction of the gum path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map; wherein each reference proxel comprises: centroid points of the glue path in the sampling interval section;
Determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section aiming at each reference projection point, wherein the growth direction and the reference projection point are positioned on the same straight line, and the distance between the target projection points is the appointed distance; wherein each target projection point comprises: the reference projection point;
Determining the gray value of each target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image; the gray value of each pixel point in the one-dimensional projection signal image is as follows: the gray value average value of each target projection point of the pixel point is obtained through projection;
Filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining extreme points of which the gradient response amplitude is within a preset threshold range in the gradient response signal as candidate extreme points;
Aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to a neighboring point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining an intersection point of a straight line parallel to the projection direction where the sub-pixel extreme point is positioned and a perpendicular bisector of a rectangular area corresponding to the sampling interval section as a sub-pixel edge point corresponding to the candidate extreme point; the perpendicular bisector passes through the centroid point of the rubber path in the sampling interval section and is perpendicular to the growth direction of the rubber path in the sampling interval section;
Determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair; for each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a negative number, the polarity of the edge where the sub-pixel edge point is located is a second polarity;
Determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair; wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference;
and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
The embodiment of the application also provides an electronic device, as shown in fig. 30, including:
a memory 3001 for storing a computer program;
the processor 3002 is configured to implement any one of the gum quality detection methods provided in the embodiments of the present application when executing the program stored in the memory 3001.
And the electronic device may further include a communication bus and/or a communication interface, where the processor 3002, the communication interface, and the memory 3001 perform communication with each other through the communication bus.
The communication bus mentioned above for the electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the above-described method for detecting a quality of a gum path.
In yet another embodiment of the present application, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods of detecting a gum road quality of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a Solid state disk (Solid STATE DISK, SSD), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer readable storage medium embodiments, and the computer program product embodiments, the description is relatively simple, as relevant to the description of the method embodiments in part, since they are substantially similar to the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (12)
1. A method for detecting the quality of a rubber path, the method comprising:
Obtaining an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by dividing the image to be detected by dividing the area of the image to be detected;
Refining the binarized image, and determining each skeleton contour point of the glue area obtained by the refining;
sequencing the skeleton contour points according to a preset sequencing rule matched with the glue path shape of the target product to obtain a glue path of the glue area;
and determining the glue path width of the glue area according to the glue path, and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
2. The method according to claim 1, wherein said determining each skeleton contour point of the glue area resulting from the thinning process comprises:
And determining the pixel points with gray values meeting the requirements of the appointed gray values as the skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
3. The method of claim 1, wherein said determining the glue path width of the glue area from the glue path comprises:
Starting from the starting point of the gum path, determining each sampling interval section on the gum path according to a preset sampling interval;
determining the growth direction and the mass center point of the gum path in each sampling interval according to the coordinates of each skeleton contour point in the sampling interval;
In the target gray level diagram, setting a corresponding rectangular area for each sampling interval section; if the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not a gray level image, the target gray level image is a gray level image obtained by converting the gray level image of the image to be detected; the height direction of the rectangular area corresponding to each sampling interval section is vertical to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not more than the preset width of the sampling interval, and the height is the preset height;
And determining the glue path width of the glue area in each sampling interval according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval in the target gray map.
4. A method according to claim 3, wherein determining the growth direction and centroid point of the gum path in each sampling interval based on the coordinates of the respective skeleton contour point in the sampling interval comprises:
For each sampling interval section, performing straight line fitting on each skeleton contour point in the sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the rubber path in the sampling interval section;
And calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under an image coordinate system of the image to be detected, and determining a point with an abscissa under the image coordinate system being the abscissa average value and an ordinate being the ordinate average value as a centroid point of a gum path in the sampling interval.
5. A method according to claim 3, wherein the determining, according to the gray values of the pixels in the rectangular area corresponding to the sampling interval in the target gray map, the glue path width of the glue area in the sampling interval includes:
Determining each reference projection point which is positioned on the same straight line with the centroid point of the gum path in the sampling interval section and has a specified interval between each two reference projection points along the vertical direction of the growth direction of the gum path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map; wherein each reference proxel comprises: centroid points of the glue path in the sampling interval section;
Determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section aiming at each reference projection point, wherein the growth direction and the reference projection point are positioned on the same straight line, and the distance between the target projection points is the appointed distance; wherein each target projection point comprises: the reference projection point;
Determining the gray value of each target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image; the gray value of each pixel point in the one-dimensional projection signal image is as follows: the gray value average value of each target projection point of the pixel point is obtained through projection;
Filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining extreme points of which the gradient response amplitude is within a preset threshold range in the gradient response signal as candidate extreme points;
Aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to a neighboring point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining an intersection point of a straight line parallel to the projection direction where the sub-pixel extreme point is positioned and a perpendicular bisector of a rectangular area corresponding to the sampling interval section as a sub-pixel edge point corresponding to the candidate extreme point; the perpendicular bisector passes through the centroid point of the rubber path in the sampling interval section and is perpendicular to the growth direction of the rubber path in the sampling interval section;
Determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair; for each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a negative number, the polarity of the edge where the sub-pixel edge point is located is a second polarity;
Determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair; wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference;
and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
6. A gum path quality inspection device, the device comprising:
the image acquisition module is used for acquiring an image to be detected of a target product to be subjected to glue quality detection, and obtaining a binarized image comprising a glue area obtained by segmentation in the image to be detected by carrying out area segmentation on the image to be detected;
the image processing module is used for carrying out refinement processing on the binarized image and determining each skeleton contour point of the glue area obtained by the refinement processing;
the contour point ordering module is used for ordering the contour points of each skeleton according to a preset ordering rule matched with the glue path shape of the target product to obtain a glue path of the glue area;
The width determining module is used for determining the glue path width of the glue area according to the glue path and determining a glue path quality detection result of the target product based on a comparison result of the glue path width and a preset width threshold value.
7. The apparatus of claim 6, wherein the image processing module is specifically configured to:
And determining the pixel points with gray values meeting the requirements of the appointed gray values as the skeleton contour points of the glue area in each pixel point in the image obtained by the refinement treatment.
8. The apparatus of claim 6, wherein the width determination module comprises:
The interval section determining submodule is used for determining each sampling interval section on the gum path according to a preset sampling interval from the starting point of the gum path;
the centroid point determining submodule is used for determining the growth direction and centroid point of the gum path in each sampling interval section according to the coordinates of each skeleton contour point in the sampling interval section;
The region setting submodule is used for setting a corresponding rectangular region for each sampling interval in the target gray level diagram; if the image to be detected is a gray level image, the target gray level image is the image to be detected; if the image to be detected is not a gray level image, the target gray level image is a gray level image obtained by converting the gray level image of the image to be detected; the height direction of the rectangular area corresponding to each sampling interval section is vertical to the growth direction of the gum path in the sampling interval section, the center is the centroid point of the gum path in the sampling interval section, the width is not more than the preset width of the sampling interval, and the height is the preset height;
the width determining submodule is used for determining the glue path width of the glue area in each sampling interval section according to the gray value of each pixel point in the rectangular area corresponding to the sampling interval section in the target gray map.
9. The apparatus of claim 8, wherein the centroid point determination submodule is specifically configured to:
For each sampling interval section, performing straight line fitting on each skeleton contour point in the sampling interval section, and determining the designated direction of the obtained fitting straight line as the growth direction of the rubber path in the sampling interval section;
And calculating an abscissa average value and an ordinate average value of each skeleton contour point in each sampling interval under an image coordinate system of the image to be detected, and determining a point with an abscissa under the image coordinate system being the abscissa average value and an ordinate being the ordinate average value as a centroid point of a gum path in the sampling interval.
10. The apparatus of claim 8, wherein the width determination submodule is specifically configured to:
Determining each reference projection point which is positioned on the same straight line with the centroid point of the gum path in the sampling interval section and has a specified interval between each two reference projection points along the vertical direction of the growth direction of the gum path in the sampling interval section in a rectangular area corresponding to the sampling interval section in the target gray scale map; wherein each reference proxel comprises: centroid points of the glue path in the sampling interval section;
Determining the growth direction of a gum path along the sampling interval section in a rectangular area corresponding to the sampling interval section aiming at each reference projection point, wherein the growth direction and the reference projection point are positioned on the same straight line, and the distance between the target projection points is the appointed distance; wherein each target projection point comprises: the reference projection point;
Determining the gray value of each target projection point according to the gray value of at least one pixel point adjacent to the target projection point in the target gray map according to a preset interpolation method, and projecting each target projection point positioned on the same straight line along the projection direction by taking the growth direction of the glue path in the sampling interval section as the projection direction to obtain a one-dimensional projection signal image; the gray value of each pixel point in the one-dimensional projection signal image is as follows: the gray value average value of each target projection point of the pixel point is obtained through projection;
Filtering the one-dimensional projection signal image according to a preset filtering algorithm to obtain a gradient response signal, and determining extreme points of which the gradient response amplitude is within a preset threshold range in the gradient response signal as candidate extreme points;
Aiming at each candidate extreme point, carrying out sub-pixel interpolation processing on the candidate extreme point according to a neighboring point adjacent to the candidate extreme point in the gradient response signal to obtain a sub-pixel extreme point, and determining an intersection point of a straight line parallel to the projection direction where the sub-pixel extreme point is positioned and a perpendicular bisector of a rectangular area corresponding to the sampling interval section as a sub-pixel edge point corresponding to the candidate extreme point; the perpendicular bisector passes through the centroid point of the rubber path in the sampling interval section and is perpendicular to the growth direction of the rubber path in the sampling interval section;
Determining two sub-pixel edge points with different polarities and distances within a preset distance range as sub-pixel edge point pairs, and obtaining at least one sub-pixel edge point pair; for each sub-pixel edge point, if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a positive number, the polarity of the edge where the sub-pixel edge point is located is a first polarity; if the gradient response amplitude of the candidate extreme point corresponding to the sub-pixel edge point is a negative number, the polarity of the edge where the sub-pixel edge point is located is a second polarity;
Determining the score of each sub-pixel edge point pair according to the appointed parameter of the sub-pixel edge point pair, and determining the sub-pixel edge point pair with the score meeting the preset requirement as a target edge point pair; wherein the specified parameters include: at least one of edge pair contrast, gray scale, position, relative position, normalized relative position, pitch difference, relative pitch difference;
and determining the distance between the target edge point pairs as the glue path width of the glue area in the sampling interval section.
11. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the method of any of claims 1-5 when executing a program stored on a memory.
12. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method of any of claims 1-5.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410529407.7A CN118351097A (en) | 2024-04-29 | 2024-04-29 | Method and device for detecting glue path quality, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410529407.7A CN118351097A (en) | 2024-04-29 | 2024-04-29 | Method and device for detecting glue path quality, electronic equipment and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118351097A true CN118351097A (en) | 2024-07-16 |
Family
ID=91824000
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410529407.7A Pending CN118351097A (en) | 2024-04-29 | 2024-04-29 | Method and device for detecting glue path quality, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118351097A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119023687A (en) * | 2024-10-25 | 2024-11-26 | 迈未视(苏州)智能科技有限公司 | A method and system for online 3D detection of rubber roads based on machine vision |
| CN119831984A (en) * | 2025-03-13 | 2025-04-15 | 宁波舜宇光电软件开发有限公司 | Glue line detection method based on machine vision |
| CN120726039A (en) * | 2025-08-26 | 2025-09-30 | 厦门微亚智能科技股份有限公司 | A method for extracting and detecting lithium battery glue |
| CN121213723A (en) * | 2025-11-27 | 2025-12-26 | 深圳市腾盛精密装备股份有限公司 | Methods for determining the adhesive application path and computer storage media |
-
2024
- 2024-04-29 CN CN202410529407.7A patent/CN118351097A/en active Pending
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119023687A (en) * | 2024-10-25 | 2024-11-26 | 迈未视(苏州)智能科技有限公司 | A method and system for online 3D detection of rubber roads based on machine vision |
| CN119831984A (en) * | 2025-03-13 | 2025-04-15 | 宁波舜宇光电软件开发有限公司 | Glue line detection method based on machine vision |
| CN120726039A (en) * | 2025-08-26 | 2025-09-30 | 厦门微亚智能科技股份有限公司 | A method for extracting and detecting lithium battery glue |
| CN120726039B (en) * | 2025-08-26 | 2025-12-02 | 厦门微亚智能科技股份有限公司 | Extraction and detection method for lithium battery gluing |
| CN121213723A (en) * | 2025-11-27 | 2025-12-26 | 深圳市腾盛精密装备股份有限公司 | Methods for determining the adhesive application path and computer storage media |
| CN121213723B (en) * | 2025-11-27 | 2026-03-24 | 深圳市腾盛精密装备股份有限公司 | Gumming path determining method and computer storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110866924B (en) | Line structured light center line extraction method and storage medium | |
| CN118351097A (en) | Method and device for detecting glue path quality, electronic equipment and storage medium | |
| CN111598913B (en) | Image segmentation method and system based on robot vision | |
| US8121415B2 (en) | Combining feature boundaries | |
| JP3706051B2 (en) | Pattern inspection apparatus and method | |
| CN113609984A (en) | Pointer instrument reading identification method and device and electronic equipment | |
| CN110706224B (en) | Method, system and device for weak scratch detection of optical components based on dark field images | |
| CN111354047B (en) | A camera module positioning method and system based on computer vision | |
| CN111507055A (en) | Circuit design layout and electron microscope scanning image registration method and system, circuit design layout and imaging error calculation method thereof | |
| CN113469171A (en) | Method, device and medium for identifying interest area in SFR test card image | |
| CN107230212B (en) | Vision-based mobile phone size measuring method and system | |
| CN108876842A (en) | A kind of measurement method, system, equipment and the storage medium of sub-pixel edge angle | |
| CN115471650A (en) | Gas pressure instrument reading method, device, equipment and medium | |
| CN120726000A (en) | Industrial image anomaly detection method, device, equipment and storage medium | |
| CN118229970A (en) | A Gray code binarization method based on boundary line detection technology | |
| CN117876364A (en) | Metal bar defect detection method and system based on image recognition | |
| CN112085708A (en) | Method and equipment for detecting defects of straight line edge in product outer contour | |
| CN113554688B (en) | O-shaped sealing ring size measurement method based on monocular vision | |
| CN119723200A (en) | Defect type detection method and device, electronic device and storage medium | |
| CN120807534B (en) | Fault detection method and device based on high-temperature-resistant camera | |
| CN121073980B (en) | Defect Segmentation and Localization Method and System for Inorganic Mineral Casting Images | |
| Zhou et al. | An adaptive clustering method detecting the surface defects on linear guide rails | |
| CN116258654A (en) | Coarse positioning method, device, electronic equipment and medium based on Blob analysis | |
| CN115984396B (en) | Cargo drawing automatic generation method based on 3D structured light depth camera | |
| CN115809999A (en) | Target object detection method, device, electronic equipment and storage medium on device |
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 |