WO2024040856A1 - 一种缺陷检测方法、装置、电子设备及存储介质 - Google Patents

一种缺陷检测方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2024040856A1
WO2024040856A1 PCT/CN2023/070587 CN2023070587W WO2024040856A1 WO 2024040856 A1 WO2024040856 A1 WO 2024040856A1 CN 2023070587 W CN2023070587 W CN 2023070587W WO 2024040856 A1 WO2024040856 A1 WO 2024040856A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
defect
silk screen
screen
edge
Prior art date
Application number
PCT/CN2023/070587
Other languages
English (en)
French (fr)
Inventor
孙高磊
曹康
吴丰礼
Original Assignee
广东拓斯达科技股份有限公司
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 广东拓斯达科技股份有限公司 filed Critical 广东拓斯达科技股份有限公司
Publication of WO2024040856A1 publication Critical patent/WO2024040856A1/zh

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/10Segmentation; Edge detection
    • G06T7/155Segmentation; Edge detection involving morphological operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection

Definitions

  • Embodiments of the present application relate to the field of image processing technology, and in particular, to a defect detection method, device, electronic equipment and storage medium.
  • Embodiments of the present application provide a defect detection method, device, electronic equipment and storage medium to automatically detect whether there are defects on the edges of silk screen printing.
  • a defect detection method which may include:
  • For each screen printing point determine the reference slope of the reference point corresponding to the screen printing point and the slope difference between the screen printing slope of the screen printing point, and determine whether the screen printing point is a defective point based on the slope difference;
  • a defect detection device which may include:
  • the image acquisition module is used to obtain the screen printing image generated after image collection of the screen printing product for screen printing products that require screen printing edge detection, as well as reference products that are of the same category as the screen printing product and have been tested and determined to have no defects on the screen printing edge, and to obtain the screen printing image of the reference product.
  • the reference image generated after image collection of the product is used to obtain the screen printing image generated after image collection of the product;
  • the edge extraction module is used to extract the silk screen edge from the silk screen image, and extract the reference edge from the reference image, where there are reference points on the reference edge corresponding to each silk screen point on the silk screen edge;
  • the defective point determination module is used to determine, for each silkscreen point, the reference slope of the reference point corresponding to the silkscreen point and the slope difference between the silkscreen slope of the silkscreen point, and determine whether the silkscreen point is a defective point based on the slope difference;
  • the defect detection module is used to detect whether there are defects on the edges of the silk screen based on whether each silk screen point is a defect point.
  • an electronic device which may include:
  • a memory communicatively connected to at least one processor; wherein,
  • the memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor, so that when executed by at least one processor, the defect detection method provided by any embodiment of the present application is implemented.
  • a computer-readable storage medium is provided, with computer instructions stored thereon.
  • the computer instructions are used to implement the defect detection method provided by any embodiment of the present application when executed by a processor.
  • the technical solution of the embodiment of the present application is to obtain the screen printing image generated after image collection of the screen printing product by targeting screen printing products that require screen printing edge detection and reference products that are of the same category as the screen printing products and have been tested and determined to have no defects in the screen printing edges. And the reference image generated after image collection of the reference product; and extract the silk screen edge from the silk screen image, and extract the reference edge from the reference image, where there are on the reference edge corresponding to each silk screen point on the silk screen edge.
  • the technical solution of the embodiment of the present application determines the defective points based on the silkscreen points on the silkscreen edge, and then detects the defects on the silkscreen edge based on the defective points, which can automatically detect whether there are defects on the silkscreen edge and achieve the effect of quickly and accurately detecting silkscreen defects. .
  • Figure 1 is a flow chart of a defect detection method provided according to Embodiment 1 of the present application.
  • Figure 2 is a flow chart of a defect detection method provided according to Embodiment 2 of the present application.
  • Figure 3 is a schematic diagram of a burr defect in a defect detection method provided according to Embodiment 2 of the present application;
  • Figure 4 is a schematic diagram of a notch defect in a defect detection method provided according to Embodiment 2 of the present application;
  • Figure 5 is a flow chart of a defect detection method provided according to Embodiment 3 of the present application.
  • Figure 6 is a schematic diagram of the silk screen point determination process in a defect detection method provided in Embodiment 3 of the present application.
  • Figure 7 is a flow chart for implementing an optional example of a defect detection method provided in Embodiment 3 of the present application.
  • Figure 8 is a flow chart of another optional example of a defect detection method provided according to Embodiment 3 of the present application.
  • Figure 9 is a structural block diagram of a defect detection device provided according to Embodiment 4 of the present application.
  • Figure 10 is a schematic structural diagram of an electronic device that implements the defect detection method according to the embodiment of the present application.
  • Figure 1 is a flow chart of a defect detection method provided in Embodiment 1 of the present application. This embodiment can be applied to detecting silk screen defects. This method can be performed by the defect detection device provided in the embodiment of the present application.
  • the device can be implemented in software and/or hardware.
  • the device can be integrated on an electronic device, and the electronic device can be various user terminals or servers.
  • the method of the embodiment of the present application specifically includes the following steps:
  • the silk screen edge can be understood as the edge contour of the silk screen product.
  • Silk screen products can be understood as products that require defect detection on the silk screen edges on themselves.
  • Reference products can be understood as products of the same category as screen-printed products, and which have been manually or automatically inspected to determine that there are no defects on the screen-printed edges. In practical applications, optionally, the reference products and screen-printed products of the same category here can be the same screen-printed products.
  • the screen-printed image and reference image generated after image collection of the screen-printed product and the reference product may have reflective spots.
  • the reflective point is a sudden change point in the image, it will cause the slope of the screen printing edge curve to increase, thereby causing a misjudgment of screen printing edge defects. Therefore, after obtaining the screen printing image and the reference image, the reflective points can be removed. related processing.
  • the above-mentioned related processing can be pre-processing such as filtering, denoising, and morphological operations, and can also be implemented based on a pre-trained neural network model, etc., which are not specifically limited here.
  • an outline image that is exactly the same as the edge outline shape and size of the silk screen product without defects as a reference image.
  • the outline image can be the design image of the screen printing designer when designing the screen printing product.
  • the reference edge can be understood as the edge profile of the reference product in the reference image.
  • the extraction steps of extracting the silk screen edge from the silk screen image and extracting the reference edge from the reference image may be the same or different, and are not specifically limited here.
  • the extracted silk screen edge can be considered to be formed by connecting the silk screen points extracted from the silk screen image.
  • the extracted reference edge can be considered to be formed from each reference point extracted from the reference image. Made up of wires.
  • each reference point on the reference edge corresponds to each silk screen point on the silk screen edge.
  • the silk screen points can be understood as points that can constitute the silk screen edge
  • the reference points can be understood as points that can constitute the reference edge.
  • the reference slope can be understood as the slope of the reference edge at the reference point.
  • the slope of screen printing can be understood as the slope of the screen printing edge at the screen printing point.
  • a defective point can be understood as a point that can indicate that the silk screen edge has a defect at that point. It should be noted that considering that the screen printing edge curve is usually relatively smooth, if there are burr defects or notch defects on it, it will cause a sudden change in the slope of the screen printing edge curve. The difference in the slope of the curve between the defect location and other surrounding locations is relatively large. , so the characteristics of the above-mentioned screen printing edge curve can be used to detect whether there are defects on the screen printing edge.
  • the slope difference between the reference slope of the reference point corresponding to the screen printing point and the screen printing slope of the screen printing point can be determined, so as to determine whether the screen printing point is based on the slope difference. Defect points. For example, the slope difference is compared with the preset slope difference range. If the slope difference is not within the slope difference range, the silk screen point is determined to be a defective point; and for example, the slope difference is The absolute value of the difference is compared with the preset slope difference threshold. If the absolute value of the slope difference is greater than the slope difference threshold, the silk screen point is determined to be a defective point.
  • a plane rectangular coordinate system can be established on the silk screen image and the reference image respectively (or the image coordinate system of the silk screen image and the reference image itself can be directly applied), and a serial number can be set for each silk screen point and reference point.
  • Each silk screen point can be The serial number of its corresponding reference point is the same.
  • the silk screen slope and reference slope can be calculated through the following two formulas:
  • f' 0 (X(t), Y(t)) is the reference slope corresponding to the reference point.
  • f 0 (X(t), Y(t)) is the screen printing slope corresponding to the screen printing point.
  • the silk screen point when the silk screen point is a defective point, it means that there may be a defect in the silk screen edge at the defective point. Therefore, in the embodiment of the present application, whether there is a defect on the edge of the silk screen can be detected based on whether each silk screen point is a defective point. For example, if the proportion of the silk screen dot that is a defective point in all the silk screen points exceeds the preset proportion When the threshold value or the candidate defect area formed by the silk screen dots of the defect points meets the preset defect conditions, it is determined that there is a defect on the silk screen edge.
  • the technical solution of the embodiment of the present application is to obtain the screen printing image generated after image collection of the screen printing product by targeting screen printing products that require screen printing edge detection and reference products that are of the same category as the screen printing products and have been tested and determined to have no defects in the screen printing edges.
  • the reference image generated after image collection of the reference product the silk screen edge is extracted from the silk screen image, and the reference edge is extracted from the reference image, where there are references on the reference edge corresponding to each silk screen point on the silk screen edge.
  • the technical solution of the embodiment of the present application uses the reference slope of the reference point as a benchmark and compares it with the screen printing slope of the screen printing point, so that it can be judged whether the screen printing point is a defective point, and whether there is a defect on the screen printing edge can be automatically detected. , achieving the effect of quickly and accurately detecting screen printing defects.
  • Figure 2 is a flow chart of another defect detection method provided in Embodiment 2 of the present application.
  • detecting whether there is a defect on the edge of the screen printing according to whether each screen printing point is a defect point includes: extracting at least one screen printing point from each screen printing point according to whether each screen printing point is a defect point. Defect points, and construct at least one pseudo defect area based on at least one defect point; for each pseudo defect area, determine whether the pseudo defect area is a real defect area based on the area and/or size of the pseudo defect area; based on each Check whether the pseudo defective area is a real defective area and detect whether there are defects on the edge of the silk screen.
  • the explanations of terms that are the same as or corresponding to the above embodiments will not be repeated here.
  • the method in this embodiment may specifically include the following steps:
  • S220 Extract the silk screen edge from the silk screen image, and extract the reference edge from the reference image, where there are reference points on the reference edge corresponding to each silk screen point on the silk screen edge.
  • each silk screen point is a defect point
  • extract at least one defect point from each silk screen point and construct at least one pseudo defect area based on at least one defect point.
  • the silk screen point is a defect point
  • At least one defect point in each silk screen point can be extracted, and at least one pseudo defect area can be constructed based on at least one defect point.
  • a pseudo-defect area is constructed based on all defect points; a pseudo-defect area is constructed by connecting defect points adjacent to each other in at least one defect point, thereby obtaining at least one pseudo-defect area; etc., which are not detailed here. limited.
  • each defect area constructed based on at least one defect point A pseudo defective area is not guaranteed to be a real defective area, but is just a defective area that may be a real defective area.
  • For each pseudo defective area determine whether the pseudo defective area is a real defective area based on the area and/or size of the pseudo defective area.
  • the area and/or area size of the pseudo defective area can be calculated, and then it is determined whether the pseudo defective area is based on the area area and/or the area size. It is a real defective area.
  • the area size can be represented by the width and/or height of the minimum circumscribed rectangle of the pseudo defective area.
  • the area threshold and/or the size threshold may be preset, the area area and/or the area size of the pseudo defect area may be calculated, the area area may be compared with the area threshold and/or the area size may be compared with the size threshold, if the area If the area is greater than the area threshold and/or the area size is greater than the size threshold, it is determined that the pseudo defective area is a real defective area.
  • the real defect area can be understood as the pseudo defect area in which defects do exist.
  • each pseudo defect area is a real defect area.
  • each pseudo defect area is a real defect area, or When the proportion of the pseudo-defect area belonging to the real defect area in the total defect area exceeds the preset proportion threshold, it means that there is a defect at the edge of the silk screen, and the real defect area can be detected as a defect.
  • the technical solution of the embodiment of the present application extracts at least one defective point from each silkscreen point according to whether each silkscreen point is a defective point, and constructs at least one pseudo defective area based on at least one defective point; for each pseudodefect area, determine whether the pseudo-defect area is a real defect area based on the area and/or size of the pseudo-defect area; detect whether there is a defect on the edge of the silk screen based on whether each pseudo-defect area is a real defect area. By determining whether the pseudo defect area is a real defect area, the accuracy of defect detection is further improved.
  • the defect detection method also includes: obtaining the serial number of each silk screen point respectively, wherein the serial number of the silk screen point is used to characterize the position of the silk screen point on the screen printing edge; constructing a method based on at least one defect point Obtaining at least one pseudo-defect area includes: determining at least one defect group from at least one defect point, wherein the serial numbers of each defect point in each defect group are connected; for each defect group, based on each defect in the defect group Point construction obtains pseudo-defect areas.
  • the serial number of each screen printing point can be obtained after extracting the screen printing edge, and the serial number of the screen printing point is used to represent the position of the screen printing point on the screen printing edge.
  • the serial numbers of the silk screen points are arranged sequentially, you can only obtain the serial number of any silk screen dot on the edge of the silk screen, and according to the serial number of the silk screen point and the arrangement direction of the silk screen dot serial numbers, you can The clockwise or counterclockwise direction of the silk screen edge will determine the serial number of other silk screen points.
  • the serial number of any screen printing point on the edge of the silk screen is 3, if the serial numbers are arranged in a clockwise direction, you can know that the serial number of the next silk printing point in the clockwise direction is 4, and the serial number of the next silk printing point is 5, and so on, to get the serial number of each silk screen point; it can also be known that the serial number of the next silk screen point in the counterclockwise direction is 2, and so on, so as to get the serial number of each silk screen point.
  • the serial number of each reference point can also be obtained.
  • the serial number of the reference point is the same as the serial number of the corresponding silk screen point, that is, the position of the reference point on the reference edge is the same as the position of the corresponding silk screen point.
  • the silk screen edges are in the same position.
  • Each defect point with consecutive serial numbers in at least one defect point can be formed into a defect group, thereby obtaining at least one defect group.
  • the defect points within it can be linearly connected according to their respective serial numbers, so that the area obtained after the connection is used as a pseudo defect area.
  • a defect group can be understood as a group containing at least two defect points with consecutive serial numbers.
  • a pseudo defect area can be constructed based on each defect group.
  • each defect point in each defect group is connected according to their respective serial numbers to construct a pseudo defect area, so that each originally independent defect point can be constructed into a more integrated one according to its location.
  • the pseudo-defect area facilitates subsequent judgment of whether there are defects on the edge of the silk screen.
  • the defect detection method also includes: when detecting defects on the edge of the silk screen, determining that the defects on the edge of the silk screen are located in the real defect area; Gray value, obtain the gray average value of the real defect area, and determine the defect type corresponding to the real defect area based on the gray average value.
  • the area points can be understood as pixels in the real defect area.
  • the gray level mean can be understood as the average level value of the gray level value of each area point.
  • the defect type can be understood as the type of defect on the screen printing edge, such as a burr defect or a notch defect.
  • the average gray value of the real defect area can be obtained based on the gray value of each area point in the real defect area, and the defect type corresponding to the real defect area can be determined based on the average gray value.
  • a region point selection rule can be preset for each real defect area, and the gray level in the real defect area that can represent the real defect area is selected according to the area point selection rules. value of partial area points, and then obtain the grayscale mean value of the real defective area based on the grayscale value of the partial area points, thereby determining the defect type corresponding to the real defective area based on the grayscale mean value.
  • the area point selection rule can be understood as a rule that can select partial area points that can represent the overall gray value of the real defect area.
  • the area point selection rule can be to select a region every preset number of pixel points in the real defect area. point.
  • the defect type corresponding to the real defect area is determined based on the gray average value, and the real defect on the edge of the silk screen located in the real defect area can be determined relatively simply and quickly.
  • the defect type of the defect within the area is determined based on the gray average value, and the real defect on the edge of the silk screen located in the real defect area can be determined relatively simply and quickly.
  • another optional technical solution is to determine the defect type corresponding to the real defect area based on the gray average value, including: obtaining the preset gray threshold; when the gray average is greater than or equal to the gray threshold In this case, the defect type corresponding to the real defect area is a notch defect, otherwise it is a burr defect.
  • the burr defects in the convex state among the silk screen defects are usually darker in color; see Figure 4, the notch defects in the concave state are lighter in color.
  • the grayscale threshold corresponding to the screen printing product can be pre-set according to the category of the screen printing product, and the preset grayscale threshold can be obtained.
  • the average grayscale value is greater than or equal to the grayscale threshold, the real defect area corresponds to The defect type is notch defect, otherwise it is burr defect.
  • the grayscale threshold can also be the grayscale mean of the reference image.
  • the defect type is determined based on the comparison result of the grayscale mean value and the grayscale threshold, so that the type of defect on the screen printing edge can be determined more accurately.
  • Figure 5 is a flow chart of a defect detection method provided in Embodiment 3 of the present application.
  • extracting the silk screen edge from the silk screen image includes: extracting drawing lines from the silk screen image, wherein drawing the lines includes, after generating the silk screen image, drawing along the lines to be extracted from the silk screen image.
  • a line drawn on the edge of the silk screen for each drawing point on the drawn line, starting from the drawing point, traverse the pixels on the silk screen image along the normal direction, and determine the silk screen point from each pixel, where the normal
  • the direction is toward the silk screen edge and perpendicular to the direction of the drawn line; the edge formed by connecting all the silk screen points is used as the extracted silk screen edge.
  • the method in this embodiment may specifically include the following steps:
  • drawing lines can be understood as lines drawn on the silk screen image that are close to the silk screen edges to be extracted from the silk screen image that require defect detection.
  • the number of lines to be drawn can be one or more; the position of the lines to be drawn can be inside or outside the edge of the silk screen; the shape of the lines can be straight lines or curves; the lines can be drawn It can be drawn manually according to the edge of the silk screen, or it can be drawn automatically according to the position of the silk screen product in the silk screen image.
  • the drawing points can be understood as points set at preset distances on the drawing lines, and the drawing points can be the pixels occupied by the drawing lines on the silk screen image.
  • the extracted silk screen points are points on the edge of the silk screen product in the silk screen image, the edge formed by connecting all the silk screen points can be used as the extracted silk screen edge.
  • the process of extracting the reference edge from the reference image and the process of extracting the silk screen edge from the silk screen image may be the same or different.
  • the positions of the silk screen products in the screen printing image and the reference products in the reference image can be corrected, so that the drawing lines extracted from the reference image and the drawing points on the drawing lines are compared with the position and shape of the reference product in the reference image.
  • quantity, the position, shape and quantity of the silk-screened products in the silk-screen image are exactly the same as those of the drawn lines extracted from the silk-screen image and the drawn points on the drawn lines.
  • the technical solution of the embodiment of the present application is to extract drawing lines from the silk screen image, and for each drawing point on the drawing line, starting from the drawing point, traverse the pixel points on the silk screen image along the normal direction, and start from each drawing point. Determine the silk screen points in the pixels, and then connect all the silk screen points to form an edge, which can be used as the extracted silk screen edge, thereby improving the accuracy of the extracted silk screen edge.
  • An optional technical solution to determine the silk screen points from each pixel point including: for each current point in each pixel point, calculate the grayscale between the grayscale value of the current point and the grayscale value of the adjacent point The absolute value of the difference, where the adjacent points are the pixels traversed after the current point and adjacent to the current point among each pixel point; the current point corresponding to the largest absolute value is used as the silk screen point.
  • the current point can be understood as the current pixel along the normal direction to calculate whether it is a silk screen point.
  • the current point can also be the pixel point within the current preset distance range along the normal direction to calculate whether it is a silk screen point.
  • the difference in grayscale value between pixels located on the silk screen pattern (such as silk screen text) and pixels not located on the silk screen pattern is more significant. Therefore, based on this characteristic , for each current point in each pixel, the absolute value of the grayscale difference between the grayscale value of the current point and the grayscale value of the adjacent point can be calculated, and the absolute values corresponding to each current point can be compared with each other. , and use the current point corresponding to the largest absolute value as the silk screen point.
  • the normal direction can be used as the horizontal axis
  • the ordinate is g(x)
  • the gray value of the current point is f(x, g(x)).
  • Absolute value and find the largest absolute value max(
  • the preset distance range can be used as the definition domain of x.
  • the current point corresponding to the absolute value of the grayscale difference between the maximum grayscale value of the current point and the grayscale value of the adjacent point is used as the silkscreen point, and the silkscreen point can be accurately determined.
  • images of the silk screen product and the reference product are collected, and the collected silk screen images and reference images are respectively preprocessed to remove reflective points; the silk screen edges are extracted from the preprocessed silk screen images, and Calculate the screen printing slope of the screen printing edge at each screen printing point, extract the reference edge from the preprocessed reference image, and calculate the reference slope of the reference edge at each reference point; calculate the screen printing slope at each screen printing point and the slope difference of the reference slope of the corresponding reference point.
  • the silk screen point is a defect point, thereby determining the defect point from these silk screen points; according to the defect Points are constructed to construct a pseudo-defect area, and it is judged whether there is a real defect area in the pseudo-defect area. If there is no real defect area in the pseudo-defect area, it means that the silk screen product is qualified; if there is a real defect area in the pseudo-defect area, each real defect area is judged separately. Whether the gray average value is greater than the gray threshold. If it is greater than the gray threshold, it means that the defect in the real defect area is a notch defect. If it is less than or equal to the gray threshold, it means that the defect in the real defect area is a burr defect.
  • images of the silk screen product and the reference product are collected, and the collected silk screen images and reference images are respectively preprocessed to remove reflective points, and the silk screen edges are extracted from the preprocessed silk screen images, and Extract the reference edge from the preprocessed reference image and analyze it to determine whether there is a defect on the silk screen edge; if there is a defect, classify the real defect area where the defect is located, and end the defect detection process after the classification is completed; if there is no defect, Then it is determined whether the photographing of the screen-printed product that requires defect detection is completed. If the photographing is completed, the defect detection process is ended. If it is not completed, the image of the silk-screened product is collected again.
  • FIG. 9 is a structural block diagram of a defect detection device provided in Embodiment 4 of the present application.
  • the device is used to execute the defect detection method provided in any of the above embodiments.
  • This device and the defect detection method in each of the above embodiments belong to the same application concept.
  • the device may specifically include: an image acquisition module 410 , an edge extraction module 420 , a defect point determination module 430 and a defect detection module 440 .
  • the image acquisition module 410 is used to obtain the silk screen image generated after image collection of the silk screen product for the silk screen products that require screen printing edge detection, and reference products that are of the same category as the silk screen products and have been tested and determined to have no defects in the silk screen edges. and the reference image generated after image acquisition of the reference product;
  • the edge extraction module 420 is used to extract the silk screen edge from the silk screen image, and extract the reference edge from the reference image, where there are reference points on the reference edge corresponding to each silk screen point on the silk screen edge;
  • the defective point determination module 430 is used to determine, for each silkscreen point, the reference slope of the reference point corresponding to the silkscreen point and the slope difference between the silkscreen slope of the silkscreen point, and determine whether the silkscreen point is a defective point based on the slope difference. ;
  • the defect detection module 440 is used to detect whether there are defects on the edges of the silk screen according to whether each silk screen point is a defect point.
  • the defect detection module 440 may include:
  • a pseudo defect area obtaining unit is used to extract at least one defect point from each silk screen point based on whether each silk screen point is a defect point, and construct at least one pseudo defect area based on at least one defect point;
  • a real defect area determination unit configured to determine, for each pseudo defect area, whether the pseudo defect area is a real defect area based on the area and/or size of the pseudo defect area;
  • the defect detection unit is used to detect whether there are defects on the edge of the silk screen based on whether each pseudo defect area is a real defect area.
  • optional defect detection devices can also include:
  • the serial number acquisition module is used to obtain the serial number of each silk screen point respectively, where the serial number of the silk screen point is used to represent the position of the silk screen point on the silk screen edge;
  • the pseudo-defect area is obtained as a unit, which can include:
  • the defect group determination subunit is used to determine at least one defect group from at least one defect point, wherein the serial numbers of the defect points in each defect group are connected;
  • the pseudo-defect area construction subunit is used to construct a pseudo-defect area for each defect group based on each defect point in the defect group.
  • optional defect detection devices can also include:
  • the defect location determination module is used to determine that the defect on the edge of the silk screen is located within the real defect area when a defect is detected on the edge of the silk screen;
  • the defect type determination module is used to obtain the gray average value of the real defect area based on the gray value of each area point in the real defect area, and determine the defect type corresponding to the real defect area based on the gray average value.
  • the optional defect type determination module can include:
  • a grayscale threshold acquisition unit used to obtain a preset grayscale threshold
  • the defect type determination unit is used to determine the defect type corresponding to the real defect area when the mean gray value is greater than or equal to the gray threshold, otherwise it is a burr defect.
  • the edge extraction module 420 may include:
  • the drawing line extraction unit is used to extract the drawing lines from the silk screen image, wherein the drawing lines include lines drawn along the edges of the silk screen to be extracted from the silk screen image after the silk screen image is generated;
  • the screen printing point determination unit is used for each drawing point on the drawing line, taking the drawing point as the starting point, traversing the pixel points on the silk screen image along the normal direction, and determining the silk printing point from each pixel point, where the normal line
  • the direction is towards the edge of the silk screen and perpendicular to the direction of the drawn lines;
  • the screen printing edge extraction unit is used to connect all the screen printing points to form an edge as the extracted screen printing edge.
  • the optional silk screen point determination unit can include:
  • the grayscale difference calculation subunit is used to calculate, for each current point in each pixel point, the absolute value of the grayscale difference between the grayscale value of the current point and the grayscale value of the adjacent point, where Neighbor points are pixel points traversed after the current point among each pixel point and adjacent to the current point;
  • the silk screen point is used as a sub-unit to use the current point corresponding to the largest absolute value as the silk screen point.
  • the defect detection device provided in Embodiment 4 of the present application uses an image acquisition module to acquire images of silk-screen products for screen-printed products that require screen-printing edge detection, as well as reference products that are in the same category as the screen-printing products and have been tested and determined to have no defects on the screen-printing edges.
  • the device of the embodiment of the present application determines defective points based on the silkscreen points on the silkscreen edge, and then detects defects on the silkscreen edge based on the defective points, so that it can automatically detect whether there are defects on the silkscreen edge, achieving the effect of quickly and accurately detecting silkscreen defects.
  • the defect detection device provided by the embodiments of this application can execute the defect detection method provided by any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method.
  • the various units and modules included are only divided according to functional logic, but are not limited to the above divisions, as long as they can realize the corresponding functions; in addition, each unit and module is not limited to the above division.
  • the specific names of the functional units are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present application.
  • FIG. 10 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present application.
  • Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.
  • Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (eg, helmets, glasses, watches, etc.), and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the present application as described and/or claimed herein.
  • the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores There is a computer program that can be executed by at least one processor.
  • the processor 11 can perform the operation according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. Perform various appropriate actions and processing.
  • RAM 13 various programs and data required for the operation of the electronic device 10 can also be stored.
  • the processor 11 , the ROM 12 and the RAM 13 are connected to each other via the bus 14 .
  • An input/output (I/O) interface 15 is also connected to bus 14 .
  • the I/O interface 15 Multiple components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc. etc.; and communication unit 19, such as network card, modem, wireless communication transceiver, etc.
  • the communication unit 19 allows the electronic device 10 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.
  • Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processing processor (DSP), and any appropriate processor, controller, microcontroller, etc.
  • the processor 11 performs various methods and processes described above, such as defect detection methods.
  • the defect detection method may be implemented as a computer program, which is tangibly embodied in a computer-readable storage medium, such as the storage unit 18 .
  • part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19 .
  • the computer program When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the defect detection method described above may be performed.
  • the processor 11 may be configured to perform the defect detection method in any other suitable manner (eg, by means of firmware).
  • Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof.
  • FPGAs field programmable gate arrays
  • ASICs application specific integrated circuits
  • ASSPs application specific standard products
  • SOC system
  • CPLD load programmable logic device
  • computer hardware firmware, software, and/or a combination thereof.
  • These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor
  • the processor which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when executed by the processor, the computer program causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented.
  • a computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
  • a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device.
  • Computer-readable storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • the computer-readable storage medium may be a machine-readable signal medium.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the systems and techniques described herein may be implemented on an electronic device having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display)) for displaying information to the user monitor); and a keyboard and pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device.
  • a display device eg, a CRT (cathode ray tube) or LCD (liquid crystal display)
  • a keyboard and pointing device e.g., a mouse or a trackball
  • Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.
  • the systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system.
  • the components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
  • Computing systems may include clients and servers.
  • Clients and servers are generally remote from each other and typically interact over a communications network.
  • the relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other.
  • the server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the problems of difficult management and weak business scalability in traditional physical hosts and VPS services. defect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Inking, Control Or Cleaning Of Printing Machines (AREA)

