CN117372432A - Electronic cigarette surface defect detection method and system based on image segmentation - Google Patents

Electronic cigarette surface defect detection method and system based on image segmentation Download PDF

Info

Publication number
CN117372432A
CN117372432A CN202311674513.6A CN202311674513A CN117372432A CN 117372432 A CN117372432 A CN 117372432A CN 202311674513 A CN202311674513 A CN 202311674513A CN 117372432 A CN117372432 A CN 117372432A
Authority
CN
China
Prior art keywords
edge
target
edges
acquiring
points
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.)
Granted
Application number
CN202311674513.6A
Other languages
Chinese (zh)
Other versions
CN117372432B (en
Inventor
申敏良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Cigreat Technology Co ltd
Original Assignee
Shenzhen Cigreat Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Cigreat Technology Co ltd filed Critical Shenzhen Cigreat Technology Co ltd
Priority to CN202311674513.6A priority Critical patent/CN117372432B/en
Publication of CN117372432A publication Critical patent/CN117372432A/en
Application granted granted Critical
Publication of CN117372432B publication Critical patent/CN117372432B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention relates to the technical field of surface defect region segmentation, in particular to an electronic cigarette surface defect detection method and system based on image segmentation. Obtaining edge similarity by analyzing the quantity and characteristic differences of angular points on every two closed edges in the surface image of the electronic cigarette, and further obtaining all target edges, target areas and reference edges by combining the differences of the two closed edges; analyzing gray information on two sides of a reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge, combining gray variation differences of all angular points on the target edge and the reference edge to the corresponding centers respectively, obtaining a zebra falling significant coefficient and screening out all suspected zebra paint stripping areas; and carrying out super-pixel segmentation on the surface image according to the regional center of the suspected speckled paint removing region, and obtaining a speckled paint removing defect region. According to the method, the seed points with the super-pixel segmentation at the center of the area with the obvious spot-shaped paint removal characteristic area are obtained, so that the detection accuracy of the defect area is improved.

Description

Electronic cigarette surface defect detection method and system based on image segmentation
Technical Field
The invention relates to the technical field of surface defect region segmentation, in particular to an electronic cigarette surface defect detection method and system based on image segmentation.
Background
Defects on the surface of the electronic cigarette can influence the structural integrity and the tightness of the electronic cigarette, so that the safety problems of electronic leakage, liquid leakage and the like are caused; meanwhile, rough surfaces or sharp edges may increase discomfort to the user and affect the aesthetic appearance of the product, reducing the satisfaction of the user with the product.
The electronic cigarette is required to be subjected to paint spraying treatment in the production process, but the paint spraying process is difficult to control, so that the surface of the electronic cigarette is easy to fall off in a spot shape, and when the traditional image segmentation algorithm detects the surface defect of the electronic cigarette, the mark, the shell structure and the defect characteristic of the surface of the electronic cigarette are complex, so that the boundary of a part of a surface defect area is fuzzy, the segmentation effect is poor, and inconvenience is brought to the quality detection process.
Disclosure of Invention
In order to solve the technical problem that the existing image segmentation algorithm has poor segmentation effect on the surface defect area, the invention aims to provide an electronic cigarette surface defect detection method and system based on image segmentation, and the adopted technical scheme is as follows:
The invention provides an electronic cigarette surface defect detection method based on image segmentation, which comprises the following steps:
acquiring a surface image of an electronic cigarette to be tested;
acquiring all closed edges in the surface image and all angular points on each closed edge; obtaining the edge similarity of every two closed edges in all the closed edges according to the quantity difference and the characteristic difference of the angular points on different closed edges; acquiring all target edges, reference edges and target areas surrounded by the target edges in the surface image according to the edge similarity and the difference between the two corresponding closed edges;
acquiring a variegated exposure significant coefficient of each target area according to gray information of pixel points at two sides of the reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge; in each target area, according to the change difference between the gray level change from all the corner points to the corresponding center on the target edge and the gray level change from all the corner points to the corresponding center on the reference edge, acquiring a paint peeling significant coefficient; acquiring the zebra-like shedding significant coefficient of each target area according to the zebra-like exposure significant coefficient and the paint stripping significant coefficient;
Screening all suspected zebra-like paint removing areas from all the target areas according to the zebra-like significant coefficients; obtaining the regional center of each suspected speckled paint removing region according to the corresponding center of the target edge and the reference edge of each suspected speckled paint removing region; and performing super-pixel segmentation on the surface image according to the center of the area to obtain a spot paint removal defect area.
Further, the method for obtaining the edge similarity comprises the following steps:
optionally, selecting one closed edge as an edge to be analyzed, acquiring any corner point on the edge to be analyzed as a first point to be analyzed, and sequentially carrying out sequencing labels on all the corner points corresponding to the edge to be analyzed along any direction of the closed edge; acquiring the first points on each of the other closed edges and performing sequencing labels, wherein the position difference between the first points and the first points to be analyzed on the surface image is the smallest, and the sequencing direction of the corner points on each of the other closed edges is consistent with the sequencing direction of the corner points on the edges to be analyzed;
acquiring feature descriptors of each corner point in a corresponding preset window; and in every two closed edges in all the closed edges, acquiring a distance variance between the angular points of all the same sorting labels and a first DTW distance average value between the corresponding feature descriptors, carrying out negative correlation mapping on absolute values obtained by subtracting a preset first positive constant from a quantity ratio of the angular points on the corresponding two closed edges, normalizing, taking the normalized value as a molecule, and adding a preset second positive constant to a product of the distance variance and the first DTW distance average value as a denominator to obtain the edge similarity of the corresponding two closed edges.
Further, the method for acquiring the target edge and the reference edge comprises the following steps:
screening out the closed edges with the largest edge similarity with the edge to be analyzed from all the closed edges to be used as matched edges, comparing the difference of the number of the pixel points on the edge to be analyzed and the matched edges, taking the closed edge with the largest number of the pixel points on the two closed edges as a target edge, and taking the other closed edge as a corresponding reference edge;
and selecting one closed edge from all other closed edges as an edge to be analyzed, acquiring corresponding target edges and reference edges, and continuously iterating until all the target edges and the reference edges are acquired.
Further, the method for obtaining the speckle nude significant coefficient comprises the following steps:
obtaining a preset standard paint removal gray value; in each target area, obtaining a first gray level difference between a gray level average value of all pixel points on the inner side of the reference edge and a preset standard paint removal gray level value, obtaining a centroid distance between the target edge and the reference edge, multiplying the centroid distance by the first gray level difference, adding a preset third positive constant, and then taking the first gray level difference as a denominator, obtaining a second gray level difference between a gray level average value of all pixel points on the outer side of the reference edge and a gray level average value of all pixel points on the inner side of the reference edge, and taking the second gray level difference as a molecule, thereby obtaining a variegated naked significant coefficient corresponding to the target area.
Further, the method for obtaining the paint peeling significant coefficient comprises the following steps:
taking the mass center of the target edge as a first starting point, acquiring all first rays in the directions corresponding to each angular point on the first starting point to the target edge, and sequentially taking gray values of all pixel points from the first starting point to a preset number of pixel points after the angular points are corresponding to each first ray as first sequence elements to obtain a corresponding first gray change sequence;
taking the mass center of the reference edge as a second starting point, acquiring all second rays in the directions corresponding to each angular point on the second starting point to the reference edge, and sequentially taking gray values from the second starting point to all pixel points corresponding to the angular points on each second ray as second sequence elements to obtain a corresponding second gray change sequence;
and in each target area, acquiring a second DTW distance average value between all first gray level change sequences corresponding to the adjacent angular points on the target edge, adding a preset fourth normal number to the second DTW distance average value as a denominator, acquiring a correlation coefficient average value between the first gray level change sequences and the second gray level change sequences corresponding to the angular points of all the same sequencing marks on the target edge and the reference edge, and taking the correlation coefficient average value as a molecule to acquire a paint stripping significant coefficient corresponding to the target area.
Further, the method for obtaining the zebra-like abscission significant coefficient comprises the following steps:
and multiplying the speckled exposure significant coefficient of each target area by the paint peeling significant coefficient, and then normalizing to obtain the speckled peeling significant coefficient of the corresponding target area.
Further, the screening method of the target area comprises the following steps:
and taking the target area with the zebra-like abscission significant coefficient larger than a preset threshold value as a suspected zebra-like paint-removing area.
Further, the method for acquiring the regional center comprises the following steps:
and in each suspected speckled paint removing area, acquiring a midpoint between the mass center of the target edge and the mass center of the reference edge, and taking the midpoint as the area center of the corresponding suspected speckled paint removing area.
Further, the preset number is 10.
The invention also provides an electronic cigarette surface defect detection system based on image segmentation, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of any one of the electronic cigarette surface defect detection methods based on image segmentation when executing the computer program.
The invention has the following beneficial effects:
according to the method, all the closed edges and all the angular points on each closed edge in the surface image of the electronic cigarette to be detected are obtained, the unique characteristics of the angular points can help shape comparison and matching analysis of the edges, the edge similarity is obtained by analyzing the quantity and characteristic differences of the angular points on each two closed edges, and then all the target edges, the corresponding target areas and the reference edges are obtained according to the edge similarity and the differences of the two corresponding closed edges; then, according to gray information of pixel points at two sides of a reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge, obtaining a speckle exposure significant coefficient of each target area, wherein the size of the speckle exposure significant coefficient reflects whether the color characteristics and the area center overlap ratio in the target area accord with the speckle paint stripping characteristics or not; in each target area, according to the gray level change difference between all the corner points on the target edge and the reference edge and the corresponding center, acquiring a paint peeling significant coefficient, wherein the paint peeling significant coefficient reflects the gray level change of each target area in the stage of conforming to the zebra paint peeling characteristic; and further synthesizing two significant coefficients reflecting the characteristic of the spot paint removal, obtaining the spot paint removal significant coefficient of each target area, screening out all suspected spot paint removal areas, and further performing super-pixel segmentation according to the area center of the suspected spot paint removal areas to obtain spot paint removal defect areas. According to the method, the seed points with the obvious spot paint removing characteristic areas and the super-pixel segmentation area centers are obtained, so that the spot paint removing areas can be effectively identified, and the detection accuracy of the defect areas is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for detecting a surface defect of an electronic cigarette based on image segmentation according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a spot-shaped paint removing area on a surface of an electronic cigarette according to an embodiment of the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following is a detailed description of specific implementation, structure, characteristics and effects of the method and system for detecting the surface defects of the electronic cigarette based on image segmentation according to the invention with reference to the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The invention provides a specific scheme of an electronic cigarette surface defect detection method and system based on image segmentation, which are specifically described below with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a method for detecting a surface defect of an electronic cigarette based on image segmentation according to an embodiment of the invention is shown, and the method includes the following steps:
and S1, acquiring a surface image of the electronic cigarette to be tested.
In order to detect whether defects exist on the surface of the electronic cigarette, the method and the device acquire the surface image of the electronic cigarette to be detected, process and analyze the acquired surface image by combining the spot paint removing features of the surface defects of the electronic cigarette, acquire a suspected spot paint removing region similar to the spot paint removing features, further segment the surface image by taking the region center of the suspected spot paint removing region as a seed point for super-pixel segmentation, and improve the accuracy of segmentation and detection of the defect region.
In one embodiment of the invention, the surface image of the electronic cigarette is acquired through a CCD camera, and it is to be noted that the embodiment of the invention aims at the electronic cigarette with the elliptic cylinder structure, and when the image acquisition is performed, six surface images of two long-axis side surfaces, two short-axis side surfaces and two end surfaces of the electronic cigarette to be detected are required to be acquired.
In order to facilitate the subsequent analysis and processing of the images, the surface image to be analyzed of the electronic cigarette to be detected needs to be preprocessed. In consideration of the fact that the characteristic of spot-shaped paint removal of the electronic cigarette is required to be combined subsequently to analyze edge characteristics in the surface image, in one embodiment of the invention, bilateral filtering is selected to carry out denoising treatment on the surface image to be analyzed of the electronic cigarette to be detected, and a weighted average method is adopted to carry out graying treatment on the surface image to be analyzed after denoising, so that the influence on the edge is reduced, the definition of the edge is kept while the noise is restrained, and an operator can select other denoising modes and graying modes according to actual conditions. It should be noted that, bilateral filtering and weighted average graying are well known technical means to those skilled in the art, and are not described herein.
Step S2, acquiring all closed edges in the surface image and all angular points on each closed edge; according to the quantity difference and the characteristic difference of the angular points on different closed edges, obtaining the edge similarity of every two closed edges in all the closed edges; and acquiring all target edges, reference edges and target areas surrounded by the target edges in the surface image according to the edge similarity and the difference between the two corresponding closed edges.
Considering that the shell processing process flow of the electronic cigarette is usually to spray the two-component PU paint on the electronic cigarette shell made of aluminum alloy material and then spray the UV paint, because of random factors such as poor control of the spraying process or improper surface treatment of the aluminum alloy shell, paint is possibly sprayed on the surface of the aluminum alloy shell to generate paint stripping conditions, irregular speckles or blocky stripping is usually shown, the edge of the stripped part usually generates stripping and warping phenomena to form an obvious boundary, the stripped and warped edge usually generates shadow on the surface of the electronic cigarette, so that a shadow edge with the shape similar to that of the edge of the paint stripping region is formed on the surface of the aluminum alloy in a speckled paint stripping region, and referring to fig. 2, a schematic diagram of a speckled paint stripping region in the surface of the electronic cigarette is shown, an outer edge line in fig. 2 is the paint stripping edge of the speckled paint stripping region, and an inner edge line is a shadow edge of the stripped edge shadow edge of the speckled paint stripping region, namely, the inner edge line is a shadow edge of the stripped edge of the aluminum alloy region is formed on the surface of the aluminum alloy stripping region.
Because the inner edge and the outer edge of the zebra-like paint removing area are closed edges with similar shapes, the embodiment of the invention firstly obtains all the closed edges in the surface image, and further analyzes the similarity between every two closed edges, thereby judging whether the two corresponding closed edges accord with the zebra-like paint removing characteristics. In one embodiment of the invention, edge detection is specifically performed on the surface image to be analyzed through a Canny operator, and then the edge closure is judged through an edge tracking algorithm. In addition, more angular points are usually arranged on irregular closed edges of the spot-shaped paint removing area, the closed edges of buttons, charging holes or structural lines and the like on the surface of the electronic cigarette to be detected possibly interfere with a final analysis result, and the uniqueness of the angular points can help shape comparison and matching analysis of the edges, so that the embodiment of the invention further obtains all the angular points on each closed edge. In one embodiment of the invention, all corner points are acquired specifically by using a Harris corner point detection algorithm. The Canny operator, the edge tracking algorithm and the Harris corner detection algorithm are all of the prior art, and are not repeated here.
After all the corner points on each closed edge are obtained, the edge similarity of every two closed edges in all the closed edges can be obtained according to the quantity difference and the characteristic difference of the corner points on different closed edges.
Preferably, in one embodiment of the invention, it is considered that the corner points of the same orientation on the paint stripping edge and the shadow edge within the spot-like paint stripping area should have similar directional gradients; because the shadow edge is projected by the warping of the paint removing edge, the number of the corner points on the paint removing edge and the shadow edge and the distances between all the corner points corresponding to the same sequence number are about the same; based on the method, the method for acquiring the edge similarity comprises the steps of selecting one closed edge as an edge to be analyzed, acquiring any corner point on the edge to be analyzed as a first point to be analyzed, and sequentially carrying out sequencing labels on all the corner points corresponding to the edge to be analyzed along any direction of the closed edge; acquiring the first points on each other closed edge and carrying out sequencing labels, wherein the position difference between the first points and the first points to be analyzed on the surface image is the smallest, and the sequencing direction of the corner points on each other closed edge is consistent with the sequencing direction of the corner points on the edge to be analyzed; acquiring feature descriptors of each corner point in a corresponding preset window; and in every two closed edges in all the closed edges, acquiring the distance variance between the corner points of all the same sorting labels and the first DTW distance average value between corresponding feature descriptors, carrying out negative correlation mapping on absolute values obtained by subtracting a preset first positive constant from the number ratio of the corner points on the corresponding two closed edges, normalizing, taking the normalized value as a molecule, and taking the product of the distance variance and the first DTW distance average value as a denominator after adding a preset second positive constant to obtain the edge similarity of the corresponding two closed edges.
In the embodiment of the invention, after the angular points on each closed edge are sequenced, a size of the angle points is constructed by taking each angular point as a centerAnd acquiring a direction gradient histogram (Histogram of Oriented Gradient, HOG) feature descriptor corresponding to each corner in the window, then acquiring dynamic time warping (Dynamic Time Warping, DTW) distances between feature descriptors corresponding to the same sequence number corner on two closed edges, further acquiring a first DTW distance average value, and acquiring euclidean distances between all the same sequence number corners, further calculating a distance variance. In other embodiments of the invention, the practitioner may vary depending on the particular applicationSetting a preset window size, selecting other distance measurement methods and other feature descriptors, and acquiring the similarity between the feature descriptors through other similarity analysis methods. The HOG feature descriptor, DTW distance and euclidean distance acquiring method are technical means well known to those skilled in the art, and are not described herein.
It should be noted that, when the DTW distances between feature descriptors corresponding to corner points with the same sequence numbers on two closed edges are obtained, there may be a case that the numbers of corner points on the two closed edges are inconsistent, and in the embodiment of the present invention, only the corner points with the same sequence numbers on the two closed edges need to be analyzed and processed.
The calculation formula of the edge similarity is expressed as:
in the method, in the process of the invention,is->Strip closure edge and->Edge line similarity of the strip closure edges; />Is->The number of corner points on the strip closing edge; />Is->The number of corner points on the strip closing edge; />Is->Strip closure edge and the firstThe sequence numbers on the strip closing edges are all +.>Euclidean distance between corner points, +.>Is->Strip closure edge and->Euclidean distance mean value among all corner points with the same sequence number on strip closing edge>Is->Strip closure edge and->The total number of corner points with the same sequence numbers on the strip closing edge; />The first DTW distance average value among feature descriptors corresponding to all corner points with the same ordering sequence number; />Is natural constant (18)>For presetting a first positive constant, +.>In order to preset the second positive constant, in the embodiment of the invention, the more the ratio of the number of the corner points on the closed edge is close to 1, the edge phase isThe higher the similarity is, the preset first normal number is set to 1, and the preset second positive constant is set to 1 in order to ensure the meaning of the denominator.
In the edge similarity formula, the smaller the number difference of the corner points is, the higher the edge similarity is; if the distance fluctuation between all the angular points with the same serial numbers on the two closed edges is smaller, namely the distance variance is smaller; meanwhile, if the DTW distances among the feature descriptors corresponding to the corner points with the same sequence numbers are smaller, the direction gradient changes among the corner points are more similar, the first DTW distance mean value among the feature descriptors corresponding to all the corner points with the same sequence numbers is smaller, and the second normal number is added as a denominator after the first DTW distance mean value is multiplied by the distance variance, so that the edge similarity of the two corresponding closed edges is larger.
After the edge similarity of every two closed edges in all the closed edges is obtained, all the target edges, the reference edges and the target area surrounded by the target edges in the surface image can be obtained according to the edge similarity and the difference of the two corresponding closed edges.
Preferably, in one embodiment of the present invention, considering that the paint removing edge and the shadow edge of the zebra stripe have similar edge profiles and each corner point on the edge has similar direction gradient change, meanwhile, because the number of pixels on the paint removing edge is greater than that of pixels on the shadow edge, the closed edge with the maximum edge similarity with the edge to be analyzed is selected from all the closed edges as a matched edge, the difference of the number of pixels on the edge to be analyzed and the matched edge is compared, the closed edge with the maximum number of pixels on the two closed edges is taken as a target edge, and the other closed edge is the corresponding reference edge; and selecting a closed edge as an edge to be analyzed from all other closed edges, acquiring corresponding target edges and reference edges, and continuously iterating until all the target edges and the reference edges are acquired.
And comparing the similarity analysis and the pixel number of all the closed areas to obtain all the target edges and the reference edges corresponding to the target edges, wherein the target areas corresponding to the target edges are areas possibly conforming to the zebra falling characteristics, the corresponding target edges are possibly corresponding paint stripping edges, and the reference edges are possibly corresponding shadow edges, but whether the target areas are zebra falling areas cannot be accurately judged only according to the edge similarity, so that the zebra falling significant coefficient is further combined in the subsequent analysis process.
Step S3, according to gray information of pixel points at two sides of a reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge, obtaining a variegated naked significant coefficient of each target area; in each target area, according to the change difference between the gray level change from all the corner points on the target edge to the corresponding center and the gray level change from all the corner points on the reference edge to the corresponding center, acquiring a paint peeling significant coefficient; and obtaining the zebra-falling significant coefficient of each target area according to the zebra-falling significant coefficient and the paint stripping significant coefficient.
The aluminum alloy exposed area in the zebra-shaped paint removing area is silvery white with higher brightness value, and the pixel value of the shadow area caused by the warping of the non-paint removing area and the pixel value of the aluminum alloy exposed area have great difference; meanwhile, the paint removing edge and the shadow edge have higher edge similarity, and the corresponding center positions of the paint removing edge and the shadow edge are approximately coincident; therefore, according to the embodiment of the invention, the variegated naked significant coefficient of each target area is obtained according to the gray information of the pixel points at the two sides of the reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge.
Preferably, in one embodiment of the present invention, the method for obtaining the zebra saliency coefficient includes: obtaining a preset standard paint removal gray value; in each target area, obtaining a first gray level difference between the gray level average value of all pixel points at the inner side of the reference edge and a preset standard paint removal gray level value, obtaining a centroid distance between the target edge and the reference edge, multiplying the centroid distance by the first gray level difference, adding a preset third positive constant, and then taking the centroid distance as a denominator, obtaining a second gray level difference between the gray level average value of all pixel points adjacent to the reference edge at the outer side of the reference edge and the gray level average value of all pixel points at the inner side of the reference edge, and taking the second gray level difference as a molecule, thus obtaining the zebra naked significant coefficient of the corresponding target area. The calculation formula of the speckle bare significant coefficient is as follows:
In the method, in the process of the invention,is->The stripe reference edge corresponds to the speckle bare significant coefficient of the target area; />Is->Gray average value of all adjacent pixel points of reference edge outside the strip reference edge, < >>Is->Gray average value of all pixels inside the strip reference edge,/, for>The gray value is a preset standard paint removal gray value; />Is->Centroid point of strip reference edgeAnd corresponding->Centroid point of strip target edge->Euclidean distance between, i.e. centroid distance; />A third positive constant is preset. In the embodiment of the invention, the gray value of the silver gray aluminum alloy shell before the electronic cigarette to be tested is sprayed is taken as a preset standard paint removing gray value, and is specifically set to 127; a third positive constant is preset to be 1, and the denominator is prevented from being zero.
In a calculation formula of the zebra exposure significant coefficient, the smaller the first gray difference is, namely the difference between the gray value mean value of the corresponding area inside the reference edge and the preset standard paint removal gray value is, if the Euclidean distance between the centroid point of the reference edge and the centroid point of the corresponding target edge is also smaller, the higher the center coincidence possibility of the two edges is indicated, the greater the degree that the target area corresponding to the reference edge accords with the zebra paint removal characteristic is, the greater the probability that the target area is a defect area is, and the greater the zebra exposure significant coefficient is obtained after the centroid distance is multiplied by the first gray difference and the preset third positive constant is added as a denominator; meanwhile, the larger the second gray level difference is, namely the larger the difference between the gray value average value of the region inside the reference edge and the gray value average value of partial adjacent pixel points in the suspected shadow region corresponding to the outer side of the reference edge is, the larger the possibility that the region surrounded by the reference edge is an aluminum alloy exposed region is, and the larger the corresponding target region accords with the zebra paint removal characteristic is, the larger the corresponding zebra exposure significant coefficient is.
In addition, in consideration of the shadow area caused by warping of the paint removal edge in each spot paint removal area, obvious stage gray scale change is formed from the exposed area to the shadow area and then to the non-paint removal area of the aluminum alloy in each spot paint removal area, and the possibility that other areas of the surface image of the electronic cigarette to be detected have the stage gray scale change characteristics is extremely low, so that in each target area, the embodiment of the invention obtains the paint stripping significant coefficient according to the change difference of the gray scale change from all corner points on the target edge to the corresponding center and the gray scale change from all corner points on the reference edge to the corresponding center.
Preferably, in one embodiment of the present invention, the method for obtaining the paint peeling significant coefficient includes using a centroid of a target edge as a first starting point, obtaining all first rays in a direction corresponding to each corner point on the target edge from a first starting point, sequentially using gray values of all pixel points of a preset number of pixel points after the first starting point on each first ray reaches the corresponding corner point as a first sequence element, and obtaining a corresponding first gray change sequence; taking the mass center of the reference edge as a second starting point, acquiring all second rays in the corresponding directions from the second starting point to each corner point on the reference edge, and sequentially taking the gray values from the second starting point to all pixel points corresponding to the corner points on each second ray as second sequence elements to acquire a corresponding second gray change sequence; and in each target area, acquiring a second DTW distance average value between all first gray scale change sequences corresponding to adjacent corner points on the target edge, adding a preset fourth normal number to the second DTW distance average value as a denominator, acquiring a correlation coefficient average value between the first gray scale change sequences and the second gray scale change sequences corresponding to all corner points with the same sorting labels on the target edge and the corresponding reference edge, and taking the correlation coefficient average value as a molecule to acquire the paint stripping significant coefficient of the corresponding target area.
In the embodiment of the invention, the preset number is 10, namely, 10 pixel points are taken after the first starting point on each first ray reaches the corresponding angular point to obtain the first sequence element, then the average value of the DTW distances between the adjacent angular points on the target edge corresponding to all the first gray level change sequences is taken as the second DTW distance average value, and the average value of Jaccard-Tanimoto coefficients between the target edge and the corresponding first gray level change sequences corresponding to all the same sequence index angular points on the reference edge is taken as the correlation coefficient average value. The DTW distance and Jaccard-Tanimoto coefficients are well known to those skilled in the art and are not described in detail herein. In other embodiments of the present invention, the practitioner may set a preset number according to the specific implementation situation, and acquire the corresponding similarity or correlation coefficient by using other similarity measurement means, and acquire the paint peeling significant coefficient by adjusting the corresponding formula correlation.
It should be noted that, when the Jaccard-Tanimoto coefficient between the first gray change sequence and the second gray change sequence corresponding to all the corner points with the same sort labels on the target edge and the corresponding reference edge is obtained, since the elements in the first gray change sequence corresponding to the target edge are more than the elements in the second gray change sequence corresponding to the reference edge, the elements in the first gray change sequence need to be removed at the tail of the sequence, so that the number of the elements in the first gray change sequence is the same as the number of the elements in the second gray change sequence; but need not be removed when the DTW distance between the first sequence of gray level variations is obtained.
The calculation formula of the paint peeling significant coefficient is as follows:
in the method, in the process of the invention,is->Paint peeling significant coefficients of the target areas corresponding to the strip reference edges; />Is->Correlation coefficient mean value in target area corresponding to strip reference edge,/->Is->A second DTW distance mean value in the target area corresponding to the strip reference edge,/or->In order to preset the fourth positive constant, in the embodiment of the present invention, the preset fourth positive constant takes 0.01, and prevents the denominator from being 0.
In the calculation formula of the paint peeling significant coefficient, when the average value of the correlation coefficient is closer to 1, the gray level change from the target edge to the reference edge and then to the center of the edge area in the target area is similar to the gray level change characteristic from the exposed area to the shadow area of the aluminum alloy in the spot paint removing area, both from the angle of the reference edge and the angle of the target edge; meanwhile, the smaller the second DTW distance average value is, the higher the similarity between all adjacent first gray sequences is, the larger the paint stripping significant coefficient is caused by taking the second DTW distance average value as a denominator after a preset fourth positive constant is added, and the gray change in the target area is more consistent with the characteristic of obvious gray change in the stage from an aluminum alloy exposed area to a shadow area and then to a non-paint stripping area in a spot-shaped paint stripping area.
After the speckle exposure significant coefficient and the paint peeling significant coefficient of each target area are obtained, and the speckle peeling characteristic coincidence degree of the target area is comprehensively evaluated according to the speckle exposure significant coefficient and the paint peeling significant coefficient.
Preferably, in one embodiment of the present invention, the method for obtaining the zebra-like shedding significant coefficient includes multiplying the zebra-like nude significant coefficient of each target area with the paint stripping significant coefficient and normalizing to obtain the zebra-like shedding significant coefficient of the corresponding target area. The calculation formula of the zebra falling significant coefficient is as follows:
in the method, in the process of the invention,is a significant coefficient of zebra falling off; />Significant coefficients are stripped for paint; />Is a marked coefficient of zebra exposure, is->Is a standard normalization function.
In a calculation formula of the zebra falling significant coefficient, the zebra falling significant coefficient and the paint stripping significant coefficient are combined in a multiplication mode, and the zebra falling significant coefficient and the paint stripping significant coefficient are in positive correlation; in other embodiments of the present invention, the combination may be performed by addition or exponential function, and the implementer may set the implementation according to the specific implementation situation.
S4, screening all suspected zebra-like paint removing areas from all target areas according to the zebra-like significant coefficient; obtaining the regional center of each suspected speckled paint removing region according to the corresponding center of the target edge and the reference edge of each suspected speckled paint removing region; and (5) carrying out super-pixel segmentation on the surface image according to the center of the area to obtain a spot paint removal defect area.
The speckle shedding significant coefficient reflects the conformity degree of the speckle shedding characteristics of the target area, and the side surface reflects the possibility that the target area is a speckle paint-removing area, so that the embodiment of the invention screens all suspected speckle paint-removing areas in all target areas according to the speckle shedding significant coefficient.
Preferably, in one embodiment of the present invention, the target area having the zebra-off significant coefficient greater than the preset threshold is regarded as the suspected zebra-off area, considering that the greater the zebra-off significant coefficient is, the greater the likelihood that the target area is the zebra-off area.
In one embodiment of the invention, a preset threshold value is set to be 0.9, and all target areas with the zebra-like shedding significant coefficient larger than 0.9 are used as suspected zebra-like paint removing areas, so that the centers of the suspected zebra-like paint removing areas can be conveniently obtained through analysis, and then the defect areas are detected and segmented by the centers of the suspected zebra-like paint removing areas.
Preferably, in one embodiment of the present invention, in each suspected zebra-like paint removal region, a midpoint between the centroid of the target edge and the centroid of the reference edge is obtained, and the midpoint is taken as the region center of the corresponding target region.
Because the relevant characteristics of the suspected spot paint removal area are highly similar to those of the spot paint removal, the area center is also very likely to be the defect area center of the spot paint removal, and after the area center is obtained, the embodiment of the invention performs super-pixel segmentation on the surface image according to the area center to obtain the spot paint removal area. In one embodiment of the invention, a surface image to be analyzed which is not subjected to gray processing after filtering is converted into an LAB color space, a simple linear iterative clustering method (Simple Linear Iterative Clustering, SLIC) is adopted to conduct super-pixel segmentation on the acquired LAB color space image by taking the center of a region as a seed point, then the acquired super-pixel segmented image is input into a support vector machine (Support Vector Machine, SVM) trained in advance, and the SVM automatically marks a defect region of the spot-shaped paint removal in the surface image, so that the surface defect of the electronic cigarette to be detected is detected. The LAB color space conversion, SLIC super-pixel segmentation, and SVM support vector machine training and use are all technical means well known to those skilled in the art, and are not described in detail herein. In other embodiments of the present invention, the practitioner may also convert the surface image into other color spaces, and may also use other supervised learning models, such as neural networks, to identify and label defective areas.
It should be noted that, in the embodiment of the present invention, the number of seed points is set to be 20, if the area center of the target area is greater than or equal to 20, 20 seed points are randomly selected from the area midpoints to perform super-pixel segmentation; if the area centers are smaller than 20, taking all the area centers as seed points, and uniformly selecting the remaining vacant seed points in the surface image. The uniform selection of seed points for superpixel segmentation is a well known technique for those skilled in the art and is not described in detail herein.
So far, the seed points with obvious speckled paint removing characteristic areas and super pixel segmentation at the area centers are obtained, the characteristics of the defect areas are better captured, the segmentation results are more in accordance with the actual shape and size of the defects, and the defects are detected more accurately.
In summary, the method acquires all the closed edges in the surface image of the electronic cigarette to be detected and all the angular points on each closed edge, and acquires the edge similarity by analyzing the quantity difference and the characteristic difference of the angular points on each two closed edges, thereby acquiring all the target edges and the corresponding target areas and reference edges according to the edge similarity and the difference of the two corresponding closed edges; then, according to gray information of pixel points at two sides of the reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge, obtaining a variegated naked significant coefficient of each target area; in each target area, according to the change difference between the gray level change from all the corner points on the target edge to the corresponding center and the gray level change from all the corner points on the reference edge to the corresponding center, acquiring a paint peeling significant coefficient; the zebra-shaped drop significant coefficient of each target area can be further obtained, and all suspected zebra-shaped paint removal areas are screened out; and carrying out super-pixel segmentation on the surface image according to the regional center of the suspected speckled paint removing region, and obtaining a speckled paint removing defect region. According to the method, the seed points with the obvious spot paint removing characteristic areas and the super-pixel segmentation area centers are obtained, so that the spot paint removing areas can be effectively identified, and the detection accuracy of the defect areas is improved.
The invention also provides an electronic cigarette surface defect detection system based on image segmentation, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes any one of the steps of the electronic cigarette surface defect detection method based on image segmentation when executing the computer program.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.

Claims (10)

1. An electronic cigarette surface defect detection method based on image segmentation is characterized by comprising the following steps:
acquiring a surface image of an electronic cigarette to be tested;
acquiring all closed edges in the surface image and all angular points on each closed edge; obtaining the edge similarity of every two closed edges in all the closed edges according to the quantity difference and the characteristic difference of the angular points on different closed edges; acquiring all target edges, reference edges and target areas surrounded by the target edges in the surface image according to the edge similarity and the difference between the two corresponding closed edges;
Acquiring a variegated exposure significant coefficient of each target area according to gray information of pixel points at two sides of the reference edge and the position deviation condition of the corresponding centers of the target edge and the reference edge; in each target area, according to the change difference between the gray level change from all the corner points to the corresponding center on the target edge and the gray level change from all the corner points to the corresponding center on the reference edge, acquiring a paint peeling significant coefficient; according to the speckle exposure significant coefficient and the paint stripping significant coefficient, obtaining a speckle shedding significant coefficient of each target area;
screening all suspected zebra-like paint removing areas from all the target areas according to the zebra-like significant coefficients; obtaining the regional center of each suspected speckled paint removing region according to the corresponding center of the target edge and the reference edge of each suspected speckled paint removing region; and performing super-pixel segmentation on the surface image according to the center of the area to obtain a spot paint removal defect area.
2. The method for detecting the surface defects of the electronic cigarette based on the image segmentation according to claim 1, wherein the method for obtaining the edge similarity comprises the following steps:
Optionally, selecting one closed edge as an edge to be analyzed, acquiring any corner point on the edge to be analyzed as a first point to be analyzed, and sequentially carrying out sequencing labels on all the corner points corresponding to the edge to be analyzed along any direction of the closed edge; acquiring the first points on each of the other closed edges and performing sequencing labels, wherein the position difference between the first points and the first points to be analyzed on the surface image is the smallest, and the sequencing direction of the corner points on each of the other closed edges is consistent with the sequencing direction of the corner points on the edges to be analyzed;
acquiring feature descriptors of each corner point in a corresponding preset window; and in every two closed edges in all the closed edges, acquiring a distance variance between the angular points of all the same sorting labels and a first DTW distance average value between the corresponding feature descriptors, carrying out negative correlation mapping on absolute values obtained by subtracting a preset first positive constant from a quantity ratio of the angular points on the corresponding two closed edges, normalizing, taking the normalized value as a molecule, and adding a preset second positive constant to a product of the distance variance and the first DTW distance average value as a denominator to obtain the edge similarity of the corresponding two closed edges.
3. The method for detecting the surface defects of the electronic cigarette based on the image segmentation according to claim 2, wherein the method for acquiring the target edge and the reference edge comprises the following steps:
screening out the closed edges with the largest edge similarity with the edge to be analyzed from all the closed edges to be used as matched edges, comparing the difference of the number of the pixel points on the edge to be analyzed and the matched edges, taking the closed edge with the largest number of the pixel points on the two closed edges as a target edge, and taking the other closed edge as a corresponding reference edge;
and selecting one closed edge from all other closed edges as an edge to be analyzed, acquiring corresponding target edges and reference edges, and continuously iterating until all the target edges and the reference edges are acquired.
4. The method for detecting the surface defects of the electronic cigarette based on the image segmentation according to claim 1, wherein the method for acquiring the speckled exposure significant coefficient comprises the following steps:
obtaining a preset standard paint removal gray value; in each target area, obtaining a first gray level difference between a gray level average value of all pixel points on the inner side of the reference edge and a preset standard paint removal gray level value, obtaining a centroid distance between the target edge and the reference edge, multiplying the centroid distance by the first gray level difference, adding a preset third positive constant, and then taking the first gray level difference as a denominator, obtaining a second gray level difference between a gray level average value of all pixel points on the outer side of the reference edge and a gray level average value of all pixel points on the inner side of the reference edge, and taking the second gray level difference as a molecule, thereby obtaining a variegated naked significant coefficient corresponding to the target area.
5. The method for detecting the surface defects of the electronic cigarette based on image segmentation according to claim 2, wherein the method for acquiring the paint peeling significant coefficient comprises the following steps:
taking the mass center of the target edge as a first starting point, acquiring all first rays in the directions corresponding to each angular point on the first starting point to the target edge, and sequentially taking gray values of all pixel points from the first starting point to a preset number of pixel points after the angular points are corresponding to each first ray as first sequence elements to obtain a corresponding first gray change sequence;
taking the mass center of the reference edge as a second starting point, acquiring all second rays in the directions corresponding to each angular point on the second starting point to the reference edge, and sequentially taking gray values from the second starting point to all pixel points corresponding to the angular points on each second ray as second sequence elements to obtain a corresponding second gray change sequence;
and in each target area, acquiring a second DTW distance average value between all first gray level change sequences corresponding to the adjacent angular points on the target edge, adding a preset fourth normal number to the second DTW distance average value as a denominator, acquiring a correlation coefficient average value between the first gray level change sequences and the second gray level change sequences corresponding to the angular points of all the same sequencing marks on the target edge and the reference edge, and taking the correlation coefficient average value as a molecule to acquire a paint stripping significant coefficient corresponding to the target area.
6. The method for detecting the surface defects of the electronic cigarette based on the image segmentation according to claim 1, wherein the method for acquiring the zebra-like shedding significant coefficient comprises the following steps:
and multiplying the speckled exposure significant coefficient of each target area by the paint peeling significant coefficient, and then normalizing to obtain the speckled peeling significant coefficient of the corresponding target area.
7. The method for detecting the surface defects of the electronic cigarette based on the image segmentation according to claim 1, wherein the method for screening the target area comprises the following steps:
and taking the target area with the zebra-like abscission significant coefficient larger than a preset threshold value as a suspected zebra-like paint-removing area.
8. The method for detecting the surface defect of the electronic cigarette based on the image segmentation according to claim 1, wherein the method for acquiring the region center comprises the following steps:
and in each suspected speckled paint removing area, acquiring a midpoint between the mass center of the target edge and the mass center of the reference edge, and taking the midpoint as the area center of the corresponding suspected speckled paint removing area.
9. The method for detecting surface defects of electronic cigarettes based on image segmentation according to claim 5, wherein the preset number is 10.
10. An electronic cigarette surface defect detection system based on image segmentation, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of an electronic cigarette surface defect detection method based on image segmentation as claimed in any one of claims 1-9.
CN202311674513.6A 2023-12-08 2023-12-08 Electronic cigarette surface defect detection method and system based on image segmentation Active CN117372432B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311674513.6A CN117372432B (en) 2023-12-08 2023-12-08 Electronic cigarette surface defect detection method and system based on image segmentation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311674513.6A CN117372432B (en) 2023-12-08 2023-12-08 Electronic cigarette surface defect detection method and system based on image segmentation

Publications (2)

Publication Number Publication Date
CN117372432A true CN117372432A (en) 2024-01-09
CN117372432B CN117372432B (en) 2024-02-09

Family

ID=89400649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311674513.6A Active CN117372432B (en) 2023-12-08 2023-12-08 Electronic cigarette surface defect detection method and system based on image segmentation

Country Status (1)

Country Link
CN (1) CN117372432B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117764992A (en) * 2024-02-22 2024-03-26 山东乔泰管业科技有限公司 Plastic pipe quality detection method based on image processing
CN117788470A (en) * 2024-02-27 2024-03-29 咸阳黄河轮胎橡胶有限公司 Tire defect detection method based on artificial intelligence

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385445A (en) * 2023-06-06 2023-07-04 东莞市希锐自动化科技股份有限公司 Visual technology-based electroplated hardware flaw detection method
CN116735612A (en) * 2023-08-15 2023-09-12 山东精亿机械制造有限公司 Welding defect detection method for precise electronic components

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385445A (en) * 2023-06-06 2023-07-04 东莞市希锐自动化科技股份有限公司 Visual technology-based electroplated hardware flaw detection method
CN116735612A (en) * 2023-08-15 2023-09-12 山东精亿机械制造有限公司 Welding defect detection method for precise electronic components

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117764992A (en) * 2024-02-22 2024-03-26 山东乔泰管业科技有限公司 Plastic pipe quality detection method based on image processing
CN117764992B (en) * 2024-02-22 2024-04-30 山东乔泰管业科技有限公司 Plastic pipe quality detection method based on image processing
CN117788470A (en) * 2024-02-27 2024-03-29 咸阳黄河轮胎橡胶有限公司 Tire defect detection method based on artificial intelligence

Also Published As

Publication number Publication date
CN117372432B (en) 2024-02-09

Similar Documents

Publication Publication Date Title
CN117372432B (en) Electronic cigarette surface defect detection method and system based on image segmentation
CN115861135B (en) Image enhancement and recognition method applied to panoramic detection of box body
CN102426649B (en) Simple steel seal digital automatic identification method with high accuracy rate
US8331650B2 (en) Methods, systems and apparatus for defect detection
CN113592845A (en) Defect detection method and device for battery coating and storage medium
US5949905A (en) Model-based adaptive segmentation
US20180075603A1 (en) Automated tattoo recognition techniques
WO2013080868A1 (en) Image processing device, image processing method, and image processing program
CN108615239B (en) Tongue image segmentation method based on threshold technology and gray level projection
CN111161222B (en) Printing roller defect detection method based on visual saliency
CN110991389B (en) Matching method for judging appearance of target pedestrian in non-overlapping camera view angles
CN108898132B (en) Terahertz image dangerous article identification method based on shape context description
CN110472081B (en) Shoe picture cross-domain retrieval method based on metric learning
CN116152242B (en) Visual detection system of natural leather defect for basketball
CN107341793A (en) A kind of target surface image processing method and device
CN110766657B (en) Laser interference image quality evaluation method
Ibraheem et al. A non-invasive automatic skin cancer detection system for characterizing malignant melanoma from seborrheic keratosis
Li et al. Sublingual vein extraction algorithm based on hyperspectral tongue imaging technology
CN111814852A (en) Image detection method, image detection device, electronic equipment and computer-readable storage medium
CN116612306B (en) Computer vision-based intelligent flange plate alignment method and system
CN116883674A (en) Multispectral image denoising device and food quality detection system using same
CN109871779B (en) Palm print identification method and electronic equipment
CN113643290B (en) Straw counting method and device based on image processing and storage medium
Saparudin et al. Segmentation of fingerprint image based on gradient magnitude and coherence
CN114529515A (en) Method for automatically identifying internal defects of solar cell

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant