CN110751623A - Joint feature-based defect detection method, device, equipment and storage medium - Google Patents

Joint feature-based defect detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN110751623A
CN110751623A CN201910841701.0A CN201910841701A CN110751623A CN 110751623 A CN110751623 A CN 110751623A CN 201910841701 A CN201910841701 A CN 201910841701A CN 110751623 A CN110751623 A CN 110751623A
Authority
CN
China
Prior art keywords
target image
characteristic
defect
calculating
probability
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
CN201910841701.0A
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 CN201910841701.0A priority Critical patent/CN110751623A/en
Publication of CN110751623A publication Critical patent/CN110751623A/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
    • 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

Landscapes

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

Abstract

The embodiment of the invention discloses a defect detection method based on joint characteristics, which comprises the following steps: acquiring a target image to be detected; calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value; calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image; and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image. The defect detection method based on the combined characteristics can accurately detect various types of defects, is suitable for surface defect detection with various defect types, and improves the accuracy and comprehensiveness of defect detection. In addition, a device, a computer device and a storage medium for defect detection based on joint features are also provided.

Description

Joint feature-based defect detection method, device, equipment and storage medium
Technical Field
The present invention relates to computer vision and pattern recognition, and more particularly, to a method, system, apparatus, computer device, and storage medium for detecting defects based on joint features.
Background
Surface defect inspection in industrial manufacturing processes is currently performed mainly by hand, and this time-consuming inspection task is increasingly becoming a bottleneck in productivity. With the development of image processing techniques and artificial intelligence, it becomes possible to use automatic detection instead of manual labor.
Currently available surface defect detection methods can be broadly classified into filter-based, reconstruction-based, and classification-based methods. Conventional filter-based defect detection algorithms are only applicable to a specific class of defects and cannot detect all defects, i.e., some features are not detected.
Therefore, a defect detection method which is not only fast in detection speed but also capable of effectively detecting various types of defects is required.
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 detecting defects based on joint features.
A method for joint feature based defect detection, the method comprising:
acquiring a target image to be detected;
calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value;
calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image;
and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
In one embodiment, the step of calculating at least two feature values of the target image by a preset at least two feature calculation methods further includes: selecting a pixel point in a target image as a target pixel point, calculating the absolute value of the difference between the gray value of the target pixel point and the gray values of other pixel points except the target pixel point in the target image, calculating the sum of the absolute values, and determining the LC characteristic value according to the sum of the absolute values.
In one embodiment, the step of calculating at least two feature values of the target image by a preset at least two feature calculation methods further includes: and/or, performing morphology closing operation processing on the target image, and calculating the difference between the target image and the target image after the morphology closing operation as a morphology top cap characteristic value.
In one embodiment, the step of calculating a joint eigenvalue from the at least two eigenvalues further comprises: and acquiring the maximum value of the LC characteristic value, the morphological top-cap characteristic value and/or the morphological bottom-cap characteristic value of the target image as the joint characteristic value.
In one embodiment, the step of performing threshold segmentation processing on the combined feature map to obtain a defective region in the target image further includes: acquiring a gray scale image of the combined characteristic image; traversing each pixel point in the gray-scale image, and judging whether the gray value of the traversed pixel point is greater than or equal to a preset gray segmentation threshold value: if yes, determining that the traversed pixel point belongs to a defect area; if not, determining that the traversed pixel belongs to the non-defect area.
In one embodiment, the step of acquiring the defect region in the target image further comprises: and carrying out gray level probability calculation on the defect area, and optimizing the defect area according to the calculated gray level probability to obtain a target defect image.
In one embodiment, the step of optimizing the defect region according to the calculated gray scale probability further includes: selecting a pixel point in the defect area as a candidate pixel point, and determining a target updating area corresponding to the candidate pixel point: acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region; acquiring a residual area except the defect area in the target updating area as a second area, and calculating a second probability of pixel points in the second area; determining whether the first probability is greater than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
A defect detection apparatus, the apparatus comprising:
the receiving module is used for acquiring a target image to be detected;
the calculation module is used for calculating at least two characteristic values of the target image through a preset characteristic calculation method, wherein the at least two characteristic values comprise LC characteristic values and/or morphological characteristic values, calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic map corresponding to the target image;
and the processing module is used for carrying out threshold segmentation processing on the combined characteristic graph to obtain a defect area in the target image.
In one embodiment, the calculation module includes an LC feature calculation unit, configured to select a pixel point in a target image as a target pixel point, calculate an absolute value of a difference between a gray value of the target pixel point and gray values of other pixel points in the target image except the target pixel point, calculate a sum of the absolute values, and determine the LC feature value according to the sum of the absolute values.
In one embodiment, the calculation module includes a morphological feature calculation unit configured to perform a morphological open operation on the target image and calculate a difference between the target image and the target image after the morphological open operation as a morphological top hat feature value, and/or perform a morphological close operation on the target image and calculate a difference between the target image and the target image after the morphological close operation as a morphological bottom hat feature value.
In one embodiment, the calculation module comprises a joint feature calculation unit for obtaining a maximum value of the LC feature value, the morphological top-cap feature value and/or the morphological bottom-cap feature value of the target image as the joint feature value.
In one embodiment, the defect detecting apparatus further includes: and the optimization module is used for calculating the gray probability of the defect area, and optimizing the defect area according to the calculated gray probability to obtain a target defect image.
In one embodiment, the optimization module includes a gray probability calculation unit, configured to select a pixel point in the defect region as a candidate pixel point, and determine a target update region corresponding to the candidate pixel point: acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region; and acquiring a residual area except the defective area in the target updating area as a second area, and calculating a second probability of the pixel points in the second area. The optimization module further comprises an optimization unit for judging whether the first probability is greater than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
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 to be detected;
calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value;
calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image;
and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
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 to be detected;
calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value;
calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image;
and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
When the defect detection method, the device, the equipment and the storage medium based on the joint features are adopted, when the surface defect needing to be detected is detected, the image of the defect needing to be detected is collected, at least two corresponding features of the image, such as LC feature, morphological top cap feature and/or psychology bottom cap feature, are calculated, a joint feature map is generated through the at least two preset features, and then threshold segmentation processing is carried out on the joint feature map, so that a defect area is obtained. Compared with a single defect detection scheme, the defect detection method, the device, the equipment and the storage medium based on the combined characteristics can detect various types of defects more accurately, are suitable for surface defect detection with various defect types, and improve the accuracy and comprehensiveness of defect detection.
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 joint feature based defect detection method;
FIG. 2 is a flow diagram of a method for joint feature based defect detection in one embodiment;
FIG. 3 is a flow diagram of a method for defect region based optimization in one embodiment;
FIG. 4 is a diagram illustrating an embodiment of determining a target update region based on candidate pixels;
FIG. 5 is a diagram illustrating a first region and a second region of a target update region, according to one embodiment;
FIG. 6 is a graph illustrating the contrast effect before and after optimization of the defective regions of the target image in one embodiment;
FIG. 7 is a block diagram of a joint feature based defect detection apparatus according to an embodiment;
FIG. 8 is a block diagram of a computer device 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 application environment of a joint feature-based defect detection method. Referring to fig. 1, the joint feature-based defect detection method may be 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, and the terminal 110 may specifically be a terminal device such as a PC, a mobile phone, a tablet computer, and a notebook computer. The server 120 may be implemented as a stand-alone server or a server cluster composed of a plurality of servers. Specifically, the terminal 110 is configured to obtain a target image to be detected and send the target image to the server, and the server 120 analyzes the image after receiving the image to determine whether the target image has a defect.
In another embodiment, the defect detection method based on the joint feature may be performed based on a terminal device, which may capture an image and analyze the image to determine whether a defect exists.
Considering that the method can be applied to both the terminal and the server, and the process of detecting a defect is the same in the specific case, the embodiment is exemplified as applied to the terminal.
In one embodiment, as shown in fig. 2, a defect detection method based on joint features is provided, which can determine whether a defect exists in a product to be detected by collecting an image of the product to be detected and analyzing the collected image. The defect detection method based on the joint features specifically comprises the following steps S202-S208:
step S202, a target image to be detected is obtained.
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 can be an original image or an original image subjected to denoising processing; for example, the image is subjected to a noise removal process by gaussian filtering. The target image may be a color image or a grayscale image, among others.
Step S204, calculating at least two characteristic values of the target image through a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value.
Since different feature calculations can be used for different types of defect detection, in the present embodiment, in order to detect only a plurality of types of defects possibly comprehensively, a plurality of image features need to be considered.
In this step, first, features of the target image, such as LC features, morphological features, PHOT features, and/or Haar-like features, need to be calculated by different feature calculation methods.
The purpose of defect feature extraction is achieved by using the global Contrast characteristic through LC (Local Contrast) features. The LC feature calculates the global contrast of a certain pixel on the whole target image, i.e. the sum of the distances of the pixel from all other pixels in the target image on the color, as the feature value of the pixel. The LC features can significantly enhance defects that differ greatly from non-defective areas.
In one embodiment, the LC characteristic value is calculated by:
a certain pixel point I in the target image IkLC (I) ofk) The definition is as follows:
Figure BDA0002193917530000071
wherein, IiThe value range is [0,255 ]]And | represents a distance metric.
Let IkmN represents the total number of pixel points of the input target image, and m, N belongs to [0, N ∈]Then, the LC characteristic calculation formula can be expressed as:
LC(Ik)=||am-a0||+||am-a1||+…+…,
wherein f isnRepresenting a pixel value anThe frequency of (d), i | represents the distance metric.
The morphological characteristics are that structural elements with certain forms are used for measuring and extracting corresponding shapes in the target image so as to achieve the purpose of analyzing and identifying the target image. The use of morphological features can simplify the target image data, preserve their underlying shape characteristics, and remove extraneous structures. The method based on the morphological characteristics has better robustness for acquiring the defect shape and low time complexity.
In one embodiment, the method for calculating the morphological top hat characteristic value is to perform morphological opening operation processing on the target image, and calculate a difference value between the target image and the target image after the morphological opening operation as the morphological top hat characteristic value, and the formula is as follows:
H(I)=I-(I o Bd)
wherein I represents a target image, o represents a morphological open operation, BdRepresenting a structural element with a radius d.
The method for calculating the morphological top hat characteristic value is to perform morphological closing operation processing on the target image, calculate the difference value between the target image and the target image after the morphological closing operation as a morphological bottom hat characteristic value, and the formula is as follows:
B(I)=(I·Bd)-I
wherein I represents a target image, represents a morphological open operation, and BdRepresenting a structural element with a radius d.
Step S206, calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image.
After the LC features and the morphological features are calculated, the at least two features may be processed to generate a joint feature map of the at least two features. In this embodiment, the calculation of the joint eigenvalue is performed according to a preset calculation formula, for example, the joint eigenvalue may be calculated by calculating the sum of at least two eigenvalues, or by calculating a weighted sum of at least two eigenvalues, or by calculating another preset calculation formula.
In one embodiment, the calculation of the joint feature value of the target image may be further based on a maximum value representing the most significant feature of the at least two features.
Specifically, the step S204: the process of calculating the joint eigenvalue according to the at least two eigenvalues specifically comprises the following steps: acquiring the maximum value of the LC characteristic value, the morphological top-hat characteristic value and/or the morphological bottom-hat characteristic value of the target image as the joint characteristic value, wherein the formula is as follows:
U(I)=max(max(H(I),B(I)),LC(I))
wherein, I represents the target image, H (I) is the morphological top-hat characteristic value, B (I) is the morphological bottom-hat characteristic value, and LC (I) is the LC characteristic value.
And generating a joint characteristic diagram based on the joint characteristic value, more accurately displaying various types of defects and being suitable for defect detection with at least two defect types.
And step S208, performing threshold segmentation processing on the combined feature map to acquire a defect area in the target image.
And performing threshold segmentation on the characteristic value, dividing the characteristic value into a defective area and a non-defective area, wherein the defective area is larger than the gray segmentation threshold, and the non-defective area is smaller than the gray segmentation threshold.
For convenience of processing, in this embodiment, the target image of the defective area obtained by the threshold segmentation method is set as a binary image, in which the pixel values of the pixel points are only two, that is, any pixel gray value in the image is either 0 or 255.
In one embodiment, the threshold segmentation process determines whether each pixel in the image belongs to a defective region or a non-defective region by determining whether the feature value of each pixel in the joint feature map satisfies the threshold requirement, and converts the joint feature map U (x, y) into a binary image D (x, y), where the formula is as follows:
Figure BDA0002193917530000091
where T represents a grayscale division threshold, for example, T may be 125. Different gray segmentation threshold values T can also be set according to different joint features and different scenes.
The threshold segmentation process is applied to an image in which a defective region and a non-defective region occupy different gray scale ranges. It not only can greatly compress data quantity, but also can greatly simplify analysis and processing steps.
Further, in this embodiment, the obtained defect area is not clear enough, and the area may be further optimized in order to make the obtained defect closer to the real defect shape.
As shown in fig. 3, in an embodiment, after the step S208, steps S302-306 are further included:
step S302, selecting a pixel point in the defect area as a candidate pixel point, and determining a target updating area corresponding to the candidate pixel point.
In order to optimize the defect region, a candidate pixel point in the defect region is selected first, and the point may be selected randomly or traversed.
The target update area is an area including candidate pixels, and may be a square area as shown in fig. 4.
Specifically, a region having a distance value with a distance from a candidate pixel point smaller than a preset value is obtained, and the region is used as a target update region, for example, a target update region determined by an n × n square with p as a center at each candidate pixel point p (i.e., d (p) ═ 1). The target updating area can be a circular area, a square area or an irregular area.
Step S304, a first area corresponding to the defect area in the target update area is obtained, and a first probability of pixel points in the first area is calculated; and acquiring a residual area except the defective area in the target updating area as a second area, and calculating a second probability of the pixel points in the second area.
Wherein, the residual area except the defect area is a non-defect area. The gray value of the pixel points in the first area is 255, and the gray value of the pixel points in the second area is 0. Fig. 5 shows a method for determining the first area and the second area.
In one embodiment, the formula for calculating the first probability and the second probability of the pixel points in the first region and the second region respectively is as follows:
Figure BDA0002193917530000101
wherein I represents a target image, rk,k∈[0,255]Representing a set of pixels having a grey value k, wiWhere i is 0,1 denotes a first region and a second region, respectively, and n denotes a first threshold valuei,kIndicates the number of pixels having a gray level of k in the i-th class,niDenotes to belong to wiThe total number of pixels.
Step S306, judging whether the first probability is larger than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
Specifically, if the first probability is greater than or equal to the second probability, it indicates that the total number of pixels belonging to the first region is greater than the total number of pixels belonging to the second region in the target update region, so that the second region is updated; if the first probability is smaller than the second probability, the total number of the pixel points belonging to the first area is smaller than the total number of the pixel points belonging to the second area in the target updating area, so that the first area is updated.
Specifically, the updating of the second region is to assign the gray values of the pixels in the first region to the pixels in the second region, so that the gray values of all the pixels in the target updating region are the same as the gray values of the pixels in the first region; and updating the first area is to endow the gray values of the pixel points in the second area to the pixel points in the first area, so that the gray values of all the pixel points in the target updating area are the same as the gray values of the pixel points in the second area.
In one embodiment, the step of comparing the magnitudes of the first probability and the second probability and updating the corresponding region can be represented by the following formula:
where D isLFor the result of optimization based on the defective region, rk,k∈[0,255]Representing a set of pixels having a grey value k, wiAnd i is 0, and 1 denotes a first region and a second region, respectively.
The gray values of the pixel points in the target updating region are the same, so that the image of the defect edge is clearer, and the defect region is optimized.
As shown in fig. 6, fig. 6(a) is a target image, fig. 6(b) is an image after joint feature and threshold segmentation, and fig. 6(c) is an image after optimization of fig. 6 (b).
As shown in fig. 7, in one embodiment, a defect detecting apparatus is provided, the apparatus comprising:
a receiving module 702, configured to obtain a target image to be detected;
a calculating module 704, configured to calculate at least two feature values of the target image by using a preset feature calculation method, where the at least two feature values include an LC feature value and/or a morphological feature value, calculate a joint feature value according to the at least two feature values, and generate a joint feature map corresponding to the target image;
and the processing module 706 is configured to perform threshold segmentation processing on the joint feature map to obtain a defect region in the target image.
In one embodiment, the calculating module 704 includes an LC feature calculating unit, configured to select a pixel point in the target image as a target pixel point, calculate an absolute value of a difference between a gray value of the target pixel point and gray values of other pixel points in the target image except the target pixel point, calculate a sum of the absolute values, and determine the LC feature value according to the sum of the absolute values.
In one embodiment, the calculation module 704 includes a morphological feature calculation unit configured to perform a morphological open operation on the target image and calculate a difference between the target image and the target image after the morphological open operation as a morphological top hat feature value, and/or perform a morphological close operation on the target image and calculate a difference between the target image and the target image after the morphological close operation as a morphological bottom hat feature value.
In one embodiment, the calculation module 704 includes a joint feature calculation unit for obtaining a maximum value of the LC feature value, the morphological top-cap feature value, and/or the morphological bottom-cap feature value of the target image as the joint feature value.
In one embodiment, the defect detecting apparatus further includes: and the optimization module is used for calculating the gray probability of the defect area, and optimizing the defect area according to the calculated gray probability to obtain a target defect image.
In one embodiment, the optimization module includes a gray probability calculation unit, configured to select a pixel point in the defect region as a candidate pixel point, and determine a target update region corresponding to the candidate pixel point: acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region; and acquiring a residual area except the defective area in the target updating area as a second area, and calculating a second probability of the pixel points in the second area. The optimization module further comprises an optimization unit for judging whether the first probability is greater than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
FIG. 8 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. 8, 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 the processor, causes the processor to implement a joint feature based defect detection method. 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 detection based on the joint signature. Those skilled in the art will appreciate that the architecture shown in fig. 8 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, the method for detecting defects based on joint features provided in the present application may be implemented in the form of a computer program, which is executable on a computer device as shown in fig. 8. The memory of the computer device may store therein the respective program templates constituting the vehicle inquiry apparatus. Such as a receiving module 702, a computing module 704, and a processing module 706.
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 to be detected; calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value; calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image; and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
In one embodiment, the step of calculating at least two feature values of the target image by at least two preset feature calculation methods further includes: selecting a pixel point in a target image as a target pixel point, calculating the absolute value of the difference between the gray value of the target pixel point and the gray values of other pixel points except the target pixel point in the target image, calculating the sum of the absolute values, and determining the LC characteristic value according to the sum of the absolute values.
In one embodiment, the step of calculating at least two feature values of the target image by at least two preset feature calculation methods further includes: and/or, performing morphology closing operation processing on the target image, and calculating the difference between the target image and the target image after the morphology closing operation as a morphology top cap characteristic value.
In one embodiment, the step of calculating a joint eigenvalue from the at least two eigenvalues further comprises: and acquiring the maximum value of the LC characteristic value, the morphological top-cap characteristic value and/or the morphological bottom-cap characteristic value of the target image as the joint characteristic value.
In one embodiment, the step of performing threshold segmentation processing on the combined feature map to obtain a defective region in the target image further includes: acquiring a gray scale image of the combined characteristic image; traversing each pixel point in the gray-scale image, and judging whether the gray value of the traversed pixel point is greater than or equal to a preset gray segmentation threshold value: if yes, determining that the traversed pixel point belongs to a defect area; if not, determining that the traversed pixel belongs to the non-defect area.
In one embodiment, after the step of acquiring the defect region in the target image, the method further includes: and carrying out gray level probability calculation on the defect area, and optimizing the defect area according to the calculated gray level probability to obtain a target defect image.
In one embodiment, the step of optimizing the defect region according to the calculated gray scale probability further includes: selecting a pixel point in the defect area as a candidate pixel point, and determining a target updating area corresponding to the candidate pixel point: acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region; acquiring a residual area except the defect area in the target updating area as a second area, and calculating a second probability of pixel points in the second area; determining whether the first probability is greater than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
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 to be detected; calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value; calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image; and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
In one embodiment, the step of calculating at least two feature values of the target image by at least two preset feature calculation methods further includes: selecting a pixel point in a target image as a target pixel point, calculating the absolute value of the difference between the gray value of the target pixel point and the gray values of other pixel points except the target pixel point in the target image, calculating the sum of the absolute values, and determining the LC characteristic value according to the sum of the absolute values.
In one embodiment, the step of calculating at least two feature values of the target image by at least two preset feature calculation methods further includes: and/or, performing morphology closing operation processing on the target image, and calculating the difference between the target image and the target image after the morphology closing operation as a morphology top cap characteristic value.
In one embodiment, the step of calculating a joint eigenvalue from the at least two eigenvalues further comprises: and acquiring the maximum value of the LC characteristic value, the morphological top-cap characteristic value and/or the morphological bottom-cap characteristic value of the target image as the joint characteristic value.
In one embodiment, the step of performing threshold segmentation processing on the combined feature map to obtain a defective region in the target image further includes: acquiring a gray scale image of the combined characteristic image; traversing each pixel point in the gray-scale image, and judging whether the gray value of the traversed pixel point is greater than or equal to a preset gray segmentation threshold value: if yes, determining that the traversed pixel point belongs to a defect area; if not, determining that the traversed pixel belongs to the non-defect area.
In one embodiment, after the step of acquiring the defect region in the target image, the method further includes: and carrying out gray level probability calculation on the defect area, and optimizing the defect area according to the calculated gray level probability to obtain a target defect image.
In one embodiment, the step of optimizing the defect region according to the calculated gray scale probability further includes: selecting a pixel point in the defect area as a candidate pixel point, and determining a target updating area corresponding to the candidate pixel point: acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region; acquiring a residual area except the defect area in the target updating area as a second area, and calculating a second probability of pixel points in the second area; determining whether the first probability is greater than or equal to a second probability; updating the second region if the first probability is greater than or equal to a second probability; updating the first region if the first probability is less than a second probability.
When the defect detection method, the device, the equipment and the storage medium based on the joint features are adopted, when the surface defect needing to be detected is detected, the image of the defect needing to be detected is collected, at least two corresponding features of the image, such as LC feature, morphological top cap feature and/or psychology bottom cap feature, are calculated, a joint feature map is generated through the at least two preset features, and then threshold segmentation processing is carried out on the joint feature map, so that a defect area is obtained. Compared with a single defect detection scheme, the defect detection method, the device, the equipment and the storage medium based on the combined characteristics can detect various types of defects more accurately, are suitable for surface defect detection with various defect types, and improve the accuracy and comprehensiveness of defect detection.
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 for defect detection based on joint features, the method comprising:
acquiring a target image to be detected;
calculating at least two characteristic values of the target image by a preset characteristic calculation method, wherein the at least two characteristic values comprise an LC characteristic value, a morphological top cap characteristic value and/or a morphological bottom cap characteristic value;
calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic graph corresponding to the target image;
and performing threshold segmentation processing on the combined feature map to obtain a defect area in the target image.
2. The method according to claim 1, wherein the step of calculating at least two feature values of the target image by a preset at least two feature calculation methods further comprises:
selecting a pixel point in a target image as a target pixel point, calculating the absolute value of the difference between the gray value of the target pixel point and the gray values of other pixel points except the target pixel point in the target image, calculating the sum of the absolute values, and determining the LC characteristic value according to the sum of the absolute values.
3. The method according to claim 1, wherein the step of calculating at least two feature values of the target image by a preset at least two feature calculation methods further comprises:
performing morphological opening operation processing on the target image, calculating a difference value between the target image and the target image after the morphological opening operation as a morphological top hat characteristic value,
and/or the presence of a gas in the gas,
and performing morphological closing operation processing on the target image, and calculating a difference value between the target image and the target image after the morphological closing operation as a morphological bottom hat characteristic value.
4. The method of claim 1, wherein the step of computing a joint eigenvalue from the at least two eigenvalues further comprises:
and acquiring the maximum value of the LC characteristic value, the morphological top-cap characteristic value and/or the morphological bottom-cap characteristic value of the target image as the joint characteristic value.
5. The method according to claim 1, wherein the step of performing a threshold segmentation process on the joint feature map to obtain the defect region in the target image further comprises:
acquiring a gray scale image of the combined characteristic image;
traversing each pixel point in the gray-scale image, and judging whether the gray value of the traversed pixel point is greater than or equal to a preset gray segmentation threshold value:
if yes, determining that the traversed pixel point belongs to a defect area;
if not, determining that the traversed pixel belongs to the non-defect area.
6. The method of claim 5, wherein the step of acquiring the defect region in the target image is followed by the step of:
and carrying out gray level probability calculation on the defect area, and optimizing the defect area according to the calculated gray level probability to obtain a target defect image.
7. The method of claim 6, wherein the step of optimizing the defect region based on the calculated gray scale probability further comprises:
selecting a pixel point in the defect area as a candidate pixel point, and determining a target updating area corresponding to the candidate pixel point:
acquiring a first region corresponding to a defect region in a target updating region, and calculating a first probability of pixel points in the first region;
acquiring a residual area except the defect area in the target updating area as a second area, and calculating a second probability of pixel points in the second area;
determining whether the first probability is greater than or equal to a second probability;
updating the second region if the first probability is greater than or equal to a second probability;
updating the first region if the first probability is less than a second probability.
8. A defect detection apparatus, the apparatus comprising:
the receiving module is used for acquiring a target image to be detected;
the calculation module is used for calculating at least two characteristic values of the target image through a preset characteristic calculation method, wherein the at least two characteristic values comprise LC characteristic values and/or morphological characteristic values, calculating a joint characteristic value according to the at least two characteristic values, and generating a joint characteristic map corresponding to the target image;
and the processing module is used for carrying out threshold segmentation processing on the combined characteristic graph to obtain a defect area in the target image.
9. 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.
10. 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.
CN201910841701.0A 2019-09-06 2019-09-06 Joint feature-based defect detection method, device, equipment and storage medium Pending CN110751623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910841701.0A CN110751623A (en) 2019-09-06 2019-09-06 Joint feature-based defect detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910841701.0A CN110751623A (en) 2019-09-06 2019-09-06 Joint feature-based defect detection method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110751623A true CN110751623A (en) 2020-02-04

Family

ID=69276074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910841701.0A Pending CN110751623A (en) 2019-09-06 2019-09-06 Joint feature-based defect detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110751623A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111325728A (en) * 2020-02-19 2020-06-23 南方科技大学 Product defect detection method, device, equipment and storage medium
CN112561896A (en) * 2020-12-22 2021-03-26 广州大学 Method, system and device for detecting defects of glass bottle mouth and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500458A (en) * 2013-09-06 2014-01-08 李静 Method for automatically detecting line number of corncobs
CN103870842A (en) * 2014-03-20 2014-06-18 西安电子科技大学 Polarized SAR image classification method combining polarization feature and watershed
CN104992429A (en) * 2015-04-23 2015-10-21 北京宇航时代科技发展有限公司 Mountain crack detection method based on image local reinforcement
CN106093066A (en) * 2016-06-24 2016-11-09 安徽工业大学 A kind of magnetic tile surface defect detection method based on the machine vision attention mechanism improved
CN108460411A (en) * 2018-02-09 2018-08-28 北京市商汤科技开发有限公司 Example dividing method and device, electronic equipment, program and medium
CN108961206A (en) * 2018-04-20 2018-12-07 北京航空航天大学 A kind of defog effect without reference method for objectively evaluating

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500458A (en) * 2013-09-06 2014-01-08 李静 Method for automatically detecting line number of corncobs
CN103870842A (en) * 2014-03-20 2014-06-18 西安电子科技大学 Polarized SAR image classification method combining polarization feature and watershed
CN104992429A (en) * 2015-04-23 2015-10-21 北京宇航时代科技发展有限公司 Mountain crack detection method based on image local reinforcement
CN106093066A (en) * 2016-06-24 2016-11-09 安徽工业大学 A kind of magnetic tile surface defect detection method based on the machine vision attention mechanism improved
CN108460411A (en) * 2018-02-09 2018-08-28 北京市商汤科技开发有限公司 Example dividing method and device, electronic equipment, program and medium
CN108961206A (en) * 2018-04-20 2018-12-07 北京航空航天大学 A kind of defog effect without reference method for objectively evaluating

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YU-FEI MA ET.AL: "Contrast-based Image Attention Analysis by Using Fuzzy Growing", 《ACM》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111325728A (en) * 2020-02-19 2020-06-23 南方科技大学 Product defect detection method, device, equipment and storage medium
CN111325728B (en) * 2020-02-19 2023-05-30 南方科技大学 Product defect detection method, device, equipment and storage medium
CN112561896A (en) * 2020-12-22 2021-03-26 广州大学 Method, system and device for detecting defects of glass bottle mouth and storage medium
CN112561896B (en) * 2020-12-22 2023-08-15 广州大学 Method, system and device for detecting defects of glass bottle mouth and storage medium