Abstract

本申请实施例公开了一种缺陷检测方法、装置、电子设备及存储介质。该方法包括:针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘;针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。本申请实施例的技术方案,可以自动检测出丝印边缘上是否存在缺陷。

Description

一种缺陷检测方法、装置、电子设备及存储介质
本申请要求在2022年08月24日提交中国专利局、申请号为202211021182.1的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及图像处理技术领域,尤其涉及一种缺陷检测方法、装置、电子设备及存储介质。
背景技术
随着丝印技术的快速发展,样式多样并且精美的丝印产品越来越受到人们的喜爱。需要注意的是,由于丝印过程中应用的油墨为黏稠状,这就可能导致在丝印边缘上存在一些缺陷,这些缺陷会对丝印效果产生影响。
针对此,为了保证丝印效果,主要是通过人工目测来检测丝印边缘上是否存在缺陷,但是这种缺陷检测方案存在检测速度较慢和准确率较低的问题。
发明内容
本申请实施例提供了一种缺陷检测方法、装置、电子设备及存储介质,以自动检测出丝印边缘上是否存在缺陷。
根据本申请的一方面,提供了一种缺陷检测方法,可以包括:
针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;
从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;
针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;
根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。
根据本申请的另一方面,提供了一种缺陷检测装置,可以包括:
图像获取模块,用于针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;
边缘提取模块,用于从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;
缺陷点确定模块,用于针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;
缺陷检测模块,用于根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。
根据本申请的另一方面,提供了一种电子设备,可以包括:
至少一个处理器;以及
与至少一个处理器通信连接的存储器;其中,
存储器存储有可被至少一个处理器执行的计算机程序,计算机程序被至少一个处理器执行,以使至少一个处理器执行时实现本申请任意实施例所提供的缺陷检测方法。
根据本申请的另一方面,提供了一种计算机可读存储介质,其上存储有计算机指令,该计算机指令用于使处理器执行时实现本申请任意实施例所提供的缺陷检测方法。
本申请实施例的技术方案,通过针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;并从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;再针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。本申请实施例的技术方案,根据丝印边缘上的丝印点确定缺陷点,再根据缺陷点检测丝印边缘的缺陷,可以实现自动检测出丝印边缘上是否存在缺陷,达到快速准确的检测丝印缺陷的效果。
附图说明
图1是根据本申请实施例一提供的一种缺陷检测方法的流程图;
图2是根据本申请实施例二提供的一种缺陷检测方法的流程图;
图3是根据本申请实施例二提供的一种缺陷检测方法中毛刺缺陷的示意图;
图4是根据本申请实施例二提供的一种缺陷检测方法中缺口缺陷的示意图;
图5是根据本申请实施例三提供的一种缺陷检测方法的流程图;
图6是实现本申请实施例三提供的一种缺陷检测方法中的丝印点确定过程的示意图;
图7是实现本申请实施例三提供的一种缺陷检测方法中的可选示例的流程图;
图8是根据本申请实施例三提供的一种缺陷检测方法中的另一可选示例的流程图;
图9是根据本申请实施例四提供的一种缺陷检测装置的结构框图;
图10是实现本申请实施例的缺陷检测方法的电子设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。“目标”、“原始”等的情况类似,在此不再赘述。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
实施例一
图1是本申请实施例一中所提供的一种缺陷检测方法的流程图。本实施例可适用于对丝印缺陷进行检测的情况。该方法可以由本申请实施例提供的缺陷检测装置来执行,该装置可以由软件和/或硬件的方式实现,该装置可以集成在电子设备上,该电子设备可以是各种用户终端或服务器。
参见图1,本申请实施例的方法具体包括如下步骤:
S110、针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生 成的丝印图像、以及对参考产品进行图像采集后生成的参考图像。
其中,丝印边缘可以理解为丝印产品的边缘轮廓。丝印产品可以理解为需要对自身上的丝印边缘进行缺陷检测的产品。参考产品可以理解为与丝印产品品类相同,且经过人工或是自动检测确定丝印边缘没有缺陷的产品,实际应用中,可选的,这里的品类相同的参考产品与丝印产品可以是将相同的丝印样式印刷至完全相同的两个被印刷产品上后得到的产品,该完全相同的两个被印刷产品可以是形状和大小等外观完全相同的产品。
可以理解的是,由于丝印产品的表面可能会具有反光的特性,因此对丝印产品和参考产品进行图像采集后生成的丝印图像和参考图像可能会存在反光点。考虑到反光点在图像中是一个突变点,会引起丝印边缘曲线的斜率增大,从而造成对丝印边缘缺陷的误判,因此在获取到丝印图像和参考图像后,可以对其进行去除反光点的相关处理。在本申请实施例中,上述相关处理可以是过滤、去噪和形态学运算等预处理,还可以根据预先训练好的神经网络模型实现,等等,在此未做具体限定。
实际应用中,可选的,还可以是直接将与丝印产品在没有缺陷的情况下的边缘轮廓形态和大小完全相同的轮廓图像作为参考图像。轮廓图像可以是丝印设计人员在设计丝印产品时的设计图像。
S120、从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点。
其中,参考边缘可以理解为参考图像中的参考产品的边缘轮廓。从丝印图像中提取出丝印边缘和从参考图像中提取出参考边缘的提取步骤可以是相同或是不同的,在此未做具体限定。
需要注意的是,提取出的丝印边缘可以认为由从丝印图像中提取出的各个丝印点连线而成的,类似的,提取出的参考边缘可以认为由从参考图像中提取出的各个参考点连线而成的。另外,参考边缘上的各个参考点与丝印边缘上的各个丝印点一一对应。其中,丝印点可以理解为能够构成丝印边缘的点,参考点可以理解为能够构成参考边缘的点。
S130、针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点。
其中,参考斜率可以理解为参考边缘在参考点处的斜率。丝印斜率可以理解为丝印边缘在丝印点处的斜率。缺陷点可以理解为能够表征丝印边缘在该点处具有缺陷的点。需要注意的是,考虑到丝印边缘曲线通常较为平滑,如果其上面有毛刺缺陷或是缺口缺陷时就会造成丝印边缘曲线斜率发生突变,缺陷位 置与周围其他位置相比曲线的斜率差值比较大,因此可以利用上述丝印边缘曲线的特性检测丝印边缘上是否存在缺陷。
在本申请实施例中,针对每个丝印点,可以确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,从而根据该斜率差值确定该丝印点是否为缺陷点。示例性的,将斜率差值与预先设定的斜率差值范围进行比对,若斜率差值不在斜率差值范围之内,则将该丝印点确定为缺陷点;再示例性的,将斜率差值的绝对值与预先设定好的斜率差值阈值进行比对,若斜率差值的绝对值大于斜率差值阈值,则将该丝印点确定为缺陷点。
示例性的,可以在丝印图像和参考图像上分别建立平面直角坐标系(或是直接应用丝印图像和参考图像自身的图像坐标系),为每个丝印点和参考点设置一个序号,各个丝印点与其对应的参考点序号相同,获取每个丝印点和参考点分别在其对应的平面直角坐标系上的坐标点,丝印点或参考点分别在其对应的平面直角坐标系上的坐标可以为(X(t),Y(t)),t=1,2…N为丝印点或参考点的序号。可以通过如下两个公式计算丝印斜率和参考斜率:
Figure PCTCN2023070587-appb-000001
Figure PCTCN2023070587-appb-000002
其中,f’ 0(X(t),Y(t))是参考点对应的参考斜率。f 0(X(t),Y(t))是丝印点对应的丝印斜率。
计算丝印斜率与参考斜率之间的斜率差值的绝对值d=|f 0(X(t),Y(t))-f’ 0(X(t),Y(t))|,将d与预先设定好的斜率差值阈值δt进行比对,如果d大于δt,则将该丝印点确定为缺陷点。
S140、根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。
其中,在丝印点为缺陷点的情况下,说明在缺陷点处的丝印边缘可能存在有缺陷。因此,在本申请实施例中,可以根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷,例如在为缺陷点的丝印点在全部丝印点中的占比超过预设占比阈值、或是为缺陷点的丝印点构成的候选缺陷区域满足预设缺陷条件的情况下,确定丝印边缘上存在缺陷。
本申请实施例的技术方案,通过针对存在丝印边缘检测需求的丝印产品、及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘, 其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;再针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。本申请实施例的技术方案,通过将参考点的参考斜率作为基准,与丝印点的丝印斜率进行对比,从而可以判断该丝印点是否为缺陷点,由此可以自动检测出丝印边缘上是否存在缺陷,达到了快速准确的检测丝印缺陷的效果。
实施例二
图2是本申请实施例二中提供的另一种缺陷检测方法的流程图。本实施例以上述各技术方案为基础进行优化。在本实施例中,可选的,根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷,包括:根据每个丝印点是否为缺陷点,从各个丝印点中提取出至少一个缺陷点,并根据至少一个缺陷点构建得到至少一个伪缺陷区域;针对每个伪缺陷区域,根据伪缺陷区域的区域面积和/或区域尺寸,确定伪缺陷区域是否为真实缺陷区域;根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上是否存在缺陷。其中,与上述各实施例相同或相应的术语的解释在此不再赘述。
参见图2,本实施例的方法具体可以包括如下步骤:
S210、针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像。
S220、从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点。
S230、针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点。
S240、根据每个丝印点是否为缺陷点,从各个丝印点中提取出至少一个缺陷点,并根据至少一个缺陷点构建得到至少一个伪缺陷区域。
其中,如果丝印点为缺陷点,则说明在缺陷点处的丝印边缘可能存在缺陷,可以将各个丝印点中的至少一个缺陷点提取出来,并根据至少一个缺陷点构建得到至少一个伪缺陷区域,例如根据全部缺陷点构建得到一个伪缺陷区域;将至少一个缺陷点中的相互临近的缺陷点相互连通来构建得到一个伪缺陷区域,从而得到至少一个伪缺陷区域;等等,在此未做具体限定。
需要注意的是,由于部分缺陷点构建出来的伪缺陷区域较小,其可能只是 轮廓的轻微变动等情况导致的不平整区域,不能作为真实缺陷区域存在,因此根据至少一个缺陷点构建得到的每个伪缺陷区域是并不能保证一定为真实缺陷区域的,仅仅只是可能为真实缺陷区域的缺陷区域。
S250、针对每个伪缺陷区域,根据伪缺陷区域的区域面积和/或区域尺寸,确定伪缺陷区域是否为真实缺陷区域。
其中,针对每个伪缺陷区域,为了确定其是否为真实缺陷区域,可以计算该伪缺陷区域的区域面积和/或区域尺寸,然后根据该区域面积和/或区域尺寸来确定该伪缺陷区域是否为真实缺陷区域,在实际应用中,可选的,该区域尺寸可以通过该伪缺陷区域的最小外接矩形的宽度和/或高度进行表示。示例性的,可以预先设定面积阈值和/或尺寸阈值,计算该伪缺陷区域的区域面积和/或区域尺寸,将区域面积与面积阈值比较和/或将区域尺寸与尺寸阈值比较,如果区域面积大于面积阈值和/或区域尺寸大于尺寸阈值,则确定伪缺陷区域是真实缺陷区域。其中,真实缺陷区域可以理解为其内确实存在缺陷的伪缺陷区域。
S260、根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上是否存在缺陷。
其中,可以根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上是否存在缺陷,例如在各个伪缺陷区域中存在至少一个真实缺陷区域、各个伪缺陷区域均为真实缺陷区域、或是属于真实缺陷区域的伪缺陷区域在全部缺陷区域中的占比超过预设比例阈值的情况下,则说明丝印边缘存在有缺陷,可以将真实缺陷区域作为缺陷被检测出来。
本申请实施例的技术方案,通过根据每个丝印点是否为缺陷点,从各个丝印点中提取出至少一个缺陷点,并根据至少一个缺陷点构建得到至少一个伪缺陷区域;针对每个伪缺陷区域,根据伪缺陷区域的区域面积和/或区域尺寸,确定伪缺陷区域是否为真实缺陷区域;根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上是否存在缺陷。通过确定对伪缺陷区域是否为真实缺陷区域的判断,进一步提高了缺陷检测的准确性。
一种可选的技术方案,缺陷检测方法,还包括:分别获取每个丝印点的序号,其中,丝印点的序号用于表征丝印点在丝印边缘上所处的位置;根据至少一个缺陷点构建得到至少一个伪缺陷区域,包括:从至少一个缺陷点中确定出至少一个缺陷组,其中,每个缺陷组内的各缺陷点的序号相连;针对每个缺陷组,基于缺陷组内的各缺陷点构建得到伪缺陷区域。
其中,可以在提取出丝印边缘后分别获取每个丝印点的序号,该丝印点的序号用于表征丝印点在丝印边缘上所处的位置。实际应用中,可选的,若丝印 点的序号是顺序排列,则可以只获取丝印边缘上的任意一个丝印点的序号,并根据该丝印点的序号以及丝印点序号的排列方向,可以沿着丝印边缘顺时针或逆时针的方向得知其它丝印点的序号。例如,获取丝印边缘上的任意一个丝印点的序号为3,若其序号是按照顺时针方向排列,可以得知其顺时针方向的下一个丝印点的序号为4,再下一个丝印点的序号为5,以此类推,从而得到每个丝印点的序号;还可以得知其逆时针方向的下一个丝印点的序号为2,以此类推,从而得到每个丝印点的序号。在本申请实施例中,还可以获取每个参考点的序号,参考点的序号和与其对应的丝印点的序号是相同的,即参考点在参考边缘上所处的位置与对应的丝印点在丝印边缘上所处的位置相同。
可以将至少一个缺陷点中序号相连的各缺陷点构成一个缺陷组,从而得到至少一个缺陷组。针对每个缺陷组,可以将其内的各个缺陷点按照各自的序号线性连接,从而将连接后得到的区域作为伪缺陷区域。换言之,缺陷组可理解为包含至少两个序号相连的缺陷点的组别,在此基础上,可以基于每个缺陷组分别可以构建出一个伪缺陷区域。
在本申请实施例中,将每个缺陷组内的各缺陷点按照各自的序号相连构建得到伪缺陷区域,从而可以将原本独立的各缺陷点按照其所处的位置构建为更具有整体性的伪缺陷区域,便于后续对丝印边缘上是否存在缺陷进行判断。
另一种可选的技术方案,缺陷检测方法,还包括:在检测出丝印边缘上存在缺陷的情况下,确定丝印边缘上的缺陷位于真实缺陷区域内;根据真实缺陷区域内的各区域点的灰度值,得到真实缺陷区域的灰度均值,并基于灰度均值确定真实缺陷区域对应的缺陷类型。
其中,区域点可以理解为真实缺陷区域内的像素点。灰度均值可以理解为各区域点的灰度值的平均水平值。缺陷类型可以理解为丝印边缘上的缺陷所属的类型,例如可以是毛刺缺陷或缺口缺陷等。
在根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上存在缺陷的情况下,这说明该缺陷是位于真实缺陷区域内的。因此,针对每个真实缺陷区域,可以根据该真实缺陷区域内的各区域点的灰度值,得到该真实缺陷区域的灰度均值,并基于灰度均值确定该真实缺陷区域对应的缺陷类型。
在本申请实施例中,还可以在需要减少计算资源消耗的情况下,针对每个真实缺陷区域,预设区域点选取规则,根据区域点选取规则选取真实缺陷区域内能够表征真实缺陷区域灰度值的部分区域点,然后根据部分区域点的灰度值得到真实缺陷区域的灰度均值,从而基于灰度均值确定该真实缺陷区域对应的缺陷类型。其中,区域点选取规则可以理解为能够选取可以表征真实缺陷区域整体灰度值的部分区域点的规则,例如区域点选取规则可以是在真实缺陷区域 内每隔预设数量的像素点选取一个区域点。
在本申请实施例中,在丝印边缘上的缺陷位于真实缺陷区域内的情况下,基于灰度均值确定真实缺陷区域对应的缺陷类型,可以较为简单快速的确定出丝印边缘上的位于该真实缺陷区域内的缺陷的缺陷类型。
在上述方案的基础上,另一种可选的技术方案,基于灰度均值确定真实缺陷区域对应的缺陷类型,包括:获取预先设置的灰度阈值;在灰度均值大于或是等于灰度阈值的情况下,真实缺陷区域对应的缺陷类型为缺口缺陷,否则为毛刺缺陷。
其中,可以理解的是,参见图3,丝印缺陷中的为凸出状态的毛刺缺陷颜色通常偏暗;参见图4,凹陷状态的缺口缺陷颜色偏亮。根据丝印缺陷的上述特性,可以根据丝印产品的品类预先设置丝印产品对应的灰度阈值,获取预先设置的灰度阈值,在灰度均值大于或是等于灰度阈值的情况下,真实缺陷区域对应的缺陷类型为缺口缺陷,否则为毛刺缺陷。在本申请实施例中,灰度阈值还可以是参考图像的灰度均值。
在本申请实施例中,根据灰度均值和灰度阈值的比较结果确定缺陷类型,可以更为精确的判断丝印边缘的缺陷所属的类型。
实施例三
图5是本申请实施例三中提供的一种缺陷检测方法的流程图。本实施例以上述各技术方案为基础进行优化。在本实施例中,可选的,从丝印图像中提取出丝印边缘,包括:从丝印图像中提取出绘制线条,其中,绘制线条包括在生成丝印图像后,沿着待从丝印图像中提取出的丝印边缘绘制的线条;针对绘制线条上的每个绘制点,以绘制点为起点,沿着法线方向遍历丝印图像上的像素点,并从各像素点中确定丝印点,其中,法线方向是朝向丝印边缘并且垂直于绘制线条的方向;将全部丝印点连接起来构成的边缘,作为提取出的丝印边缘。其中,与上述各实施例相同或相应的术语的解释在此不再赘述。
参见图5,本实施例的方法具体可以包括如下步骤:
S310、针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像。
S320、从丝印图像中提取出绘制线条,其中,绘制线条包括在生成丝印图像后,沿着待从丝印图像中提取出的丝印边缘绘制的线条。
其中,绘制线条可以理解为在丝印图像上绘制的,距离需要进行缺陷检测的待从丝印图像中提取出的丝印边缘较近的线条。绘制线条的数量可以是一个或是多个;绘制线条的位置可以是在丝印边缘的内侧,也可以是在丝印边缘的外侧;绘制线条的形态可以是直线,也可以是曲线;绘制线条可以是人工根据丝印边缘进行绘制的,还可以是自动的根据丝印产品在丝印图像中的位置进行绘制。在本申请实施例中,对绘制线条的数量、位置、形态和绘制方法不做具体的限定。
S330、针对绘制线条上的每个绘制点,以绘制点为起点,沿着法线方向遍历丝印图像上的像素点,并从各像素点中确定丝印点,其中,法线方向是朝向丝印边缘并且垂直于绘制线条的方向。
其中,绘制点可以理解为绘制线条上每隔预设距离设置的点,绘制点可以是绘制线条在丝印图像上占据的像素点。
示例性的,参见图6,针对绘制线条上的每个绘制点,以绘制点为起点,沿着绘制线条在绘制点处的法线方向遍历法线上的,预设距离范围内的丝印图像上的像素点,并从各像素点中确定丝印点,其中,法线方向是朝向丝印边缘并且垂直于绘制线条的方向。
S340、将全部丝印点连接起来构成的边缘,作为提取出的丝印边缘。
其中,由于提取出的丝印点即为丝印图像中丝印产品的边缘上的点,因此可以将全部丝印点连接起来构成的边缘,作为提取出的丝印边缘。
S350、从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点。
需要说明的是,在本申请实施例中,从参考图像中提取出参考边缘的过程与从丝印图像中提取出丝印边缘的过程可以相同或不同。并且可以对丝印图像中的丝印产品和参考图像中的参考产品的位置进行校正,使得参考图像中提取出的绘制线条以及绘制线条上的绘制点相较于参考图像中的参考产品的位置、形态和数量,与丝印图像中提取出的绘制线条以及绘制线条上的绘制点相较于丝印图像中的丝印产品的位置、形态和数量是完全相同的。
S360、针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点。
S370、根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。
本申请实施例的技术方案,通过从丝印图像中提取出绘制线条,针对绘制线条上的每个绘制点,以绘制点为起点,沿着法线方向遍历丝印图像上的像素点,并从各像素点中确定丝印点,然后可将全部丝印点连接起来构成的边缘, 作为提取出的丝印边缘,从而可以提高提取出的丝印边缘的准确性。
一种可选的技术方案,从各像素点中确定丝印点,包括:针对各像素点中的每个当前点,计算当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值,其中,相邻点是各像素点中的在当前点之后遍历到的并且与当前点相邻的像素点;将最大的绝对值对应的当前点作为丝印点。
其中,当前点可以理解为当前沿着法线方向上计算是否是丝印点的像素点。在实际应用中,可选的,当前点还可以是当前沿着法线方向上预设距离范围内的计算是否是丝印点的像素点。
需要理解的是,考虑到丝印特点,丝印图像上位于丝印样式(如丝印文图)上的像素点与未位于丝印样式上的像素点的灰度值的差值较为显著,因此基于这一特性,可以针对各像素点中的每个当前点,计算当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值,将每个当前点对应的绝对值相互比较,并将最大的绝对值对应的当前点作为丝印点。
示例性的,可以将法线方向作为横轴X,将在绘制点出与法线垂直的绘制线条作为纵轴Y,沿着法线方向遍历的丝印图像上的像素点的横坐标为x,纵坐标为g(x),当前点的灰度值为f(x,g(x)),分别计算各个当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值,并从中找对最大的绝对值max(|f(x+1,g(x+1))-f(x,g(x))|),将该最大的绝对值对应的当前点f(x a,g(x a))作为丝印点。其中,可以将预设距离范围作为x的定义域。
将最大的当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值对应的当前点作为丝印点,可以精准确定出丝印点。
为了更好的理解上述本申请实施例的技术方案,在此提供一种可选示例。示例性的,参见图7,对丝印产品和参考产品进行图像采集,并对采集的丝印图像和参考图像分别进行去除反光点的预处理;从预处理后的丝印图像中提取出丝印边缘,并计算丝印边缘在每个丝印点处的丝印斜率,以及从预处理后的参考图像中提取出参考边缘,并计算参考边缘在每个参考点处的参考斜率;计算每个丝印点处的丝印斜率和与其对应的参考点的参考斜率的斜率差值,根据斜率差值和斜率差值阈值进行比对的结果来确定该丝印点是否为缺陷点,从而从这些丝印点中确定缺陷点;根据缺陷点构建伪缺陷区域,判断伪缺陷区域中是否存在真实缺陷区域,若伪缺陷区域中没有真实缺陷区域,则说明丝印产品合格;若伪缺陷区域中存在真实缺陷区域,则分别判断各真实缺陷区域的灰度均值是否大于灰度阈值,大于灰度阈值则说明真实缺陷区域内的缺陷为缺口缺陷,小于或是等于灰度阈值则说明真实缺陷区域内的缺陷为毛刺缺陷。
为了更好的理解上述本申请实施例的技术方案,在此提供另一种可选示例。示例性的,参见图8,对丝印产品和参考产品进行图像采集,并对采集的丝印图像和参考图像分别进行去除反光点的预处理,从预处理后的丝印图像中提取出丝印边缘,以及从预处理后的参考图像中提取出参考边缘并进行分析,判断丝印边缘是否存在缺陷;如果有缺陷,则对缺陷所在的真实缺陷区域进行分类,分类完成后结束缺陷检测过程;如果没有缺陷,则判断是否对需要进行缺陷检测的丝印产品拍照完成,如果拍照完成则结束缺陷检测过程,如果没有完成则重新对丝印产品进行图像采集。
实施例四
图9为本申请实施例四所提供的缺陷检测装置的结构框图,该装置用于执行上述任意实施例所提供的缺陷检测方法。该装置与上述各实施例的缺陷检测方法属于同一个申请构思,在缺陷检测装置的实施例中未详尽描述的细节内容,可以参考上述缺陷检测方法的实施例。参见图9,该装置具体可包括:图像获取模块410、边缘提取模块420、缺陷点确定模块430和缺陷检测模块440。
其中,图像获取模块410,用于针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;
边缘提取模块420,用于从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;
缺陷点确定模块430,用于针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;
缺陷检测模块440,用于根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。
可选的,缺陷检测模块440,可以包括:
伪缺陷区域得到单元,用于根据每个丝印点是否为缺陷点,从各个丝印点中提取出至少一个缺陷点,并根据至少一个缺陷点构建得到至少一个伪缺陷区域;
真实缺陷区域确定单元,用于针对每个伪缺陷区域,根据伪缺陷区域的区域面积和/或区域尺寸,确定伪缺陷区域是否为真实缺陷区域;
缺陷检测单元,用于根据每个伪缺陷区域是否为真实缺陷区域,检测出丝印边缘上是否存在缺陷。
在上述方案的基础上,可选的,缺陷检测装置,还可以包括:
序号获取模块,用于分别获取每个丝印点的序号,其中,丝印点的序号用于表征丝印点在丝印边缘上所处的位置;
伪缺陷区域得到单元,可以包括:
缺陷组确定子单元,用于从至少一个缺陷点中确定出至少一个缺陷组,其中,每个缺陷组内的各缺陷点的序号相连;
伪缺陷区域构建子单元,用于针对每个缺陷组,基于缺陷组内的各缺陷点构建得到伪缺陷区域。
在上述方案的基础上,可选的,缺陷检测装置,还可以包括:
缺陷位置确定模块,用于在检测出丝印边缘上存在缺陷的情况下,确定丝印边缘上的缺陷位于真实缺陷区域内;
缺陷类型确定模块,用于根据真实缺陷区域内的各区域点的灰度值,得到真实缺陷区域的灰度均值,并基于灰度均值确定真实缺陷区域对应的缺陷类型。
在上述方案的基础上,可选的,缺陷类型确定模块,可以包括:
灰度阈值获取单元,用于获取预先设置的灰度阈值;
缺陷类型确定单元,用于在灰度均值大于或是等于灰度阈值的情况下,真实缺陷区域对应的缺陷类型为缺口缺陷,否则为毛刺缺陷。
可选的,边缘提取模块420,可以包括:
绘制线条提取单元,用于从丝印图像中提取出绘制线条,其中,绘制线条包括在生成丝印图像后,沿着待从丝印图像中提取出的丝印边缘绘制的线条;
丝印点确定单元,用于针对绘制线条上的每个绘制点,以绘制点为起点,沿着法线方向遍历丝印图像上的像素点,并从各像素点中确定丝印点,其中,法线方向是朝向丝印边缘并且垂直于绘制线条的方向;
丝印边缘提取单元,用于将全部丝印点连接起来构成的边缘,作为提取出的丝印边缘。
在上述方案的基础上,可选的,丝印点确定单元,可以包括:
灰度差值计算子单元,用于针对各像素点中的每个当前点,计算当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值,其中,相邻点是各像素点中的在当前点之后遍历到的并且与当前点相邻的像素点;
丝印点作为子单元,用于将最大的绝对值对应的当前点作为丝印点。
本申请实施例四提供的缺陷检测装置,通过图像获取模块针对存在丝印边缘检测需求的丝印产品、以及与丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对丝印产品进行图像采集后生成的丝印图像、以及对参考产品进行图像采集后生成的参考图像;并通过边缘提取模块从丝印图像中提取出丝印边缘,并从参考图像中提取出参考边缘,其中,参考边缘上存在与丝印边缘上的各个丝印点分别对应的参考点;再通过缺陷点确定模块针对每个丝印点,确定丝印点对应的参考点的参考斜率,与丝印点的丝印斜率之间的斜率差值,并根据斜率差值确定丝印点是否为缺陷点;通过缺陷检测模块根据每个丝印点是否为缺陷点,检测出丝印边缘上是否存在缺陷。本申请实施例的装置,根据丝印边缘上的丝印点确定缺陷点,再根据缺陷点检测丝印边缘的缺陷,可以实现自动检测出丝印边缘上是否存在缺陷,达到快速准确的检测丝印缺陷的效果。
本申请实施例所提供的缺陷检测装置可执行本申请任意实施例所提供的缺陷检测方法,具备执行方法相应的功能模块和有益效果。
值得注意的是,上述缺陷检测装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。
实施例五
图10示出了可以用来实施本申请的实施例的电子设备10的结构示意图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备(如头盔、眼镜、手表等)和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。
如图10所示,电子设备10包括至少一个处理器11,以及与至少一个处理器11通信连接的存储器,如只读存储器(ROM)12、随机访问存储器(RAM)13等,其中,存储器存储有可被至少一个处理器执行的计算机程序,处理器11可以根据存储在只读存储器(ROM)12中的计算机程序或从存储单元18加载到随机访问存储器(RAM)13中的计算机程序,来执行各种适当的动作和处理。 在RAM13中,还可存储电子设备10操作所需的各种程序和数据。处理器11、ROM12以及RAM13通过总线14彼此相连。输入/输出(I/O)接口15也连接至总线14。
电子设备10中的多个部件连接至I/O接口15,包括:输入单元16,例如键盘、鼠标等;输出单元17,例如各种类型的显示器、扬声器等;存储单元18,如磁盘、光盘等;以及通信单元19,例如网卡、调制解调器、无线通信收发机等。通信单元19允许电子设备10通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
处理器11可以是各种具有处理和计算能力的通用和/或专用处理组件。处理器11的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的处理器、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。处理器11执行上文所描述的各个方法和处理,例如缺陷检测方法。
在一些实施例中,缺陷检测方法可被实现为计算机程序,其被有形地包含于计算机可读存储介质,例如存储单元18。在一些实施例中,计算机程序的部分或者全部可以经由ROM12和/或通信单元19而被载入和/或安装到电子设备10上。当计算机程序加载到RAM13并由处理器11执行时,可以执行上文描述的缺陷检测方法的一个或多个步骤。备选地,在其他实施例中,处理器11可通过其他任何适当的方式(例如,借助于固件)而被配置为执行缺陷检测方法。
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、以及至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、以及该至少一个输出装置。
用于实施本申请的方法的计算机程序可以采用一个或多个编程语言的任何组合来编写。这些计算机程序可以提供给通用计算机、专用计算机或是其他可编程数据处理装置的处理器,使得计算机程序当由处理器执行时使流程图和/或框图中所规定的功能/操作被实施。计算机程序可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行并且部分地在远程机器上执行或完全在远程机器或服务器上执行。
在本申请的上下文中,计算机可读存储介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。计算机可读存储介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。备选地,计算机可读存储介质可以是机器可读信号介质。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在电子设备上实施此处描述的系统和技术,该电子设备具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给电子设备。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。
计算系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请的技术方案所期望的结果,本文在此不进行限制。

Claims (10)

  1. 一种缺陷检测方法,包括:
    针对存在丝印边缘检测需求的丝印产品、以及与所述丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对所述丝印产品进行图像采集后生成的丝印图像、以及对所述参考产品进行图像采集后生成的参考图像;
    从所述丝印图像中提取出丝印边缘,并从所述参考图像中提取出参考边缘,其中,所述参考边缘上存在与所述丝印边缘上的各个丝印点分别对应的参考点;
    针对每个所述丝印点,确定所述丝印点对应的参考点的参考斜率,与所述丝印点的丝印斜率之间的斜率差值,并根据所述斜率差值确定所述丝印点是否为缺陷点;
    根据每个所述丝印点是否为缺陷点,检测出所述丝印边缘上是否存在缺陷。
  2. 根据权利要求1所述的方法,其中,所述根据每个所述丝印点是否为缺陷点,检测出所述丝印边缘上是否存在缺陷,包括:
    根据每个所述丝印点是否为缺陷点,从所述各个丝印点中提取出至少一个缺陷点,并根据所述至少一个缺陷点构建得到至少一个伪缺陷区域;
    针对每个所述伪缺陷区域,根据所述伪缺陷区域的区域面积和/或区域尺寸,确定所述伪缺陷区域是否为真实缺陷区域;
    根据每个所述伪缺陷区域是否为真实缺陷区域,检测出所述丝印边缘上是否存在缺陷。
  3. 根据权利要求2所述的方法,还包括:
    分别获取每个所述丝印点的序号,其中,所述丝印点的序号用于表征所述丝印点在所述丝印边缘上所处的位置;
    所述根据所述至少一个缺陷点构建得到至少一个伪缺陷区域,包括:
    从所述至少一个缺陷点中确定出至少一个缺陷组,其中,每个所述缺陷组内的各缺陷点的序号相连;
    针对每个所述缺陷组,基于所述缺陷组内的各缺陷点构建得到伪缺陷区域。
  4. 根据权利要求2所述的方法,还包括:
    在检测出所述丝印边缘上存在缺陷的情况下,确定所述丝印边缘上的缺陷位于所述真实缺陷区域内;
    根据所述真实缺陷区域内的各区域点的灰度值,得到所述真实缺陷区域的灰度均值,并基于所述灰度均值确定所述真实缺陷区域对应的缺陷类型。
  5. 根据权利要求4所述的方法,其中,所述基于所述灰度均值确定所述真实缺陷区域对应的缺陷类型,包括:
    获取预先设置的灰度阈值;
    在所述灰度均值大于或是等于所述灰度阈值的情况下,所述真实缺陷区域对应的缺陷类型为缺口缺陷,否则为毛刺缺陷。
  6. 根据权利要求1所述的方法,其中,所述从所述丝印图像中提取出丝印边缘,包括:
    从所述丝印图像中提取出绘制线条,其中,所述绘制线条包括在生成所述丝印图像后,沿着待从所述丝印图像中提取出的丝印边缘绘制的线条;
    针对所述绘制线条上的每个绘制点,以所述绘制点为起点,沿着法线方向遍历所述丝印图像上的像素点,并从各所述像素点中确定所述丝印点,其中,所述法线方向是朝向所述丝印边缘并且垂直于所述绘制线条的方向;
    将全部所述丝印点连接起来构成的边缘,作为提取出的所述丝印边缘。
  7. 根据权利要求6所述的方法,其中,所述从各所述像素点中确定所述丝印点,包括:
    针对各所述像素点中的每个当前点,计算所述当前点的灰度值与相邻点的灰度值之间的灰度差值的绝对值,其中,所述相邻点是各所述像素点中在所述当前点之后遍历到的并且与所述当前点相邻的像素点;
    将最大的所述绝对值对应的所述当前点作为所述丝印点。
  8. 一种缺陷检测装置,包括:
    图像获取模块,用于针对存在丝印边缘检测需求的丝印产品、以及与所述丝印产品品类相同且经检测确定丝印边缘无缺陷的参考产品,获取对所述丝印产品进行图像采集后生成的丝印图像、以及对所述参考产品进行图像采集后生成的参考图像;
    边缘提取模块,用于从所述丝印图像中提取出丝印边缘,并从所述参考图像中提取出参考边缘,其中,所述参考边缘上存在与所述丝印边缘上的各个丝印点分别对应的参考点;
    缺陷点确定模块,用于针对每个所述丝印点,确定所述丝印点对应的参考点的参考斜率,与所述丝印点的丝印斜率之间的斜率差值,并根据所述斜率差值确定所述丝印点是否为缺陷点;
    缺陷检测模块,用于根据每个所述丝印点是否为缺陷点,检测出所述丝印 边缘上是否存在缺陷。
  9. 一种电子设备,包括:
    至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器执行如权利要求1-7中任一项所述的缺陷检测方法。
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使处理器执行时实现如权利要求1-7中任一所述的缺陷检测方法。
PCT/CN2023/070587 2022-08-24 2023-01-05 一种缺陷检测方法、装置、电子设备及存储介质 WO2024040856A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211021182.1A CN115272290A (zh) 2022-08-24 2022-08-24 一种缺陷检测方法、装置、电子设备及存储介质
CN202211021182.1 2022-08-24

Publications (1)

Publication Number Publication Date
WO2024040856A1 true WO2024040856A1 (zh) 2024-02-29

Family

ID=83752752

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/070587 WO2024040856A1 (zh) 2022-08-24 2023-01-05 一种缺陷检测方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN115272290A (zh)
WO (1) WO2024040856A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117893541A (zh) * 2024-03-18 2024-04-16 济南玖通志恒信息技术有限公司 一种基于边缘检测的果树叶部花叶病分析方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115272290A (zh) * 2022-08-24 2022-11-01 广东拓斯达科技股份有限公司 一种缺陷检测方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108280822A (zh) * 2017-12-20 2018-07-13 歌尔科技有限公司 屏幕划痕的检测方法及装置
CN108355987A (zh) * 2018-01-08 2018-08-03 西安交通大学 一种基于分块模板匹配的电池丝印质量检测方法
CN110018169A (zh) * 2019-04-10 2019-07-16 珠海格力智能装备有限公司 一种丝印线条的检测方法及装置、存储介质和处理器
CN115272290A (zh) * 2022-08-24 2022-11-01 广东拓斯达科技股份有限公司 一种缺陷检测方法、装置、电子设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108280822A (zh) * 2017-12-20 2018-07-13 歌尔科技有限公司 屏幕划痕的检测方法及装置
CN108355987A (zh) * 2018-01-08 2018-08-03 西安交通大学 一种基于分块模板匹配的电池丝印质量检测方法
CN110018169A (zh) * 2019-04-10 2019-07-16 珠海格力智能装备有限公司 一种丝印线条的检测方法及装置、存储介质和处理器
CN115272290A (zh) * 2022-08-24 2022-11-01 广东拓斯达科技股份有限公司 一种缺陷检测方法、装置、电子设备及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117893541A (zh) * 2024-03-18 2024-04-16 济南玖通志恒信息技术有限公司 一种基于边缘检测的果树叶部花叶病分析方法
CN117893541B (zh) * 2024-03-18 2024-05-28 济南玖通志恒信息技术有限公司 一种基于边缘检测的果树叶部花叶病分析方法

