CN113160161A - Method and device for detecting defects at edge of target - Google Patents

Method and device for detecting defects at edge of target Download PDF

Info

Publication number
CN113160161A
CN113160161A CN202110401749.7A CN202110401749A CN113160161A CN 113160161 A CN113160161 A CN 113160161A CN 202110401749 A CN202110401749 A CN 202110401749A CN 113160161 A CN113160161 A CN 113160161A
Authority
CN
China
Prior art keywords
edge
pixel points
target
image
determining
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
CN202110401749.7A
Other languages
Chinese (zh)
Other versions
CN113160161B (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.)
Goertek Inc
Original Assignee
Goertek Inc
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 Goertek Inc filed Critical Goertek Inc
Priority to CN202110401749.7A priority Critical patent/CN113160161B/en
Publication of CN113160161A publication Critical patent/CN113160161A/en
Application granted granted Critical
Publication of CN113160161B publication Critical patent/CN113160161B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • 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/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a method and a device for detecting defects at edges of a target, wherein the method comprises the following steps: acquiring an image to be detected of a target; determining edge pixel points representing the edge of a target according to an image to be detected; screening interference points from the edge pixel points to obtain candidate pixel points; performing linear fitting processing on the candidate pixel points to obtain an edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance between the edge pixel points and the edge calibration line. The technical scheme has the advantages of providing a mode for efficiently, automatically and accurately detecting the defects at the edge of the target, having low omission factor, small demand on computing resources and low cost, and being suitable for automatic production line realization.

Description

Method and device for detecting defects at edge of target
Technical Field
The present application relates to the field of target detection technologies, and in particular, to a method and an apparatus for detecting defects at an edge of a target.
Background
Computer vision technology is gradually applied to industrial production, for example, quality detection of products can be realized by photographing the products and then identifying defects of the products by using a pre-trained computer vision model.
However, a better detection means is still lacking for defects at the edge of a part of the target, such as defect defects at the edge of a glass chip.
Disclosure of Invention
The embodiment of the application provides a method and a device for detecting defects at the edge of a target, and aims to provide an efficient, automatic and accurate method for detecting the defects at the edge of the target.
The embodiment of the application adopts the following technical scheme:
in a first aspect, an embodiment of the present application provides a method for detecting a defect at an edge of a target, including: acquiring an image to be detected of a target; determining edge pixel points representing the edge of a target according to an image to be detected; screening interference points from the edge pixel points to obtain candidate pixel points; performing linear fitting processing on the candidate pixel points to obtain an edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line.
In some embodiments, the above method, wherein acquiring the image to be detected of the target includes: shooting a target to obtain a color image of the target; and determining the image to be detected of the target from the color image based on template matching and/or feature matching.
In some embodiments, the determining, according to the image to be detected, an edge pixel point representing an edge of the target includes: carrying out graying processing on an image to be detected to obtain a grayscale image; performing Gaussian filtering and self-adaptive binarization processing on the gray level image to obtain a binarization image; and identifying edge pixel points representing the target edge from the binary image.
In some embodiments, the above method, the screening the interference points from the edge pixel points to obtain candidate pixel points includes: determining a circumscribed graph contour line according to the edge pixel points; calculating the distance variance between each edge pixel point and the corresponding external graphic contour line; and screening out interference points in the edge pixel points according to the distance variance.
In some embodiments, the performing a straight line fitting process on the candidate pixel point to obtain an edge calibration line in the method includes: and screening out candidate pixel points not exceeding a preset number based on the horizontal coordinates or the vertical coordinates of the candidate pixel points to perform straight line fitting by a least square method.
In some embodiments, in the above method, determining the pixel points characterizing the defect at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line includes: determining an edge pixel point set corresponding to each edge calibration line; for each edge calibration line, calculating a distance variance according to the distance between each edge pixel point and the edge calibration line in an edge pixel point set corresponding to the edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance.
In some embodiments, in the above method, determining the edge pixel point set corresponding to each edge calibration line includes: and for each edge pixel point, calculating the minimum distance value between the edge pixel point and each edge calibration line, and determining the edge calibration line corresponding to the candidate pixel point according to the minimum distance value.
In some embodiments, the determining, according to the distance variance, a pixel point representing a defect at an edge of the target includes: and if the distance variances of the continuous edge pixel points are all larger than a preset variance threshold value and the number of the continuous edge pixel points is larger than a preset number threshold value, the continuous edge pixel points are pixel points representing defects at the edge of the target.
In some embodiments, the target is a glass chip, the method further comprising: and filling the part in the edge contour in the binary image according to the edge contour determined by the edge pixel points.
In a second aspect, an embodiment of the present application further provides an apparatus for detecting a defect at an edge of a target, which is used to implement any one of the above methods for detecting a defect at an edge of a target.
In some embodiments, an apparatus for detecting defects at an edge of a target, comprises: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring an image to be detected of a target; the edge determining unit is used for determining edge pixel points representing the edge of the target according to the image to be detected; the screening unit is used for screening interference points from the edge pixel points to obtain candidate pixel points; the fitting unit is used for performing linear fitting processing on the candidate pixel points to obtain an edge calibration line; and the defect determining unit is used for determining pixel points representing the defects at the edges of the target according to the distance variance between the edge pixel points and the edge calibration line.
In some embodiments, in the above apparatus, the obtaining unit is configured to photograph the target to obtain a color image of the target; and determining the image to be detected of the target from the color image based on template matching and/or feature matching.
In some embodiments, in the apparatus, the edge determining unit is configured to perform graying processing on an image to be detected to obtain a grayscale image; performing Gaussian filtering and self-adaptive binarization processing on the gray level image to obtain a binarization image; and identifying edge pixel points representing the target edge from the binary image.
In some embodiments, in the apparatus, the screening unit is configured to determine the outline of the circumscribed figure according to the edge pixel points; calculating the distance variance between each edge pixel point and the corresponding external graphic contour line; and screening out interference points in the edge pixel points according to the distance variance.
In some embodiments, in the above apparatus, the fitting unit is configured to screen out no more than a preset number of candidate pixels based on horizontal coordinates or vertical coordinates of the candidate pixels to perform straight line fitting by a least square method.
In some embodiments, in the apparatus, the defect determining unit is configured to determine an edge pixel point set corresponding to each edge calibration line; for each edge calibration line, calculating a distance variance according to the distance between each edge pixel point and the edge calibration line in an edge pixel point set corresponding to the edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance.
In some embodiments, in the above apparatus, the defect determining unit is configured to calculate, for each edge pixel point, a minimum distance between the edge pixel point and each edge calibration line, and determine, according to the minimum distance, an edge calibration line corresponding to the candidate pixel point.
In some embodiments, in the apparatus, the defect determining unit is configured to determine that the consecutive edge pixels are pixels representing the defect at the target edge if the distance variances of the consecutive edge pixels are all greater than a preset variance threshold and the number of the consecutive edge pixels is greater than a preset number threshold.
In some embodiments, the target is a glass chip, the apparatus further comprising: and the filling unit is used for filling the part in the edge contour in the binary image according to the edge contour determined by the edge pixel points.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform a method of detecting defects at an edge of a target as any one of the above.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium storing one or more programs, which when executed by an electronic device including a plurality of application programs, cause the electronic device to perform the method for detecting a defect at an edge of a target as described above.
According to the at least one technical scheme, after the edge of the target is determined according to the image to be detected of the target, candidate pixel points with high quality are obtained in a mode of screening out interference points, an edge calibration line is obtained through fitting according to the candidate pixel points, and then the defects at the edge of the target are determined according to the distance variance between the candidate pixel points and the edge calibration line. The technical scheme has the advantages of providing a mode for efficiently, automatically and accurately detecting the defects at the edge of the target, having low omission factor, small demand on computing resources and low cost, and being suitable for automatic production line realization.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a schematic flow chart diagram illustrating a method for detecting defects at an edge of a target according to one embodiment of the present application;
FIG. 2 shows an image taken of a glass chip;
fig. 3 shows an image after the binarization process is performed on fig. 2;
FIG. 4 shows an image resulting from the padding process of FIG. 3;
FIG. 5 shows the resulting four edge calibration lines on the basis of FIG. 4;
FIG. 6 shows the labeling result of the defect at the edge;
FIG. 7 is a schematic diagram of an apparatus for detecting defects at an edge of a target according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
The technical idea of the application is that considering that the edge defect substantially changes the original (in an ideal state) edge line of the target partially, and the overall influence is generally small, the original edge line is determined first, then the edge defect is detected according to the difference between the actual edge line and the actual edge line, and the distance variance is used as a detection basis, so that the detection accuracy is ensured.
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart illustrating a method for detecting defects at an edge of a target according to an embodiment of the present application, where the method includes:
step S110, acquiring an image to be detected of the target. The target in the embodiment of the application can be various objects with edge defect detection requirements, and particularly can be products produced on an industrial production line, such as glass chips and the like.
FIG. 2 shows a schematic view of a glass chip according to one embodiment of the present application. The glass chip is a chip partially made of glass (a white area in fig. 2 is approximately a square area), and is generally used in a main board of a product such as VR (Virtual Reality). The method has great influence on the eyesight of the staff and has high omission ratio.
And step S120, determining edge pixel points representing the edge of the target according to the image to be detected. Determining edge pixel points also means determining the actual edge of the object.
And step S130, screening interference points from the edge pixel points to obtain candidate pixel points. If the interference points are not screened out, the edge calibration line obtained by fitting in the subsequent step S140 may be too deviated from the original edge of the target, and the detection accuracy of the defect at the edge may be reduced.
And step S140, performing straight line fitting processing on the candidate pixel points to obtain an edge calibration line. The edge calibration lines may be multiple, for example four for a generally square target. The edge calibration line may be considered to characterize the original edge of the target, for example, characterizing the edge pattern expected by the product at the design stage. Therefore, according to the distance characteristics between the candidate pixel points capable of representing the target edge and the edge calibration line, the pixel points representing the defects at the target edge can be determined.
And S150, determining pixel points representing defects at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line. The distance variance is selected as the basis for determining the defects, so that the degree of deviation of the candidate pixel points from the edge calibration line can be more accurately measured, and the defect detection precision is ensured.
Therefore, the method shown in fig. 1 can provide a mode for efficiently, automatically and accurately detecting the defects at the edge of the target, has low omission factor, low requirement on computing resources and low cost, and is suitable for automatic production line implementation.
In some embodiments, the above method, wherein acquiring the image to be detected of the target includes: shooting a target to obtain a color image of the target; and determining the image to be detected of the target from the color image based on template matching and/or feature matching.
For example, a camera may be installed in a product manufacturing line to capture a color image of a product. In order to avoid the influence of the non-target part in the color image on the subsequent detection, a part corresponding to the target can be determined from the color image and used as an image to be detected.
In particular, it may be implemented using computer vision techniques, such as using template matching and/or feature matching. In one example, a template matching function of Halcon software can be used to set a template image as a standard image of a target, extract features from the template image by means of create _ shape _ model, and obtain a confidence score (score) of a region to be matched in a color image in a find _ shape _ model manner. And when the score is larger than the set threshold, the image corresponding to the area is the image to be detected.
In some embodiments, the determining, according to the image to be detected, an edge pixel point representing an edge of the target includes: carrying out graying processing on an image to be detected to obtain a grayscale image; performing Gaussian filtering and self-adaptive binarization processing on the gray level image to obtain a binarization image; and identifying edge pixel points representing the target edge from the binary image.
If the original image of the target is directly obtained by shooting according to the gray-scale camera, the image to be detected is obtained by processing the original image such as cutting, or the color type in the image to be detected is less, and the influence on subsequent detection is not great, the step of carrying out gray-scale processing on the image to be detected can be omitted.
Noise points in the gray level image can be eliminated through a Gaussian filtering mode, and the noise points are different from the interference points, so that binarization processing is facilitated, and a better binarization image is obtained. After binarization, the gray values of the subsequently identified edge pixels may be uniform, for example, all are 255 (white).
Based on the binary image, any type of prior art can be selected to realize the step of identifying the edge pixel points representing the target edge, for example, an edge detection operator is adopted to realize the step.
For example, fig. 2 is processed as above to obtain fig. 3, which can be seen to remove the interference of the background portion (outside the white area in fig. 2) of the glass chip, so as to more conveniently identify the edge pixel.
The glass chip shown in fig. 2 and 3 has characters (in the white area). These do not help for subsequent defect detection, but rather interfere, and thus, in some embodiments, when the target is a glass chip, the method further comprises: and filling the part in the edge contour in the binary image according to the edge contour determined by the edge pixel points. For example, fig. 4 may be processed based on fig. 3.
In some embodiments, the above method, the screening the interference points from the edge pixel points to obtain candidate pixel points includes: determining a circumscribed graph contour line according to the edge pixel points; calculating the distance variance between each edge pixel point and the corresponding external graphic contour line; and screening out interference points in the edge pixel points according to the distance variance.
Because before the straight line fitting is carried out, if the point for fitting the straight line is far away from the real edge, the deviation of the straight line is large after the fitting, and aiming at the situation, the method for screening the interference points by adopting the distance variance is provided.
However, before calculating the distance variance, it is necessary to determine the distance, specifically, the distance between the edge pixel point and which reference object, and how to find such a reference object before the fitted straight line is not obtained is a problem to be solved.
The application provides a mode of determining the outline of the external graph according to the edge pixel points. Generally, the external graphic contour line is a line forming a closed image, and in the embodiment of the application, in order to perform screening of interference points, the interference points may be divided into a plurality of lines according to inflection points, so that edge pixel points respectively correspond to one external graphic contour line. For example, if the object is square as a whole, there are four circumscribed contour lines (it is understood that the circumscribed contour lines in the normal sense are divided into four segments), the edge pixel points correspond to one of the circumscribed figure contour lines closest to the edge pixel points, and the distance variance are calculated.
Specifically, for each edge pixel point i, which corresponds to one circumscribed contour line, the distance variance theta thereof can be calculated by the following formula:
Figure BDA0003020634310000081
wherein m is the total number of edge pixel points corresponding to the external contour line, kiAnd k is the expected distance from each edge pixel point corresponding to the external contour line.
If the distance variance theta of the edge pixel point i is smaller than a preset threshold (the threshold can be determined according to the size of a common defect and the like), the edge pixel point is reserved, otherwise, the edge pixel point is used as an interference point to be deleted.
In some embodiments, the performing a straight line fitting process on the candidate pixel point to obtain an edge calibration line in the method includes: and screening out candidate pixel points not exceeding a preset number based on the horizontal coordinates or the vertical coordinates of the candidate pixel points to perform straight line fitting by a least square method.
When the straight line fitting is carried out, an excessive number of candidate pixel points are not needed, so that the candidate pixel points for fitting the straight line can be selected in a coordinate screening mode.
The defect at the edge is generally a defect at the edge, so the fitted straight line needs to cut the target at one side of the straight line instead of cutting the target, and when screening candidate pixel points, the method can be implemented based on the horizontal coordinate or the vertical coordinate of the candidate pixel points, for example, taking the target of a square as an example, the pixel coordinate system of the image to be detected takes the upper left corner as the origin of coordinates, so the specific screening mode can be as follows:
for the upper edge of the square, the way to obtain the edge calibration line is to screen based on the vertical coordinate value (y value) of the candidate pixel point. Specifically, the candidate pixel points are sequentially traversed from left to right, the value of y with the gray scale of 255 under the pixel coordinate (x, y) is searched, and the first q points with the minimum y value (distance _ min _ y1, distance _ miny2, distance _ min _ y3 … distance _ min _ yq) are taken. Wherein q is a preset threshold value. Then, fitting the points into a straight Line _ top by using a least square method, wherein the straight Line equation is as follows: a istop*xtop+btop*xtop+ctop=0。
Similarly, for the left edge of the square, sequentially traversing the candidate pixel points from top to bottom, finding the value of x with the gray level of 255 under the pixel coordinate (x, y), and taking the first n points (distance _ min _ x1, distance _ min _ x2, distance _ min _ x3 … distance _ min _ xn) with the minimum value of x, where n is also a preset threshold. Then, fitting the points into a straight Line _ left by adopting a least square method, wherein the straight Line equation is as follows: a isleft*xleft+bleft*xleft+cleft=0。
For the lower edge of the square, sequentially traversing the candidate pixel points from left to right, screening based on the vertical coordinate values of the candidate pixel points, searching the value of y with the gray scale of 255 under the pixel coordinate (x, y), and taking the front q points (distance _ max1, distance _ max2, distance _ max3 … distance _ maxq) with the maximum y value, wherein q is a preset threshold value. Fitting the points into a straight Line _ bottom by using a least square method, wherein the straight Line equation is as follows: a isbottom*xbottom+bbottom*xbottom+cbottom=0。
For the right edge of the square, sequentially traversing the candidate pixel points from top to bottom, screening based on the horizontal coordinate values of the candidate pixel points, searching the value of x with the gray scale of 255 under the pixel coordinate (x, y), and taking the first n points (distance _ max1, distance _ max2, distance _ max3 … distance _ maxn) with the maximum value of x, wherein n is a preset threshold value. These points are fitted to a Line right using a least squares method, whose equation is: a isright*xright+bright*xright+cright0. FIG. 5 showsFour edge calibration lines are determined according to figure 4.
In some embodiments, in the above method, determining the pixel points characterizing the defect at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line includes: determining an edge pixel point set corresponding to each edge calibration line; for each edge calibration line, calculating a distance variance according to the distance between each edge pixel point and the edge calibration line in an edge pixel point set corresponding to the edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance.
The edge defect usually appears as defect, that is, the edge pixel point representing the edge of the target has an excessive distance from the edge calibration line representing the original edge of the target. But taking the square target as an example, the edge pixel points representing the upper edge are obviously at a large distance from the calibration line of the lower edge, but this does not mean that there is a defect on the lower edge. Therefore, the corresponding relationship between the edge calibration line and the edge pixel point needs to be determined first.
Specifically, in some embodiments, in the method, determining the edge pixel point set corresponding to each edge calibration line includes: and for each edge pixel point, calculating the minimum distance value between the edge pixel point and each edge calibration line, and determining the edge calibration line corresponding to the candidate pixel point according to the minimum distance value. That is to say, the edge pixel point set corresponding to each edge calibration line is determined through the 'proximity principle'.
Then, the method and the device determine pixel points representing defects at the edge of the target in a mode of calculating the distance variance. In some embodiments, the determining, according to the distance variance, a pixel point representing a defect at an edge of the target includes: and if the distance variances of the continuous edge pixel points are all larger than a preset variance threshold value and the number of the continuous edge pixel points is larger than a preset number threshold value, the continuous edge pixel points are pixel points representing defects at the edge of the target.
The manufactured product has an error within an acceptable range with an ideal state, so a preset number threshold can be set, and only when the distance variances of a plurality of continuous edge pixel points are all larger than the preset variance threshold, the manufactured product is considered to correspond to one edge defect.
Taking fig. 5 as an example, the minimum distance value from Point (x, y) of each edge pixel Point to four edges is calculated
Figure BDA0003020634310000101
Wherein a is correspondingly selected as atop、aleft、arightAnd abottomOne of which, b is selected accordingly as btop、bleft、brightAnd bbottomOne of which, c is selected as ctop、cleft、crightAnd cbottomOne of which, the corresponding edge calibration line is also determined.
For an edge calibration line, the starting points of the edge calibration line are respectively set to point _ start1(x _ start1, y _ start1) and point _ end1(x _ end1, y _ end1), so that the number pixel _ num of edge pixels in the edge pixel set corresponding to the edge calibration line can be obtained.
For each edge calibration line, the Distance mean value Distance _ mean can be calculated according to the corresponding edge pixel point set. First, the sum of distances is calculated
Figure BDA0003020634310000111
Then, Distance _ mean is calculated as Distance _ all/pixel _ num.
Then, the distance variance of each edge pixel point can be calculated
Figure BDA0003020634310000112
Figure BDA0003020634310000113
And finally, judging whether the distance variances of a plurality of edge pixel points are all larger than a preset variance threshold thres. And when the number of the continuous edge pixel points meeting the distance variance condition is larger than thres, determining the edge pixel points as defective pixel points.
According to the detected defective pixel points, a labeling frame can be generated, and as shown in fig. 6, the defect at the upper right corner of the glass chip is labeled.
The embodiment of the application also provides a device for detecting the defects at the edge of the target, which is used for realizing the method for detecting the defects at the edge of the target.
Specifically, fig. 7 shows a schematic structural diagram of a device for detecting a defect at an edge of a target according to an embodiment of the present application. As shown in fig. 7, the apparatus 700 for detecting a defect at an edge of a target includes:
the acquiring unit 710 is configured to acquire an image to be detected of a target. The target in the embodiment of the application can be various objects with edge defect detection requirements, and particularly can be products produced on an industrial production line, such as glass chips and the like.
And an edge determining unit 720, configured to determine edge pixel points representing an edge of the target according to the image to be detected. Determining edge pixel points also means determining the actual edge of the object.
The screening unit 730 is configured to screen the interference points from the edge pixel points to obtain candidate pixel points. If the interference points are not screened out, the edge calibration line obtained by the subsequent fitting unit 740 may be too deviated from the original edge of the target, and the detection accuracy of the defect at the edge is reduced.
And the fitting unit 740 is configured to perform linear fitting processing on the candidate pixel points to obtain an edge calibration line. The edge calibration lines may be multiple, for example four for a generally square target. The edge calibration line may be considered to characterize the original edge of the target, for example, characterizing the edge pattern expected by the product at the design stage. Therefore, according to the distance characteristics between the candidate pixel points capable of representing the target edge and the edge calibration line, the pixel points representing the defects at the target edge can be determined.
And the defect determining unit 750 is configured to determine pixel points representing defects at the edge of the target according to a distance variance between the edge pixel points and the edge calibration line. The distance variance is selected as the basis for determining the defects, so that the degree of deviation of the candidate pixel points from the edge calibration line can be more accurately measured, and the defect detection precision is ensured.
Therefore, the device shown in fig. 7 can provide a mode for efficiently, automatically and accurately detecting the defects at the edge of the target, has low omission factor, low requirement on computing resources and low cost, and is suitable for automatic production line implementation.
In some embodiments, in the above apparatus, the obtaining unit 710 is configured to photograph a target, and obtain a color image of the target; and determining the image to be detected of the target from the color image based on template matching and/or feature matching.
In some embodiments, in the above apparatus, the edge determining unit 720 is configured to perform graying processing on the image to be detected to obtain a grayscale image; performing Gaussian filtering and self-adaptive binarization processing on the gray level image to obtain a binarization image; and identifying edge pixel points representing the target edge from the binary image.
In some embodiments, in the above apparatus, the screening unit 730 is configured to determine the outline of the circumscribed graph according to the edge pixel points; calculating the distance variance between each edge pixel point and the corresponding external graphic contour line; and screening out interference points in the edge pixel points according to the distance variance.
In some embodiments, in the above apparatus, the fitting unit 740 is configured to screen out no more than a preset number of candidate pixels based on horizontal coordinates or vertical coordinates of the candidate pixels to perform a straight line fitting by a least square method.
In some embodiments, in the apparatus, the defect determining unit 750 is configured to determine an edge pixel point set corresponding to each edge calibration line; for each edge calibration line, calculating a distance variance according to the distance between each edge pixel point and the edge calibration line in an edge pixel point set corresponding to the edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance.
In some embodiments, in the above apparatus, the defect determining unit 750 is configured to calculate, for each edge pixel point, a minimum distance between the edge pixel point and each edge calibration line, and determine, according to the minimum distance, an edge calibration line corresponding to the candidate pixel point.
In some embodiments, in the apparatus, the defect determining unit 750 is configured to determine that the consecutive edge pixels are pixels representing the defect at the target edge if the distance variances of the consecutive edge pixels are all greater than a preset variance threshold and the number of the consecutive edge pixels is greater than a preset number threshold.
In some embodiments, the target is a glass chip, the apparatus further comprising: and the filling unit is used for filling the part in the edge contour in the binary image according to the edge contour determined by the edge pixel points.
It can be understood that the apparatus for detecting a defect at a target edge can implement the steps of the method for detecting a defect at a target edge provided in the foregoing embodiment, and the explanations related to the method for detecting a defect at a target edge are applicable to the apparatus for detecting a defect at a target edge, and are not repeated herein.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 8, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form a detection device of the defect at the edge of the target on a logic level. The detection means for the target edge defect shown in fig. 6 does not constitute a limitation of the present application on the number of edge defect detection means. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
acquiring an image to be detected of a target; determining edge pixel points representing the edge of a target according to an image to be detected; screening interference points from the edge pixel points to obtain candidate pixel points; performing linear fitting processing on the candidate pixel points to obtain an edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line.
The method performed by the apparatus for detecting a defect at an edge of an object as disclosed in the embodiment of fig. 1 of the present application may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further execute the method executed by the apparatus for detecting a defect at an edge of a target in fig. 1, and implement the function of the apparatus for detecting a defect at an edge of a target in the embodiment shown in fig. 1, which is not described herein again.
An embodiment of the present application further provides a computer-readable storage medium storing one or more programs, where the one or more programs include instructions, which, when executed by an electronic device including a plurality of application programs, enable the electronic device to perform the method performed by the apparatus for detecting a defect at an edge of a target in the embodiment shown in fig. 1, and are specifically configured to perform:
acquiring an image to be detected of a target; determining edge pixel points representing the edge of a target according to an image to be detected; screening interference points from the edge pixel points to obtain candidate pixel points; performing linear fitting processing on the candidate pixel points to obtain an edge calibration line; and determining pixel points representing defects at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method of detecting defects at an edge of a target, comprising:
acquiring an image to be detected of a target;
determining edge pixel points representing the edge of a target according to the image to be detected;
screening interference points from the edge pixel points to obtain candidate pixel points;
performing linear fitting processing on the candidate pixel points to obtain an edge calibration line;
and determining pixel points representing defects at the edge of the target according to the distance variance between the edge pixel points and the edge calibration line.
2. The method of claim 1, wherein the acquiring the image of the target to be detected comprises:
shooting the target to obtain a color image of the target;
and determining the image to be detected of the target from the color image based on template matching and/or feature matching.
3. The method of claim 1, wherein the determining edge pixel points characterizing the edge of the target according to the image to be detected comprises:
carrying out graying processing on an image to be detected to obtain a grayscale image;
performing Gaussian filtering and self-adaptive binarization processing on the gray level image to obtain a binarized image;
and identifying edge pixel points representing the target edge from the binary image.
4. The method of claim 1, wherein the step of filtering the edge pixels from the interference points to obtain candidate pixels comprises:
determining a circumscribed graph contour line according to the edge pixel points;
calculating the distance variance between each edge pixel point and the corresponding external graphic contour line;
and screening out interference points in the edge pixel points according to the distance variance.
5. The method of claim 1, wherein the step of performing a straight line fitting process on the candidate pixel points to obtain an edge calibration line comprises:
and screening out candidate pixel points not exceeding a preset number based on the horizontal coordinates or the vertical coordinates of the candidate pixel points to perform straight line fitting by a least square method.
6. The method of claim 1, wherein determining pixel points characterizing defects at an edge of the target based on a variance in distance between the edge pixel points and the edge calibration line comprises:
determining an edge pixel point set corresponding to each edge calibration line;
for each edge calibration line, calculating a distance variance according to the distance between each edge pixel point and the edge calibration line in an edge pixel point set corresponding to the edge calibration line;
and determining pixel points representing defects at the edge of the target according to the distance variance.
7. The method of claim 6, wherein determining the set of edge pixels corresponding to each edge calibration line comprises:
and for each edge pixel point, calculating the minimum distance value between the edge pixel point and each edge calibration line, and determining the edge calibration line corresponding to the candidate pixel point according to the minimum distance value.
8. The method of claim 6, wherein determining pixel points characterizing defects at an edge of a target according to the distance variance comprises:
and if the distance variances of the continuous edge pixel points are all larger than a preset variance threshold value and the number of the continuous edge pixel points is larger than a preset number threshold value, the continuous edge pixel points are pixel points representing defects at the edge of the target.
9. The method of any one of claims 1 to 8, wherein the target is a glass chip, the method further comprising:
and filling the part in the edge contour in the binary image according to the edge contour determined by the edge pixel points.
10. An apparatus for detecting defects at an edge of a target, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring an image to be detected of a target;
the edge determining unit is used for determining edge pixel points representing the edge of the target according to the image to be detected;
the screening unit is used for screening interference points from the edge pixel points to obtain candidate pixel points;
the fitting unit is used for performing linear fitting processing on the candidate pixel points to obtain an edge calibration line;
and the defect determining unit is used for determining pixel points representing the defects at the edges of the target according to the distance between the edge pixel points and the edge calibration line.
CN202110401749.7A 2021-04-14 2021-04-14 Method and device for detecting defects at edge of target Active CN113160161B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110401749.7A CN113160161B (en) 2021-04-14 2021-04-14 Method and device for detecting defects at edge of target

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110401749.7A CN113160161B (en) 2021-04-14 2021-04-14 Method and device for detecting defects at edge of target

Publications (2)

Publication Number Publication Date
CN113160161A true CN113160161A (en) 2021-07-23
CN113160161B CN113160161B (en) 2023-07-11

Family

ID=76890430

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110401749.7A Active CN113160161B (en) 2021-04-14 2021-04-14 Method and device for detecting defects at edge of target

Country Status (1)

Country Link
CN (1) CN113160161B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113870266A (en) * 2021-12-03 2021-12-31 中导光电设备股份有限公司 Method and system for judging authenticity of line defect based on TFT-LCD
CN114800660A (en) * 2022-06-27 2022-07-29 浙江双元科技股份有限公司 Defect positioning system and method for sheet slitting
CN115018829A (en) * 2022-08-03 2022-09-06 创新奇智(成都)科技有限公司 Glass flaw positioning method and device
CN115239737A (en) * 2022-09-26 2022-10-25 淄博永丰环保科技有限公司 Corrugated paper defect detection method based on image processing
CN117350984A (en) * 2023-10-23 2024-01-05 保定景欣电气有限公司 Method and device for detecting shoulder-opening and fork-opening of monocrystalline silicon

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050659A (en) * 2014-05-26 2014-09-17 华中科技大学 Method for measuring workpiece linear edges
CN104614385A (en) * 2015-02-06 2015-05-13 北京中科纳新印刷技术有限公司 Microscopic quality detection method for printing, platemaking and imaging
CN105335963A (en) * 2015-09-24 2016-02-17 凌云光技术集团有限责任公司 Edge defect detection method and apparatus
CN106503720A (en) * 2016-10-19 2017-03-15 深圳市路远自动化设备有限公司 A kind of element image-recognizing method for removing suction nozzle interference
CN108805870A (en) * 2018-06-14 2018-11-13 安徽海思达机器人有限公司 A kind of detection method of the connector with needle stand
CN109086734A (en) * 2018-08-16 2018-12-25 新智数字科技有限公司 The method and device that pupil image is positioned in a kind of pair of eye image
US20190139251A1 (en) * 2016-05-16 2019-05-09 Hangzhou Hikrobot Technology Co., Ltd Method and Apparatus for Determining Volume of Object
CN110348307A (en) * 2019-06-10 2019-10-18 武汉理工大学 A kind of the routed edges recognition methods and system of vibrative mechanism climbing robot
CN110570471A (en) * 2019-10-17 2019-12-13 南京鑫和汇通电子科技有限公司 cubic object volume measurement method based on depth image
CN111275633A (en) * 2020-01-13 2020-06-12 五邑大学 Point cloud denoising method, system and device based on image segmentation and storage medium
CN111667477A (en) * 2020-06-10 2020-09-15 创新奇智(广州)科技有限公司 Magnetic material size defect detection method and device, detection equipment and readable storage medium
CN112330678A (en) * 2021-01-07 2021-02-05 中科慧远视觉技术(北京)有限公司 Product edge defect detection method
CN112651343A (en) * 2020-12-28 2021-04-13 哈尔滨市科佳通用机电股份有限公司 Railway wagon brake beam breaking fault identification method based on image processing

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050659A (en) * 2014-05-26 2014-09-17 华中科技大学 Method for measuring workpiece linear edges
CN104614385A (en) * 2015-02-06 2015-05-13 北京中科纳新印刷技术有限公司 Microscopic quality detection method for printing, platemaking and imaging
CN105335963A (en) * 2015-09-24 2016-02-17 凌云光技术集团有限责任公司 Edge defect detection method and apparatus
US20190139251A1 (en) * 2016-05-16 2019-05-09 Hangzhou Hikrobot Technology Co., Ltd Method and Apparatus for Determining Volume of Object
CN106503720A (en) * 2016-10-19 2017-03-15 深圳市路远自动化设备有限公司 A kind of element image-recognizing method for removing suction nozzle interference
CN108805870A (en) * 2018-06-14 2018-11-13 安徽海思达机器人有限公司 A kind of detection method of the connector with needle stand
CN109086734A (en) * 2018-08-16 2018-12-25 新智数字科技有限公司 The method and device that pupil image is positioned in a kind of pair of eye image
CN110348307A (en) * 2019-06-10 2019-10-18 武汉理工大学 A kind of the routed edges recognition methods and system of vibrative mechanism climbing robot
CN110570471A (en) * 2019-10-17 2019-12-13 南京鑫和汇通电子科技有限公司 cubic object volume measurement method based on depth image
CN111275633A (en) * 2020-01-13 2020-06-12 五邑大学 Point cloud denoising method, system and device based on image segmentation and storage medium
CN111667477A (en) * 2020-06-10 2020-09-15 创新奇智(广州)科技有限公司 Magnetic material size defect detection method and device, detection equipment and readable storage medium
CN112651343A (en) * 2020-12-28 2021-04-13 哈尔滨市科佳通用机电股份有限公司 Railway wagon brake beam breaking fault identification method based on image processing
CN112330678A (en) * 2021-01-07 2021-02-05 中科慧远视觉技术(北京)有限公司 Product edge defect detection method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
方新茂等: "基于机器视觉的方块地毯边缘缺陷检测技术", 《电子设计工程》 *
方新茂等: "基于机器视觉的方块地毯边缘缺陷检测技术", 《电子设计工程》, vol. 26, no. 3, 28 February 2018 (2018-02-28), pages 55 - 59 *
柳娜等: "基于最小外接矩形的直角多边形拟合算法", 《计算机科学》 *
柳娜等: "基于最小外接矩形的直角多边形拟合算法", 《计算机科学》, vol. 44, no. 6, 30 June 2017 (2017-06-30), pages 294 - 297 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113870266A (en) * 2021-12-03 2021-12-31 中导光电设备股份有限公司 Method and system for judging authenticity of line defect based on TFT-LCD
CN114800660A (en) * 2022-06-27 2022-07-29 浙江双元科技股份有限公司 Defect positioning system and method for sheet slitting
CN115018829A (en) * 2022-08-03 2022-09-06 创新奇智(成都)科技有限公司 Glass flaw positioning method and device
CN115239737A (en) * 2022-09-26 2022-10-25 淄博永丰环保科技有限公司 Corrugated paper defect detection method based on image processing
CN115239737B (en) * 2022-09-26 2022-12-13 淄博永丰环保科技有限公司 Corrugated paper defect detection method based on image processing
CN117350984A (en) * 2023-10-23 2024-01-05 保定景欣电气有限公司 Method and device for detecting shoulder-opening and fork-opening of monocrystalline silicon
CN117350984B (en) * 2023-10-23 2024-05-28 保定景欣电气有限公司 Method and device for detecting shoulder-opening and fork-opening of monocrystalline silicon

