CN110728659A - Defect merging method and device, computer equipment and storage medium - Google Patents

Defect merging method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110728659A
CN110728659A CN201910876015.7A CN201910876015A CN110728659A CN 110728659 A CN110728659 A CN 110728659A CN 201910876015 A CN201910876015 A CN 201910876015A CN 110728659 A CN110728659 A CN 110728659A
Authority
CN
China
Prior art keywords
defect
area
preset
reference value
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910876015.7A
Other languages
Chinese (zh)
Inventor
夏鑫淼
王双桥
张孟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xinshizhi Technology Co Ltd
Original Assignee
Shenzhen Xinshizhi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xinshizhi Technology Co Ltd filed Critical Shenzhen Xinshizhi Technology Co Ltd
Priority to CN201910876015.7A priority Critical patent/CN110728659A/en
Publication of CN110728659A publication Critical patent/CN110728659A/en
Pending legal-status Critical Current

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
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8854Grading and classifying of flaws
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

The embodiment of the invention discloses a defect merging method, which comprises the following steps: acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one; traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value; if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region. The defect merging method can merge the detected defects, avoids respectively processing a plurality of defects in the small block region as the defects, and improves the integrity of the defect detection. A device for defect merging, a computer device and a storage medium are also provided.

Description

Defect merging method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of machine vision technologies, and in particular, to a method and an apparatus for defect merging, a computer device, and a storage medium.
Background
With the development of machine vision technology, the defect detection based on machine vision gradually replaces manual detection, and can accurately detect the defects in the shot target; and with the improvement of the precision of the defect detection system, the physical size of the defect which can be detected is gradually reduced, and the detection omission hardly occurs, so that the precision of the defect detection is greatly improved.
However, when the same defect is detected at different positions of a small area with high precision by the defect detection system, a plurality of defects or a plurality of same defects in the small area are recognized as a plurality of small defects, which increases the workload in the subsequent processing of defect analysis, classification and the like, and is not beneficial to the overall analysis of the detected product.
Therefore, a solution for analyzing and considering the defects in the process of detecting the defects of the product is needed.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device and a storage medium for merging defects.
A method of defect merging, the method comprising:
acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one;
traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value;
if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
In one embodiment, after the step of determining whether the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, the method further includes: if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, adding the other defect regions, the distance between which and the traversed defect region is smaller than the preset first distance threshold, to a defect group where the traversed defect region is located; and for each defect group, determining that each defect area contained in the defect group meets a preset first characteristic threshold, merging the defect areas meeting the first characteristic threshold, and taking the merged defect area as a target defect area.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether the first characteristic reference value meets a preset first characteristic threshold value or not; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring a gray reference value of a pixel point contained in each defect area contained in the defect group, and calculating a difference value between the gray reference values of each defect area contained in the defect group, wherein the gray reference value comprises at least one of a minimum gray value, an average gray value and/or a maximum gray value; judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: in the case that the target image comprises multiple frames of target sub-images, determining whether a defect area in each frame of target sub-image is in an edge area in the target sub-image, wherein the edge area position comprises at least one of an upper edge area and/or a right edge area; in the case where the defect region is in an edge region in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area; if the defect area in the target sub-image is in the right edge area, acquiring the defect area of the edge area of the target sub-image adjacent to the left and right of the target sub-image as a second defect area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
In one embodiment, the step of determining whether the second characteristic reference value of the at least one defective area satisfies a preset second characteristic threshold further includes: judging whether the length value and/or the width value of each defect area is smaller than or equal to a preset second characteristic threshold value or not; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
An apparatus for defect merging, the apparatus comprising:
the acquisition module is used for acquiring a target image of a target to be detected, identifying defect areas in the target image, and the number of the identified defect areas is at least one;
the judging module is used for traversing the at least one defect area and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value or not;
and the merging module is used for merging the traversed defect region and other defect regions with the distances smaller than the preset first distance threshold if the distances between the traversed defect region and the other defect regions are smaller than the preset first distance threshold, and outputting the merged defect region as a target defect region.
In one embodiment, the merge module further comprises: the grouping unit is used for adding other defect areas, the distances between which and the traversed defect areas are smaller than a preset first distance threshold value, to a defect group where the traversed defect areas are located if the distances between the traversed defect areas and the other defect areas are smaller than the preset first distance threshold value; and the merging unit is used for determining that each defect area contained in each defect group meets a preset first characteristic threshold value, merging the defect areas meeting the first characteristic threshold value, and taking the merged defect area as a target defect area.
In one embodiment, the merging unit further includes: the first acquiring subunit is used for acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; the first judging subunit is used for judging whether the first characteristic reference value meets a preset first characteristic threshold value; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
In one embodiment, the merging unit further includes: the second acquiring subunit is configured to acquire a grayscale reference value of a pixel point included in each defect region included in the defect group, and calculate a difference between the grayscale reference values of each defect region included in the defect group, where the grayscale reference value includes at least one of a minimum grayscale value, an average grayscale value, and/or a maximum grayscale value; the second judgment subunit is used for judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
In one embodiment, the merge module further comprises: the judging unit is used for determining whether the defect area is in an edge area of each frame of target sub-image or not aiming at the defect area in each frame of target sub-image under the condition that the target image comprises a plurality of frames of target sub-images, wherein the position of the edge area comprises at least one of an upper edge area and/or a right edge area; an upper merging unit for in case the defect area is in an edge area in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area; the right merging unit is used for acquiring a defective area of the edge area of the target sub-image which is adjacent to the left and right of the target sub-image as a second defective area if the defective area in the target sub-image is in the right edge area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
In one embodiment, the apparatus further comprises: the filtering module is used for acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
In one embodiment, the filtration module further comprises: the threshold judging unit is used for judging whether the length value and/or the width value of each defect area is less than or equal to a preset second characteristic threshold; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of:
acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one;
traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value;
if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one;
traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value;
if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
By adopting the defect merging method, the defect merging device, the computer equipment and the storage medium, when a product to be detected is detected, a target image of the product to be detected is obtained, at least one defect area in the target image is identified, if the distance between the defect areas is smaller than a preset distance value, the defect areas with the distance smaller than the preset distance value are merged, and the merged defect areas are output as target defect areas. The defect merging method, the defect merging device, the computer equipment and the storage medium can merge detected defects, for example, defects in a small range or with a small distance, so that the defects in a small block region are prevented from being respectively treated as defects, and the integrity of defect detection is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Wherein:
FIG. 1 is a diagram of an exemplary embodiment of a method for merging defects;
FIG. 2 is a flow diagram of a method of defect merging in one embodiment;
FIG. 3 is a schematic diagram of the distribution of defect regions in a single frame image;
FIG. 4 is a schematic diagram of the distribution of defect regions in a multi-frame image;
FIG. 5 is a flow diagram of a method of defect merging in one embodiment;
FIG. 6 is a diagram illustrating merging of defective areas in a single frame image;
FIG. 7 is a flow diagram of a method of defect merging in one embodiment;
FIG. 8 is a schematic diagram of defective area grouping in a single frame image;
FIG. 9 is a diagram illustrating merging of defective areas in a multi-frame image;
FIG. 10 is a block diagram of an apparatus for defect merging in one embodiment;
FIG. 11 is a block diagram of a merge module of the apparatus for defect merging in one embodiment;
FIG. 12 is a block diagram showing the structure of a merging unit of the apparatus for defect merging in one embodiment;
FIG. 13 is a block diagram showing the structure of a merging unit of the apparatus for merging defects in one embodiment;
FIG. 14 is a block diagram showing the structure of a merge module of the apparatus for defect merging in one embodiment;
FIG. 15 is a block diagram of an apparatus for defect merging in one embodiment;
FIG. 16 is a block diagram of a computer device that executes the method for defect merging described above in one embodiment.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
FIG. 1 is a diagram of an exemplary embodiment of a method for merging defects. Referring to fig. 1, the method for defect merging is applied to a defect detection system. The defect detection system includes a terminal 110 and a server 120. The terminal 110 and the server 120 are connected through a network, the terminal 110 may be a terminal device installed on a product detection station, and the terminal device includes a camera for acquiring an image of a target to be detected; the server 120 may be implemented by an independent server or a server cluster composed of a plurality of servers, and is configured to analyze the image collected by the terminal 110, identify corresponding defects, and merge the defects that need to be merged.
In another embodiment, the defect merging method may be performed based on a terminal device, and the terminal device may collect images, analyze the collected images, identify corresponding defects, and merge the defects to be merged.
Considering that the method can be applied to both the terminal and the server, and the process of combining the specific defects is the same, the present embodiment is exemplified as applied to the terminal.
In one embodiment, as shown in FIG. 2, a method of defect merging is provided. The method analyzes the collected images, identifies corresponding defects and merges the defects needing to be merged. The defect merging method specifically includes the following steps S202 to S206:
step S202, acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one.
Specifically, the target image is an image corresponding to a product to be detected, and the target image may be an image of the product to be detected collected by a camera, for example, an image of the product moving to a product detection position on a product detection line is collected by the camera mounted thereon. The target image to be detected may be an original image, or may be an image obtained by performing preprocessing such as denoising on the original image. The target image to be detected may be a color image or a grayscale image. The target image to be detected can be a single-frame image or a multi-frame image; the multi-frame image may be a multi-frame image shot by a single camera, or a multi-frame image shot by a plurality of cameras, a multi-frame image formed by combining single-frame images shot by each camera, or a multi-frame image formed by combining multi-frame images shot by each camera. At least one defective region in the target image may be distributed on the single frame image, for example, as shown in fig. 3, and the defect Q1, the defect Q2, and the defect Q3 are distributed on the single frame image. At least one defect region in the target image may be distributed over multiple frame images, such as shown in fig. 4, defect q1 is located at the upper edge of image a2, defect q2 is located at the lower edge of image a1, defect q3 is located at the right edge of image a1, defect q4 is located at the left edge of image a3, defect q5 is located in the middle of image a3, and defect 6 is located at the right edge of image a3, where defect q1 is vertically adjacent to defect q2, and defect q3 and defect q4 are laterally adjacent.
Before defect merging or defect output is performed, it is also necessary to consider whether the currently detected defect can be referred to as a defect, for example, in the case where the size or area of the defect is sufficiently small, the defect can be ignored. Therefore, as shown in fig. 5, in an embodiment, after the step of identifying the defect region in the target image, the method further includes: acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
Specifically, in this step, the size, the gray value, and the like of the defect region may be filtered, and thus, the second feature reference value and the second feature threshold may be features corresponding to the defect region. For example, as shown in table 1, the second feature reference value and the second feature threshold value may include one or more of features such as a rotating external rectangle, a minimum external moment, a gray scale, a length, a width, a roundness, a circularity, a convexity, and/or a flatness, but the second feature reference value and the second feature threshold value are not limited to the contents of table 1, and table 1 expresses some possibilities of feature selection. When filtering the at least one defective area according to the second feature threshold, the second feature threshold may select one of different features, for example, a length threshold of 10mm, a width threshold of 5mm, a gray threshold of greater than or equal to 10, or a radius threshold of 5 mm. The second feature threshold may also select multiple different features, for example, the length, width, gray value, and other features of the defect region are combined, and the defect region is filtered according to multiple features at the same time, so that defects that do not need to be combined can be filtered to a greater extent, and the workload of subsequent grouping and combining is reduced. The defect region not meeting the characteristic threshold value can be filtered, the defect region meeting the characteristic threshold value can be filtered, for example, the defect region not meeting the length greater than the preset length threshold value can be filtered, the defect region meeting the length less than or equal to the length threshold value can be filtered, and the filtering effects of the two options are the same.
TABLE 1
Figure BDA0002204309750000091
By filtering the image of the defect region, defects which do not need to be combined, such as defects with larger area, are filtered, and the workload of subsequent defect grouping and combination is reduced.
In one embodiment, the step of determining whether the second characteristic reference value of the at least one defective area satisfies a preset second characteristic threshold further includes: judging whether the length value and/or the width value of each defect area is smaller than or equal to a preset second characteristic threshold value or not; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
Specifically, the second characteristic threshold is a preset length value and/or a preset width value, and defects with lengths and/or widths larger than the preset length value and/or width value are filtered out, and the results of visual resolution of the defects are consistent with the results detected by a high-precision defect detection system. Defects with small length and/or width values are left, which may be visually distinguished as one defect, and a high-precision defect detection system detects a plurality of defects, which are defects capable of defect combination. By setting the characteristic threshold, defects which do not need to be combined are filtered, all defects do not need to be grouped and combined, and the workload of subsequent defect grouping and combination is reduced.
Step S204, traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value.
Specifically, the distance between the defect region and the region of another defect may be a minimum distance in a horizontal direction between the defect region and the edge of the region of another defect, a minimum distance in a vertical direction between the defect region and the edge of the region of another defect, an euclidean distance between the defect region and the center point of the region of another defect, or other distance calculation methods such as an euclidean distance, a mahalanobis distance, and/or a chebyshev distance. As shown in table 2, the preset first distance threshold may be a preset distance value MX in the X-axis directionUPAnd/or predetermined along the Y-axisRadial distance value MYUP
TABLE 2
Serial number Distance threshold in X direction Logic Distance threshold in Y direction
1 MX<MXUP And MY<MYUP
2 MX<MXUP or MY<MYUP
In step S206, if the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, the traversed defect region and the other defect regions having a distance smaller than the preset first distance threshold are merged, and the merged defect region is output as the target defect region.
Specifically, the defect region and other defect regions with a distance smaller than the preset first distance threshold are merged into the same defect region, and the merged defect region is output as a defect region, that is, the defect region and other defect regions with a distance smaller than the preset first distance threshold are merged, and a target defect region, which is the merged defect region, is shown in fig. 6, where the target defect region is defect Q4 and is formed by merging defect Q1, defect Q2, and defect Q3. The defect areas with similar distances are combined, so that the defect areas are accurately selected and combined, the processes of judging other characteristics are reduced, and the combining speed is improved.
As shown in fig. 7, in an embodiment, after the step of determining whether the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, the method further includes: if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, adding the other defect regions, the distance between which and the traversed defect region is smaller than the preset first distance threshold, to a defect group where the traversed defect region is located; and for each defect group, determining that each defect area contained in the defect group meets a preset first characteristic threshold, merging the defect areas meeting the first characteristic threshold, and taking the merged defect area as a target defect area.
Specifically, as shown in table 2, the preset first distance threshold may be a preset distance value MX along the X-axis directionUPAnd/or a preset distance value MY in the Y-axis directionUP. The preset first distance threshold may be other distance calculation methods such as euclidean distance, mahalanobis distance, and/or chebyshev distance. The defect area and other defect areas having a distance less than the preset first distance threshold are divided into the same defect group, and as shown in fig. 8, the defect Q1, the defect Q2, and the defect Q3 are divided into the same defect group Z1.
As shown in table 1, the first feature reference value and the first feature threshold value may include one or more of features such as a rotating external rectangle, a minimum external moment, a gray scale, a length, a width, a roundness, a circularity, a convexity and/or a flatness, but the first feature reference value and the first feature threshold value are not limited to the contents of table 1, and table 1 expresses some possibilities of feature selection. When at least one defect area is merged according to the first feature threshold, the first feature threshold may select one of different features, for example, a length threshold of 10mm, a width threshold of 5mm, a gray threshold of greater than or equal to 10, or a radius threshold of 5 mm. The first feature threshold may also select multiple different features, for example, the length, width, gray value, and other features of the defect region are combined, and the defect region is merged according to multiple features at the same time, so as to improve the accuracy of merging. Dividing the defect regions in each defect group that meet the preset characteristic threshold into the same defect region, that is, merging the defect regions in each defect group that meet the preset characteristic threshold, where the merged defect region is the target defect region shown in fig. 6, where the target defect region is defect Q4 and is formed by merging defect Q1, defect Q2, and defect Q3.
There may be a case where the defect regions with similar distances are divided into the same group, but the features of the defect regions have great differences, for example, the difference of the gray values is greater than 20, and the defect regions do not belong to the same defect region. Therefore, on the basis of grouping the defective regions, each group of defective regions is screened through the first characteristic threshold, the defective regions to be combined can be selected more accurately, errors of combining the defective regions are reduced, and the accuracy of combining is improved.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether the first characteristic reference value meets a preset first characteristic threshold value or not; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
Specifically, in this embodiment, at least one feature screening is performed on each defect region of the defect group, for example, as shown in table 1, the first feature reference value and the first feature threshold may include one or more features of a rotating external rectangle, a minimum external moment, a gray scale, a length, a width, a roundness, a circularity, a convexity, and/or a flatness, but the first feature reference value and the first feature threshold are not limited to the contents of table 1, and table 1 expresses part of the possibilities of feature selection. When each defect area is screened according to the first feature threshold, the first feature threshold may select one of different features, for example, the length threshold is 10mm, the width threshold is 5mm, the gray threshold is greater than or equal to 10, or the radius threshold is 5 mm. The first feature threshold may also select multiple different features, for example, the length, width, gray value and other features of the defect region are combined, and the defect region is screened according to the multiple features at the same time, so that defects that do not need to be merged may be screened to a greater extent, and the accuracy of merging is improved.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring a gray reference value of a pixel point contained in each defect area contained in the defect group, and calculating a difference value between the gray reference values of each defect area contained in the defect group, wherein the gray reference value comprises at least one of a minimum gray value, an average gray value and/or a maximum gray value; judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
Specifically, the fluctuation range of the difference value of the gradation reference values may be as shown in table 3, the fluctuation range of the difference value of the minimum gradation value may be ± 10, the fluctuation range of the difference value of the average gradation value may be ± 20, and the fluctuation range of the difference value of the maximum gradation value may be ± 10. The gray value reference value of each defect area contained in the defect group is selected, the gray value reference value of the defect area to be combined is ensured to be within a certain threshold value, the defect area to be combined can be selected more accurately, and the error of combining the defect areas is reduced.
TABLE 3
Serial number Defect feature name Range of fluctuation
1 Minimum grayscale value min _ gray ±10
2 Maximum grayscale value max _ gray ±20
3 Mean gray value mean _ gray ±10
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: in the case that the target image comprises multiple frames of target sub-images, determining whether a defect area in each frame of target sub-image is in an edge area in the target sub-image, wherein the edge area position comprises at least one of an upper edge area and/or a right edge area; in the case where the defect region is in an edge region in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area; if the defect area in the target sub-image is in the right edge area, acquiring the defect area of the edge area of the target sub-image adjacent to the left and right of the target sub-image as a second defect area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
Specifically, the distance between the defect region in the target sub-image and the first defect region, and the distance between the defect region in the target sub-image and the second defect region may be the minimum distance in the horizontal direction, the minimum distance in the vertical direction, the distance between the center points, or other distance calculation methods such as the euclidean distance, the mahalanobis distance, and/or the chebyshev distance. As shown in table 2, the preset second distance threshold may be a preset distance value MX in the X-axis directionUPAnd/or a preset distance value MY in the Y-axis directionUP. Dividing the defect region of the target sub-image and the first defect region or the second defect region with the distance smaller than the preset second distance threshold into the same defect region, namely merging the defect region in the target sub-image and the first defect region or the second defect region with the distance smaller than the preset second distance threshold, wherein the merged defect region is as shown in fig. 9, a defect q1 is located at the upper edge of an image a2, a defect q2 is located at the lower edge of the image a1, and the defect q1 and the defect q2 are adjacent up and down, and if the distance between the defect q1 and the defect q2 meets the preset second distance threshold, merging the defect q1 and the defect q 2. Defect q3 is located at the right edge of image a1, defect q4 is located at the left edge of image a3, defect q3 and defect q4 are adjacent left and right, and if the distance between defect q3 and defect q4 meets a preset second distance threshold, defect q3 and defect q4 are merged. Defect q2 and defect q3 are located in the same image a1, and defect q4, defect q5 and defect q6 are located in the same image a3, and steps S202-S206 are performed to perform defect merging, respectively. Combining the defective areas on the multi-frame images to form a targetDefective area q 7.
For the case that the target image is a multi-frame image, the present embodiment provides a method for distributing the defect areas on the edge areas of the multi-frame image and merging the defect areas. The defect areas distributed on the multi-frame images are combined into one defect area, and the comprehensiveness of the combination of the defect areas is improved. For the condition that the target image is a single-frame image, namely the single-frame image can completely shoot the product to be detected, for example, the detection of a small-sized sheet, only the defect areas in the single-frame image need to be merged, and whether the defect areas are in the edge area of the image does not need to be judged.
As shown in fig. 10, in one embodiment, an apparatus for defect merging is provided, the apparatus comprising:
the acquiring module 1002 is configured to acquire a target image of a target to be detected, and identify defect regions in the target image, where the number of the identified defect regions is at least one;
the determining module 1004 is configured to traverse the at least one defect region, and determine whether a distance between the traversed defect region and another defect region is smaller than a preset first distance threshold;
a merging module 1006, configured to merge the traversed defect region and other defect regions whose distances are smaller than a preset first distance threshold if the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, and output the merged defect region as a target defect region.
As shown in fig. 11, in one embodiment, the merge module 1006 further includes:
the grouping unit is used for adding other defect areas, the distances between which and the traversed defect areas are smaller than a preset first distance threshold value, to a defect group where the traversed defect areas are located if the distances between the traversed defect areas and the other defect areas are smaller than the preset first distance threshold value;
and the merging unit is used for determining that each defect area contained in each defect group meets a preset first characteristic threshold value, merging the defect areas meeting the first characteristic threshold value, and taking the merged defect area as a target defect area.
As shown in fig. 12, in one embodiment, the merging unit further includes:
the first acquiring subunit is used for acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value;
the first judging subunit is used for judging whether the first characteristic reference value meets a preset first characteristic threshold value; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
As shown in fig. 13, in one embodiment, the merging unit further includes:
the second acquiring subunit is configured to acquire a grayscale reference value of a pixel point included in each defect region included in the defect group, and calculate a difference between the grayscale reference values of each defect region included in the defect group, where the grayscale reference value includes at least one of a minimum grayscale value, an average grayscale value, and/or a maximum grayscale value;
the second judgment subunit is used for judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
As shown in fig. 14, in one embodiment, the merge module 1006 further includes:
the judging unit is used for determining whether the defect area is in an edge area of each frame of target sub-image or not aiming at the defect area in each frame of target sub-image under the condition that the target image comprises a plurality of frames of target sub-images, wherein the position of the edge area comprises at least one of an upper edge area and/or a right edge area;
an upper merging unit for in case the defect area is in an edge area in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area;
the right merging unit is used for acquiring a defective area of the edge area of the target sub-image which is adjacent to the left and right of the target sub-image as a second defective area if the defective area in the target sub-image is in the right edge area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
As shown in fig. 15, in one embodiment, the apparatus further comprises:
the filtering module 1003 is configured to obtain at least one second characteristic reference value included in at least one defect region, where the second characteristic reference value includes a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value, and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
In one embodiment, the filtering module 1003 further includes:
the threshold judging unit is used for judging whether the length value and/or the width value of each defect area is less than or equal to a preset second characteristic threshold; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
FIG. 16 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may specifically be a terminal, and may also be a server. As shown in fig. 16, the computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by a processor, causes the processor to implement a method of defect merging. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform a method for defect merging. Those skilled in the art will appreciate that the architecture shown in fig. 16 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is proposed, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one; traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value; if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
In one embodiment, after the step of determining whether the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, the method further includes: if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, adding the other defect regions, the distance between which and the traversed defect region is smaller than the preset first distance threshold, to a defect group where the traversed defect region is located; and for each defect group, determining that each defect area contained in the defect group meets a preset first characteristic threshold, merging the defect areas meeting the first characteristic threshold, and taking the merged defect area as a target defect area.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether the first characteristic reference value meets a preset first characteristic threshold value or not; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring a gray reference value of a pixel point contained in each defect area contained in the defect group, and calculating a difference value between the gray reference values of each defect area contained in the defect group, wherein the gray reference value comprises at least one of a minimum gray value, an average gray value and/or a maximum gray value; judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: in the case that the target image comprises multiple frames of target sub-images, determining whether a defect area in each frame of target sub-image is in an edge area in the target sub-image, wherein the edge area position comprises at least one of an upper edge area and/or a right edge area; in the case where the defect region is in an edge region in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area; if the defect area in the target sub-image is in the right edge area, acquiring the defect area of the edge area of the target sub-image adjacent to the left and right of the target sub-image as a second defect area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
In one embodiment, the step of determining whether the second characteristic reference value of the at least one defective area satisfies a preset second characteristic threshold further includes: judging whether the length value and/or the width value of each defect area is smaller than or equal to a preset second characteristic threshold value or not; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
In one embodiment, a computer-readable storage medium is proposed, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the steps of: acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one; traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value; if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
In one embodiment, after the step of determining whether the distance between the traversed defect region and the other defect regions is smaller than the preset first distance threshold, the method further includes: if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, adding the other defect regions, the distance between which and the traversed defect region is smaller than the preset first distance threshold, to a defect group where the traversed defect region is located; and for each defect group, determining that each defect area contained in the defect group meets a preset first characteristic threshold, merging the defect areas meeting the first characteristic threshold, and taking the merged defect area as a target defect area.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether the first characteristic reference value meets a preset first characteristic threshold value or not; and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
In one embodiment, the step of determining that each defect area included in the defect group satisfies a preset first characteristic threshold further includes: acquiring a gray reference value of a pixel point contained in each defect area contained in the defect group, and calculating a difference value between the gray reference values of each defect area contained in the defect group, wherein the gray reference value comprises at least one of a minimum gray value, an average gray value and/or a maximum gray value; judging whether the difference value meets a preset first characteristic threshold value or not; and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: in the case that the target image comprises multiple frames of target sub-images, determining whether a defect area in each frame of target sub-image is in an edge area in the target sub-image, wherein the edge area position comprises at least one of an upper edge area and/or a right edge area; in the case where the defect region is in an edge region in the target sub-image; if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area; judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not; if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area; if the defect area in the target sub-image is in the right edge area, acquiring the defect area of the edge area of the target sub-image adjacent to the left and right of the target sub-image as a second defect area; judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not; and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
In one embodiment, after the step of identifying the defect region in the target image, the method further includes: acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value; judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not; and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
In one embodiment, the step of determining whether the second characteristic reference value of the at least one defective area satisfies a preset second characteristic threshold further includes: judging whether the length value and/or the width value of each defect area is smaller than or equal to a preset second characteristic threshold value or not; and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
By adopting the defect merging method, the defect merging device, the computer equipment and the storage medium, when a product to be detected is detected, a target image of the product to be detected is obtained, at least one defect area in the target image is identified, if the distance between the defect areas is smaller than a preset distance value, the defect areas with the distance smaller than the preset distance value are merged, and the merged defect areas are output as target defect areas. The defect merging method, the defect merging device, the computer equipment and the storage medium can merge detected defects, for example, defects in a small range or with a small distance, so that the defects in a small block region are prevented from being respectively treated as defects, and the integrity of defect detection is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims. Please enter the implementation content part.

Claims (10)

1. A method of defect merging, the method comprising:
acquiring a target image of a target to be detected, and identifying defect areas in the target image, wherein the number of the identified defect areas is at least one;
traversing the at least one defect area, and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value;
if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, combining the traversed defect region and other defect regions with the distance smaller than the preset first distance threshold, and outputting the combined defect region as a target defect region.
2. The method according to claim 1, wherein after the step of determining whether the distance between the traversed defect region and other defect regions is smaller than the preset first distance threshold, the method further comprises:
if the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold, adding the other defect regions, the distance between which and the traversed defect region is smaller than the preset first distance threshold, to a defect group where the traversed defect region is located;
and for each defect group, determining that each defect area contained in the defect group meets a preset first characteristic threshold, merging the defect areas meeting the first characteristic threshold, and taking the merged defect area as a target defect area.
3. The method of claim 2, wherein the step of determining that each defect region included in the defect group satisfies a predetermined first characteristic threshold further comprises:
acquiring at least one first characteristic reference value contained in each defect area contained in the defect group, wherein the first characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value;
judging whether the first characteristic reference value meets a preset first characteristic threshold value or not;
and under the condition that the first characteristic reference value meets a preset first characteristic threshold value, judging that each defect area contained in the defect group meets the preset first characteristic threshold value.
4. The method of claim 2, wherein the step of determining that each defect region included in the defect group satisfies a predetermined first characteristic threshold further comprises:
acquiring a gray reference value of a pixel point contained in each defect area contained in the defect group, and calculating a difference value between the gray reference values of each defect area contained in the defect group, wherein the gray reference value comprises at least one of a minimum gray value, an average gray value and/or a maximum gray value;
judging whether the difference value meets a preset first characteristic threshold value or not;
and under the condition that the difference value meets a preset first characteristic value, judging that each defect area contained in the defect group meets a preset first characteristic threshold value.
5. The method of claim 1, wherein the step of identifying a defective region in the target image is followed by the step of:
in the case that the target image comprises multiple frames of target sub-images, determining whether a defect area in each frame of target sub-image is in an edge area in the target sub-image, wherein the edge area position comprises at least one of an upper edge area and/or a right edge area;
in the case where the defect region is in an edge region in the target sub-image;
if the defect area in the target sub-image is in the upper edge area, acquiring the defect area of the target sub-image adjacent to the target sub-image as a first defect area;
judging whether the distance between the defect area in the upper edge area and the first defect area meets a preset second distance threshold value or not;
if the preset second distance threshold is met, merging the defect area in the upper edge area with the first defect area, and taking the merged defect area as a target defect area;
if the defect area in the target sub-image is in the right edge area, acquiring the defect area of the edge area of the target sub-image adjacent to the left and right of the target sub-image as a second defect area;
judging whether the distance between the defective area at the right edge area and the second defective area meets a preset second distance threshold value or not;
and if the preset second distance threshold is met, merging the defect area in the right edge area and the second defect area, and taking the merged defect area as a target defect area.
6. The method of claim 1, wherein the step of identifying a defective region in the target image is followed by the step of:
acquiring at least one second characteristic reference value contained in at least one defect area, wherein the second characteristic reference value comprises a rotating external rectangle reference value, a minimum external moment reference value, a gray reference value, a length reference value, a width reference value, a roundness reference value, a circularity reference value, a convexity reference value and/or a flatness reference value;
judging whether a second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value or not;
and if the second characteristic reference value meets a preset second characteristic threshold value, executing the step of traversing the at least one defect region and judging whether the distance between the traversed defect region and other defect regions is smaller than a preset first distance threshold value.
7. The method according to claim 6, wherein the step of determining whether the second characteristic reference value of the at least one defect area meets a preset second characteristic threshold value further comprises:
judging whether the length value and/or the width value of each defect area is smaller than or equal to a preset second characteristic threshold value or not;
and judging that the defect area meets the second characteristic threshold value when the length value and/or the width value of the defect area is smaller than or equal to the second characteristic threshold value.
8. An apparatus for defect merging, the apparatus comprising:
the acquisition module is used for acquiring a target image of a target to be detected, identifying defect areas in the target image, and the number of the identified defect areas is at least one;
the judging module is used for traversing the at least one defect area and judging whether the distance between the traversed defect area and other defect areas is smaller than a preset first distance threshold value or not;
and the merging module is used for merging the traversed defect region and other defect regions with the distances smaller than the preset first distance threshold if the distances between the traversed defect region and the other defect regions are smaller than the preset first distance threshold, and outputting the merged defect region as a target defect region.
9. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.
CN201910876015.7A 2019-09-17 2019-09-17 Defect merging method and device, computer equipment and storage medium Pending CN110728659A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910876015.7A CN110728659A (en) 2019-09-17 2019-09-17 Defect merging method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910876015.7A CN110728659A (en) 2019-09-17 2019-09-17 Defect merging method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110728659A true CN110728659A (en) 2020-01-24

Family

ID=69219031

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910876015.7A Pending CN110728659A (en) 2019-09-17 2019-09-17 Defect merging method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110728659A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339220A (en) * 2020-05-21 2020-06-26 深圳新视智科技术有限公司 Defect mapping method
CN114140679A (en) * 2021-10-26 2022-03-04 中科慧远视觉技术(北京)有限公司 Defect fusion method, device, recognition system and storage medium
CN116152248A (en) * 2023-04-20 2023-05-23 中科慧远视觉技术(北京)有限公司 Appearance defect detection method and device, storage medium and computer equipment
CN117078666A (en) * 2023-10-13 2023-11-17 东声(苏州)智能科技有限公司 Two-dimensional and three-dimensional combined defect detection method, device, medium and equipment
CN117078665A (en) * 2023-10-13 2023-11-17 东声(苏州)智能科技有限公司 Product surface defect detection method and device, storage medium and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102148919A (en) * 2010-02-09 2011-08-10 新奥特(北京)视频技术有限公司 Method and system for detecting balls
CN108445020A (en) * 2018-01-31 2018-08-24 彩虹显示器件股份有限公司 A kind of glass substrate defect aggregation recognition methods
CN109242819A (en) * 2018-07-02 2019-01-18 广东工业大学 A kind of algorithm of the galled spots defect connection based on image procossing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102148919A (en) * 2010-02-09 2011-08-10 新奥特(北京)视频技术有限公司 Method and system for detecting balls
CN108445020A (en) * 2018-01-31 2018-08-24 彩虹显示器件股份有限公司 A kind of glass substrate defect aggregation recognition methods
CN109242819A (en) * 2018-07-02 2019-01-18 广东工业大学 A kind of algorithm of the galled spots defect connection based on image procossing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘坤 等: "基于机器视觉的带钢表面缺陷检测***设计", 《制造业自动化》 *
韩九强,杨磊: "《数字图像处理 基于XAVIS组态软件》", 西安交通大学出版社 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339220A (en) * 2020-05-21 2020-06-26 深圳新视智科技术有限公司 Defect mapping method
WO2021232606A1 (en) * 2020-05-21 2021-11-25 深圳新视智科技术有限公司 Defect mapping method
CN114140679A (en) * 2021-10-26 2022-03-04 中科慧远视觉技术(北京)有限公司 Defect fusion method, device, recognition system and storage medium
CN114140679B (en) * 2021-10-26 2022-07-01 中科慧远视觉技术(北京)有限公司 Defect fusion method, device, recognition system and storage medium
CN116152248A (en) * 2023-04-20 2023-05-23 中科慧远视觉技术(北京)有限公司 Appearance defect detection method and device, storage medium and computer equipment
CN117078666A (en) * 2023-10-13 2023-11-17 东声(苏州)智能科技有限公司 Two-dimensional and three-dimensional combined defect detection method, device, medium and equipment
CN117078665A (en) * 2023-10-13 2023-11-17 东声(苏州)智能科技有限公司 Product surface defect detection method and device, storage medium and electronic equipment
CN117078665B (en) * 2023-10-13 2024-04-09 东声(苏州)智能科技有限公司 Product surface defect detection method and device, storage medium and electronic equipment
CN117078666B (en) * 2023-10-13 2024-04-09 东声(苏州)智能科技有限公司 Two-dimensional and three-dimensional combined defect detection method, device, medium and equipment

Similar Documents

Publication Publication Date Title
CN110728659A (en) Defect merging method and device, computer equipment and storage medium
CN110414507B (en) License plate recognition method and device, computer equipment and storage medium
CN107228860B (en) Gear defect detection method based on image rotation period characteristics
US6778694B1 (en) Method for examining doubtful zones on the surface of an unwinding strip by image segmentation
CN113109368B (en) Glass crack detection method, device, equipment and medium
CN109632808B (en) Edge defect detection method and device, electronic equipment and storage medium
CN109300127B (en) Defect detection method, defect detection device, computer equipment and storage medium
US20230005130A1 (en) Method and device for detecting display panel defect
CN109492642B (en) License plate recognition method, license plate recognition device, computer equipment and storage medium
CN113160161B (en) Method and device for detecting defects at edge of target
CN108918093B (en) Optical filter mirror surface defect detection method and device and terminal equipment
CN115953373B (en) Glass defect detection method, device, electronic equipment and storage medium
CN113379723B (en) Irregular glue overflow port detection method, device, equipment and storage medium
CN113554649B (en) Defect detection method and device, computer equipment and storage medium
CN112164050B (en) Method and device for detecting surface defects of products on production line and storage medium
CN113487607A (en) Defect detection method and device based on multi-view-field image
CN114998324A (en) Training method and device for semiconductor wafer defect detection model
CN112465807A (en) License plate image authenticity identification method, device, equipment and medium
US6697516B1 (en) Method for inspecting the surface of a moving strip by prior classification of the detected surface irregularity
CN113066088A (en) Detection method, detection device and storage medium in industrial detection
JP6960252B2 (en) Maintenance management method for image analyzers and railway equipment parts
CN113781393A (en) Screen defect detection method, device, equipment and storage medium
CN115631198B (en) Crack detection method and device for glass display screen and computer equipment
CN115880481A (en) Curve positioning algorithm and system based on edge profile
CN110223309B (en) Edge detection method, edge detection device, computer equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200124

RJ01 Rejection of invention patent application after publication