A clothing buttonhole defect detection method based on Hough transform

Automatically detecting defects in clothing keyhole buttons through Hough transform technology solves the problem of manual detection dependence, improves detection efficiency and accuracy, and ensures the quality of finished garments.

CN115035023BActive Publication Date: 2024-08-30HUNAN CHUNFENG CLOTHING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210453898.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-08-30
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

Existing garment factories mainly rely on manual labor to detect clothing buttonhole buttons. As a result, detection accuracy and efficiency are related to workers' experience, and the discrimination standards are inconsistent, which affects the efficiency and accuracy of detection.

Method used

Using a method based on Hough transform, image processing technology is used to collect clothing images, detect the number and position of buttonholes and buttons, use the Hough gradient method to calculate the radius and area of ​​buttons, and calculate the matching degree of buttonholes and buttons combined with Hough line detection. Determine the degree of defects in clothing locks and screen out defective products based on the degree of defects.

Benefits of technology

It improves detection efficiency, reduces manual errors, ensures the quality of finished clothes, and realizes automated and accurate detection of lock defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115035023B
    Figure CN115035023B
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and in particular to a method for detecting clothing buttonhole and button defects based on Hough transform. The method collects clothing images, performs initial defect matching on clothing buttons according to the number of buttonholes and buttons in the clothing images; obtains the size qualification of the buttons and the matching degree between the buttonholes and buttons; obtains the defect degree of each clothing button in combination with the size qualification and the matching degree, and screens the clothing according to the defect degree. Image processing can improve detection efficiency, avoid detection errors, and ensure the quality of finished clothing products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a clothing buttonhole defect detection method based on Hough transform. Background Art

[0002] During the production process of clothing, the buttonholes and buttons of the clothing need to be inspected before the clothing leaves the factory. The buttonholes should be inspected to see whether the buttonhole position is correct and whether the size of the buttonhole matches the size of the button.

[0003] Generally, clothing factories perform manual inspections on buttonholes and buttons on clothing. The accuracy of the inspections is often related to the experience and efficiency of the inspectors, and the judgment criteria are also different. This increases the efficiency and accuracy of clothing inspections to a certain extent. Summary of the Invention

[0004] In order to solve the above technical problems, the purpose of the present invention is to provide a method for detecting buttonhole defects in clothing based on Hough transform. The technical solution adopted is as follows:

[0005] Acquire a clothing image, wherein the clothing image includes buttonholes and buttons, and perform initial defect matching on clothing buttons according to the number of buttonholes and buttons in the clothing image;

[0006] When the initial defect matching result is no defect, the clothing image is converted into a grayscale image, the Hough gradient method is used on the grayscale image to detect the radius of the circle corresponding to the button, and the button area is obtained based on the radius to confirm the size conformity of the button; the straight line corresponding to the buttonhole is obtained based on the Hough line detection, and the matching degree of the clothing lock is calculated based on the first length of the straight line and the second length of the button;

[0007] The defect degree of each clothing buckle is obtained by combining the size conformity and the matching degree, and the clothing is screened according to the defect degree.

[0008] Furthermore, the method of using the Hough gradient method on the grayscale image to detect the radius of the circle corresponding to the button includes:

[0009] Perform edge detection on the buttons in the grayscale image to obtain a binary image of edge detection; calculate the neighborhood gradient values ​​of all pixels in the grayscale image to obtain the gradient direction of each pixel, traverse all non-zero pixels in the binary image, draw a straight line along its gradient direction, count the number N of straight lines for each pixel in all accumulators that the straight line passes through, set a number threshold, and use the pixel position corresponding to the number greater than the number threshold as the suspected center position of the circle;

[0010] Assign a weight to each suspected circle center position according to the number of lines corresponding to each suspected circle center position, and determine the center position of the button by combining each suspected circle center position and its corresponding weight;

[0011] The distance from the center of the circle to each non-zero pixel in the binary image is calculated respectively to obtain probabilities corresponding to different distances, and the radius is determined based on the probabilities.

[0012] Furthermore, the method for screening clothes according to the degree of defects includes:

[0013] A defect threshold is set. When the defect degree of any of the clothing buttons is greater than or equal to the defect threshold, the clothing button is confirmed to be defective and the clothing is screened out; when the defect degree of all the clothing buttons is less than the defect threshold, further defect judgment is required based on the distance between the corresponding buttonhole and button of the clothing button.

[0014] Furthermore, the method for further defect determination based on the distance between the buttonhole and the button of the clothing buckle includes:

[0015] The distance between the buttonhole and the button corresponding to each of the clothing buttons is calculated based on the straight line corresponding to the buttonhole and the center position of the button, and the distance difference between every two of the clothing buttons is calculated based on the distance; a difference threshold is set, and when the distance difference is less than the difference threshold, it is determined that the clothing has no defects; conversely, when any of the distance differences is greater than or equal to the difference threshold, it is determined that the clothing has defects, and the clothing is screened out.

[0016] Furthermore, the method for obtaining the size qualification of the button includes:

[0017] The ratio between the button area and the standard button area is calculated, and the size qualification of the button is obtained from the ratio, and there is a negative correlation between the ratio and the size qualification.

[0018] Furthermore, the method for calculating the matching degree of clothing buttons according to the length of the straight line and the length of the button includes:

[0019] The diameter of the button is used as the second length of the button, and the total number of corresponding pixel points on the straight line is used as the first length of the straight line; the difference between the first length and the second length is calculated, and the matching degree of the corresponding clothing button is obtained from the difference.

[0020] Furthermore, the method for obtaining the straight line corresponding to the buttonhole based on Hough line detection includes:

[0021] Set a maximum cumulative number threshold and a minimum cumulative number threshold for the number of accumulated pixels corresponding to each highlight point in the Hough space, retain the highlight points whose accumulated number of pixels is greater than the minimum cumulative number threshold and less than the maximum cumulative number threshold, and obtain the target straight line in the grayscale image based on the highlight points;

[0022] Horizontal target straight lines are filtered out from the target straight lines to obtain suspected buttonhole straight lines; the center point of each suspected buttonhole straight line is obtained, and the degree of deviation of the current suspected buttonhole straight line relative to other suspected buttonhole straight lines is calculated based on the horizontal coordinate of the center point, and the straight line corresponding to each buttonhole is confirmed by the degree of deviation.

[0023] The embodiments of the present invention have at least the following beneficial effects: by detecting the matching of the number of buttonholes and buttons on the clothes, the matching degree of the buttonholes and buttons, and the distance between each pair of buttons and buttonholes on the clothes, it is determined whether the clothes have defects so as to screen out defective clothes; the detection efficiency can be improved through image processing, detection errors can be avoided, and the quality of the finished clothes can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0025] Figure 1 A flowchart of the steps of a method for detecting buttonhole and button defects in clothing based on Hough transform is provided in one embodiment of the present invention. DETAILED DESCRIPTION

[0026] To further illustrate the technical means and effectiveness of the present invention in achieving its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation, structure, features, and effectiveness of a clothing buttonhole defect detection method based on a Hough transform proposed by the present invention. In the following description, different references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.

[0027] 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.

[0028] The following describes in detail a method for detecting buttonhole and button defects in clothing based on Hough transform provided by the present invention with reference to the accompanying drawings.

[0029] See also Figure 1 , which shows a flowchart of a method for detecting buttonhole and buttonhole defects in clothing based on Hough transform according to an embodiment of the present invention, the method comprises the following steps:

[0030] Step S001: Acquire a clothing image, which includes buttonholes and buttons, and perform initial defect matching on the clothing buttons according to the number of buttonholes and buttons in the clothing image.

[0031] Specifically, the produced clothes are placed neatly with the front side facing up and the buttons unbuttoned. The clothes image is captured using a camera, and the clothes image includes the buttonholes and buttons on the clothes. The number of buttonholes and buttons in the clothes image is counted, and initial defect matching is performed by comparing their numbers: when the number of buttonholes is equal to the number of buttons, the clothes are initially considered to have no defects. Otherwise, the clothes are considered to have defects and are screened out.

[0032] Step S002: When the initial defect matching result is no defect, the clothing image is converted into a grayscale image, and the Hough gradient method is used on the grayscale image to detect the radius of the circle corresponding to the button. The button area is obtained based on the radius to confirm the size qualification of the button; the straight line corresponding to the buttonhole is obtained based on the Hough line detection, and the matching degree of the clothing lock is calculated according to the first length of the straight line and the second length of the button.

[0033] Specifically, when the initial defect matching result is no defect, the clothing image is converted into a grayscale image, and edge detection is performed on the buttons in the grayscale image to obtain a binary image of edge detection, that is, the pixel value of the corresponding pixel on the edge is 1, and the other pixels are 0; a Sobel operator is performed on the grayscale image, and the neighborhood gradient values ​​of all pixels are calculated to obtain the gradient direction of each pixel. All non-zero pixels in the binary image are traversed, and a straight line is drawn along its gradient direction. The number N of straight lines for each pixel in all accumulators through which the straight line passes is counted, and a number threshold is set. The pixel position corresponding to the value greater than the number threshold is used as the suspected center position of the circle.

[0034] According to the number of lines corresponding to each suspected circle center position, a weight is assigned to the corresponding suspected circle center position. That is, the sum of the number of lines corresponding to all suspected circle center positions is counted, and the ratio between the number of lines corresponding to each suspected circle center position and the sum is calculated: The ratio is used as the weight corresponding to the suspected circle center position.

[0035] The center position of the button is determined according to each suspected center position and its corresponding weight, that is, the horizontal coordinate of each suspected center position is weighted summed to obtain the horizontal coordinate of the center position, and similarly, the vertical coordinate is weighted summed to obtain the vertical coordinate of the center position.

[0036] Furthermore, considering that the circle obtained in the process of image acquisition may not be a perfect circle and the button pattern may also appear circular, the distance from the center position of the circle to each non-zero pixel point in the binary image is calculated separately, and then the probability of different distances is calculated based on all the calculated distances, and the radius is obtained by the probability. The method is: setting a probability threshold, eliminating distances less than or equal to the probability threshold, and retaining distances greater than the probability threshold; then setting a first distance threshold and a second distance threshold to re-screen the retained distances, that is, only retaining distances greater than the first threshold and less than the second threshold, and then selecting the maximum distance among the distances retained by the secondary screening as the radius r corresponding to the center position of the circle.

[0037] Calculate the button area based on the radius S = 2πr 2 , calculate the ratio between the button area and the standard button area, and get the size qualification of the button from the ratio, that is, Among them, V is the size qualification, g is the standard button area, and there is a negative correlation between the ratio and the size qualification.

[0038] Furthermore, the Hough line detection method is used to detect the straight line corresponding to the buttonhole seam in the grayscale image. The specific process is:

[0039] (1) A cumulative number threshold is set for the number of accumulated pixels corresponding to each highlight point in the Hough space. In order to exclude longer and shorter straight lines, a maximum cumulative number threshold and a minimum cumulative number threshold are set. The highlight points whose accumulated number of pixels is greater than the minimum cumulative number threshold and less than the maximum cumulative number threshold are retained. The target straight line in the grayscale image is obtained based on the highlight points, and the length of each target straight line is the total number of corresponding pixels.

[0040] (2) Since the buttonhole seams of clothes are vertical, the horizontal target straight lines are filtered out from the target straight lines to obtain the suspected buttonhole straight lines.

[0041] (3) Considering the interference of other vertical target lines, and considering that the lines corresponding to all buttonholes on the clothes should be in a row, the center point of each suspected buttonhole line is obtained, and the deviation degree of the current suspected buttonhole line relative to other suspected buttonhole lines is calculated based on the horizontal coordinate of the center point. The calculation formula of the deviation degree is:

[0042]

[0043] Where D is the degree of deviation; x i is the horizontal coordinate of the current suspected buttonhole line; n is the horizontal coordinate of the other suspected buttonhole straight line n; n is the number of other suspected buttonhole straight lines.

[0044] A deviation threshold is set, and the suspected buttonhole straight lines with a deviation less than the deviation threshold are retained to obtain the straight line corresponding to each buttonhole.

[0045] Only when the length of the buttonhole is similar to the diameter of the button can the button fit into the buttonhole and the buttons of the clothes match. Therefore, the diameter of the button is used as the second length of the button, and the total number of corresponding pixels on the straight line is used as the first length of the line. The difference between the first and second lengths is calculated, and the matching degree of the corresponding buttons of the clothes is obtained from the difference. The matching degree calculation formula is:

[0046]

[0047] Wherein, T is the matching degree; l is the first length; and 2r is the second length.

[0048] Step S003: combining the size conformity and the matching degree to obtain the defect degree of the clothing buckle, and screening the clothing according to the defect degree.

[0049] Specifically, step S002 can obtain the size qualification V of the button in each clothing lock and the matching degree T between the corresponding buttonhole and the button. The defect degree of the corresponding clothing lock is calculated by combining the size qualification and the matching degree. The defect degree is negatively correlated with the size qualification and the matching degree, respectively. The calculation formula of the defect degree is:

[0050] Furthermore, clothes are screened according to the degree of defects: a defect threshold is set. When the defect degree of any clothing button is greater than or equal to the defect threshold, the clothing button is confirmed to be defective and the clothing is screened out; when the defect degree of all clothing buttons is less than the defect threshold, further defect judgment is required based on the distance between the corresponding buttonhole and button of the clothing button.

[0051] The method for further defect judgment is as follows: calculate the distance between the buttonhole and button of each clothing button respectively, and calculate the distance difference between each two clothing buttons based on the distance; set a difference threshold, when the distance difference is less than the difference threshold, it is confirmed that the clothing has no defects; conversely, when any distance difference is greater than or equal to the difference threshold, it is confirmed that the clothing has defects and the clothing is screened out.

[0052] In summary, an embodiment of the present invention provides a method for detecting buttonhole and button defects in clothing based on Hough transform. The method collects a clothing image, which includes buttonholes and buttons, and performs initial defect matching on the clothing buttons based on the number of buttonholes and buttons in the clothing image. When the initial defect matching result is no defect, the clothing image is converted into a grayscale image, and the Hough gradient method is used on the grayscale image to detect the radius of the circle corresponding to the button. The button area is obtained based on the radius to confirm the size qualification of the button. The straight line corresponding to the buttonhole is obtained based on the Hough line detection, and the matching degree of the clothing button is calculated based on the first length of the straight line and the second length of the button. The defect degree corresponding to each clothing button is obtained by combining the size qualification and the matching degree, and the clothing is screened according to the defect degree. Image processing can improve detection efficiency, avoid detection errors, and ensure the quality of the finished clothing.

[0053] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not represent the superiority or inferiority of the embodiments. The above description is of specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0054] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

[0055] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A clothing buttonhole defect detection method based on Hough transform, characterized in that: The method includes: Collecting a clothing image, wherein the clothing image includes buttonholes and buttons, and performing initial defect matching on clothing buttons according to the number of buttonholes and buttons in the clothing image; When the initial defect matching result is no defect, the clothing image is converted into a grayscale image, the Hough gradient method is used on the grayscale image to detect the radius of the circle corresponding to the button, and the button area is obtained according to the radius to confirm the size qualification of the button; the straight line corresponding to the buttonhole is obtained based on the Hough straight line detection, and the matching degree of the clothing lock is calculated according to the first length of the straight line and the second length of the button; The defect degree of each clothing buckle is obtained by combining the size conformity and the matching degree, and the clothing is screened according to the defect degree.

2. The method according to claim 1, characterized in that The method of using the Hough gradient method to detect the radius of the circle corresponding to the button on the grayscale image includes: Perform edge detection on the buttons in the grayscale image to obtain a binary image of edge detection; calculate the neighborhood gradient values ​​of all pixels in the grayscale image to obtain the gradient direction of each pixel, traverse all non-zero pixels in the binary image, draw a straight line along its gradient direction, count the number N of straight lines for each pixel in all accumulators through which the straight line passes, set a number threshold, and use the pixel position corresponding to the number greater than the number threshold as the suspected center position of the circle; According to the number of straight lines corresponding to each suspected center position, a weight is assigned to the corresponding suspected center position, and the center position of the button is determined by combining each suspected center position and its corresponding weight; The distance from the center of the circle to each non-zero pixel in the binary image is calculated respectively to obtain the probabilities corresponding to different distances, and the radius is determined based on the probabilities.

3. The method according to claim 2, characterized in that The method for screening clothes according to the degree of defects comprises: A defect threshold is set. When the defect degree of any one of the clothing buckles is greater than or equal to the defect threshold, the clothing buckle is confirmed to be defective and the clothing is screened out; when the defect degrees of all the clothing buckles are less than the defect threshold, further defect judgment is required based on the distance between the corresponding buttonhole and button of the clothing buckle.

4. The method according to claim 3, characterized in that The method for further defect determination based on the distance between the buttonhole and the button of the clothing buckle comprises: The distance between the buttonhole and the button corresponding to each of the clothing buttons is calculated respectively from the straight line corresponding to the buttonhole and the center position of the button, and the distance difference between every two clothing buttons is calculated respectively according to the distance; a difference threshold is set, and when the distance difference is less than the difference threshold, it is confirmed that the clothing has no defects; conversely, when any of the distance differences is greater than or equal to the difference threshold, it is confirmed that the clothing has defects, and the clothing is screened out.

5. The method according to claim 1, characterized in that The method for obtaining the size qualification of the button comprises: The ratio between the button area and the standard button area is calculated, and the size qualification of the button is obtained from the ratio, and there is a negative correlation between the ratio and the size qualification.

6. The method according to claim 1, characterized in that The method for calculating the matching degree of clothing buttons according to the length of the straight line and the length of the button comprises: The diameter of the button is taken as the second length of the button, and the total number of corresponding pixel points on the straight line is taken as the first length of the straight line; the difference between the first length and the second length is calculated, and the matching degree of the corresponding clothing button is obtained from the difference.

7. The method according to claim 1, characterized in that The method for obtaining a straight line corresponding to a buttonhole based on Hough straight line detection comprises: A maximum cumulative number threshold and a minimum cumulative number threshold are set for the number of accumulated pixels corresponding to each highlight point in the Hough space, and highlight points whose accumulated number of pixels is greater than the minimum cumulative number threshold and less than the maximum cumulative number threshold are retained, and the target straight line in the grayscale image is obtained according to the highlight points; Horizontal target straight lines are filtered out from the target straight lines to obtain suspected buttonhole straight lines; the center point of each of the suspected buttonhole straight lines is obtained, and the degree of deviation of the current suspected buttonhole straight line relative to other suspected buttonhole straight lines is calculated based on the horizontal coordinate of the center point, and the straight line corresponding to each buttonhole is confirmed by the degree of deviation.

Citation Information

Patent Citations

  • Machine vision based button automatic alignment method

    CN108921882A

  • Textile defect self-adaptive detection method based on spectral analysis

    CN113643294A