Also Published As

Publication number Publication date
CN113160161B (en) 2023-07-11

Similar Documents

Publication Publication Date Title
CN113160161B (en) Method and device for detecting defects at edge of target
CN111627009B (en) Screen detection method and device and head-mounted display equipment
CN111612781B (en) Screen defect detection method and device and head-mounted display equipment
CN111882520B (en) Screen defect detection method and device and head-mounted display equipment
CN109509166B (en) Printed circuit board image detection method and device
CN109948521B (en) Image deviation rectifying method and device, equipment and storage medium
CN112634201B (en) Target detection method and device and electronic equipment
CN109102026B (en) Vehicle image detection method, device and system
CN109741295B (en) Product quality detection method and device
CN117152165B (en) Photosensitive chip defect detection method and device, storage medium and electronic equipment
CN113034447A (en) Edge defect detection method and device
CN111325717A (en) Mobile phone defect position identification method and equipment
CN114519714A (en) Method and system for judging smudgy defect of display screen
CN114565558A (en) CMOS chip surface defect detection method and system
CN114612427A (en) Nameplate defect detection method and device, electronic equipment and storage medium
CN113160176B (en) Defect detection method and device
WO2014103617A1 (en) Alignment device, defect inspection device, alignment method, and control program
CN115719326A (en) PCB defect detection method and device
CN113379678A (en) Circuit board detection method and device, electronic equipment and storage medium
CN110288655B (en) Method and device for automatically identifying position of test pattern in chart picture
CN114627113B (en) Method, system, device and medium for detecting defects of printed circuit board
CN113378847B (en) Character segmentation method, system, computer device and storage medium
WO2023060927A1 (en) 3d grating detection method and apparatus, computer device, and readable storage medium
CN114397671B (en) Course angle smoothing method and device of target and computer readable storage medium
CN110782439B (en) Method and device for auxiliary detection of image annotation quality

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