Similar Documents

Publication Publication Date Title
CN110414507B (en) License plate recognition method and device, computer equipment and storage medium
CN110110799B (en) Cell sorting method, cell sorting device, computer equipment and storage medium
WO2021000524A1 (en) Hole protection cap detection method and apparatus, computer device and storage medium
CN110148130B (en) Method and device for detecting part defects
CN113109368B (en) Glass crack detection method, device, equipment and medium
CN112184744B (en) Display screen edge defect detection method and device
CN111768392B (en) Target detection method and device, electronic equipment and storage medium
CN108875600A (en) A kind of information of vehicles detection and tracking method, apparatus and computer storage medium based on YOLO
KR20200087297A (en) Defect inspection method and apparatus using image segmentation based on artificial neural network
CN110596120A (en) Glass boundary defect detection method, device, terminal and storage medium
CN106557740B (en) The recognition methods of oil depot target in a kind of remote sensing images
CN111325769A (en) Target object detection method and device
CN116485779B (en) Adaptive wafer defect detection method and device, electronic equipment and storage medium
CN116012291A (en) Industrial part image defect detection method and system, electronic equipment and storage medium
CN110502977B (en) Building change classification detection method, system, device and storage medium
CN111145120A (en) Visibility detection method and device, computer equipment and storage medium
CN110610123A (en) Multi-target vehicle detection method and device, electronic equipment and storage medium
CN113780110A (en) Method and device for detecting weak and small targets in image sequence in real time
CN113781406A (en) Scratch detection method and device for electronic component and computer equipment
CN116977239A (en) Defect detection method, device, computer equipment and storage medium
CN110751623A (en) Joint feature-based defect detection method, device, equipment and storage medium
CN115797314A (en) Part surface defect detection method, system, equipment and storage medium
CN115471476A (en) Method, device, equipment and medium for detecting component defects
CN111402185B (en) Image detection method and device
CN113392455A (en) House type graph scale detection method and device based on deep learning and electronic equipment

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: 20200204

RJ01 Rejection of invention patent application after publication