CN115797361B - Aluminum template surface defect detection method - Google Patents

Aluminum template surface defect detection method Download PDF

Info

Publication number
CN115797361B
CN115797361B CN202310101457.0A CN202310101457A CN115797361B CN 115797361 B CN115797361 B CN 115797361B CN 202310101457 A CN202310101457 A CN 202310101457A CN 115797361 B CN115797361 B CN 115797361B
Authority
CN
China
Prior art keywords
contour
area
level
point
lowest
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310101457.0A
Other languages
Chinese (zh)
Other versions
CN115797361A (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.)
Shandong Miaotai Construction Technology Co ltd
Original Assignee
Shandong Miaotai Construction 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 Shandong Miaotai Construction Technology Co ltd filed Critical Shandong Miaotai Construction Technology Co ltd
Priority to CN202310101457.0A priority Critical patent/CN115797361B/en
Publication of CN115797361A publication Critical patent/CN115797361A/en
Application granted granted Critical
Publication of CN115797361B publication Critical patent/CN115797361B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of image processing, and provides a method for detecting surface defects of an aluminum template, which comprises the following steps: acquiring an aluminum template surface image; extracting a region of interest to obtain an image to be detected, obtaining an edge contour of the image to be detected, and establishing a contour grade; dividing all contours into separate regions and complex regions; obtaining a suspected pock area; in the complex region, a gray balance index of the lowest-level contour region is obtained; acquiring a contour rule index of a lowest-level contour region, and judging whether the lowest-level contour region in the complex region is a pitting defect region according to the contour rule index; calculating the similarity between the region confirmed to be the pit defect and each suspected pit region to obtain all pit defect regions; and calculating the area ratio of the pit defect area to realize the defect detection of the aluminum template. According to the invention, through the contour rule index and the contour grade of each region on the aluminum template, the pock defect is accurately detected from the aluminum template, and the detection precision is improved.

Description

Aluminum template surface defect detection method
Technical Field
The invention relates to the technical field of image processing, in particular to a method for detecting surface defects of an aluminum template.
Background
The aluminum template is a material made of aluminum alloy and is formed by extrusion manufacturing of professional equipment. The building template system of the aluminum template has high construction speed and short running period, and can meet the requirement of engineering production efficiency. Meanwhile, the aluminum template is made of materials suitable for recycling, and the average cost per use is low, so that more production cost can be saved. Meanwhile, the aluminum template has good material, strong stability and high bearing capacity. The aluminum templates can be assembled into templates with different sizes and shapes, so that the defects of the traditional templates are overcome, and the working efficiency of building operation is improved.
Due to the influence of various factors in the production process of industrial products, surface defects such as pinholes, bubbles, pits, cracks and the like may exist on the surface of the aluminum template. These defects can reduce the material strength of the aluminum templates, shorten the service life of the workpieces, and increase the safety risk of the construction site. Therefore, quality detection needs to be carried out on the surface of the aluminum template, and the surface quality detection is a key link of industrial production quality, thereby being beneficial to reducing the occurrence rate of missed detection and improving the product quality. Furthermore, by analyzing the forming reason of the defective products, scientific basis can be provided for calibrating the parameters of processing equipment, standardizing personnel operation, improving the processing technology and perfecting the industrial process.
Disclosure of Invention
The invention provides a method for detecting surface defects of an aluminum template, which aims to solve the problem of lower detection precision in the prior art, and adopts the following technical scheme:
the embodiment of the invention provides a method for detecting surface defects of an aluminum template, which comprises the following steps:
acquiring an aluminum template surface image;
manually marking an interested region from an aluminum template surface image to obtain an image to be detected, obtaining edge pixel points of the image to be detected, obtaining all edge contours according to the edge pixel points, and establishing contour grades;
dividing all contours into individual regions and complex regions according to the obtained contour levels;
distinguishing the areas which are possibly pit defect areas in the single areas according to the average value of all the areas, and enabling the areas meeting the conditions to be called as suspected pit areas;
in the complex area, each pixel point except a center point in the lowest-level outline area is connected with the center point, the pixel point is marked as a first pixel point, each first pixel point is used for obtaining a straight line, the straight line is marked as a first straight line, the radius of the minimum circumcircle of the highest-level outline is marked as R, the distance from the first pixel point on the first straight line is marked as R, the pixel point in the highest-level outline area is marked as a second pixel point, and the gray balance index of the lowest-level outline is obtained according to all the first pixel points in each lowest-level outline and the corresponding second pixel points;
in the complex area, a random point on the edge of the lowest-level outline is taken to be connected with a center point, the point is called a third intersection point, a straight line of the point intersects with the second-level outline at a point in the direction of the straight line, the intersection point is marked as a second intersection point, the intersection point intersects with the highest-level outline at a point, the intersection point is marked as a first intersection point, K straight lines are uniformly obtained by taking the straight line as a datum line, the lowest-level outline is divided into K straight lines, the intersection points of the straight lines except the datum line and the lowest-level outline are called fourth intersection points, the intersection point of the straight lines except the datum line and the second-level outline are called fifth intersection points, the intersection point with the highest-level outline is called sixth intersection points, and the contour rule index of the lowest-level outline in the complex area is obtained according to the positions of the first intersection point, the second intersection points, the third intersection points, all fourth intersection points and the gray balance index of the lowest-level outline, and whether the lowest-level outline in the complex area is a pitting defect area is judged according to the contour rule index;
all areas which are confirmed to be the pitting defect areas in the complex areas and each suspected pitting area are calculated to be similar according to gray values of the pixel points of the areas, and the suspected pitting areas with the area similarity being larger than a threshold value are extracted to be the pitting defect areas;
and calculating the total area ratio of all the pit defect areas to realize the defect detection of the aluminum template.
Preferably, the method for obtaining edge pixel points of the image to be detected, obtaining all edge contours according to the edge pixel points, and establishing contour grades includes:
and carrying out edge detection on the image to be detected to obtain edge pixel points, carrying out contour detection on the edge pixel points to obtain all edge contours, wherein the edge contour of one region is the highest-level contour, the contour of an object in the cavity of the highest-level contour is the second-level contour, and the contour of the object in the second-level contour is the lowest-level contour.
Preferably, the method for dividing all contours into separate regions and complex regions according to the obtained contour levels is as follows:
after the levels of all the contours are obtained, each contour is judged, if the contour contains the lowest level contour, the region corresponding to the contour is called as a complex region, and besides, the regions corresponding to all the contours are all independent regions.
Preferably, the method for distinguishing the regions which are possibly pit defect regions in the individual regions according to the average value of all the regions and calling the regions meeting the conditions as suspected pit regions comprises the following steps:
and calculating the area of each contour according to all the obtained contours, wherein the area of each contour is the number of pixel points contained in the contour, wherein in a complex area, each contour obtains an area, then calculating the area average value of all the contours, comparing each area in an individual area with the area average value of all the contours, and considering the individual area as a suspected pit area when the area of the individual area is smaller than the area average value of all the contours.
Preferably, the method for obtaining the gray balance index of the lowest-level outline according to all the first pixel points in each lowest-level outline and the corresponding second pixel points comprises the following steps:
Figure SMS_1
wherein i is the pixel point of any non-central point in the lowest-level outline z of the complex area, namely the first pixel point, M represents the number of the pixel points divided by the central point in the lowest-level outline,
Figure SMS_2
gray value representing pixel i on line L +.>
Figure SMS_3
The gray value of the pixel point j on the connecting line L is represented, wherein the distance between the pixel points i and j is R, and the pixel point j is in the highest-level outline corresponding to the lowest-level outline z, ">
Figure SMS_4
And the gray balance index representing the lowest-level profile z, wherein the connecting line L is a first straight line of the pixel point i.
Preferably, the method for obtaining the contour rule index of the lowest-level contour in the complex area according to the respective positions of the first intersection point, the second intersection point, the third intersection point, all the fourth intersection points, all the fifth intersection points, all the sixth intersection points and the gray balance index of the lowest-level contour comprises the following steps:
Figure SMS_5
in the method, in the process of the invention,
Figure SMS_6
gray balance index representing lowest level profile z, < >>
Figure SMS_9
Euclidean distance representing the third intersection point and the second intersection point,>
Figure SMS_11
euclidean distance representing the first intersection point and the second intersection point,>
Figure SMS_7
euclidean distance of fourth intersection point and fifth intersection point of the e-th straight line, +.>
Figure SMS_10
Euclidean distance between the sixth intersection and the fifth intersection of the e-th straight line, +.>
Figure SMS_12
For regulating the coefficient->
Figure SMS_13
Straight line representing K non-datum lines, +.>
Figure SMS_8
A contour rule index representing the lowest level contour z.
Preferably, the specific method for calculating the similarity of the two regions according to the gray values of the pixels of the two regions by using all the regions identified as the pock defect regions in the complex region and each suspected pock region is as follows:
Figure SMS_14
in the method, in the process of the invention,
Figure SMS_25
、/>
Figure SMS_18
is any two non-repeated pixels in the pit defect area z, +.>
Figure SMS_21
Is the number of pixels in the pit defect area z, < >>
Figure SMS_16
Is pixel dot +.>
Figure SMS_19
Gray value of +.>
Figure SMS_23
Is pixel dot +.>
Figure SMS_26
Gray value of +.>
Figure SMS_28
Is that gray value in pit defect region z is +.>
Figure SMS_31
、/>
Figure SMS_15
Image entropy of pixel pairs of (a); />
Figure SMS_22
、/>
Figure SMS_29
Is any two non-repeated pixel points in the suspected pit area q, +.>
Figure SMS_33
Is the number of pixels in the suspected pit area q,/>
Figure SMS_30
Is pixel dot +.>
Figure SMS_34
Gray value of +.>
Figure SMS_24
Is pixel dot +.>
Figure SMS_27
Gray value of +.>
Figure SMS_32
Is that gray value in pit defect region z is +.>
Figure SMS_35
、/>
Figure SMS_17
N is the number of pit defect areas that have been detected, < >>
Figure SMS_20
And the similarity between the detected pit defect area and the suspected pit area is represented.
The beneficial effects of the invention are as follows: according to the aluminum template surface defect detection method, after preprocessing an acquired image, all areas are divided into independent areas and complex areas by utilizing profile grades, suspected pit areas are obtained according to the areas of the areas, extra calculation caused by various defects is avoided, and the reliability of acquiring the comprehensive characteristics of the connected areas is improved. Through the contour rule index and the contour grade of each area on the aluminum template, the defects are accurately detected from the complex area on the aluminum template, and the detection precision is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for detecting surface defects of an aluminum template according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of profile class;
fig. 3 is a schematic diagram of a connection line between a center point and an edge point.
Detailed Description
The following description of the embodiments of the present invention 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 invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart of a method for detecting surface defects of an aluminum template according to an embodiment of the invention is shown, the method includes the following steps:
and S001, acquiring a surface image of the aluminum template by using a camera, and preprocessing the surface image of the aluminum template.
And selecting a proper position to place a CCD camera according to the technological process of the aluminum template, and obtaining the surface image of the aluminum template. In the process of shooting and transmitting pictures, certain interference noise inevitably exists, and the noise not only reduces the picture quality, but also shields defect characteristics in a target area on an aluminum template, so that subsequent image processing is affected. Therefore, in order to reduce noise interference and improve image quality, it is necessary to perform denoising processing on the acquired original image of the aluminum template. In the field of image processing, a common denoising method includes: filter-based denoising, model-based denoising, and the like. The scheme adopts median filtering to preprocess the collected aluminum template image.
Step S002, classifying the contours, obtaining an independent area and a complex area according to the class of each contour, solving the contour rule index of the lowest-level contour area in the complex area, and judging whether the area is a pitting defect area or not.
In addition to the effects of image background, such as conveyor belts, scraps, etc., the obtained aluminum template image may also have the effects of other defects on the surface of the aluminum template, such as: cracks, bubbles, etc. Therefore, when the detection of the pock defect on the surface of the aluminum template is desired, the aluminum template can be extracted from the whole image, and the region containing the pock in the aluminum template is artificially marked as the region of interest in the scheme, namely the ROI region. The method for pre-extracting the ROI area not only reduces the calculated amount, but also reduces errors in the subsequent image recognition.
First, various contours on the surface of the aluminum template are searched. Due to industrial or human factors, the pits on the surface of the aluminum template are not completely consistent in shape and are distributed without obvious rules, and a plurality of pits exist in one area. After the aluminum template is extracted from the whole image, the scheme utilizes a canny detection operator to carry out edge detection on the image of the aluminum template to obtain an edge detection image.
Further, if the target area is screened only by the area, there is a problem that the pit area is equal to the other areas, and the non-pit area is easily misjudged as the target area. There may be cases where the pit area is located in the surface corrosion area of the aluminum template, that is, the pit defect is located in the surface corrosion area of the aluminum template, it is difficult to accurately extract the pit only by the area, at this time, all the outlines of the obtained edge detection images are detected first, a hierarchical relationship is established, the outline of one area is a first outline, the outline of the object in the outline cavity is divided into a second outline, the outline of the object in the second outline is a third outline, the hierarchical distribution is as shown in fig. 2, after the levels of all the outlines are obtained, all the third outlines are extracted, the first outline at the outermost side of each third outline is taken as a complex area, for example, in fig. 2, the range of the first outline indicated by 1A is just one complex area, then all the complex areas in all the first outlines are extracted, and each of the remaining first outlines is just one single area, for example, in the range of the first outline indicated by 0A in fig. 2, all the outlines in the edge image are all the outlines are extracted, and a complete outline system and all the single areas are obtained. The capturing of the target contour in the image may be implemented by using a findcontour function in OpenCV, and a specific process is a known technology and will not be described in detail herein. By combining the contour relationship and knowing the hierarchical relationship in the parent contour, the contour result containing the pit defects in the smallest area can be primarily screened out by calculating certain geometric features of the pit defects, so that the subsequent calculated amount is reduced, and the interference problem caused by defect types in the same area is avoided.
In fig. 2, the maximum area-black area represents the image acquired by an industrial camera, the white area represents the aluminum template surface image, and the gray area represents the distribution of some defects on the aluminum template surface. For one of the complex regions, three circles are respectively numbered circle 1, circle 2, and circle 3. In the figure, the contours 0a,1a,4a respectively correspond to the outermost edges of a circle, which belong to the same stage and are divided into the 1 st stage in the scheme; profile 2A is a sub-profile of profile 1A, level 2; contour 3A is a sub-contour of contour 2A, level 3; and similarly, constructing the hierarchical relation of the contours in the edge image in the invention, wherein the 1 st level is the highest level, the 3 rd level is the lowest level, and the first contour, the second contour and the third contour are also respectively called as the highest level contour, the second level contour and the lowest level contour.
Further, since the individual pock defects are characterized by a dark gray region which is approximately circular, however, due to irregular occurrence of the defects, the phenomenon that two pock defects intersect is likely to occur, that is, all the individual regions are calculated, and the suspected pock regions are selected from the individual regions, so that the subsequent calculation amount is reduced.
Wherein, the formula of area mean value is:
Figure SMS_36
in the method, in the process of the invention,
Figure SMS_37
representing the average of the areas corresponding to all contours in the ROI area, wherein the area of each contour is all pixels contained in the contour, for example, in the complex area of fig. 2, the area of contour 1A containing contour 3A and the area of contour 1A also containing 3A does not include 2A area, N represents the number of all contours, and N represents the number of contours>
Figure SMS_38
Representing the area of the D2 nd contour. Comparing the area of each individual region with the average value of all contour areas +.>
Figure SMS_39
The sizes of the pits are observed, the distribution of the pits on the surface of the aluminum template is observed, the corresponding areas of the pits are smaller than the average value of all contour areas, and therefore the screening area is smaller than the average value +.>
Figure SMS_40
Therefore, the area in the individual region is smaller than +.>
Figure SMS_41
The area of (2) is marked as a suspected pit area.
For each complex region, the area and the mean value of the lowest-level outline in the complex region are calculated
Figure SMS_42
By comparison, the area is likewise smaller than +.>
Figure SMS_43
For determining a true pitting defect area, the location of edge points on the pit defect contour to edge points of the complex area is relatively uniform for a complex area if the pit defect is contained therein, and the lowest contour is also referred to as the lowest contour area because the contour is an area in the image.
The gray-scale equalization coefficient of each lowest level contour region is thus calculated first:
Figure SMS_44
wherein i is any non-center pixel point in the lowest-level outline region z of the complex region, the pixel point is a first pixel point, M represents the number of the pixel points except the center point in the lowest-level outline,
Figure SMS_45
gray value representing pixel i on line L +.>
Figure SMS_46
Representing the gray value of a pixel point j on a connecting line L, wherein the pixel point j is a second pixel point, the pixel points i and j are on the same straight line, the distance between the pixel points i and j is R, the pixel point j is in the highest-level outline area corresponding to the area z, if the pixel point j is not, the pixel value of the pixel point is 0, and the pixel value of the pixel point is 0>
Figure SMS_47
And the gray balance index of the lowest-level contour region z is represented, and the connecting line L is a first straight line of the pixel point i.
The extension line of the point connection line between the pixel point i and the center of the region z is L (the extension line is only required to intersect with the highest-level outline), the extension line is called a first line, and the distance R is the radius of the minimum circumcircle of the highest-level outline where the lowest-level outline region z is located.
Figure SMS_48
The gray balance coefficient corresponding to the region z is used for measuring the prominence degree of the region z in the whole mother contour, and the gray balance coefficient mainly considers the color characteristics of the pock defect, which are mostly black gray. The larger the gray scale change of the gray scale balance coefficient parent profile and the inner child profile, the more likely that there is a pit defect in the parent profile, and the more likely that the region z is an independent pit defect region.
Marking an edge point on the lowest level contour region z as
Figure SMS_54
This point is denoted as third intersection point, connecting the center O of the region z with the point +.>
Figure SMS_50
And extending a line, the line being a reference line, and recording the intersection point of the reference line and the second-stage contour edge line +.>
Figure SMS_53
For the second intersection point, the intersection point of the reference line and the highest-level contour edge line is marked +.>
Figure SMS_51
For the first intersection point, second randomUniformly selecting another edge point on the lowest level contour region z, which is marked as +.>
Figure SMS_55
The point is marked as a fourth intersection point, and the intersection point of the connecting line of the center point of the point and the edge of the second-stage contour is +.>
Figure SMS_57
The fifth intersection point is marked as the intersection point of the connecting line of the center point of the point and the edge of the first-stage contour
Figure SMS_61
The sixth intersection point is shown schematically in fig. 3. />
Figure SMS_59
For edge points->
Figure SMS_62
And edge points->
Figure SMS_49
Is used for the distance of euclidean distance,
Figure SMS_56
for edge points->
Figure SMS_58
To the edge point->
Figure SMS_64
European distance,/, of->
Figure SMS_60
For edge points->
Figure SMS_63
To the edge point->
Figure SMS_52
The calculation of the Euclidean distance is a well-known technique, and will not be described in detail herein. The specific process of obtaining each point is as follows:
obtaining the center point of region z using the getContourCenter function in OpenCVO, dividing the lowest-level profile by randomly and uniformly generating K+1 straight lines (passing through a center point O), taking an empirical value 15 for the size of K, extending all straight lines until the straight lines have an intersection point with each level profile in the region, then fixedly selecting one straight line as a datum line (in the case of the generated uniformly divided straight lines, a vertical straight line can be fixedly selected), and marking the intersection point of the datum line and the lowest-level profile as a sitting mark
Figure SMS_65
Intersection point of the second level region outline is marked as +.>
Figure SMS_66
The intersection point with the highest level profile is marked +.>
Figure SMS_67
。/>
Figure SMS_68
Is the intersection of the e-th line with the lowest level contour of region z, < >>
Figure SMS_69
Is the intersection of the e-th line with the second level profile,
Figure SMS_70
the point of intersection of the e-th straight line and the highest-level contour is a known technique, and the center point of the image contour region is obtained by using the getContourcenter function, and the detailed process is not repeated.
Then, the contour rule index of the lowest-level contour region z is obtained according to the gray balance coefficient of each lowest-level contour region z and the Euclidean distance of the intersection point
Figure SMS_71
Figure SMS_72
In the method, in the process of the invention,
Figure SMS_75
gray balance index representing lowest level contour region z, < ->
Figure SMS_77
Euclidean distance representing the third intersection point and the second intersection point,>
Figure SMS_79
euclidean distance representing the first intersection point and the second intersection point,>
Figure SMS_74
euclidean distance of fourth intersection point and fifth intersection point of the e-th straight line, +.>
Figure SMS_76
Euclidean distance between the sixth intersection and the fifth intersection of the e-th straight line, +.>
Figure SMS_78
For adjusting the coefficients, c=1 in this embodiment, < >>
Figure SMS_80
Straight line representing K non-datum lines, +.>
Figure SMS_73
A contour rule index indicating the lowest level contour region z.
The contour rule index reflects the degree of regularity of the contour of the low-level contour region in the complex region, and since the geometric shape of the pitting defect region is relatively regular, the Euclidean distance from the point on the pitting region contour to the point on the parent contour is stable, that is
Figure SMS_81
And->
Figure SMS_85
The difference between the two distances should be close to 0. While the geometry of non-pitted areas is irregular, the Euclidean distance between points on the contour of such areas to points on the parent contour is not constant, and thus the contour rule index
Figure SMS_86
The larger the area z is, the more likely it is a pit defect area, and a judgment threshold value is set +.>
Figure SMS_83
,/>
Figure SMS_84
For determining whether the area is a pit area, < >>
Figure SMS_87
Takes 20 from the empirical value of (2) if the profile rule index +.>
Figure SMS_88
Less than->
Figure SMS_82
The region is considered to be a pitted defective region, otherwise it is considered to be a non-pitted region.
And step S003, calculating the similarity between the rest suspected pit areas and the determined pit areas to obtain all pit defect areas.
Traversing all the parent contours and the internal child contours of the ROI image after area screening to obtain a pitting defect detection result in a complex region, wherein whether the pitting defect is positioned in the complex region or an independent defect region on an aluminum template, the pitting defects have certain similarity, so that the similarity between the independent defect region and the pitting defect region is calculated to judge, the similarity of the regions is constructed, whether the two regions are consistent or not is evaluated, and the similarity of the region between any one independent region q and all the pitting defect region z is calculated
Figure SMS_89
Figure SMS_90
In the method, in the process of the invention,
Figure SMS_101
is a pixel point within region z that does not overlap p1, < >>
Figure SMS_92
Is the number of pixels in region z, < +.>
Figure SMS_98
Is the region z pixel->
Figure SMS_93
Gray value of +.>
Figure SMS_96
Is the region z pixel->
Figure SMS_100
Gray value of +.>
Figure SMS_104
Is the gray value in region z +.>
Figure SMS_99
、/>
Figure SMS_105
Image entropy of pixel pairs of (a); />
Figure SMS_91
Is a pixel point within region q that does not overlap k1, < >>
Figure SMS_97
Is the number of pixels in region q, < >>
Figure SMS_103
Is pixel dot +.>
Figure SMS_107
Gray value of +.>
Figure SMS_106
Is pixel dot +.>
Figure SMS_108
Gray value of +.>
Figure SMS_94
Is the gray value in region z +.>
Figure SMS_95
、/>
Figure SMS_102
N is the number of pit defect areas that have been detected.
The region similarity reflects the degree of similarity of two regions, and if two regions have higher similarity, the higher the frequency of occurrence of the same pixel point should be,
Figure SMS_109
the greater the ratio of (2) should be, that is to say the region similarity +.>
Figure SMS_110
The larger the two regions have a higher similarity.
Further, traversing all the independent areas in the aluminum template image, respectively calculating the area similarity between each independent area and the pitting defect area z, setting the threshold value to be 0.8, if
Figure SMS_111
When the individual region q is considered as a pit defect region.
So far, all the pock defect areas in the ROI image are obtained.
And S004, judging the defect detection result of the surface of the aluminum template according to the pit defect area.
The detection result of the pock defect in the ROI image is obtained through the steps, the coordinate set of each pixel point on the edge of the obtained region is marked on the original image, and the pock defect is marked by adopting the method for obtaining the minimum circumscribed matrix. The minimum circumscribed matrix of the acquired region is a known technology and will not be described in detail. Furthermore, considering the generation reasons of the pit defects, the detection of the defects of the aluminum template is realized by calculating the proportion of the total area of the pit defects to the area of the aluminum template, and the generation reasons of the defects are manually classified.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (6)

1. The method for detecting the surface defects of the aluminum template is characterized by comprising the following steps of:
acquiring an aluminum template surface image;
manually marking an interested region from an aluminum template surface image to obtain an image to be detected, obtaining edge pixel points of the image to be detected, obtaining all edge contours according to the edge pixel points, and establishing contour grades;
dividing all contours into individual regions and complex regions according to the obtained contour levels;
distinguishing the areas which are possibly pit defect areas in the single areas according to the average value of all the areas, and enabling the areas meeting the conditions to be called as suspected pit areas;
in the complex area, each pixel point except a center point in the lowest-level outline area is connected with the center point, the pixel point is marked as a first pixel point, each first pixel point is used for obtaining a straight line, the straight line is marked as a first straight line, the radius of the minimum circumcircle of the highest-level outline is marked as R, the distance from the first pixel point on the first straight line is marked as R, the pixel point in the highest-level outline area is marked as a second pixel point, and the gray balance index of the lowest-level outline is obtained according to all the first pixel points in each lowest-level outline and the corresponding second pixel points;
in the complex area, a random point on the edge of the lowest-level outline is taken to be connected with a center point, the point is called a third intersection point, a straight line of the point intersects with the second-level outline at a point in the direction of the straight line, the intersection point is marked as a second intersection point, the intersection point intersects with the highest-level outline at a point, the intersection point is marked as a first intersection point, K straight lines are uniformly obtained by taking the straight line as a datum line, the lowest-level outline is divided into K straight lines, the intersection points of the straight lines except the datum line and the lowest-level outline are called fourth intersection points, the intersection point of the straight lines except the datum line and the second-level outline are called fifth intersection points, the intersection point with the highest-level outline is called sixth intersection points, and the contour rule index of the lowest-level outline in the complex area is obtained according to the positions of the first intersection point, the second intersection points, the third intersection points, all fourth intersection points and the gray balance index of the lowest-level outline, and whether the lowest-level outline in the complex area is a pitting defect area is judged according to the contour rule index;
calculating the similarity of the regions according to the gray values of the pixels of the regions between the confirmed pitting defect regions in the complex regions and each suspected pitting region, and extracting the suspected pitting regions with the similarity greater than a threshold value as the pitting defect regions;
calculating the total area occupation ratio of all the pit defect areas to realize the defect detection of the aluminum template;
the method for obtaining the contour rule index of the lowest-level contour in the complex area according to the gray balance index of the lowest-level contour, wherein the method comprises the following steps of:
Figure QLYQS_1
in the method, in the process of the invention,
Figure QLYQS_2
gray balance index representing lowest level profile z, < >>
Figure QLYQS_6
Euclidean distance representing the third intersection point and the second intersection point,>
Figure QLYQS_8
euclidean distance representing the first intersection point and the second intersection point,>
Figure QLYQS_4
representing the e-th straight lineEuclidean distance between fourth intersection point and fifth intersection point,>
Figure QLYQS_5
euclidean distance between the sixth intersection and the fifth intersection of the e-th straight line, +.>
Figure QLYQS_7
For regulating the coefficient->
Figure QLYQS_9
Straight line representing K non-datum lines, +.>
Figure QLYQS_3
A contour rule index representing the lowest level contour z.
2. The method for detecting surface defects of an aluminum template according to claim 1, wherein the method for obtaining edge pixel points of an image to be detected, obtaining all edge contours according to the edge pixel points, and establishing contour grades comprises the following steps:
and carrying out edge detection on the image to be detected to obtain edge pixel points, carrying out contour detection on the edge pixel points to obtain all edge contours, wherein the edge contour of one region is the highest-level contour, the contour of an object in the cavity of the highest-level contour is the second-level contour, and the contour of the object in the second-level contour is the lowest-level contour.
3. The method for detecting surface defects of aluminum templates according to claim 1, wherein the method for dividing all contours into separate areas and complex areas according to the obtained contour levels comprises the following steps:
after the levels of all the contours are obtained, each contour is judged, if the contour contains the lowest level contour, the region corresponding to the contour is called as a complex region, and besides, the regions corresponding to all the contours are all independent regions.
4. The method for detecting surface defects of aluminum templates according to claim 1, wherein the method for distinguishing the areas possibly being pit defect areas in the individual areas according to the average value of all the areas and calling the areas meeting the conditions as suspected pit areas comprises the following steps:
and calculating the area of each contour according to all the obtained contours, wherein the area of each contour is the number of pixel points contained in the contour, wherein in a complex area, each contour obtains an area, then calculating the area average value of all the contours, comparing each area in an individual area with the area average value of all the contours, and considering the individual area as a suspected pit area when the area of the individual area is smaller than the area average value of all the contours.
5. The method for detecting surface defects of aluminum templates according to claim 1, wherein the method for obtaining gray balance indexes of the lowest-level contours according to all first pixel points in each lowest-level contour and the corresponding second pixel points comprises the following steps:
Figure QLYQS_10
wherein i is the pixel point of any non-central point in the lowest-level outline z of the complex area, namely the first pixel point, M represents the number of the pixel points divided by the central point in the lowest-level outline,
Figure QLYQS_11
gray value representing pixel i on line L +.>
Figure QLYQS_12
The gray value of the pixel point j on the connecting line L is represented, wherein the distance between the pixel points i and j is R, and the pixel point j is in the highest-level outline corresponding to the lowest-level outline z, ">
Figure QLYQS_13
And the gray balance index representing the lowest-level profile z, wherein the connecting line L is a first straight line of the pixel point i.
6. The method for detecting surface defects of aluminum templates according to claim 1, wherein the specific method for calculating the similarity of the areas between all the identified pock defect areas in the complex area and each suspected pock area according to the gray value of the area pixel is as follows:
Figure QLYQS_14
in the method, in the process of the invention,
Figure QLYQS_32
、/>
Figure QLYQS_17
is any two non-repeated pixels in the pit defect area z, +.>
Figure QLYQS_25
Is the number of pixels in the pit defect area z, < >>
Figure QLYQS_31
Is pixel dot +.>
Figure QLYQS_34
Gray value of +.>
Figure QLYQS_33
Is pixel dot +.>
Figure QLYQS_35
Gray value of +.>
Figure QLYQS_21
Is that gray value in pit defect region z is +.>
Figure QLYQS_26
、/>
Figure QLYQS_16
Image entropy of pixel pairs of (a); />
Figure QLYQS_28
、/>
Figure QLYQS_15
Is any two non-repeated pixel points in the suspected pit area q, +.>
Figure QLYQS_30
Is the number of pixels in the suspected pit area q,/>
Figure QLYQS_22
Is pixel dot +.>
Figure QLYQS_27
Is used for the gray-scale value of (c),
Figure QLYQS_18
is pixel dot +.>
Figure QLYQS_23
Gray value of +.>
Figure QLYQS_19
Is that gray value in pit defect region z is +.>
Figure QLYQS_24
、/>
Figure QLYQS_20
N is the number of pit defect areas that have been detected, < >>
Figure QLYQS_29
And the similarity between the detected pit defect area and the suspected pit area is represented.
CN202310101457.0A 2023-02-13 2023-02-13 Aluminum template surface defect detection method Active CN115797361B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310101457.0A CN115797361B (en) 2023-02-13 2023-02-13 Aluminum template surface defect detection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310101457.0A CN115797361B (en) 2023-02-13 2023-02-13 Aluminum template surface defect detection method

Publications (2)

Publication Number Publication Date
CN115797361A CN115797361A (en) 2023-03-14
CN115797361B true CN115797361B (en) 2023-06-27

Family

ID=85430898

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310101457.0A Active CN115797361B (en) 2023-02-13 2023-02-13 Aluminum template surface defect detection method

Country Status (1)

Country Link
CN (1) CN115797361B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630332B (en) * 2023-07-26 2023-09-26 山东华航高分子材料有限公司 PVC plastic pipe orifice defect detection method based on image processing
CN117890214B (en) * 2024-03-14 2024-06-04 西安汉华建筑实业有限公司 Aluminum template quality inspection detection method based on machine vision

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018068415A1 (en) * 2016-10-11 2018-04-19 广州视源电子科技股份有限公司 Detection method and system for wrong part
CN115100171A (en) * 2022-07-11 2022-09-23 常宝云 Steel die welding defect detection method and system based on machine vision

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10326035B4 (en) * 2003-06-10 2005-12-22 Hema Electronic Gmbh Method for adaptive error detection on a structured surface
JP2015059854A (en) * 2013-09-19 2015-03-30 セントラル硝子株式会社 Defect inspection method and defect inspection device
CN107808378B (en) * 2017-11-20 2020-08-25 浙江大学 Method for detecting potential defects of complex-structure casting based on vertical longitudinal and transverse line profile features
CN109658376A (en) * 2018-10-24 2019-04-19 哈尔滨工业大学 A kind of surface defect recognition method based on image recognition
CN111896556B (en) * 2020-08-04 2021-05-28 湖南大学 Glass bottle bottom defect detection method and system based on machine vision
CN115330773B (en) * 2022-10-12 2023-03-28 南通红运金属科技有限公司 Metal grinding pockmark defect detection method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018068415A1 (en) * 2016-10-11 2018-04-19 广州视源电子科技股份有限公司 Detection method and system for wrong part
CN115100171A (en) * 2022-07-11 2022-09-23 常宝云 Steel die welding defect detection method and system based on machine vision

Also Published As

Publication number Publication date
CN115797361A (en) 2023-03-14

Similar Documents

Publication Publication Date Title
CN115082467B (en) Building material welding surface defect detection method based on computer vision
CN115797361B (en) Aluminum template surface defect detection method
CN114723701B (en) Gear defect detection method and system based on computer vision
CN115082418B (en) Precise identification method for automobile parts
CN109191459B (en) Automatic identification and rating method for continuous casting billet macrostructure center segregation defect
CN115222733B (en) Metal component surface defect detection method based on image recognition
CN115423813B (en) Method for detecting welding defects on surface of welded pipe
CN116205919B (en) Hardware part production quality detection method and system based on artificial intelligence
CN115345885A (en) Method for detecting appearance quality of metal fitness equipment
CN115601362B (en) Welding quality evaluation method based on image processing
CN114820773B (en) Silo transport vehicle carriage position detection method based on computer vision
CN109215009B (en) Continuous casting billet surface image defect detection method based on deep convolution neural network
CN115953398B (en) Defect identification method for strip steel surface
CN115049657A (en) Glass defect detection method
CN116883408B (en) Integrating instrument shell defect detection method based on artificial intelligence
CN116091504A (en) Connecting pipe connector quality detection method based on image processing
CN117314925B (en) Metal workpiece surface defect detection method based on computer vision
CN114820625A (en) Automobile top block defect detection method
CN116309577B (en) Intelligent detection method and system for high-strength conveyor belt materials
CN117635604B (en) Method for detecting welding quality of constructional engineering steel structure
CN114119603A (en) Image processing-based snack box short shot defect detection method
CN117635609B (en) Visual inspection method for production quality of plastic products
CN114998356A (en) Axle defect detection method based on image processing
CN114155226A (en) Micro defect edge calculation method
CN112561875A (en) Photovoltaic cell panel coarse grid detection method based on artificial intelligence

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
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A surface defect detection method for aluminum templates

Granted publication date: 20230627

Pledgee: Shandong Weishan Rural Commercial Bank Co.,Ltd.

Pledgor: Shandong Miaotai Construction Technology Co.,Ltd.

Registration number: Y2024980020606