Also Published As

Publication number Publication date
CN115272290A (zh) 2022-11-01

Similar Documents

Publication Publication Date Title
WO2024040856A1 (zh) 一种缺陷检测方法、装置、电子设备及存储介质
CN112801164B (zh) 目标检测模型的训练方法、装置、设备及存储介质
CN112949767B (zh) 样本图像增量、图像检测模型训练及图像检测方法
RU2581786C1 (ru) Определение преобразований изображения для повышения качества оптического распознавания символов
WO2021135985A1 (zh) 识别混合排版文字的方法、设备、芯片电路和计算机可读存储介质
CN115272291A (zh) 一种贴膜的缺陷检测方法、装置、设备及存储介质
US20230096921A1 (en) Image recognition method and apparatus, electronic device and readable storage medium
CN117333443A (zh) 一种缺陷检测方法、装置、电子设备及存储介质
CN113610809A (zh) 骨折检测方法、装置、电子设备以及存储介质
CN117036345A (zh) 一种压接导线的对边距测量方法及系统
CN112991308B (zh) 一种图像质量的确定方法、装置、电子设备和介质
CN114399617B (zh) 一种遮挡图案识别方法、装置、设备和介质
CN114120305B (zh) 文本分类模型的训练方法、文本内容的识别方法及装置
CN115937324A (zh) 一种装配质量评价方法、装置、设备及存储介质
CN114255540A (zh) 一种污损纸币的识别方法、装置、设备和存储介质
CN111582151A (zh) 文档图像朝向检测方法和装置
CN115187585A (zh) 一种缺陷检测方法、装置、电子设备及存储介质
CN116503407B (zh) 图像中异物区域的检测方法、装置及电子设备
CN116071773B (zh) 检测电网建设类档案中表格的方法、装置、介质和设备
CN113409288B (zh) 一种图像清晰度的检测方法、装置、设备和存储介质
CN116611997A (zh) 样本图像的生成方法、装置和设备
CN117275006A (zh) 一种图像处理方法、装置、电子设备及存储介质
CN116880785A (zh) 印刷电路板的喷墨打印方法、电子设备和存储介质
CN116740727A (zh) 票据图像的处理方法、装置、电子设备及存储介质
CN115188017A (zh) 一种圆形印章的文本识别方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23855953

Country of ref document: EP

Kind code of ref document: A1