CN118279304A - Abnormal recognition method, device and medium for special-shaped metal piece based on image processing - Google Patents
Abnormal recognition method, device and medium for special-shaped metal piece based on image processing Download PDFInfo
- Publication number
- CN118279304A CN118279304A CN202410695832.3A CN202410695832A CN118279304A CN 118279304 A CN118279304 A CN 118279304A CN 202410695832 A CN202410695832 A CN 202410695832A CN 118279304 A CN118279304 A CN 118279304A
- Authority
- CN
- China
- Prior art keywords
- gray
- connected domain
- illumination
- pixel points
- defect
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 239000002184 metal Substances 0.000 title claims abstract description 90
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 50
- 238000000034 method Methods 0.000 title claims abstract description 38
- 238000012545 processing Methods 0.000 title claims abstract description 30
- 230000007547 defect Effects 0.000 claims abstract description 198
- 238000005286 illumination Methods 0.000 claims abstract description 129
- 238000009826 distribution Methods 0.000 claims abstract description 67
- 238000012216 screening Methods 0.000 claims abstract description 12
- 230000002950 deficient Effects 0.000 claims description 28
- 238000012937 correction Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 13
- 238000004891 communication Methods 0.000 claims description 10
- 230000006870 function Effects 0.000 claims description 10
- 230000008859 change Effects 0.000 claims description 7
- 238000003708 edge detection Methods 0.000 claims description 6
- 238000003860 storage Methods 0.000 claims description 3
- 230000004044 response Effects 0.000 claims description 2
- 238000005516 engineering process Methods 0.000 abstract description 2
- 230000011218 segmentation Effects 0.000 description 13
- 238000013528 artificial neural network Methods 0.000 description 11
- 230000000694 effects Effects 0.000 description 9
- 230000005856 abnormality Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 241000894007 species Species 0.000 description 2
- 241001270131 Agaricus moelleri Species 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20076—Probabilistic image processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30136—Metal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30164—Workpiece; Machine component
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Geometry (AREA)
- Quality & Reliability (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
- Image Analysis (AREA)
Abstract
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a medium for identifying abnormal shapes of deformed metal pieces based on image processing. The method comprises the following steps: dividing the special-shaped metal part image into a plurality of connected domains, determining whether the connected domains are affected by illumination, acquiring a first defect area in the connected domains without the influence of illumination, classifying pixel points in the connected domains affected by illumination, predicting standard gray distribution according to gray distribution of the pixel points in all categories, screening target categories according to differences between the standard gray distribution and the gray distribution of the pixel points in the categories, constructing windows according to the target categories, correcting gray values of the pixel points in the windows, acquiring defect probability of each window, screening a second defect area in the connected domains affected by illumination according to the defect probability, and carrying out abnormal recognition on the special-shaped metal part. The method eliminates the influence of illumination and more accurately identifies the abnormal condition of the special-shaped metal piece.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a medium for identifying abnormal shapes of deformed metal pieces based on image processing.
Background
The special-shaped metal part is a metal part with special shape and structure and is generally used in the engineering and manufacturing fields. They can be designed and customized according to specific needs to meet various complex engineering requirements. The special-shaped metal piece is widely applied to the fields of automobiles, aerospace, mechanical manufacturing and the like, and the quality and the performance of the special-shaped metal piece directly influence the quality and the efficiency of a product, so that the special-shaped metal piece is identified to ensure the quality of the product.
At present, defects are usually identified by an image processing method, for example, a Chinese patent application document with the application publication number of CN116777884A, named as a method for detecting appearance defects based on special-shaped metal stamping parts, discloses: acquiring an original image of the special-shaped metal stamping part; performing image preprocessing on the original image, and extracting characteristics of the special-shaped stamping part to obtain a binarized image; extracting the region of the divided graphic array from the array according to the characteristics of the graphic array region by connected domain analysis; and comparing the characteristic information with a standard component according to the information in the obtained original image to judge the appearance defect of the product.
However, due to the complex structure of the special-shaped metal piece, in the special-shaped metal piece image, due to the change of the structure of the special-shaped metal piece, the degree of influence of illumination on each part of the special-shaped metal piece is different, so that part positions are brighter, part positions are darker, and part positions have the characteristic of gray level gradient.
Disclosure of Invention
In order to solve the problem of low identification accuracy of defects in the area of the abnormal metal piece affected by illumination, the invention provides an abnormal identification method, device and medium of the abnormal metal piece based on image processing.
In a first aspect, the present invention provides a method for identifying abnormal shaped metal parts based on image processing, which adopts the following technical scheme:
Dividing the special-shaped metal part image into a plurality of connected domains, wherein the connected domains correspond to each surface of the special-shaped metal part; taking the gradient direction with the largest frequency in the connected domain as the main direction of the connected domain; determining whether the connected domain is affected by illumination according to the difference between the gradient direction and the main direction of the pixel points in the connected domain; performing edge detection on the connected domain without illumination influence to obtain a first defect region; dividing pixel points in the connected domain affected by illumination into a plurality of categories according to the gray level gradual change rule in the connected domain affected by illumination, wherein the pixel points in each category are positioned on the same straight line, and the direction of the straight line is the main direction of the connected domain affected by illumination; according to the gray distribution of the pixel points in all the categories, predicting standard gray distribution, wherein the standard gray distribution is the gray distribution of the pixel points without defects in the categories; screening the class with possible defects as a target class according to the difference between the standard gray distribution and the gray distribution of the pixel points in the class; constructing a plurality of windows, wherein the windows only comprise pixel points in the target category; correcting gray values of pixel points in the window according to the pixel points outside the window, and determining defect probability of the window according to difference of gray distribution of the pixel points in the window before and after correction; determining a second defect area according to the defect probability; and carrying out abnormal recognition on the abnormal metal piece according to the first defect area and the second defect area.
The effect is that: according to the method, the special-shaped metal part image is divided into a plurality of connected domains, the connected domains are divided into the connected domains influenced by illumination and the connected domains influenced by no illumination, and the two methods are adopted to respectively obtain the connected domains influenced by illumination and the defect areas in the connected domains influenced by no illumination, so that the obtained defect areas are more accurate, the difficulty of abnormal recognition of the special-shaped metal part is reduced, and the accuracy of abnormal recognition of the special-shaped metal part is improved; the invention utilizes the standard gray level distribution to reflect the gray level distribution condition of the pixel points in the class when no defect exists, and the screened target class which possibly has defects is more accurate by comparing the standard gray level distribution with the actual gray level distribution, thereby improving the accuracy of the acquisition of the subsequent second defect region and enabling the identification of the defects in the region affected by illumination to be more accurate; according to the method, the gray value of the pixel point in the window is corrected by using the pixel point outside the window, when the pixel point in the window is a defective pixel point, the pixel point in the window after correction is converted into a normal pixel point, the difference of the gray distribution of the pixel point in the window before and after correction is larger, when the pixel point in the window is a normal pixel point, the pixel points in the window before and after correction are both normal pixel points, the difference of the gray distribution of the pixel point in the window before and after correction is smaller, the probability of defects acquired by using the difference of the gray distribution of the pixel point in the window before and after correction can reflect the probability of the defects in the window, so that a second defect area screened based on the probability of the defects is more accurate, the influence of illumination on defect identification is eliminated, the defects in the communication area affected by illumination can be accurately identified, and the abnormal identification accuracy of the abnormal special-shaped metal piece is further improved.
In one embodiment, the determining whether the connected domain is affected by light comprises: obtaining the possibility that the connected domain is affected by illumination: ; wherein c represents the possibility that the connected domain is affected by light; p represents the frequency at which the main direction of the connected domain occurs in the connected domain; representing the j-th gradient direction existing in the connected domain; j represents the sequence number of the gradient direction existing in the connected domain; representing the frequency of occurrence of the j-th gradient direction existing in the connected domain; representing the main direction of the connected domain; n represents the number of species in the gradient direction existing in the connected domain;
Responding to the condition that the possibility of the connected domain affected by illumination is larger than or equal to a preset illumination possibility threshold value, wherein the connected domain is the connected domain affected by illumination; and responding to the possibility that the connected domain is affected by illumination is smaller than a preset illumination possibility threshold, wherein the connected domain is a connected domain without illumination.
The effect is that: the connected domain affected by illumination has gradation, so the gradient direction of the pixel points of the connected domain affected by illumination is basically consistent. According to the invention, the possibility that the connected domain is affected by illumination is obtained by analyzing the difference between the main direction of the connected domain and the gradient direction of the pixel points in the connected domain, so that the connected domain affected by illumination can be accurately distinguished from the connected domain without illumination.
In one embodiment, the predicting the standard gray scale distribution according to the gray scale distribution of the pixel points in all the classes includes: obtaining the minimum gray value and the maximum gray value in each category, taking the average value of all the minimum gray values of all the categories as the minimum representative gray value, and taking the average value of all the maximum gray values of all the categories as the maximum representative gray value; the minimum representative gray value, the maximum representative gray value and all integers between the minimum representative gray value and the maximum representative gray value are formed into a sequence from small to large, and each element in the standard gray distribution can be regarded as a gray value.
The effect is that: under the influence of no defect, the gray values of the pixel points in each category of the connected domain influenced by illumination are gradually changed, the frequencies of the gray values are relatively equal, and the standard gray distribution obtained by the gray representing range formed by the minimum representing gray value and the maximum representing gray value simulates the condition that the frequencies of the gray values are equal under the influence of no defect, so that the gray value distribution condition in the category without defect can be reflected relatively accurately.
In one embodiment, the screening the class with possible defects according to the difference between the standard gray scale distribution and the gray scale distribution of the pixel points in the class, as the target class, includes: calculating information entropy of the class according to the frequency of each gray value in the class, and taking the information entropy as gray entropy of the class; calculating information entropy according to the frequency of each gray value in the standard gray distribution, and taking the information entropy as a representative gray entropy; obtaining a difference value between the representative gray entropy and the gray entropy of the class, and taking the ratio of the difference value to the representative gray entropy as the possibility of defective pixel points in the class; and responding to the possibility that the defective pixel points exist in the category to be greater than or equal to a preset defect possibility threshold value, and taking the category as a target category.
The effect is that: the standard gray distribution reflects the gray distribution condition of pixel points in the classes when no defect exists, and the target class screened by comparing the standard gray distribution with the actual gray distribution is more likely to have defects, so that the accuracy of acquiring the subsequent second defect region is improved.
In one embodiment, the correcting the gray value of the pixel point in the window includes: taking any pixel point in the window as a pixel point to be corrected, screening reference pixel points outside the window, wherein the reference pixel points belong to non-target categories, the reference pixel points and the pixel point to be corrected are positioned on the same straight line, and the direction of the straight line is perpendicular to the main direction of the communication domain affected by illumination; correcting the gray value of the pixel point to be corrected according to the reference pixel point: ; wherein L represents a corrected gray value of the pixel point to be corrected; representing the gray value of the kth reference pixel point of the pixel point to be corrected; k represents the serial number of the reference pixel point of the pixel point to be corrected; Representing the Euclidean distance between the pixel point to be corrected and the kth reference pixel point; s denotes the number of reference pixel points of the pixel points to be corrected.
The effect is that: and correcting the pixel points in the window by using the pixel points outside the window, so that the pixel points in the window can be corrected to be normal pixel points, the difference of gray distribution of the pixel points in the window before and after the subsequent comparison correction can be accurately judged whether defects exist in the window before the correction.
In one embodiment, the defect probability satisfies the expression: ; wherein, Representing a defect probability of the u-th window; q represents the gray entropy of the connected domain affected by illumination; representing the gray entropy of the connected domain affected by illumination after correcting the gray value of the pixel point in the u window; representing a hyperbolic tangent function.
The effect is that: the defect probability reflects the difference between the gray level entropy of the connected domain affected by illumination before and after correcting the gray level value of the pixel point in the window, and when the difference is larger, the pixel point in the window is more likely to be corrected from the defective pixel point to the normal pixel point, and the defect is more likely to be contained in the window before correction. The window where the defect is can be accurately identified through the defect probability.
In one embodiment, the determining the second defect area according to the defect probability size includes: taking the defect probability of the window as the defect probability of the pixel point in the center of the window; for the pixel points in the connected domain affected by illumination, if the pixel points are the centers of a plurality of windows, taking the largest defect probability among a plurality of defect probabilities corresponding to the pixel points as the representative defect probability of the pixel points; if the pixel point is only the center of one window, the defect probability of the pixel point is taken as the representative defect probability of the pixel point; if the pixel point is not the center of any window, the representative defect probability of the pixel point is specified to be 0; and acquiring all local maxima representing the defect probability in the connected domain affected by illumination, and taking a window with the largest defect probability as a second defect region by taking a pixel point corresponding to the local maxima as a center in response to the local maxima being larger than or equal to a probability threshold.
The effect is that: and taking the defect probability as a judging standard, acquiring a defect center pixel point through a local maximum value representing the defect probability of the pixel point, and acquiring a second defect region according to the defect center pixel point, wherein the second defect region can contain complete defects, so that the abnormal recognition accuracy of the special-shaped metal piece is improved.
In a second aspect, the present invention provides an abnormal recognition device for a special-shaped metal piece based on image processing, which adopts the following technical scheme:
Abnormal recognition device of abnormal shape metalwork based on image processing includes: the abnormal recognition method for the special-shaped metal piece based on the image processing comprises a processor and a memory, wherein the memory stores computer program instructions, and the abnormal recognition method for the special-shaped metal piece based on the image processing is realized when the computer program instructions are executed by the processor.
By adopting the technical scheme, the abnormal recognition method of the special-shaped metal piece based on the image processing generates a computer program, and the computer program is stored in the memory to be loaded and executed by the processor, so that the terminal equipment is manufactured according to the memory and the processor, and the use is convenient.
In a third aspect, a computer-readable storage medium having a computer program stored thereon is provided. The abnormal recognition method of the special-shaped metal piece based on the image processing is realized when the computer program is executed.
The invention has the following technical effects:
According to the method, the defect area is obtained by adopting two different methods for the connected area influenced by illumination and the connected area without illumination, so that the difficulty of abnormal identification of the abnormal metal piece is reduced, and the accuracy of abnormal identification of the abnormal metal piece is improved; the method eliminates the influence of illumination on defect identification, can accurately identify the defects in the communication domain influenced by the illumination, and further improves the accuracy of abnormal identification of the special-shaped metal piece.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not by way of limitation, and like or corresponding reference numerals refer to like or corresponding parts.
Fig. 1 is a flowchart of a method for identifying abnormal shapes of profiled metal sheets based on image processing according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that when the terms "first," "second," and the like are used in the claims, the specification and the drawings of the present invention, they are used merely for distinguishing between different objects and not for describing a particular sequential order. The terms "comprises" and "comprising" when used in the specification and claims of the present invention are taken to specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The embodiment of the invention discloses a special-shaped metal part abnormality identification method based on image processing, which comprises the following steps of S1-S5 with reference to FIG. 1:
s1: and acquiring the special-shaped metal part image, and dividing the special-shaped metal part image into a plurality of connected domains.
Specifically, the special-shaped metal piece to be detected is placed on an operation table, a surface light source parallel to the operation table is arranged above the operation table, the special-shaped metal piece to be detected is shot through a camera, a special-shaped metal piece image is obtained, and the shot special-shaped metal piece image is a gray image for facilitating subsequent processing.
It should be noted that, because the special-shaped metal piece has a complex structure, when the special-shaped metal piece is imaged, the distances from each surface of the special-shaped metal piece to the surface light source are different, and the angles between each surface and the surface light source are different, so that the brightness of each surface is different, for example, part of the surfaces show the overall brighter characteristic, part of the surfaces show the overall darker characteristic, and part of the surfaces show the gradation characteristic, therefore, the overall analysis of the whole special-shaped metal piece is difficult to be great, and the accuracy of defect identification in each surface is affected. Therefore, the method and the device divide the special-shaped metal piece image into the faces so as to analyze each face independently and identify the defects.
In one embodiment, the special-shaped metal piece image is segmented through a semantic segmentation network, and the specific content of the semantic segmentation network is as follows: the input of the semantic segmentation network is a special-shaped metal piece image, the output of the semantic segmentation network is a segmentation image of the special-shaped metal piece, the dataset of the semantic segmentation network is a dataset formed by a plurality of special-shaped metal piece images containing shooting backgrounds, each special-shaped metal piece image in the dataset is marked as 0 on a pixel point belonging to the background, the pixel point belonging to the first surface of the special-shaped metal piece is marked as 1, the pixel point belonging to the second surface of the special-shaped metal piece is marked as 2, and the pixel point belonging to the third surface of the special-shaped metal piece is marked as 3 and …. The loss function of the semantic segmentation network is a cross entropy loss function.
Inputting the special-shaped metal part image into a trained semantic segmentation network, outputting a segmentation image of the special-shaped metal part, wherein a connected domain formed by pixel points marked as 1 in the segmentation image corresponding to the pixel points in the special-shaped metal part image corresponds to one surface of the special-shaped metal part, a connected domain formed by pixel points marked as 2 in the segmentation image corresponding to the pixel points in the special-shaped metal part image corresponds to one surface of the special-shaped metal part, a connected domain formed by pixel points marked as 3 in the segmentation image corresponding to the pixel points in the special-shaped metal part image corresponds to one surface of the special-shaped metal part, and the like, so that a plurality of connected domains are obtained, wherein each connected domain corresponds to one surface of the special-shaped metal part.
Thus, the communicating areas corresponding to the surfaces of the special-shaped metal piece are obtained.
S2: and determining whether the connected domain is affected by illumination according to the difference between the gradient direction of the pixel points in the connected domain and the main direction by taking the gradient direction with the largest frequency in the connected domain as the main direction of the connected domain.
When one surface of the special-shaped metal piece is parallel to the surface light source, the quantity of reflected light entering the camera lens is basically consistent at each position of the surface which is not defective, so that the gray values of the pixel points of the non-defective part are uniformly distributed, and the surface is not affected by illumination; when one surface of the special-shaped metal piece is not parallel to the surface light source, the quantity of light reflected by each position entering the camera lens is different, so that the gray value of the pixel point of the non-defect part is gradually changed, and the surface is affected by illumination. In the area without illumination influence, the defects are obvious, and in the area with illumination influence, the defects are influenced by gray value gradual change and are difficult to identify by using the existing methods of threshold segmentation, edge detection and the like. Therefore, the invention classifies the connected domains into the connected domains without illumination influence and the connected domains affected by illumination, so that defects can be detected by adopting two different methods aiming at the connected domains without illumination influence and the connected domains affected by illumination.
Specifically, for each connected domain, the gradient direction of each pixel point in the connected domain is obtained by using a Sobel operator. The frequency of each gradient direction existing in the connected domain is obtained, and the gradient direction with the largest frequency is taken as the main direction of the connected domain. The invention only takes Sobel operator as an example to describe the gradient direction acquisition method, and an operator can select the gradient operator according to the actual implementation condition to acquire the gradient direction of the pixel point, such as Prewitt and other operators, roberts operators and the like.
Optionally, according to the difference between the gradient direction and the main direction of the pixel points in the connected domain, determining whether the connected domain is affected by illumination, and specifically:
Acquiring the difference between the main direction of the connected domain and the gradient direction of each pixel point in the connected domain, taking the pixel point with the difference smaller than a preset difference threshold value as a target pixel point, and taking the connected domain as the connected domain influenced by illumination when the ratio of the number of the target pixel points to the number of all the pixel points in the connected domain is larger than or equal to a preset ratio threshold value; otherwise, the connected domain is used as the connected domain without illumination.
Wherein the difference threshold and the proportion threshold can be set by an operator according to actual implementation conditions, for example, the difference threshold isThe ratio threshold was 0.8.
Preferably, according to the difference between the gradient direction and the main direction of the pixel points in the connected domain, whether the connected domain is affected by illumination is determined, and specifically:
Acquiring the possibility that the connected domain is affected by illumination according to the gradient direction of each pixel point in the connected domain and the main direction of the connected domain:
;
wherein c represents the possibility that the connected domain is affected by light; p represents the frequency at which the main direction of the connected domain occurs in the connected domain; representing the j-th gradient direction existing in the connected domain; j represents the sequence number of the gradient direction existing in the connected domain; representing the frequency of occurrence of the j-th gradient direction existing in the connected domain; representing the main direction of the connected domain; n represents the number of species in the gradient direction existing in the connected domain; representing absolute value symbols; An exponential function that is based on a natural constant; a coefficient of difference representing the j-th gradient direction existing in the connected domain from the main direction of the connected domain, For reflecting the difference coefficientThe more likely the jth gradient direction is to correspond to an image feature in the connected domain when the frequency of occurrence of the jth gradient direction is greater, the more attention is paid to the coefficient of difference of the jth gradient direction from the main direction, and the less attention is paid to the coefficient of difference of the jth gradient direction from the main direction when the frequency of occurrence of the jth gradient direction is smaller, the more likely the jth gradient direction is due to noise. When the difference coefficient between the main direction and the gradient direction with higher frequency is smaller, the main direction is smaller than the gradient direction difference of most of the pixel points in the connected domain, and the gradient directions of all the pixel points in the connected domain are more consistent, at the moment, the connected domain presents the characteristic of gray level gradient, and the possibility c that the connected domain is influenced by illumination is higher; in the area without illumination influence, the gray values of the pixel points are approximate, so that the gradient directions of the pixel points are random, the frequency of the main direction is small, the difference coefficient between the main direction and the rest gradient directions is large, and the probability c that the connected domain is affected by illumination is smaller.
Presetting a lighting possibility threshold valueThe empirical value is 0.5, and the practitioner can set the probability of the connected domain being affected by illumination according to the probability of the connected domain being affected by illumination, but note that the threshold value of illumination probability is set because the probability of the connected domain being affected by illumination is between [0,1]Also between [0,1 ].
When the possibility of the connected domain being affected by illumination is greater than or equal to the illumination possibility threshold valueWhen the probability of the connected domain affected by illumination is smaller than the threshold value of illumination probabilityIn this case, the connected domain is a connected domain which is not affected by irradiation.
Thus, the connected domain influenced by illumination and the connected domain without illumination are obtained.
S3: and carrying out edge detection on the connected domain without illumination influence to obtain a first defect region.
It should be noted that, the gray values of the pixels of the non-defective portion in the connected domain without the illumination effect are uniformly distributed, so that the contrast ratio of the defective portion to the non-defective portion is relatively obvious.
Specifically, for each connected domain without illumination, edge detection is performed on the connected domain without illumination by using a Canny edge detection algorithm, and when no edge is obtained by detection, the connected domain without illumination is considered to be defect-free. When detecting and obtaining edges, if each edge only comprises one pixel point, rejecting the edge, if the edge is closed end to end, taking an area surrounded by the edge as a first defect area, and if the edge is not closed end to end, taking the edge as the first defect area.
Thus, the first defective area in the communication domain affected by no illumination is obtained.
S4: dividing pixel points in a connected domain affected by illumination into a plurality of categories, predicting standard gray distribution according to gray distribution of the pixel points in all the categories, screening target categories according to differences between the standard gray distribution and the gray distribution of the pixel points in the categories, constructing a plurality of windows, correcting gray values of the pixel points in the windows according to the pixel points outside the windows, determining defect probability of the windows according to differences of the gray distribution of the pixel points in the windows before and after correction, and determining a second defect region according to the defect probability.
It should be noted that, the gray value of the pixel point of the non-defective portion of the connected domain affected by light changes gradually, and the main direction of the connected domain affected by light is the gradient direction of most of the pixel points in the connected domain affected by light, so that the main direction of the connected domain affected by light is the gradient direction of the gray value, if no defect exists, in the gradient direction of the gray value, the influence degree of the light on each pixel point is different, so that the gray value of each pixel point changes gradually, and in the direction perpendicular to the gradient direction of the gray value, the influence degree of the light on each pixel point is consistent, so that the gray values of the pixel points are basically consistent. Therefore, the invention classifies the pixel points according to the gray value gradual change direction, so that the pixel points in the gray value gradual change direction are classified into one class, when the pixel points are not defective, the gray distribution of the pixel points in each class is consistent, when the defect exists, the gray distribution of the pixel points in the class where the defect exists is different from the rest classes, and therefore, the invention obtains the class possibly having the defect by comparing the gray distribution of each class.
For each connected domain affected by illumination, classifying pixels in the connected domain affected by illumination into a plurality of categories, specifically:
Each pixel point in the communication domain which is affected by illumination is taken as a straight line with the direction of the main direction of the communication domain which is affected by illumination, so that a plurality of straight lines are obtained, and all the pixel points in the communication domain which is affected by illumination and is positioned on the same straight line are divided into one category, so that a plurality of categories are obtained.
The gray entropy of each category is obtained, and the specific steps are as follows:
counting the frequency of each gray value appearing in the category, calculating the information entropy of the category according to the frequency of each gray value, and recording the information entropy as the gray entropy of the category.
Optionally, according to the gray distribution of the pixel points in all the categories, a standard gray distribution is predicted, specifically:
And forming a sequence of gray values of all pixel points in the class with the maximum gray entropy as standard gray distribution. It should be noted that, because the gray values of the pixels in each category are gradually changed under the influence of no defect, the frequencies of the gray values in each category are relatively equal, so that the gray entropy of the category is relatively large. And under the influence of defects, the frequency of each gray value in each category is different, so that the gray entropy of the category is smaller. Therefore, the class with the maximum gray entropy has high probability of no defect, and the gray distribution of the pixel points in the class can reflect the gray distribution of the pixel points in the class when no defect exists.
Preferably, the standard gray distribution is predicted according to the gray distribution of the pixel points in all the categories, and the specific is:
And acquiring the minimum gray value and the maximum gray value in each category, taking the average value of all the minimum gray values of all the categories as the minimum representative gray value, and taking the average value of all the maximum gray values of all the categories as the maximum representative gray value. The minimum representative gray value, the maximum representative gray value and all integers between the minimum representative gray value and the maximum representative gray value are formed into a sequence from small to large, and each element in the standard gray distribution can be regarded as a gray value.
The gray values of the pixels in each class are gradually changed under the influence of no defect, the frequencies of the gray values in each class are relatively equal, the minimum representative gray value reflects the average level of the minimum gray value in each class, the maximum representative gray value reflects the average level of the maximum gray value in each class, and all integers in the gray representative range formed by the minimum representative gray value and the maximum representative gray value reflect the gray value distribution in the defect-free class.
Screening target classes according to the difference between the standard gray distribution and the gray distribution of pixel points in the classes, wherein the screening target classes specifically comprise:
Information entropy is calculated from the frequency of each gradation value in the standard gradation distribution as a representative gradation entropy. The representative gray entropy can be regarded as a gray entropy of a class having no defects to some extent.
Obtaining the possibility of defective pixel points in each category according to the representative gray entropy and the gray entropy of each category:
;
Wherein i represents the serial number of the category, Indicating the likelihood of defective pixels in the ith class; Gray entropy representing the i-th class; q represents a representative gray entropy; the gray entropy can reflect the gray distribution of the corresponding class to a certain extent, and because the pixel points are classified according to the main direction of the connected domain influenced by illumination, the gray value of the pixel point in each class is gradually changed under the condition of no defect, and at the moment, the frequency of each gray value in each class is relatively equal, so that the gray entropy of each class is very large. When the defects exist, the gray scales of the defects are basically consistent, so that the frequency of gray scale values corresponding to the defects in the category is higher than that of other gray scale values, and the gray entropy of the category is reduced. The representative gray entropy reflects gray entropy of a non-defective class to some extent, so that when a defective pixel exists in the i-th class, the gray entropy of the i-th class is smaller than the representative gray entropy, The gray entropy used to reflect the ith class is less than the level representing gray entropy whenThe larger the gray entropy of the i-th class is, the smaller the gray entropy is compared with the representative gray entropy, and the probability that the defective pixel point exists in the i-th class is higher.
Presetting a defect probability thresholdThe class with the experience value of 0.25 is used for screening the class with the defective pixel according to the possibility of the defective pixel in the class, and the implementer can set according to the practical implementation situation, but it should be noted that the threshold value of the defective possibility is set because the possibility of the defective pixel in the class is between [0,1]Also between [0,1 ].
When the probability of the defective pixel point in the category is greater than or equal to the defect probability thresholdWhen the class is taken as a target class, the probability of the existence of the defective pixel point in the class is smaller than the defect probability threshold valueWhen the category is regarded as a non-target category.
The construction of a plurality of windows is specifically as follows:
and constructing a plurality of windows in the connected domain influenced by illumination, wherein the windows only comprise pixel points in the target class. The window may be rectangular, circular, elliptical or irregular in shape, and the size of the window is not limited.
For each window, correcting the gray value of the pixel point in the window according to the pixel point outside the window, specifically:
and taking any pixel point in the window as a pixel point to be corrected, making a straight line by the pixel point to be corrected, wherein the direction of the straight line is perpendicular to the main direction of the communication domain affected by illumination, and taking the pixel points which are positioned on the straight line and belong to non-target categories as reference pixel points of the pixel points to be corrected.
Optionally, according to all the reference pixel points of the pixel points to be corrected, a corrected gray value of the pixel points to be corrected is obtained, specifically:
And acquiring the average value of the gray values of all the reference pixel points of the pixel points to be corrected, and taking the average value as the corrected gray value of the pixel points to be corrected.
Preferably, the corrected gray value of the pixel to be corrected is obtained according to all the reference pixel points of the pixel to be corrected, specifically:
;
Wherein L represents a corrected gray value of the pixel point to be corrected; representing the gray value of the kth reference pixel point of the pixel point to be corrected; k represents the serial number of the reference pixel point of the pixel point to be corrected; representing the Euclidean distance between the pixel point to be corrected and the kth reference pixel point; s represents the number of reference pixel points of the pixel points to be corrected; An exponential function that is based on a natural constant; Representing a normalization function; Distance parameter of kth reference pixel point representing pixel point to be corrected, when Euclidean distance between pixel point to be corrected and kth reference pixel point The smaller the distance parameter is, the larger the distance parameter is; The linear normalization of the distance parameter of the kth reference pixel point according to the distance parameters of all the reference pixel points is represented, the obtained result can be regarded as the weight of the kth reference pixel point, and when the Euclidean distance between the pixel point to be corrected and the kth reference pixel point is obtained When the pixel value is smaller, the weight of the kth reference pixel point is larger, and the gray value of the kth reference pixel point of the pixel point to be correctedThe greater the reference degree of the corrected gray value for the pixel to be corrected.
Optionally, determining the defect probability of the window according to the difference of the gray distribution of the pixel points in the window before and after correction, specifically includes:
and acquiring the average value of the absolute values of the differences between the gray values of all the pixel points in the window and the corrected gray values, acquiring the ratio of the average value to a preset gray value difference threshold value, taking the ratio as the defect probability of the window when the ratio is smaller than or equal to 1, and taking 1 as the defect probability of the window when the ratio is larger than 1. The gray value difference threshold may be set by an operator according to actual implementation, for example, the gray value difference threshold is 20.
Preferably, the defect probability of the window is determined according to the difference of the gray distribution of the pixel points in the window before and after correction, specifically:
Counting the frequency of each gray value in the connected domain affected by illumination, calculating the information entropy of the connected domain affected by illumination according to the frequency of each gray value, and recording the information entropy as the gray entropy of the connected domain affected by illumination.
And replacing the gray value of each pixel point in the window with the corrected gray value of each pixel point in the window, counting the frequency of each gray value in the connected domain affected by illumination at the moment, and calculating the information entropy of the connected domain affected by illumination according to the frequency of each gray value to serve as the gray entropy of the connected domain affected by illumination after the gray value of the pixel point in the window is corrected.
According to gray level entropy of the connected domain affected by illumination before and after correction of gray level values of pixel points in the windows, defect probability of each window is calculated:
;
Wherein, Representing a defect probability of the u-th window; q represents the gray entropy of the connected domain affected by illumination; representing the gray entropy of the connected domain affected by illumination after correcting the gray value of the pixel point in the u window; Representing a hyperbolic tangent function; The function of the maximum value is represented, Is used for preventing whenWhen smaller than 0, the defect probability is smaller than 0; The change degree of gray entropy of the connected domain influenced by illumination before and after correcting the gray value of the pixel point in the u window is shown; when the connected domain affected by illumination is defect-free, the gray value of the pixel point in the connected domain affected by illumination is gradual, at the moment, the frequency of each gray value in the connected domain affected by illumination is equal, so that the gray entropy of the connected domain affected by illumination is very large, when the connected domain affected by illumination has defects, the gray value of the defective pixel point is basically consistent, at the moment, the frequency of the gray value corresponding to the defects in the connected domain affected by illumination is bigger than the frequency of the rest gray values, so that the gray entropy of the connected domain affected by illumination is reduced, if the defects exist in the u-th window, the connected domain affected by illumination is affected by the defects in the u-th window, the gray entropy Q is smaller, at the moment, the gray value of the pixel point in the u-th window is corrected according to the gray value of the reference pixel point, so that the defects in the u-th window are disappeared, so that the defects in the u-th window also show the gray gradual characteristics, when the u-th window is out of the u-th window, the corrected u-th window makes the defects in the whole connected domain affected by illumination disappear, and the corresponding gray entropy is small Larger, the difference between the gray value entropy of the connected domain affected by illumination before and after correctionLarger at this timeWhen defects exist outside the ith window, the modified ith window reduces the degree of the influence of the defects on the whole connected domain influenced by illumination, and the corresponding gray entropyThe difference between the gray value entropy of the connected domain affected by illumination before and after correction at this time is larger than the gray value before correctionSlightly larger at this timeSlightly larger; if no defect exists in the ith window, correcting the gray value of the pixel point in the ith window according to the gray value of the reference pixel point, wherein the influence on the gray value of the pixel point in the ith window is small, and the difference between the gray entropy of the connected domain influenced by illumination before and after correction is smallSmaller, at this timeSmaller; thus the invention utilizesThe defect probability of the u window is represented, when the u window contains complete defects, the defect probability of the u window is larger, and when the u window is not defective, the defect probability of the u window is smaller.
Presetting a probability thresholdFor obtaining the second defect area, the empirical value is 0.32, and the practitioner can set the defect area according to the practical implementation, but it should be noted that the probability threshold value is set because the defect probability is between [0,1]Also between [0,1 ].
Optionally, the second defect area is determined according to the defect probability, specifically:
The defect probability is larger than or equal to a preset probability threshold value If two candidate defect areas are adjacent or contain the same pixel point, merging the two candidate defect areas into the same candidate defect area, and merging and judging all candidate defect areas to obtain one or more final candidate defect areas. And taking the finally obtained candidate defect area as a second defect area. Wherein, the two candidate defect areas are adjacent to each other, which means that the two candidate defect areas do not contain the same pixel point, and one pixel point exists in one candidate defect area in eight adjacent areas of one pixel point of the other candidate defect area.
Preferably, the second defect area is determined according to the defect probability, specifically:
The defect probability of the window is taken as the defect probability of the pixel point in the center of the window. For each pixel point in the connected domain affected by illumination, if the pixel point is the center of a plurality of windows, a plurality of defect probabilities exist in the pixel point, and the largest defect probability is taken as the representative defect probability of the pixel point; if the pixel point is only the center of one window, the defect probability of the pixel point is taken as the representative defect probability of the pixel point; if the pixel is not at the center of any window, the probability of representing a defect of the pixel is defined as 0. Thus, the probability of representing defects of each pixel point in the connected domain affected by illumination is obtained.
Obtaining all local maxima representing defect probability in the connected domain affected by illumination, and if the local maxima are larger than or equal to a preset probability threshold value for each local maximumTaking the pixel point corresponding to the local maximum value as a defect center pixel point; when all local maxima are smaller than a preset probability thresholdIn this case, it is considered that the connected domain affected by the light is defect-free.
For each defect center pixel point, a window which takes the defect center pixel point as a center and has the largest defect probability is taken as a second defect area. The second defect area is a window before the gray value of the pixel point in the window is corrected.
Thus, a second defective area in the communication domain affected by the illumination is obtained.
S5: and carrying out abnormal recognition on the abnormal metal piece according to the first defect area and the second defect area.
Specifically, the first defect area and the second defect area are collectively called as defect areas, the defect type of each defect area is identified by using a neural network, and the specific content of the neural network is as follows:
The input of the neural network is a defect area, and the output is a defect type corresponding to the defect area; the neural network is in a structure of a fully-connected neural network; the data set of the neural network is a data set formed by defect areas extracted from the special-shaped metal piece by adopting the method, the labels are defect types corresponding to the defect areas, such as scratches, pits and the like, and the labels are marked manually; the loss function of the neural network is cross entropy loss.
And inputting each defect area into the trained neural network, and outputting the defect type of the defect area.
So far, the defects and defect types in the special-shaped metal piece are obtained, and the abnormal identification of the special-shaped metal piece is realized.
It should be noted that, in the invention, the defect area is input into the neural network to obtain the defect type, and compared with the method that the abnormal metal piece image is directly input into the neural network to identify the defect, the convergence speed of the neural network can be increased, and the accuracy of defect type identification can be improved.
The embodiment of the invention also discloses a special-shaped metal part abnormality identification device based on image processing, which comprises a processor and a memory, wherein the memory stores computer program instructions, and the special-shaped metal part abnormality identification method based on the image processing is realized when the computer program instructions are executed by the processor.
The embodiment of the invention also discloses a computer readable storage medium, on which the computer program is stored. The computer program, when executed, implements the abnormal recognition method for the special-shaped metal piece based on image processing according to the invention.
While various embodiments of the present invention have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Many modifications, changes, and substitutions will now occur to those skilled in the art without departing from the spirit and scope of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in practicing the invention.
The above embodiments are not intended to limit the scope of the present invention, so: all equivalent changes in structure, shape and principle of the invention should be covered in the scope of protection of the invention.
Claims (9)
1. The abnormal recognition method for the abnormal metal piece based on the image processing is characterized by comprising the following steps of:
Dividing the special-shaped metal part image into a plurality of connected domains, wherein the connected domains correspond to each surface of the special-shaped metal part; taking the gradient direction with the largest frequency in the connected domain as the main direction of the connected domain; determining whether the connected domain is affected by illumination according to the difference between the gradient direction and the main direction of the pixel points in the connected domain;
Performing edge detection on the connected domain without illumination influence to obtain a first defect region;
Dividing pixel points in the connected domain affected by illumination into a plurality of categories according to the gray level gradual change rule in the connected domain affected by illumination, wherein the pixel points in each category are positioned on the same straight line, and the direction of the straight line is the main direction of the connected domain affected by illumination; according to the gray distribution of the pixel points in all the categories, predicting standard gray distribution, wherein the standard gray distribution is the gray distribution of the pixel points without defects in the categories; screening the class with possible defects as a target class according to the difference between the standard gray distribution and the gray distribution of the pixel points in the class;
Constructing a plurality of windows, wherein the windows only comprise pixel points in the target category; correcting gray values of pixel points in the window according to the pixel points outside the window, and determining defect probability of the window according to difference of gray distribution of the pixel points in the window before and after correction; determining a second defect area according to the defect probability;
and carrying out abnormal recognition on the abnormal metal piece according to the first defect area and the second defect area.
2. The method for identifying abnormal conditions of a profiled metal sheet based on image processing according to claim 1, wherein the determining whether the connected domain is affected by illumination comprises:
Obtaining the possibility that the connected domain is affected by illumination: ; wherein c represents the possibility that the connected domain is affected by light; p represents the frequency at which the main direction of the connected domain occurs in the connected domain; representing the j-th gradient direction existing in the connected domain; j represents the sequence number of the gradient direction existing in the connected domain; representing the frequency of occurrence of the j-th gradient direction existing in the connected domain; representing the main direction of the connected domain; n represents the number of species in the gradient direction existing in the connected domain;
Responding to the condition that the possibility of the connected domain affected by illumination is larger than or equal to a preset illumination possibility threshold value, wherein the connected domain is the connected domain affected by illumination; and responding to the possibility that the connected domain is affected by illumination is smaller than a preset illumination possibility threshold, wherein the connected domain is a connected domain without illumination.
3. The abnormal recognition method of a special-shaped metal piece based on image processing according to claim 1, wherein predicting standard gray distribution according to gray distribution of pixel points in all categories comprises:
Obtaining the minimum gray value and the maximum gray value in each category, taking the average value of all the minimum gray values of all the categories as the minimum representative gray value, and taking the average value of all the maximum gray values of all the categories as the maximum representative gray value; the minimum representative gray value, the maximum representative gray value and all integers between the minimum representative gray value and the maximum representative gray value are formed into a sequence from small to large, and each element in the standard gray distribution can be regarded as a gray value.
4. A method for identifying abnormal shapes of abnormal metal pieces based on image processing according to claim 1 or 3, wherein said screening a class in which defects are likely to exist as a target class based on a difference between the standard gray distribution and gray distribution of pixels in the class includes:
calculating information entropy of the class according to the frequency of each gray value in the class, and taking the information entropy as gray entropy of the class; calculating information entropy according to the frequency of each gray value in the standard gray distribution, and taking the information entropy as a representative gray entropy; obtaining a difference value between the representative gray entropy and the gray entropy of the class, and taking the ratio of the difference value to the representative gray entropy as the possibility of defective pixel points in the class;
and responding to the possibility that the defective pixel points exist in the category to be greater than or equal to a preset defect possibility threshold value, and taking the category as a target category.
5. The abnormal recognition method of the abnormal shaped metal part based on the image processing as set forth in claim 1, wherein the correcting the gray value of the pixel point in the window includes:
Taking any pixel point in the window as a pixel point to be corrected, screening reference pixel points outside the window, wherein the reference pixel points belong to non-target categories, the reference pixel points and the pixel point to be corrected are positioned on the same straight line, and the direction of the straight line is perpendicular to the main direction of the communication domain affected by illumination;
correcting the gray value of the pixel point to be corrected according to the reference pixel point:
; wherein L represents a corrected gray value of the pixel point to be corrected; representing the gray value of the kth reference pixel point of the pixel point to be corrected; k represents the serial number of the reference pixel point of the pixel point to be corrected; Representing the Euclidean distance between the pixel point to be corrected and the kth reference pixel point; s denotes the number of reference pixel points of the pixel points to be corrected.
6. The abnormal recognition method of a deformed metal piece based on image processing according to claim 1 or 5, wherein the defect probability satisfies an expression:
; wherein, Representing a defect probability of the u-th window; q represents the gray entropy of the connected domain affected by illumination; representing the gray entropy of the connected domain affected by illumination after correcting the gray value of the pixel point in the u window; representing a hyperbolic tangent function.
7. The abnormal recognition method of the abnormal shaped metal part based on the image processing according to claim 1, wherein the determining the second defect area according to the defect probability size comprises:
taking the defect probability of the window as the defect probability of the pixel point in the center of the window; for the pixel points in the connected domain affected by illumination, if the pixel points are the centers of a plurality of windows, taking the largest defect probability among a plurality of defect probabilities corresponding to the pixel points as the representative defect probability of the pixel points; if the pixel point is only the center of one window, the defect probability of the pixel point is taken as the representative defect probability of the pixel point; if the pixel point is not the center of any window, the representative defect probability of the pixel point is specified to be 0;
And acquiring all local maxima representing the defect probability in the connected domain affected by illumination, and taking a window with the largest defect probability as a second defect region by taking a pixel point corresponding to the local maxima as a center in response to the local maxima being larger than or equal to a probability threshold.
8. Abnormal recognition device of abnormal shape metalwork based on image processing, its characterized in that includes: a processor and a memory storing computer program instructions which, when executed by the processor, implement the method for identifying anomalies in profiled metal sheets based on image processing according to any one of claims 1 to 7.
9. A computer-readable storage medium on which a computer program is stored, characterized in that the computer program, when executed, implements the abnormal-shape metal piece identification method based on image processing as set forth in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410695832.3A CN118279304B (en) | 2024-05-31 | 2024-05-31 | Abnormal recognition method, device and medium for special-shaped metal piece based on image processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410695832.3A CN118279304B (en) | 2024-05-31 | 2024-05-31 | Abnormal recognition method, device and medium for special-shaped metal piece based on image processing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118279304A true CN118279304A (en) | 2024-07-02 |
CN118279304B CN118279304B (en) | 2024-08-13 |
Family
ID=91642633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410695832.3A Active CN118279304B (en) | 2024-05-31 | 2024-05-31 | Abnormal recognition method, device and medium for special-shaped metal piece based on image processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118279304B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118411367A (en) * | 2024-07-03 | 2024-07-30 | 浙江一鸣包装印刷有限公司 | Printing pattern defect detection method and system for plastic packaging |
CN118628489A (en) * | 2024-08-12 | 2024-09-10 | 宝鸡新华利机械科技有限公司 | Packaging box sealing quality inspection method based on machine vision |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114862862A (en) * | 2022-07-11 | 2022-08-05 | 江苏大田阀门制造有限公司 | Pump body cold shut defect identification method and system based on image processing |
CN114972357A (en) * | 2022-08-03 | 2022-08-30 | 南通恒立机械设备有限公司 | Roller surface defect detection method and system based on image processing |
CN115311290A (en) * | 2022-10-12 | 2022-11-08 | 南通市通州区精华电器有限公司 | Method for detecting defects of metal parts of precision instrument |
US20230326006A1 (en) * | 2020-08-28 | 2023-10-12 | Goertek Inc. | Defect detection method and device for an lcd screen |
CN117576086A (en) * | 2024-01-11 | 2024-02-20 | 普森美微电子技术(苏州)有限公司 | Method and system for detecting metal electron beam welding defects |
-
2024
- 2024-05-31 CN CN202410695832.3A patent/CN118279304B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20230326006A1 (en) * | 2020-08-28 | 2023-10-12 | Goertek Inc. | Defect detection method and device for an lcd screen |
CN114862862A (en) * | 2022-07-11 | 2022-08-05 | 江苏大田阀门制造有限公司 | Pump body cold shut defect identification method and system based on image processing |
CN114972357A (en) * | 2022-08-03 | 2022-08-30 | 南通恒立机械设备有限公司 | Roller surface defect detection method and system based on image processing |
CN115311290A (en) * | 2022-10-12 | 2022-11-08 | 南通市通州区精华电器有限公司 | Method for detecting defects of metal parts of precision instrument |
CN117576086A (en) * | 2024-01-11 | 2024-02-20 | 普森美微电子技术(苏州)有限公司 | Method and system for detecting metal electron beam welding defects |
Non-Patent Citations (1)
Title |
---|
张加朋: "基于影像的工件识别与测量系统的研究与设计", 《中国优秀硕士学位论文全文数据库工程科技Ⅱ辑》, no. 01, 15 January 2022 (2022-01-15), pages 1 - 61 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118411367A (en) * | 2024-07-03 | 2024-07-30 | 浙江一鸣包装印刷有限公司 | Printing pattern defect detection method and system for plastic packaging |
CN118628489A (en) * | 2024-08-12 | 2024-09-10 | 宝鸡新华利机械科技有限公司 | Packaging box sealing quality inspection method based on machine vision |
Also Published As
Publication number | Publication date |
---|---|
CN118279304B (en) | 2024-08-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110148130B (en) | Method and device for detecting part defects | |
CN118279304B (en) | Abnormal recognition method, device and medium for special-shaped metal piece based on image processing | |
CN116611748B (en) | Titanium alloy furniture production quality monitoring system | |
US7373018B2 (en) | Method and system for object recognition using fractal maps | |
CN115082683A (en) | Injection molding defect detection method based on image processing | |
CN116152242B (en) | Visual detection system of natural leather defect for basketball | |
CN115294140A (en) | Hardware part defect detection method and system | |
CN114972326A (en) | Defective product identification method for heat-shrinkable tube expanding process | |
CN111369523B (en) | Method, system, equipment and medium for detecting cell stack in microscopic image | |
CN116883408B (en) | Integrating instrument shell defect detection method based on artificial intelligence | |
CN114926441B (en) | Defect detection method and system for injection molding part machining and forming | |
US7062079B2 (en) | Method and system for image segmentation | |
CN114495098B (en) | Diaxing algae cell statistical method and system based on microscope image | |
KR101929669B1 (en) | The method and apparatus for analyzing an image using an entropy | |
CN116246174A (en) | Sweet potato variety identification method based on image processing | |
CN115841488A (en) | Hole checking method of PCB (printed Circuit Board) based on computer vision | |
CN117576687A (en) | Cervical cancer cytology screening system and method based on image analysis | |
CN115082449B (en) | Electronic component defect detection method | |
Sun et al. | A novel method for multi-feature grading of mango using machine vision | |
CN119090879A (en) | Printing material surface quality detection method based on image enhancement | |
CN117934469B (en) | Visual detection method for production quality of mining high-voltage frequency converter shell | |
CN206897873U (en) | A kind of image procossing and detecting system based on detection product performance | |
CN117237747B (en) | Hardware defect classification and identification method based on artificial intelligence | |
Lech et al. | Binarization of document images using the modified local-global Otsu and Kapur algorithms | |
CN117036314A (en) | Method for detecting oxidation area of high-density flexible IC substrate |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |