CN115423807B - Cloth defect detection method based on outlier detection - Google Patents

Cloth defect detection method based on outlier detection Download PDF

Info

Publication number
CN115423807B
CN115423807B CN202211373105.2A CN202211373105A CN115423807B CN 115423807 B CN115423807 B CN 115423807B CN 202211373105 A CN202211373105 A CN 202211373105A CN 115423807 B CN115423807 B CN 115423807B
Authority
CN
China
Prior art keywords
value
sequence
abnormal
local outlier
outlier
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
Application number
CN202211373105.2A
Other languages
Chinese (zh)
Other versions
CN115423807A (en
Inventor
郝一民
王焕敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Pengmin Clothing Co.,Ltd.
Original Assignee
Shandong Yimin Clothing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Yimin Clothing Co ltd filed Critical Shandong Yimin Clothing Co ltd
Priority to CN202211373105.2A priority Critical patent/CN115423807B/en
Publication of CN115423807A publication Critical patent/CN115423807A/en
Application granted granted Critical
Publication of CN115423807B publication Critical patent/CN115423807B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/54Extraction of image or video features relating to texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (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 a cloth defect detection method based on outlier detection. The method comprises the steps of carrying out gray scale abnormality detection on a line average value sequence and a column average value sequence of a cloth gray scale image through an LOF outlier detection method so as to determine an image abnormal area, carrying out iterative updating on a distance measurement mode in the LOF outlier detection method according to the image abnormal area so as to obtain an optimal distance measurement mode, and determining the optimal abnormal area in the cloth gray scale image in the optimal distance measurement mode of the LOF outlier detection, so that self-adaptive defect detection according to the gray scale characteristics and the texture characteristics of the cloth is realized, and the accuracy of the cloth defect detection is improved.

Description

Cloth defect detection method based on outlier detection
Technical Field
The invention relates to the technical field of image processing, in particular to a cloth defect detection method based on outlier detection.
Background
Because the cloth is woven, certain woven textures exist in the whole cloth, and in addition, patterns and the like exist additionally on a plurality of pieces of cloth, which further aggravates the texture degree of the whole cloth, in the process of detecting the defects of the cloth by utilizing an edge detection technology in the prior art, because the defects of the cloth are influenced by the cloth textures, a large amount of operations are needed to judge which edge characteristic points are points on real cloth defects and which are edge characteristic points correspondingly generated by the cloth textures after edge detection, and for weak defects in some pieces of cloth, due to the interference of the cloth textures, the points corresponding to the defects are difficult to accurately find out from the edge characteristic points after edge detection, so that the accuracy of detecting the cloth defects in the prior art is insufficient.
Disclosure of Invention
The invention provides a cloth defect detection method based on outlier detection, which is used for solving the technical problem that cloth defect detection in the prior art is not accurate enough, and adopts the following technical scheme:
the invention discloses a cloth defect detection method based on outlier detection, which comprises the following steps:
acquiring a cloth gray image;
calculating the row average gray value of each row and the column average gray value of each column on the cloth gray image to obtain a row average gray value sequence and a column average gray value sequence, and determining the primary direction and the secondary direction of the defect abnormal degree and the distance measuring mode of the LOF from the cluster point detection according to the row average gray value sequence and the column average gray value sequence;
performing LOF outlier detection on the average gray value sequences corresponding to the primary direction and the secondary direction respectively, and determining the abnormal degree of the primary direction and the secondary direction so as to determine an image abnormal region;
determining the optimal distance measurement mode of LOF outlier detection according to the determined image abnormal area;
and determining the optimal abnormal area in the gray level image of the cloth according to the optimal distance measurement mode of LOF outlier detection, and completing the cloth defect detection.
The invention has the beneficial effects that:
according to the method, gray level abnormality detection is carried out on the line average value sequence and the column average value sequence of the cloth gray level image through an LOF outlier detection method so as to determine an image abnormal area, iterative updating is carried out on a distance measurement mode in the LOF outlier detection method according to the image abnormal area so as to obtain an optimal distance measurement mode, the optimal abnormal area in the cloth gray level image is determined in the optimal distance measurement mode of the LOF outlier detection, self-adaptive defect detection according to the gray level characteristics and the texture characteristics of the cloth is achieved, and the accuracy of the cloth defect detection is improved.
Further, the method for determining the primary direction and the secondary direction of the defect abnormal degree comprises the following steps:
Figure 100002_DEST_PATH_IMAGE001
Figure DEST_PATH_IMAGE002
wherein, the first and the second end of the pipe are connected with each other,
Figure 100002_DEST_PATH_IMAGE003
and
Figure DEST_PATH_IMAGE004
respectively representing a row score and a column score for determining a main direction of a defect abnormality degree,
Figure 100002_DEST_PATH_IMAGE005
and
Figure DEST_PATH_IMAGE006
respectively represent the maxima in the row-averaged gray value sequence and the column-averaged gray value sequence,
Figure 100002_DEST_PATH_IMAGE007
and
Figure DEST_PATH_IMAGE008
respectively representing the variances of the row average gray value sequence and the column average gray value sequence;
the direction corresponding to the larger value of the row score and the column score is used as the primary direction of the defect abnormality degree, and the other direction is used as the secondary direction.
Further, the method for determining the degree of abnormality of the primary direction and the secondary direction includes:
performing LOF outlier detection on the average gray value sequence corresponding to the main direction to obtain a local outlier factor sequence:
Figure 100002_DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE010
indicating the sequence of local outlier factors corresponding to the dominant direction,
Figure 100002_DEST_PATH_IMAGE011
representing the ith local outlier in the sequence of local outlier factors corresponding to the dominant direction,
Figure DEST_PATH_IMAGE012
representing the total number of local outlier factors in the local outlier factor sequence corresponding to the main direction;
will be provided with
Figure 327282DEST_PATH_IMAGE010
Median value greater than
Figure 100002_DEST_PATH_IMAGE013
The values of (a) are extracted and normalized as the degree of anomaly in the main direction:
Figure DEST_PATH_IMAGE014
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE015
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the main direction and is normalized is represented,
Figure DEST_PATH_IMAGE016
represents the jth local outlier factor greater than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure 100002_DEST_PATH_IMAGE017
represents the minimum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction,
Figure DEST_PATH_IMAGE018
representing the maximum value in the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction;
carrying out LOF outlier detection on the average gray value sequence corresponding to the secondary direction to obtain a local outlier factor sequence:
Figure 100002_DEST_PATH_IMAGE019
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE020
representing the sequence of local outlier factors corresponding to the secondary direction,
Figure 100002_DEST_PATH_IMAGE021
represents the p-th local outlier factor in the sequence of local outlier factors corresponding to the secondary direction,
Figure DEST_PATH_IMAGE022
representing the total number of local outlier factors in the local outlier factor sequence corresponding to the secondary direction;
will be provided with
Figure 542625DEST_PATH_IMAGE020
Median value greater than
Figure 384679DEST_PATH_IMAGE013
The value of (a) is extracted and normalized as the degree of abnormality in the secondary direction:
Figure 100002_DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE024
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the secondary direction and is normalized is represented,
Figure 100002_DEST_PATH_IMAGE025
represents the qth local outlier factor larger than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure DEST_PATH_IMAGE026
represents the minimum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the secondary direction,
Figure 100002_DEST_PATH_IMAGE027
the maximum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction is represented.
Further, the method for determining the image abnormal region comprises the following steps:
for degree of abnormality
Figure DEST_PATH_IMAGE028
The abnormal degree of each pixel point in the rows or the columns is marked as the abnormal degree which is not equal to 0
Figure 891140DEST_PATH_IMAGE015
Then, the secondary abnormal degree corresponding to the row or the line where each pixel point in the rows or the columns is located is used as the secondary weight of the pixel point;
then determining the comprehensive abnormal degree of each pixel point in the cloth gray level image:
Figure 100002_DEST_PATH_IMAGE029
wherein, the first and the second end of the pipe are connected with each other,
Figure DEST_PATH_IMAGE030
representing pixel points
Figure 100002_DEST_PATH_IMAGE031
The degree of comprehensive abnormality of (a),
Figure DEST_PATH_IMAGE032
the degree of abnormality of the pixel points is represented,
Figure 100002_DEST_PATH_IMAGE033
representing the secondary weight of the pixel point;
making a mask image of the cloth gray image, marking the pixel values of all the pixels with nonzero comprehensive abnormal degree value as 255, marking the pixel values of the pixels with zero comprehensive abnormal degree value as 0, performing connected domain processing on the mask image, and marking all the obtained connected domains as image abnormal regions.
Further, the method for determining the optimal distance measure for detecting the LOF outliers comprises the following steps:
setting an initial value of a K value and an adjustment step length of the K value in LOF outlier detection, increasing the K value according to the adjustment step length, then calculating a new image abnormal area by using the new K value, and when the number change value of the new image abnormal area is smaller than the number change threshold compared with the number change threshold of the previous image abnormal area, taking the new K value after the adjustment at the moment as an optimal distance measurement mode of the LOF outlier detection.
Drawings
FIG. 1 is a flow chart of the method for detecting cloth defects based on outlier detection according to the present invention.
Detailed Description
The conception of the invention is as follows:
the method comprises the steps of firstly determining the abnormal degree of each line and each column on a gray level image of the cloth, determining the primary direction and the secondary direction of the abnormal degree of the defect and the distance measurement mode of LOF outlier detection, then respectively carrying out LOF outlier detection on the average gray level value sequence of the lines or the columns in the primary direction and the secondary direction to determine the abnormal degree of the primary direction and the secondary direction so as to determine an abnormal area of the image, then obtaining the optimal distance measurement mode according to the distance measurement mode of the determined abnormal area of the image on the LOF outlier detection, carrying out the LOF outlier detection again in the optimal distance measurement mode to obtain the optimal abnormal area, and completing the accurate detection of the cloth defect.
The following describes a cloth defect detection method based on outlier detection in detail with reference to the drawings and embodiments.
The method comprises the following steps:
the invention discloses an embodiment of a cloth defect detection method based on outlier detection, which has the overall flow as shown in figure 1 and comprises the following specific processes:
the method comprises the following steps of obtaining a cloth image, and carrying out gray processing to obtain a cloth gray image.
The method comprises the steps of shooting cloth by using related image acquisition electronic equipment, shooting the cloth by using an industrial camera in the embodiment, obtaining a cloth image, and performing graying processing on the cloth image to obtain a gray image of the cloth correspondingly.
And step two, calculating the row average gray value of each row and the column average gray value of each column on the cloth gray image, correspondingly obtaining a row average gray value sequence and a column average gray value sequence, and determining the primary and secondary directions of the defect abnormal degree and the distance measuring mode of LOF outlier detection according to the row average gray value sequence and the column average gray value sequence.
On the obtained cloth gray image, the gray value of the pixel point on each line is averaged, so that each line can obtain a line average gray value, and all the lines can form a line average gray value sequence corresponding to the obtained line average gray values; similarly, the gray value of the pixel point on each row is averaged, so that each row can obtain a row average gray value, and the row average gray value sequence can be formed by all the rows corresponding to the obtained row average gray value.
1. The primary direction of the defect anomaly is determined.
Since there is a process of integrating the defect abnormal degrees in the two directions after judging the defect abnormal degrees in the two directions of the cloth gray image, if the defect in the cloth gray image is biased to the vertical direction, the defect cannot be obviously represented according to the row average gray value sequence, and if the defect is biased to the horizontal direction, the defect cannot be obviously represented in the column average gray value sequence. The defect needs to be determined in the main direction of the row or column.
The main direction and the secondary direction of the degree of abnormality can be determined by the extreme value and the variance inside the row average gray-scale value sequence and the column average gray-scale value sequence.
The reason is that extreme cases in the sequence may account for some significant pixel information in a row or column, and the variance of the sequence may express the degree of dispersion of the sequence. In the average gray scale value of the row or the column of the cloth image, if the value of the extreme value is higher and the data is more discrete, most information of the defect can be more easily judged in the direction, and the corresponding direction is the main direction of the abnormal degree of the defect.
Calculating a row score and a column score for determining a main direction of the defect abnormal degree according to the respective sequence maximum values and the sequence variances of the row average gray value sequence and the column average gray value sequence:
Figure 252983DEST_PATH_IMAGE001
Figure 872183DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 935954DEST_PATH_IMAGE003
and
Figure 197171DEST_PATH_IMAGE004
respectively representing a row score and a column score for determining a main direction of a defect abnormality degree,
Figure 164252DEST_PATH_IMAGE005
and
Figure 954353DEST_PATH_IMAGE006
respectively represent the maxima in the row-averaged gray value sequence and the column-averaged gray value sequence,
Figure 771000DEST_PATH_IMAGE007
and
Figure 304749DEST_PATH_IMAGE008
the variance of the row-average gray-scale value sequence and the column-average gray-scale value sequence is represented respectively.
The direction corresponding to the larger value of the row score and the column score is used as the primary direction of the defect abnormality degree, and the other direction is used as the secondary direction.
2. Determining the distance measure of LOF outlier detection.
A distance measure is needed in LOF outlier detection, and a one-dimensional sequence is processed in the invention. Therefore, it is necessary to explain a distance measurement manner of the one-dimensional data processed in the scene, in which the distance of the one-dimensional sequence is measured by a numerical value of the gray value. In the outlier detection, the first outlier detection is carried out through the gray value according to the sequence of the numerical values in the sequence as the basis for judging the sequence
Figure DEST_PATH_IMAGE034
And measuring the distance.
In the case of LOF outlier detection,
Figure 188654DEST_PATH_IMAGE034
the values represent a measure of the distance of the neighborhood in outlier detection. When in use
Figure 415236DEST_PATH_IMAGE034
If the values are selected differently, the effect of detecting outliers will be different. To ensure the invention can be properly passed
Figure 453599DEST_PATH_IMAGE034
Values to perform outlier detection. Here by setting the initial
Figure 525460DEST_PATH_IMAGE034
After the abnormal degree of the pixel point is obtained, the value is obtained and the abnormal degree of the pixel point is used for obtaining the value
Figure 965669DEST_PATH_IMAGE034
Judging whether the value is good or bad, and comparing the judged result
Figure 610757DEST_PATH_IMAGE034
The values are iteratively changed until a suitable one is found
Figure 136416DEST_PATH_IMAGE034
The value is obtained.
In the invention, the initial stage is
Figure 11968DEST_PATH_IMAGE034
The value is expressed as
Figure DEST_PATH_IMAGE035
And step three, performing LOF outlier detection on the average gray value sequences corresponding to the primary direction and the secondary direction respectively, and determining the abnormal degree of the primary direction and the secondary direction so as to determine an image abnormal area.
If the primary direction of the degree of defect anomaly is the column direction, then for a sequence of column-averaged gray values, each value in the sequence represents a mean value of the gray scale of a column, and then for an outlier in the sequence of column-averaged gray values, it represents that the column in the image represented by the outlier is outlier, i.e., anomalous. Then the degree of outlier of an outlier in the sequence of column mean gray values can be calculated by an outlier detection algorithm to characterize the degree of outlier of a column in the image.
a. The degree of abnormality of the principal direction is determined.
By passing
Figure 103421DEST_PATH_IMAGE035
Calculating the local outlier factor of each element in the average gray value sequence corresponding to the main direction, and recording the local outlier factors into a sequence in a one-to-one correspondence mode:
Figure 438849DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 186225DEST_PATH_IMAGE010
indicating the office to which the main direction correspondsThe sequence of the partial outlier factor is,
Figure 865469DEST_PATH_IMAGE011
representing the ith local outlier in the sequence of local outlier factors corresponding to the dominant direction,
Figure 749111DEST_PATH_IMAGE012
representing the total number of local outlier factors in the sequence of local outlier factors corresponding to the dominant direction.
For each local outlier in the sequence of local outlier factors corresponding to the dominant direction:
if the LOF outlier factor is close to the value
Figure 753976DEST_PATH_IMAGE013
The neighborhood point density of the point is similar, and the point and the neighborhood are probably in the same cluster.
If the LOF outlier factor has a value less than
Figure 988648DEST_PATH_IMAGE013
It is indicated that the density of this point is higher than the density of the neighboring points, and this point is a dense point.
If the LOF outlier factor value is greater than
Figure 707468DEST_PATH_IMAGE013
It is stated that this point is less dense than its neighbors, which may be outliers.
The abnormal degree of each column in the image is obtained through the local outlier factor:
by the nature of the local outlier factor, the numerical value of the local outlier factor is larger than
Figure 507934DEST_PATH_IMAGE013
In time, it is necessary to give the numerical value an abnormal degree, which is increasing as the numerical value increases. Will be provided with
Figure 683700DEST_PATH_IMAGE010
Median value greater than
Figure 671248DEST_PATH_IMAGE013
The values of (a) are extracted and normalized as the degree of anomaly in the main direction:
Figure 459337DEST_PATH_IMAGE014
wherein, the first and the second end of the pipe are connected with each other,
Figure 583151DEST_PATH_IMAGE015
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the main direction and is normalized is represented,
Figure 664240DEST_PATH_IMAGE016
represents the jth local outlier factor greater than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure 139083DEST_PATH_IMAGE017
represents the minimum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction,
Figure 465285DEST_PATH_IMAGE018
the maximum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction is represented.
b. The degree of abnormality in the secondary direction is determined.
In the above-described primary direction determination, the primary direction and the secondary direction are determined by preliminary sequence information. This step is to obtain a secondary weight of the degree of abnormality by the secondary direction. Since the main defects in the image are more likely to be present in the main direction. If the defect is one that is biased to be vertical. Then the more important role of the degree of abnormality in the secondary direction is to determine the specific defective region rather than to make the determination of the degree of abnormality.
Outlier detection for secondary directions because of basic information by lines and columns in the direction determination processThe score of the basic information is obtained, the degree of the score indicates the amount of the information contained, the information contained in the secondary direction is less, and the outlier of the secondary direction can be better detected, so the initial point is
Figure 709184DEST_PATH_IMAGE034
The value should be set smaller than the primary direction, and the secondary direction is detected from the initial outlier
Figure 695595DEST_PATH_IMAGE034
Value set to
Figure DEST_PATH_IMAGE036
Satisfy the following requirements
Figure DEST_PATH_IMAGE037
Since the numerical value is set so that outliers can be detected, this embodiment is preferable
Figure DEST_PATH_IMAGE038
By passing
Figure 346150DEST_PATH_IMAGE036
Calculating the local outlier factor of each element in the average gray value sequence corresponding to the secondary direction, and recording the LOF local outlier factor of each element as:
Figure 974577DEST_PATH_IMAGE019
wherein the content of the first and second substances,
Figure 72983DEST_PATH_IMAGE020
representing the sequence of local outlier factors corresponding to the secondary direction,
Figure 997339DEST_PATH_IMAGE021
represents the p-th local outlier factor in the sequence of local outlier factors corresponding to the secondary direction,
Figure 181196DEST_PATH_IMAGE022
representing the total number of local outlier factors in the sequence of local outlier factors corresponding to the secondary direction.
Likewise, will
Figure 347735DEST_PATH_IMAGE020
Median value greater than
Figure 300648DEST_PATH_IMAGE013
The value of (a) is extracted and normalized as the degree of abnormality in the secondary direction:
Figure 395905DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 535899DEST_PATH_IMAGE024
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the secondary direction and is normalized is represented,
Figure 771708DEST_PATH_IMAGE025
represents the qth local outlier factor larger than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure 313548DEST_PATH_IMAGE026
represents the minimum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the secondary direction,
Figure 78242DEST_PATH_IMAGE027
the maximum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction is represented.
c. And determining the comprehensive abnormal degree according to the abnormal degrees of the primary direction and the secondary direction, thereby determining the abnormal region.
After the degree of abnormality of the primary direction and the secondary direction is obtained, an abnormal region in the image can be determined.
For degree of abnormality
Figure 236691DEST_PATH_IMAGE028
The abnormal degree of each pixel point in the rows or the columns is marked as the abnormal degree which is not equal to 0
Figure 234779DEST_PATH_IMAGE015
Then, the secondary abnormal degree corresponding to the row or line where each pixel point in the rows or columns is located is used as the secondary weight of the pixel point.
Then determining the comprehensive abnormal degree of each pixel point in the cloth gray level image:
Figure 896704DEST_PATH_IMAGE029
wherein the content of the first and second substances,
Figure 832299DEST_PATH_IMAGE030
representing pixels
Figure 212465DEST_PATH_IMAGE031
The degree of comprehensive abnormality of (a),
Figure 524498DEST_PATH_IMAGE032
the degree of abnormality of the pixel points is represented,
Figure 807974DEST_PATH_IMAGE033
representing the secondary weight of the pixel.
When the outliers in the average gray-level sequence corresponding to the primary direction indicate that the rows or columns corresponding to the primary direction are abnormal, some of the pixels in the rows or columns corresponding to the primary direction may not be abnormal in the secondary direction by the time of the secondary weight determination, and at this time, the outliers in the average gray-level sequence corresponding to the primary direction indicate that the rows or columns corresponding to the primary direction are abnormal
Figure DEST_PATH_IMAGE039
And for normalized degree of abnormality, the value is in the interval
Figure DEST_PATH_IMAGE040
In (1). So as to pass through
Figure DEST_PATH_IMAGE041
To calculate its effect on the main direction.
The abnormal degree of the pixel points in the abnormal row or column in the row or column corresponding to the main direction in the cloth gray image is obtained through the method, and then the abnormal area in the image is obtained through the abnormal degree of the pixel points in the neighborhood information of the pixel points.
And for the judgment of the abnormal region in the image, determining the abnormal region to which each pixel point with the abnormal degree belongs by a connected domain calculation method taking the abnormal degree as a standard.
By passing
Figure DEST_PATH_IMAGE042
Determines the order of determination of the abnormal region.
Example (c): if there is an abnormal column in the abnormal detection
Figure DEST_PATH_IMAGE043
The order of the secondary weights of the rows of the pixel points is
Figure DEST_PATH_IMAGE044
Then, the sequence of the abnormal regions is judged as the pixel point
Figure DEST_PATH_IMAGE045
And (3) connected domain calculation: making image mask marking all pixel point with non-zero synthetic abnormal degree value as pixel value
Figure DEST_PATH_IMAGE046
Marking the pixel value of the pixel point with the comprehensive abnormal degree value of zero as
Figure DEST_PATH_IMAGE047
. To this mask imageAnd processing the connected domains, and marking all the obtained connected domains as abnormal regions in the image.
All connected domains obtained as initial
Figure 884776DEST_PATH_IMAGE034
Value that is
Figure 752238DEST_PATH_IMAGE035
The obtained image is abnormal.
And step four, determining the optimal distance measurement mode for LOF outlier detection through the determined image abnormal area.
At the beginning of acquisition
Figure 602382DEST_PATH_IMAGE034
In the abnormal regions determined by the values, all the abnormal regions are recorded as:
Figure DEST_PATH_IMAGE048
and calculating the number of pixel points in all abnormal regions and the average value of the abnormal degree of the pixel points, and taking the average value of the abnormal degree as the abnormal degree of the abnormal region. For the
Figure 35638DEST_PATH_IMAGE034
Adjustment of the value, known if
Figure 80079DEST_PATH_IMAGE034
If the value is too large for the abnormality detection sequence, there are fewer abnormal points and the number of abnormal regions is reduced, and it is difficult to identify the abnormal regions
Figure 169258DEST_PATH_IMAGE034
If the value is too small for the sequence of abnormality detection, the number of abnormal points is too large, and the number of abnormal regions is increased. For the cloth image with texture, the normal texture change is not judged as an abnormal value, if the abnormal value occurs, the original texture is damaged, and the gray value becomes abnormal large or abnormal large for the gray value of the line and column of the imageIf the anomaly is small, the row or column is determined to be an abnormal value.
Based on the above principle, the following evaluation expectations are made for the merits of the abnormal area:
if the number of abnormal regions changes, the abnormal regions are considered to be
Figure 823093DEST_PATH_IMAGE034
The value needs to be changed and can be increased
Figure 314118DEST_PATH_IMAGE034
The value is obtained. When the number of abnormal regions is not changed
Figure 762416DEST_PATH_IMAGE034
The value is stable, and this can be achieved
Figure 105935DEST_PATH_IMAGE034
Value as optimum
Figure 297882DEST_PATH_IMAGE034
The value is obtained.
After the adjustment method is determined, adjustment is performed by referring to the abnormal area information detected for the first time.
The number of abnormal regions in the image is recorded as
Figure DEST_PATH_IMAGE049
Namely the number of the connected domains of the abnormal pixel points in the image.
In view of the fact that
Figure 705730DEST_PATH_IMAGE034
When the value is small, more abnormal points can be detected, and setting the initial value to be smaller can make the value smaller
Figure 590509DEST_PATH_IMAGE034
The determination of the value iteration process is more accurate, so this embodiment will be the initial one
Figure 155745DEST_PATH_IMAGE034
The value is set to 3.
Will be provided with
Figure 151383DEST_PATH_IMAGE034
The step size of the adjustment of the value is set to 1, i.e. if an adjustment is required, either an increase or a decrease, will be made each time
Figure 351420DEST_PATH_IMAGE034
The value is incremented by one.
The process is iterated until
Figure 141522DEST_PATH_IMAGE034
When the number of abnormal regions detected after the change of the value is not changed or the change of the number of abnormal regions is smaller than the threshold value of the change of the number
Figure 958168DEST_PATH_IMAGE034
Value as optimum
Figure 993382DEST_PATH_IMAGE034
Value, optimum
Figure 313505DEST_PATH_IMAGE034
The value is also the best distance measure for LOF outlier detection.
And step five, determining the optimal abnormal area in the gray level image of the cloth according to the optimal distance measurement mode of the LOF outlier detection, and finishing the cloth defect detection.
By obtaining optimality
Figure 540087DEST_PATH_IMAGE034
And determining abnormal areas in the cloth gray level image. And carrying out special defect detection on the obtained abnormal area pixel points, and determining the types of the defects according to the distribution characteristics and the pixel values of the pixel points. And matching the common defects in the cloth according to the characteristics of the defects to obtain the defect types of the abnormal areas so as to realize defect detection. In the defect detection process, the abnormal region is extracted, so that the influence of other pixel points in the cloth image is avoided, and the defect type of the region can be determined independently.
So far, the gray level image can be optimized in the cloth gray level image
Figure 312871DEST_PATH_IMAGE034
And obtaining the position and the defect type of the defect in the cloth according to the determined defect area, and finishing the cloth defect detection.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; the modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application, and are included in the protection scope of the present application.

Claims (2)

1. A cloth defect detection method based on outlier detection is characterized by comprising the following steps:
acquiring a cloth gray image;
calculating the row average gray value of each row and the column average gray value of each column on the cloth gray image to obtain a row average gray value sequence and a column average gray value sequence, and determining the primary direction and the secondary direction of the defect abnormal degree and the distance measuring mode of the LOF from the cluster point detection according to the row average gray value sequence and the column average gray value sequence;
respectively carrying out LOF outlier detection on the average gray value sequences corresponding to the primary direction and the secondary direction, and determining the abnormal degrees of the primary direction and the secondary direction so as to determine an image abnormal region;
determining the optimal distance measurement mode of LOF outlier detection according to the determined image abnormal area;
determining an optimal abnormal area in the gray level image of the cloth according to an optimal distance measurement mode of LOF outlier detection, and completing cloth defect detection;
the method for determining the primary direction and the secondary direction of the defect abnormal degree comprises the following steps:
Figure DEST_PATH_IMAGE001
Figure 497934DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
and
Figure 589386DEST_PATH_IMAGE004
respectively representing a row score and a column score for determining a main direction of a defect abnormality degree,
Figure DEST_PATH_IMAGE005
and
Figure 721553DEST_PATH_IMAGE006
respectively representing maxima in the row-averaged gray value sequence and the column-averaged gray value sequence,
Figure DEST_PATH_IMAGE007
and
Figure 265667DEST_PATH_IMAGE008
respectively representing the variances of the row average gray value sequence and the column average gray value sequence;
taking the direction corresponding to the larger value of the row fraction and the column fraction as the main direction of the defect abnormal degree, and taking the other direction as the secondary direction;
the method for determining the abnormal degree of the main direction and the secondary direction comprises the following steps:
performing LOF outlier detection on the average gray value sequence corresponding to the main direction to obtain a local outlier factor sequence:
Figure DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 538385DEST_PATH_IMAGE010
indicating the sequence of local outlier factors corresponding to the dominant direction,
Figure DEST_PATH_IMAGE011
representing the ith local outlier in the sequence of local outlier factors corresponding to the dominant direction,
Figure 985809DEST_PATH_IMAGE012
representing the total number of local outlier factors in the local outlier factor sequence corresponding to the main direction;
will be provided with
Figure 193936DEST_PATH_IMAGE010
Median value greater than
Figure DEST_PATH_IMAGE013
The values of (a) are extracted and normalized as the degree of anomaly in the main direction:
Figure 22084DEST_PATH_IMAGE014
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE015
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the main direction and is normalized is represented,
Figure 272062DEST_PATH_IMAGE016
represents the jth local outlier factor greater than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure DEST_PATH_IMAGE017
represents the minimum value of local outlier factors larger than 1 in the sequence of local outlier factors corresponding to the main direction,
Figure 134845DEST_PATH_IMAGE018
representing the maximum value of local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction;
carrying out LOF outlier detection on the average gray value sequence corresponding to the secondary direction to obtain a local outlier factor sequence:
Figure DEST_PATH_IMAGE019
wherein the content of the first and second substances,
Figure 812076DEST_PATH_IMAGE020
representing the sequence of local outlier factors corresponding to the secondary direction,
Figure DEST_PATH_IMAGE021
represents the p-th local outlier factor in the sequence of local outlier factors corresponding to the secondary direction,
Figure 861940DEST_PATH_IMAGE022
representing the total number of local outlier factors in the local outlier factor sequence corresponding to the secondary direction;
will be provided with
Figure 414145DEST_PATH_IMAGE020
Median value greater than
Figure 508265DEST_PATH_IMAGE013
The value of (a) is extracted and normalized as the degree of abnormality in the secondary direction:
Figure DEST_PATH_IMAGE023
wherein the content of the first and second substances,
Figure 917249DEST_PATH_IMAGE024
the local outlier factor which is greater than 1 in the local outlier factor sequence corresponding to the secondary direction and is normalized is represented,
Figure DEST_PATH_IMAGE025
represents the qth local outlier factor larger than 1 in the sequence of local outlier factors corresponding to the dominant direction,
Figure 209735DEST_PATH_IMAGE026
represents the minimum value of the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the secondary direction,
Figure DEST_PATH_IMAGE027
representing the maximum value in the local outlier factors larger than 1 in the local outlier factor sequence corresponding to the main direction;
the method for determining the abnormal region of the image comprises the following steps:
for degree of abnormality
Figure 831209DEST_PATH_IMAGE028
The abnormal degree of each pixel point in the rows or the columns is marked as the abnormal degree which is not equal to 0
Figure 75109DEST_PATH_IMAGE015
Then, the secondary abnormal degree corresponding to the row or the line where each pixel point in the rows or the columns is located is used as the secondary weight of the pixel point;
then determining the comprehensive abnormal degree of each pixel point in the cloth gray level image:
Figure DEST_PATH_IMAGE029
wherein the content of the first and second substances,
Figure 422039DEST_PATH_IMAGE030
representing pixel points
Figure DEST_PATH_IMAGE031
The degree of comprehensive abnormality of (a),
Figure 446496DEST_PATH_IMAGE032
the degree of abnormality of the pixel points is represented,
Figure DEST_PATH_IMAGE033
representing the secondary weight of the pixel point;
making a mask image of the cloth gray image, marking the pixel values of all the pixels with nonzero comprehensive abnormal degree value as 255, marking the pixel values of the pixels with zero comprehensive abnormal degree value as 0, performing connected domain processing on the mask image, and marking all the obtained connected domains as image abnormal regions.
2. The cloth defect detection method based on outlier detection as claimed in claim 1, wherein said method for determining the best distance measure for LOF outlier detection is:
setting an initial value of a K value and an adjustment step length of the K value in LOF outlier detection, increasing the K value according to the adjustment step length, then calculating a new image abnormal area by using the new K value, and when the number change value of the new image abnormal area is smaller than the number change threshold compared with the number change threshold of the previous image abnormal area, taking the new K value after the adjustment at the moment as an optimal distance measurement mode of the LOF outlier detection.
CN202211373105.2A 2022-11-04 2022-11-04 Cloth defect detection method based on outlier detection Active CN115423807B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211373105.2A CN115423807B (en) 2022-11-04 2022-11-04 Cloth defect detection method based on outlier detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211373105.2A CN115423807B (en) 2022-11-04 2022-11-04 Cloth defect detection method based on outlier detection

Publications (2)

Publication Number Publication Date
CN115423807A CN115423807A (en) 2022-12-02
CN115423807B true CN115423807B (en) 2023-03-24

Family

ID=84207429

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211373105.2A Active CN115423807B (en) 2022-11-04 2022-11-04 Cloth defect detection method based on outlier detection

Country Status (1)

Country Link
CN (1) CN115423807B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117314894B (en) * 2023-11-27 2024-03-29 深圳市金三维实业有限公司 Method for rapidly detecting defects of watch bottom cover

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926436A (en) * 2022-05-20 2022-08-19 南通沐沐兴晨纺织品有限公司 Defect detection method for periodic pattern fabric
CN115100200A (en) * 2022-08-24 2022-09-23 南通光烁通信设备有限公司 Optical fiber defect detection method and system based on optical means

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8559730B2 (en) * 2010-09-15 2013-10-15 Foveon, Inc. Method for detecting pixel outliers
CN110865260A (en) * 2019-11-29 2020-03-06 南京信息工程大学 Method for monitoring and evaluating MOV actual state based on outlier detection
SE1930421A1 (en) * 2019-12-30 2021-07-01 Unibap Ab Method and means for detection of imperfections in products
CN112184725B (en) * 2020-09-21 2024-02-02 东南大学 Method for extracting center of structured light bar of asphalt pavement image
CN113963042B (en) * 2021-12-21 2022-03-15 派立锐汽车零部件(武汉)有限公司 Metal part defect degree evaluation method based on image processing

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926436A (en) * 2022-05-20 2022-08-19 南通沐沐兴晨纺织品有限公司 Defect detection method for periodic pattern fabric
CN115100200A (en) * 2022-08-24 2022-09-23 南通光烁通信设备有限公司 Optical fiber defect detection method and system based on optical means

Also Published As

Publication number Publication date
CN115423807A (en) 2022-12-02

Similar Documents

Publication Publication Date Title
CN114937055B (en) Image self-adaptive segmentation method and system based on artificial intelligence
CN115018828B (en) Defect detection method for electronic component
CN115294113B (en) Quality detection method for wood veneer
CN115439481B (en) Deaerator welding quality detection method based on image processing
CN115829883A (en) Surface image denoising method for dissimilar metal structural member
CN106920219A (en) Article defect detection method, image processing system and computer readable recording medium
CN115311303B (en) Textile warp and weft defect detection method
CN116091504B (en) Connecting pipe connector quality detection method based on image processing
CN115423807B (en) Cloth defect detection method based on outlier detection
CN108520514A (en) Printed circuit board electronics member device consistency detecting method based on computer vision
CN111563896B (en) Image processing method for detecting abnormality of overhead line system
CN116703251B (en) Rubber ring production quality detection method based on artificial intelligence
CN112508950B (en) Anomaly detection method and device
CN116228780B (en) Silicon wafer defect detection method and system based on computer vision
US7352901B2 (en) Contour inspection method and apparatus
CN115049671A (en) Cloth surface defect detection method and system based on computer vision
CN116883412B (en) Graphene far infrared electric heating equipment fault detection method
CN115797473B (en) Concrete forming evaluation method for civil engineering
CN117808796B (en) Gear surface damage detection method based on computer vision
CN115311286A (en) Dyeing defect identification method for dyed textiles
CN116152224B (en) Dead pixel detection method for computer display
CN112561875A (en) Photovoltaic cell panel coarse grid detection method based on artificial intelligence
CN111126371B (en) Coarse pointer dial reading method based on image processing
CN115855961B (en) Distribution box fault detection method used in operation
CN116168024A (en) Corrugated paper production quality real-time detection method based on computer vision

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
TR01 Transfer of patent right

Effective date of registration: 20230724

Address after: 277600 South Building in Xinyuan Industrial Park, Liuzhuang Town, Weishan County, Jining City, Shandong Province

Patentee after: Shandong Pengmin Clothing Co.,Ltd.

Address before: 277600 Xinyuan Industrial Park, west of 104 Provincial Road, Liuzhuang Town, Weishan County, Jining City, Shandong Province

Patentee before: Shandong Yimin Clothing Co.,Ltd.

TR01 Transfer of patent right