CN116664577B - Abnormality identification extraction method based on carbon fiber connector image processing - Google Patents
Abnormality identification extraction method based on carbon fiber connector image processing Download PDFInfo
- Publication number
- CN116664577B CN116664577B CN202310952067.4A CN202310952067A CN116664577B CN 116664577 B CN116664577 B CN 116664577B CN 202310952067 A CN202310952067 A CN 202310952067A CN 116664577 B CN116664577 B CN 116664577B
- Authority
- CN
- China
- Prior art keywords
- value
- pixel
- preset
- pixel point
- gray
- 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.)
- Active
Links
- 229920000049 Carbon (fiber) Polymers 0.000 title claims abstract description 17
- 239000004917 carbon fiber Substances 0.000 title claims abstract description 17
- VNWKTOKETHGBQD-UHFFFAOYSA-N methane Chemical compound C VNWKTOKETHGBQD-UHFFFAOYSA-N 0.000 title claims abstract description 17
- 238000000605 extraction Methods 0.000 title claims abstract description 16
- 230000005856 abnormality Effects 0.000 title claims description 12
- 230000002159 abnormal effect Effects 0.000 claims abstract description 36
- 230000007547 defect Effects 0.000 claims abstract description 22
- 238000012216 screening Methods 0.000 claims abstract description 10
- 238000004458 analytical method Methods 0.000 claims description 54
- 238000000034 method Methods 0.000 claims description 30
- 238000004364 calculation method Methods 0.000 claims description 17
- 230000004927 fusion Effects 0.000 claims description 13
- 230000002950 deficient Effects 0.000 description 16
- 230000000694 effects Effects 0.000 description 9
- 238000005299 abrasion Methods 0.000 description 6
- 230000011218 segmentation Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000001914 filtration Methods 0.000 description 3
- 230000000149 penetrating effect Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000003208 petroleum Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011897 real-time detection 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
- G06T7/0004—Industrial image inspection
-
- 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/136—Segmentation; Edge detection involving thresholding
-
- 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/10024—Color image
-
- 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)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
The invention relates to the technical field of image processing, in particular to an anomaly identification extraction method based on carbon fiber connector image processing, which comprises the following steps: acquiring a gray image of the surface of the connector; acquiring color information of each pixel point in the gray image, and acquiring color consistency of the corresponding pixel point based on the color information; obtaining fluctuation average values in different preset directions according to the color consistency and gray values of each pixel point; screening target points based on the fluctuation average value in each preset direction, and acquiring a direction threshold value in the corresponding preset direction according to the color consistency and gray value of the target points; and acquiring judgment values of the pixel points in the corresponding preset directions according to the direction threshold value in each preset direction, and acquiring an abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions. The invention can improve the accuracy of extracting the abnormal defect area on the surface of the connector.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to an anomaly identification extraction method based on carbon fiber connector image processing.
Background
The connector is a common mechanical part and is widely applied to various common living application scenes, such as various common fields of petroleum and gas pipeline laying transmission, transmission line erection, optical cable interface installation and the like.
The connector is likely to be damaged due to old faults of related processing equipment or the impact in the connector parts obtained by production and processing caused by improper operation of technicians, so that the surface of the connector is damaged and the quality of the connector is improved; the attractive appearance and flatness in the subsequent connector assembly process are seriously affected, and the scratch part is possibly worn more seriously when the connector is used at high frequency, so that the system cannot work normally, production safety accidents are caused, and unnecessary economic property loss is caused.
The existing method for detecting and identifying the surface abnormality of the connector generally uses threshold judgment, but when the traditional threshold segmentation is used for extracting an abnormal region, the global threshold is often used for processing, and the effect of the global threshold on the abnormal segmentation is not ideal enough; the efficiency is lower when part adopts local threshold analysis, and the analysis process is comparatively single, and is relatively poor to the unusual recognition effect of connector image.
Disclosure of Invention
In order to solve the problem that the conventional threshold segmentation has poor effect on identifying the surface abnormality of the connector, the invention aims to provide an abnormality identification extraction method based on carbon fiber connector image processing, and the adopted technical scheme is as follows:
the embodiment of the invention provides an anomaly identification extraction method based on carbon fiber connector image processing, which comprises the following steps:
acquiring a gray image corresponding to the surface image of the connector;
acquiring color information of each pixel point in the surface image, and acquiring color consistency of the corresponding pixel point based on the color information; obtaining fluctuation average values in different preset directions according to the color consistency and the gray value of each pixel point;
screening target points based on the fluctuation mean value in each preset direction, and acquiring a direction threshold value in the corresponding preset direction according to the color consistency and the gray value of the target points;
and acquiring judgment values of the pixel points in the corresponding preset directions according to the direction threshold value in each preset direction, and acquiring an abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions.
Preferably, the step of obtaining the color consistency of the corresponding pixel point based on the color information includes:
acquiring a corresponding second-order color moment according to the color information of each pixel point;
taking any pixel point as a center point, acquiring an eight-neighborhood range corresponding to the center point, and calculating the absolute value of the difference between the second-order color moment of each neighborhood pixel point in the eight-neighborhood range and the second-order color moment of the center point; obtaining the sum of the absolute values of the differences between the second-order color moments of all the neighborhood pixel points in the eight neighborhood range and the second-order color moment of the center point;
and taking the negative number of the sum of the absolute values of the differences as an index, taking a natural constant as a base, and taking the obtained index function result as the color consistency of the central point.
Preferably, the step of obtaining the average value of the fluctuation in different preset directions according to the color consistency and the gray value of each pixel point includes:
obtaining a product result of the color consistency and the corresponding gray value of each pixel point in a preset direction; and the average value of the product results corresponding to all the pixel points in the preset direction is the fluctuation average value in the corresponding preset direction.
Preferably, the step of screening the target point based on the mean value of the fluctuation in each preset direction includes:
and obtaining a product result of the color consistency and the corresponding gray value of each pixel point in the preset direction, and taking the pixel point corresponding to the product result as a target point when the product result is not larger than the fluctuation mean value of the corresponding preset direction.
Preferably, the calculation formula of the direction threshold value is as follows:
wherein,representing a direction threshold; />Indicate->Color consistency corresponding to the target points; />Indicate->Gray values corresponding to the target points; />Indicate->The fluctuation mean value corresponding to each target point; />Representing the number of all target points; />Representing absolute value calculations.
Preferably, the obtaining formula of the judgment value is as follows:
wherein,representing the coordinate position as +.>A judgment value of a pixel point of (2); />Representing the coordinate position as +.>Gray values of the pixels of (a); />Representing coordinates asImage of (2)Gray value of the pixel; />Representing a direction threshold; />Represents the abscissa index, and the value range is +.>;/>Representing the ordinate index, the value range is +.>;/>Representing the coordinate position as +.>An analysis step length corresponding to the pixel points; />Representing absolute value calculations.
Preferably, the method for obtaining the analysis step length includes:
the corresponding analysis step length of each pixel point is different in different preset directions, and the preset directions comprise:and +.>The analysis units in different preset directions are different; acquiring the number of all target points in each analysis unit in different preset directions, and when the number of the target points is not more than the preset proportion of the number of all pixel points in the analysis unit, setting the analysis step length of each pixel point in the analysis unit as a first preset value; when the number of the target points is larger than the preset proportion of the number of all pixel points in the analysis unit, each pixel point in the analysis unitThe analysis step length of each pixel point is a second preset value.
Preferably, the step of obtaining the abnormal defect area in the gray image based on the judgment values of the pixel points in all preset directions includes:
taking the judgment value of the pixel point in each preset direction as a binary image corresponding to the pixel point in the preset direction, and superposing the binary images corresponding to all the preset directions to obtain a fusion image, wherein the superposition is to accumulate the judgment values of the pixel points at corresponding positions in the binary images, and the accumulated judgment values are taken as the pixel values of the pixel points at corresponding positions in the fusion image;
and the region formed by the pixel points with non-zero pixel values in the fusion image is an abnormal defect region in the gray level image.
Preferably, the color information of each pixel point refers to the H-channel value of the pixel point in the HSV color space.
Preferably, the first preset value is set to 2, and the second preset value is set to 1.
The invention has the following beneficial effects: the invention aims to solve the problem that the traditional threshold segmentation is inaccurate in acquiring the abnormal area of the surface of a connector, firstly, the color consistency is calculated through the color information of each pixel point in the gray level image of the surface of the connector, and when the abnormal defect occurs due to the fact that the color information among the pixels of the normal area part of the surface of the connector is similar, the color information of the pixels changes, so that the color consistency of each pixel point is used as the basis of subsequent analysis; then, analyzing by setting a plurality of preset directions, and acquiring a fluctuation average value by combining the color consistency of the pixel points and the gray values corresponding to the pixel points in each preset direction, so that a target point in the target point is screened according to the fluctuation average value; furthermore, the direction threshold value is obtained according to the color consistency and gray value of the target point obtained through screening, and compared with the traditional global threshold value, the applicability of analyzing by using the direction threshold values in different preset directions is stronger; finally, based on the direction threshold values in different preset directions, the judgment values of the pixel points in the corresponding preset directions are obtained, the final abnormal defect area is obtained through combination analysis of the judgment values of the pixel points in the preset directions, the analysis is carried out through the preset directions, errors of single-direction analysis of the traditional local threshold values are avoided, meanwhile, the reliability of obtaining the abnormal defect area is guaranteed, and the accuracy of extracting the surface abnormality of the connector is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of an anomaly identification extraction method based on image processing of a carbon fiber connector according to an embodiment of the present invention;
fig. 2 is a schematic diagram of target point screening according to an embodiment of the invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description refers to specific implementation, structure, characteristics and effects of the abnormality recognition extraction method based on the image processing of the carbon fiber connector according to the invention, which is provided by the invention, with reference to the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the abnormality identification extraction method based on the image processing of the carbon fiber connector.
Referring to fig. 1, a flowchart of an anomaly identification extraction method based on image processing of a carbon fiber connector according to an embodiment of the invention is shown, and the method includes the following steps:
step S100, acquiring a gray image corresponding to the surface image of the connector.
When the surface of the connector is abnormally identified, the quality of the acquired connector surface image has larger influence on whether the surface of the connector has abnormal defects such as scratch and abrasion and the like, the image sensor in the current mainstream is mainly divided into a CMOS component and a CCD component, and compared with the CMOS component, the CCD component has the advantages of high imaging quality, complete image detail reservation and no smear, so that in order to acquire the connector surface image with clear detail and higher image quality, the image acquisition module formed by the CCD component is used for acquiring the connector surface image.
Considering that the connector has different side surfaces, if shooting analysis is performed on only a single side surface, a larger error occurs, and in order to accurately extract abrasion conditions occurring on different side surfaces, in this embodiment, rotation shooting is performed on a plurality of side surfaces of the connector to be detected, so as to obtain a complete surface image of the connector surface.
If the surface image obtained based on the image acquisition module is an image under the RGB space, repeated calculation needs to be performed in three channels of the RGB space during subsequent anomaly identification and extraction, the calculated amount is large, in order to reduce the calculation cost, the surface image is subjected to graying treatment so as to obtain a gray image corresponding to the surface image, in this embodiment, a weighted average method is adopted, in other embodiments, an operator can select the method by himself, and the graying means by the weighted average method are known techniques, which are not described in detail in this embodiment.
Because of the influence of shooting and collecting working environment, natural random noise possibly exists in the gray level image on the surface of the connector, namely noise points can appear in the gray level image, and a certain influence can be generated on the abnormal recognition of the subsequent connector; gaussian filtering is a well known technique and will not be described in detail.
Step S200, obtaining color information of each pixel point in the surface image, and obtaining color consistency of the corresponding pixel point based on the color information; and obtaining fluctuation average values in different preset directions according to the color consistency and gray values of each pixel point.
Analyzing based on the gray level image after Gaussian filtering in the step S100, wherein the gray level images used subsequently are all gray level images after Gaussian filtering treatment for convenience of description; when the surface of the connector has defects such as scratch abrasion, the pixel points of the scratch abrasion part have larger difference from the pixel points of the normal part, and the color information between the adjacent pixel points of the normal part is similar, so that the color consistency of each pixel point is analyzed in the embodiment.
Acquiring a corresponding second-order color moment according to the color information of each pixel point; taking any pixel point as a center point, acquiring an eight-neighborhood range corresponding to the center point, and calculating the absolute value of the difference between the second-order color moment of each neighborhood pixel point in the eight-neighborhood range and the second-order color moment of the center point; obtaining the sum of the absolute values of the differences between the second-order color moments of all the neighborhood pixel points in the eight neighborhood range and the second-order color moment of the center point; and taking the negative number of the sum of absolute values of the differences as an index, taking a natural constant as a base, and taking the obtained index function result as the color consistency of the center point.
Specifically, converting an RGB image corresponding to a gray level image into an HSV color space to obtain an H channel value corresponding to each pixel point, namely, the H channel value corresponding to each pixel point in the gray level image can be correspondingly obtained, and the H channel value corresponding to each pixel point is recorded as the color information of the pixel point; the method for obtaining the corresponding second-order color moment according to the color information corresponding to each pixel point, converting the gray level image into the HSV color space and obtaining the second-order color moment are all known means, and detailed description is omitted in this embodiment; and obtaining the color consistency corresponding to the pixel points through the second-order color moment of each pixel point.
Taking any pixel point as an example, taking the pixel point as a center point, acquiring an eight neighborhood region corresponding to the center point, and calculating the color consistency of the center point based on the second-order color moment of the neighborhood pixel point in the eight neighborhood region, wherein the specific calculation method of the color consistency comprises the following steps:
wherein,indicate->Color consistency corresponding to the individual pixel points, namely color consistency corresponding to the center point; />Indicate->Second-order color moment corresponding to each pixel point; />Indicate->Eighth +.>Second-order color moments of the neighborhood pixel points; />Representing natural constants; />Calculated for absolute values.
Indicate->Eighth in eight neighborhood of each pixel>The pixel points of the neighborhood and the +.>The absolute value of the difference value of the second-order color moment between the pixel points is larger, which indicates the +.>The pixel points of the neighborhood and the +.>The larger the color difference between the individual pixels, i.e. +.>The pixel points of the neighborhood and the +.>The more dissimilar the color information between the individual pixels, the +.>The smaller the color consistency corresponding to the pixel points; />Indicate->All neighborhood pixel points and +.>Summing the absolute values of the differences of the second-order color moments between the pixelsThe larger the summation result, the description of +.>The more similar the color information between each pixel and the neighboring pixels in the eight neighboring regions, namelyThe greater the result of (2)>The smaller the color consistency corresponding to the pixel points;for ensuring summation result->The relationship with the color consistency is a negative correlation relationship, and the value of the color consistency is normalized at the same time, and mapped to +.>And the color consistency is convenient for subsequent analysis and calculation.
Similarly, based on acquisition of the firstThe method for obtaining the color consistency of each pixel point in the gray image comprises the steps of obtaining the color consistency corresponding to each pixel point in the gray image, wherein the pixel point with smaller color consistency is more likely to be an abnormal pixel point of an abnormal region.
In the traditional threshold segmentation calculation process, a global single threshold or a local multi-threshold is generally used for segmentation calculation, and when the global threshold is used for processing and calculating a more complex scene, the more accurate and satisfactory effect is difficult to achieve; when the window is used for calculating the local multi-threshold value, the final effect is greatly related to the size of the window, and meanwhile, the poor window size setting also can cause the poor real-time effect of the whole scheme, so that the final real-time detection effect of the scheme is affected; therefore, in this embodiment, according to gray scale fluctuation conditions in different preset directions in the gray scale image, analysis and calculation are performed in combination with color consistency of pixel points at each position, so as to avoid error influence caused by improper window size setting. In order to obtain feature information of defect abnormality in the gray level image, calculating a fluctuation mean value based on color consistency and gray level values corresponding to each pixel point in different preset directions; obtaining a product result of the color consistency of each pixel point in a preset direction and a corresponding gray value; the average value of the product results corresponding to all the pixel points in the preset direction is the fluctuation average value in the corresponding preset direction.
In the embodiment of the invention, the preset direction isAnd +.>In other embodiments, the practitioner may set a different predetermined direction for analysis. The analytical units in different preset directions are different, the preset direction is +.>When the gray level image is displayed, each row of pixel points in the gray level image is an analysis unit; the preset direction is +.>When the gray scale image is marked, marking a main diagonal line of the gray scale image, wherein each straight line penetrating through the gray scale image, which is parallel to the main diagonal line, in the gray scale image is an analysis unit; the preset direction is +.>When the gray level image is displayed, each column of pixel points in the gray level image is an analysis unit; the preset direction is +.>In this case, the sub-diagonal line of the gradation image is marked, and each straight line passing through the gradation image in parallel with the sub-diagonal line in the gradation image is one unit of analysis.
In a preset directionIn the case of an example of this,calculating the preset direction +.>The fluctuation mean value of the lower pixel points, namely the fluctuation mean value of each row of pixel points in the gray level image, for any row of pixel points, the total number of the row of pixel points in the gray level image is obtained, the fluctuation mean value is calculated based on the color consistency and the gray level value of the pixel points, and the specific calculation method of the fluctuation mean value is as follows:
wherein,representing a preset direction +.>The mean value of the fluctuation of the lower pixel point, here the preset direction +.>Is->Namely, the fluctuation mean value of any row of pixel points in the gray level image; />Representing a preset direction +.>The number of the lower pixel points is the number of one row of pixel points in the gray level image; />Indicate->Color consistency corresponding to the individual pixels, here +.>Each pixel point is a preset direction +.>A lower pixel point; />Indicate->Gray values of individual pixels.
Since the color consistency of the abnormal pixel points of the abnormal region is smaller and the gray value of the pixel points with abnormal scratch abrasion is generally smaller, the smaller the result of the fluctuation mean value is, the more likely the pixel points in the preset direction are the abnormal pixel points of the scratch abrasion region, by taking the mean value of the products of the color consistency and the gray value of all the pixel points in the preset direction as the fluctuation mean value in the preset direction; at this time in a preset directionThe actual obtained fluctuation mean value of each row of pixel points in the gray level image is based on the fluctuation mean value of each row of pixel points as a basis for subsequent anomaly analysis.
In the preset directionIn the actual acquisition, the fluctuation average value of all the pixel points on the straight line penetrating through the gray level image, which are parallel to the main diagonal line, in the gray level image is obtained; in the preset direction->In the process, the fluctuation mean value of each column of pixel points in the gray level image is actually obtained; in the preset direction->In the actual acquisition, the fluctuation average value of all the pixel points on the straight line penetrating through the gray level image, which are parallel to the secondary diagonal line, in the gray level image is obtained; the method for obtaining the fluctuation mean value in different preset directions is the same.
Step S300, screening target points based on the fluctuation mean value in each preset direction, and acquiring a direction threshold value in the corresponding preset direction according to the color consistency and the gray value of the target points.
Step S200 is performed to obtain a fluctuation mean value in each preset direction, wherein the smaller the fluctuation mean value is, the greater the possibility that abnormal pixel points exist in the preset direction is, so that target points which are possibly abnormal pixel points in the corresponding preset direction are screened out based on the fluctuation mean value; and obtaining a product result of the color consistency of each pixel point in the preset direction and the corresponding gray value, and taking the pixel point corresponding to the product result as a target point when the product result is not larger than the fluctuation mean value corresponding to the preset direction.
The acquisition method of the target point comprises the following steps: the gray value of the abnormal pixel point is known to be smaller and the color consistency is poor, so the product of the gray value and the color consistency of the abnormal pixel point is smaller, namelyThe value of (2) is smaller; in a preset direction +.>Taking any row of pixels in the gray image as an example, taking pixels in which the product of the color consistency and the corresponding gray value in the row of pixels is not greater than the mean value of the fluctuation of the row of pixels as target points, as an example>The product of the color consistency of each pixel point and the corresponding gray value is +>If the product resultsNot more than the corresponding fluctuation mean value of the row of pixel points, the product result is +.>Corresponding->The pixel points are target points; thereby obtaining a presetDirection->A target point in each row of pixel points in the gray level image; similarly, based on the acquisition of the preset direction +.>The same method as the lower target point can obtain the preset direction +.>Preset direction->And a preset directionA lower target point.
As another example, please refer to fig. 2, which shows a target point screening diagram, wherein a curve is formed by taking the position of a pixel as the abscissa and the product of the color consistency and gray value corresponding to the pixel as the ordinate, and the curve is assumed to be the preset directionMarking out fluctuation mean +.f of pixel points in the line according to the curve constructed by the pixel points in any next line>The corresponding straight line, i.e. the transversal dashed line +.>The curve formed by the fluctuation mean value and the pixel points of the row is intersected at two points, and the positions of the corresponding pixel points of the two points are respectively +.>And->And->And->The product result of the color consistency and gray value of the pixel points is not more than the corresponding fluctuation mean value +.>Is thus +.>And->The pixel points between the two are all target points, +.>And->The number of pixels in between is the number of target points +.>。
Further still in the preset directionTaking any row of pixel points in the gray image as an example, obtaining all the target points in the row of pixel points by the method for obtaining the target points, and counting the number of the target points, wherein the number of the target points in the row of pixel points is ∈ ->When the number of target points in the pixel point is large, that is, the number of possible abnormal pixel points is large, more detailed analysis is needed for the row of pixel points, so that in this embodiment, the analysis step is set based on the number of target points, and the specific analysis step is set as follows:
wherein,representing an analysis step size; />Representing a first preset value, in this embodiment +.>Taking an experience value of 2;representing a second preset value, in this embodiment +.>Taking an experience value of 1; />Representing the number of target points in a row of pixel points; />Representing the number of all pixel points in a row of pixel points; />Is a preset proportion; when->At this time, it is indicated that the number of target points in the row of pixels is greater than the total number of the row of pixels>The number of target points in the line of pixels is large, so that a smaller analysis step length is adopted for the line of pixels>Extracting abnormal change forms better; when (when)At this time, it is indicated that the number of target points in the row of pixels is not greater than +.>The number of target points in the line of pixels is small, so that a larger analysis step length is adopted for the line of pixels>To improve the efficiency of the analysis.
Meanwhile, the direction threshold value is acquired based on the fluctuation mean value corresponding to each row of pixel points and the number of target points, namely, the direction threshold value is calculated in the preset directionThe specific calculation method of the direction threshold value corresponding to each row of pixel points comprises the following steps:
wherein,representing a direction threshold; />Indicate->Color consistency corresponding to the target points; />Indicate->Gray values corresponding to the target points; />Indicate->The mean of the fluctuations corresponding to the target points, i.e. +.>The fluctuation mean value of the rows of the target points; />Representing the number of all target points; />Representing absolute value calculations.
Because the target point is a pixel point with the product result of the color consistency and the gray value in a row of pixel points not larger than the fluctuation mean value, when the fluctuation mean value is smaller, the product result of the color consistency and the gray value corresponding to the abnormal pixel point may be larger than the fluctuation mean value corresponding to the row of pixel points, so that the judgment of the abnormal pixel point is not accurate enough by selecting the target point based on the fluctuation mean value only, in the embodiment, the difference mean value between all the target points and the fluctuation mean value is used as the direction threshold value for judging the row of pixel points,representing the product of the color consistency and the gray value corresponding to the target point and the absolute value of the difference value between the average value of the fluctuation of the line of the target point; />Representing the sum result of the absolute values of the differences corresponding to all the target points in the row of pixel points; />The difference average value between all target points and the fluctuation average value is the direction threshold value of the row of pixel points.
Step S400, obtaining the judgment value of the pixel point in the corresponding preset direction according to the direction threshold value in each preset direction, and obtaining the abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions.
Step S300 is used for obtaining direction thresholds corresponding to the pixels in different preset directions and analysis step length corresponding to each pixel, judging the defective pixel based on the analysis step length and the direction thresholds of the pixels in different preset directions, and obtaining the preset directionIn the following, an arbitrary row of pixels is taken as an example, and the direction threshold value obtained by the row of pixels is +.>And the method of step S300 obtains the analysis step length corresponding to the row of pixel points, and then obtains the judgment value of each pixel point based on the analysis step length and the direction threshold value, and the judgment value determines whether the pixel point is a defective pixel point, and the specific obtaining method of the judgment value of each pixel point is as follows:
wherein,representing the coordinate position as +.>A judgment value of a pixel point of (2); />Representing the coordinate position as +.>Gray values of the pixels of (a); />Representing coordinates asGray values of the pixels of (a); />Representing a direction threshold; />Representing an abscissa index; />Representing an ordinate index; />Representing the coordinate position as +.>The corresponding analysis step length of the pixel points of (a) is that the coordinate position isThe analysis step length of the row of the pixel points; />Representing absolute value calculations.
The value range of the abscissa index in the judgment value acquisition is as followsThe value range of the ordinate index is +.>The purpose is to select the pixel point according to the corresponding preset direction, in the preset direction +.>Lower, abscissa index->Ordinate index->The method comprises the steps of carrying out a first treatment on the surface of the In the preset direction->Lower, abscissa index->Ordinate indexThe method comprises the steps of carrying out a first treatment on the surface of the In the preset direction->Lower, abscissa index->Ordinate index->The method comprises the steps of carrying out a first treatment on the surface of the In the preset direction->Lower, abscissa index->Ordinate index->The method comprises the steps of carrying out a first treatment on the surface of the I.e. in the preset direction +.>In the case of analyzing pixels in any line, the coordinate positions of pixels in the line are +.>For the pixel points of (1), it is assumed that the coordinate position is +.>The analysis step size of the row in which the pixels of (a) are located +.>Taking the value 2, then calculate +.>Is to take the value of (i.e. calculate)If the coordinate position is +.>The pixel points and the coordinate positions of (2) areIf the absolute value of the difference of the gray values between the pixel points is smaller than the direction threshold value, the difference of the gray values corresponding to the two pixel points is smaller, and the coordinate position is +.>Taking 0 as the judgment value of the pixel point; on the contrary, if the coordinate position is +.>The pixel point and the coordinate position of (2) are +.>The absolute value of the difference in gray values between the pixels of (a) is not less than the direction threshold, i.e. +.>Coordinate position is +.>The judgment value of the pixel point of (2) is 1.
According to the change of the horizontal coordinate index and the vertical coordinate index in different preset directions, the judgment value corresponding to each pixel point in the gray level image is obtained, and the pixel point is the defective pixel point when the judgment value of the pixel point takes 1 because the difference between the defective pixel points is smaller and the difference between the defective pixel point and the non-defective pixel point is larger.
It should be noted that, because there are multiple preset directions, the results obtained by analyzing the pixel points in different preset directions are different, that is, a certain pixel point may have a judgment value of 1 in one preset direction and a judgment value of 0 in the other preset directions.
Taking the judgment value of the pixel point in each preset direction as a binary image corresponding to the pixel point in the preset direction, and superposing the binary images corresponding to all the preset directions to obtain a fusion image, wherein the superposition is to accumulate the judgment value of the pixel point at the corresponding position in the binary image, and the accumulated judgment value is taken as the pixel value of the pixel point at the corresponding position in the fusion image; the region formed by the pixel points with non-zero pixel values in the fusion image is an abnormal defect region in the gray level image.
Specifically, since all pixels in the gray image are analyzed in each preset direction to obtain corresponding judgment values, the judgment value of each pixel in the gray image is taken as the pixel value to obtain corresponding binary images, and since the judgment values of the pixels in different preset directions are different, in this embodiment, 4 preset directions exist, 4 binary images corresponding to the gray image can be obtained correspondingly, and the 4 binary images are respectively marked as、/>、/>And +.>The method comprises the steps of carrying out a first treatment on the surface of the According to the 4 binary images, carrying out superposition analysis to obtain a fusion image corresponding to the gray level image, namely accumulating pixel values of pixel points at corresponding positions in the 4 binary images to obtain a fusion image, wherein five values exist in the pixel value of each pixel point in the fusion image, namely>The larger the pixel value of the pixel point in the fused image, the more times that the pixel point is judged to be a defective pixel point in different preset directions are indicated, so that the pixel points with the pixel values of 3 and 4 in the fused image are marked as serious defective pixel points in the embodiment, and all the serious defective pixel points form a serious defect area on the surface of the connector; marking pixel points with pixel values of 1 and 2 in the fusion image as slightly defective pixel points, wherein all slightly defective pixel points form a slightly defective area on the surface of the connector, and the severely defective area and the slightly defective area are abnormal defective areas in the gray level image; the pixel with the pixel value of 0 in the fused image is the pixel which is judged to be non-defective in each preset direction, so the pixel with the pixel value of 0 in the fused image is marked as positiveAnd normal pixel points, wherein all normal pixel points form a normal area of the surface of the connector.
In summary, the embodiment of the invention obtains the gray image on the surface of the connector; acquiring color information of each pixel point in the gray image, and acquiring color consistency of the corresponding pixel point based on the color information; obtaining fluctuation average values in different preset directions according to the color consistency and gray values of each pixel point; screening target points based on the fluctuation average value in each preset direction, and acquiring a direction threshold value in the corresponding preset direction according to the color consistency and gray value of the target points; acquiring judgment values of pixel points in the corresponding preset directions according to the direction threshold value in each preset direction, and acquiring an abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions; the corresponding direction threshold value is obtained through analysis of a plurality of preset directions, the defect pixel points corresponding to the preset directions are obtained based on the direction threshold value at the moment, the final abnormal defect area is obtained through comprehensive analysis of the defect pixel points in all the preset directions, and the accuracy of extraction of the abnormal defect area on the surface of the connector is ensured.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description of the preferred embodiments of the present invention is not intended to be limiting, but rather, any modifications, equivalents, improvements, etc. that fall within the principles of the present invention are intended to be included within the scope of the present invention.
Claims (7)
1. The anomaly identification and extraction method based on the image processing of the carbon fiber connector is characterized by comprising the following steps of:
acquiring a gray image corresponding to the surface image of the connector;
acquiring color information of each pixel point in the surface image, and acquiring color consistency of the corresponding pixel point based on the color information; obtaining fluctuation average values in different preset directions according to the color consistency and the gray value of each pixel point;
screening target points based on the fluctuation mean value in each preset direction, and acquiring a direction threshold value in the corresponding preset direction according to the color consistency and the gray value of the target points;
acquiring judgment values of pixel points in the corresponding preset directions according to the direction threshold value in each preset direction, and acquiring an abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions;
the step of obtaining the color consistency of the corresponding pixel points based on the color information comprises the following steps:
acquiring a corresponding second-order color moment according to the color information of each pixel point;
taking any pixel point as a center point, acquiring an eight-neighborhood range corresponding to the center point, and calculating the absolute value of the difference between the second-order color moment of each neighborhood pixel point in the eight-neighborhood range and the second-order color moment of the center point; obtaining the sum of the absolute values of the differences between the second-order color moments of all the neighborhood pixel points in the eight neighborhood range and the second-order color moment of the center point;
taking the negative number of the sum of the absolute values of the differences as an index, taking a natural constant as a base, and taking the obtained index function result as the color consistency of the central point;
the calculation formula of the direction threshold value is as follows:
wherein,representing a direction threshold; />Indicate->Color consistency corresponding to the target points; />Indicate->Gray values corresponding to the target points; />Indicate->The fluctuation mean value corresponding to each target point; />Representing the number of all target points; />Representing absolute value calculation;
the judgment value obtaining formula is as follows:
wherein,representing the coordinate position as +.>A judgment value of a pixel point of (2); />Representing coordinate bitsPut into->Gray values of the pixels of (a); />Representing coordinates of +.>Gray values of the pixels of (a); />Representing a direction threshold; />Represents the abscissa index, and the value range is +.>;/>Representing the ordinate index, the value range is +.>;/>Representing the coordinate position as +.>An analysis step length corresponding to the pixel points; />Representing absolute value calculations.
2. The method for extracting and identifying anomalies based on image processing of a carbon fiber connector according to claim 1, wherein the step of obtaining the average value of fluctuation in different preset directions according to the color consistency and the gray value of each pixel point comprises the following steps:
obtaining a product result of the color consistency and the corresponding gray value of each pixel point in a preset direction; and the average value of the product results corresponding to all the pixel points in the preset direction is the fluctuation average value in the corresponding preset direction.
3. The abnormality recognition extraction method based on the image processing of the carbon fiber connector according to claim 1, wherein the step of screening the target point based on the fluctuation average value in each preset direction comprises the steps of:
and obtaining a product result of the color consistency and the corresponding gray value of each pixel point in the preset direction, and taking the pixel point corresponding to the product result as a target point when the product result is not larger than the fluctuation mean value of the corresponding preset direction.
4. The method for identifying and extracting anomalies based on image processing of a carbon fiber connector according to claim 1, wherein the method for obtaining the analysis step length comprises the following steps:
the corresponding analysis step length of each pixel point is different in different preset directions, and the preset directions comprise:and +.>The analysis units in different preset directions are different; acquiring the number of all target points in each analysis unit in different preset directions, and when the number of the target points is not more than the preset proportion of the number of all pixel points in the analysis unit, setting the analysis step length of each pixel point in the analysis unit as a first preset value; when the number of the target points is larger than the preset proportion of the number of all the pixel points in the analysis unit, the analysis step length of each pixel point in the analysis unit is a second preset value.
5. The method for identifying and extracting an abnormality based on image processing of a carbon fiber connector according to claim 1, wherein the step of obtaining the abnormal defect area in the gray image based on the judgment values of the pixel points in all the preset directions comprises the steps of:
taking the judgment value of the pixel point in each preset direction as a binary image corresponding to the pixel point in the preset direction, and superposing the binary images corresponding to all the preset directions to obtain a fusion image, wherein the superposition is to accumulate the judgment values of the pixel points at corresponding positions in the binary images, and the accumulated judgment values are taken as the pixel values of the pixel points at corresponding positions in the fusion image;
and the region formed by the pixel points with non-zero pixel values in the fusion image is an abnormal defect region in the gray level image.
6. The anomaly identification extraction method based on carbon fiber connector image processing of claim 1, wherein the color information of each pixel point is an H-channel value of the pixel point in an HSV color space.
7. The abnormality recognition extraction method based on the image processing of the carbon fiber connector according to claim 4, wherein the first preset value is set to 2, and the second preset value is set to 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310952067.4A CN116664577B (en) | 2023-08-01 | 2023-08-01 | Abnormality identification extraction method based on carbon fiber connector image processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310952067.4A CN116664577B (en) | 2023-08-01 | 2023-08-01 | Abnormality identification extraction method based on carbon fiber connector image processing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116664577A CN116664577A (en) | 2023-08-29 |
CN116664577B true CN116664577B (en) | 2023-11-14 |
Family
ID=87721026
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310952067.4A Active CN116664577B (en) | 2023-08-01 | 2023-08-01 | Abnormality identification extraction method based on carbon fiber connector image processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116664577B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104458755A (en) * | 2014-11-26 | 2015-03-25 | 吴晓军 | Multi-type material surface defect detection method based on machine vision |
WO2016143134A1 (en) * | 2015-03-12 | 2016-09-15 | オリンパス株式会社 | Image processing device, image processing method, and program |
CN111160373A (en) * | 2019-12-30 | 2020-05-15 | 重庆邮电大学 | Method for extracting, detecting and classifying defect image features of variable speed drum parts |
CN114913109A (en) * | 2021-01-29 | 2022-08-16 | 深圳市万普拉斯科技有限公司 | Image anomaly detection method and device, test chart and terminal equipment |
CN115294338A (en) * | 2022-09-29 | 2022-11-04 | 中威泵业(江苏)有限公司 | Impeller surface defect identification method |
CN115330767A (en) * | 2022-10-12 | 2022-11-11 | 南通南辉电子材料股份有限公司 | Method for identifying production abnormity of corrosion foil |
CN115641336A (en) * | 2022-12-23 | 2023-01-24 | 无锡康贝电子设备有限公司 | Air conditioner sheet metal part defect identification method based on computer vision |
-
2023
- 2023-08-01 CN CN202310952067.4A patent/CN116664577B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104458755A (en) * | 2014-11-26 | 2015-03-25 | 吴晓军 | Multi-type material surface defect detection method based on machine vision |
WO2016143134A1 (en) * | 2015-03-12 | 2016-09-15 | オリンパス株式会社 | Image processing device, image processing method, and program |
CN111160373A (en) * | 2019-12-30 | 2020-05-15 | 重庆邮电大学 | Method for extracting, detecting and classifying defect image features of variable speed drum parts |
CN114913109A (en) * | 2021-01-29 | 2022-08-16 | 深圳市万普拉斯科技有限公司 | Image anomaly detection method and device, test chart and terminal equipment |
CN115294338A (en) * | 2022-09-29 | 2022-11-04 | 中威泵业(江苏)有限公司 | Impeller surface defect identification method |
CN115330767A (en) * | 2022-10-12 | 2022-11-11 | 南通南辉电子材料股份有限公司 | Method for identifying production abnormity of corrosion foil |
CN115641336A (en) * | 2022-12-23 | 2023-01-24 | 无锡康贝电子设备有限公司 | Air conditioner sheet metal part defect identification method based on computer vision |
Non-Patent Citations (2)
Title |
---|
Automated recognition of surface defects using digital color image processing;Sangwook Lee et al;《Automated recognition of surface defects using digital color image processing》;第15卷(第4期);540-549 * |
基于机器视觉的磁性零件表面缺陷检测与分类研究;肖贤军;《中国优秀硕士学位论文全文数据库(电子期刊)》;第2022卷(第09期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN116664577A (en) | 2023-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114937055B (en) | Image self-adaptive segmentation method and system based on artificial intelligence | |
CN109870461B (en) | Electronic components quality detection system | |
CN115601364B (en) | Golden finger circuit board detection method based on image analysis | |
CN111383209B (en) | Unsupervised flaw detection method based on full convolution self-encoder network | |
CN111429403B (en) | Automobile gear finished product defect detection method based on machine vision | |
CN111223093A (en) | AOI defect detection method | |
CN115345885A (en) | Method for detecting appearance quality of metal fitness equipment | |
CN102175700B (en) | Method for detecting welding seam segmentation and defects of digital X-ray images | |
CN111080582B (en) | Method for detecting defects of inner and outer surfaces of workpiece | |
CN109540925B (en) | Complex ceramic tile surface defect detection method based on difference method and local variance measurement operator | |
CN116721107B (en) | Intelligent monitoring system for cable production quality | |
CN116977342B (en) | PCB circuit detection method based on image segmentation | |
CN115526889B (en) | Nondestructive testing method of boiler pressure pipeline based on image processing | |
CN117437223B (en) | Intelligent defect detection method for high-speed board-to-board connector | |
CN110766683B (en) | Pearl finish grade detection method and system | |
CN114897855A (en) | Method for judging defect type based on X-ray picture gray value distribution | |
CN116309548B (en) | Automatic defect detection system for valve sealing surface | |
CN111563896A (en) | Image processing method for catenary anomaly detection | |
CN115035141A (en) | Tunnel crack remote monitoring and early warning method based on image processing | |
CN115205318A (en) | Submarine cable surface defect identification method and system | |
CN109767426B (en) | Shield tunnel water leakage detection method based on image feature recognition | |
CN101807297B (en) | Medical ultrasonic image line detection method | |
CN116664577B (en) | Abnormality identification extraction method based on carbon fiber connector image processing | |
JP2009198290A (en) | Flaw detection method and detector | |
CN105787955A (en) | Sparse segmentation method and device of strip steel defect |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |