A paper tube damage defect detection method based on shape features

Through the detection method based on shape characteristics, including image downsampling, graying processing and contour extraction, the circularity of the paper tube is calculated to judge the damage, which solves the problems of low efficiency and low accuracy of paper tube detection in the prior art, and achieves efficient and accurate paper tube damage detection.

CN114494225BActive Publication Date: 2025-05-23ANHUI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210127706.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2025-05-23
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

The prior art has problems such as low production efficiency, low accuracy and high labor costs in the detection of paper tube damage defects. The automation detection technology is not yet mature and it is difficult to apply on industrial production lines.

Method used

The detection method based on shape characteristics is adopted, and the paper tube image is obtained for downsampling, grayscale processing, Gaussian filtering and pixel transformation, followed by binarization processing and contour extraction, and the circularity of the minimum circumference circle is calculated to determine whether the paper tube is damaged.

Benefits of technology

It realizes high accuracy and high efficiency of paper tube damage defect detection, which can effectively remove background interference, improve the production efficiency and product quality of inspection, and is suitable for applications on industrial production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494225B_ABST
    Figure CN114494225B_ABST
Patent Text Reader

Abstract

The present invention relates to a paper tube damage defect detection method based on shape features, comprising: obtaining a paper tube image, image downsampling; image graying; Gaussian filtering, pixel transformation operation; binarization processing; edge contour drawing, obtaining the area of ​​all contours; retaining the maximum contour area according to an iterative method, the contour corresponding to the maximum contour area is the maximum contour, drawing the minimum circumscribed circle of the maximum contour, obtaining the center and radius of the minimum circumscribed circle; performing image mask segmentation on the minimum circumscribed circle, obtaining the circularity of the final contour; and judging according to the circularity of the final contour. The present invention comprehensively considers various background interferences of paper tubes caused by imaging in industrial production as well as the characteristics and distribution of the background, thereby completely removing the interference of the background without affecting the useful foreground information in the original image, successfully outputting the shape features of the paper tube, and having a high accuracy rate and short time consumption for detecting paper tube damage defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of 2D industrial image processing, and in particular to a paper tube damage defect detection method based on shape features. Background Art

[0002] In daily life, paper tubes can be seen everywhere and are widely used in fabrics, clothing, building interiors and other fields. They are also involved in national defense, aerospace, biomedical materials, energy development and other fields. The quality of paper tubes deeply affects the quality of paper tube-related fields. On industrial production lines, paper tube defect detection is mainly carried out manually, but this detection method is greatly affected by human factors, resulting in low production efficiency and accuracy, and high and increasing labor costs, which has caused bottlenecks in the development of enterprises. Moreover, at present, professors and scholars in various universities in my country are still in the initial stage of research on automated defect detection of paper tube products. Although relevant papers, patents and other achievements have been obtained, these achievements are not mature and can only remain in the research and verification stage of the laboratory.

[0003] At present, there are three main approaches to the research on paper tube damage defects: First, use some traditional feature extraction algorithms of machine learning, then process the image into a data set and train it to obtain feature vectors, and then combine the label with some classification methods of machine learning to calculate its accuracy, and finally perform slider prediction on the entire image to detect whether the image belongs to a damaged paper tube; but there are many types of traditional feature extraction methods and machine learning classification methods of machine learning, how to select and improve them to obtain a high accuracy rate; and how to avoid a series of interferences caused by imaging on industrial production lines during the learning process. Second, use deep learning methods. Third, use some traditional image processing methods. Traditional image processing methods are efficient and stable, but have great limitations.

[0004] Therefore, how to achieve high accuracy, high efficiency and real-time detection of paper tube damage defects and use them in the production lines of some textile manufacturing enterprises in a timely manner has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The purpose of the present invention is to provide a method for effectively and automatically detecting paper tube damage defects, so that the paper tube can not only successfully realize automatic defect detection, but also greatly improve the production efficiency of paper tube defect detection and product quality of the paper tube damage defect detection method based on shape features.

[0006] To achieve the above object, the present invention adopts the following technical solution: a paper tube damage defect detection method based on shape features, the method comprising the following steps in order:

[0007] (1) Obtaining a paper tube image and performing downsampling: reading the paper tube image to be detected, and reducing the length and width of the paper tube image to the same size;

[0008] (2) grayscale processing: converting the reduced paper tube image into a grayscale image;

[0009] (3) Gaussian filtering is performed on the grayscale image, followed by pixel transformation;

[0010] (4) Binarization of the image after pixel transformation operation;

[0011] (5) Draw the contours of the binary image and obtain the areas of all contours;

[0012] (6) retaining the maximum contour area according to the iterative method, the contour corresponding to the maximum contour area is the maximum contour, drawing the minimum circumscribed circle of the maximum contour, and obtaining the center and radius of the minimum circumscribed circle;

[0013] (7) performing image mask segmentation on the minimum circumscribed circle to obtain the circularity of the final contour;

[0014] (8) Judging based on the circularity of the final contour: a circularity is selected as an intermediate threshold within the range of circularities of a normal round tube and a damaged round tube. If the circularity of the final contour is greater than or equal to the intermediate threshold, the paper tube in the paper tube image to be detected is judged to be a normal paper tube. Conversely, if the circularity of the final contour is less than the intermediate threshold, the paper tube in the paper tube image to be detected is judged to be a damaged paper tube.

[0015] In step (3), the pixel transformation operation specifically includes the following steps:

[0016] (2a) Obtain all pixel values ​​of the paper tube image after Gaussian filtering;

[0017] (2b) Define a variable and compare all pixel values ​​on the image with this variable. If the pixel value on the image is less than this variable, the pixel value on the image is changed to 255, that is, white. Conversely, if the pixel value on the image is greater than this variable, the pixel value on the image remains unchanged.

[0018] In step (5), drawing the outline of the image after binarization processing specifically includes the following steps:

[0019] (3a) Find the contour of the binarized image, with the background being black and the object being white;

[0020] (3b) Find the outline of the white object;

[0021] (3c) When finding the contour, draw the white object contour.

[0022] In step (5), obtaining the areas of all contours means: after finding the contours, calculating the areas of all contours in the image.

[0023] In step (6), retaining the maximum contour area according to the iterative method specifically includes the following steps:

[0024] (5a) Iteration: Arrange the contours from small to large in area;

[0025] (5b) Obtain the largest contour area after iteration, define the largest contour area as a threshold, define the contour area smaller than the threshold as a small contour, and define the contour in the image with the contour area equal to the threshold as a large contour, i.e., the contour that needs to be retained in the end;

[0026] (5c) Delete small contours.

[0027] In step (6), drawing the minimum circumscribed circle of the maximum contour specifically includes the following steps:

[0028] (6a) Calculate the center coordinates and radius of each contour;

[0029] (6b) Draw the minimum circumscribed circle on the drawn contour.

[0030] In step (7), the image mask segmentation of the minimum circumscribed circle specifically includes the following steps:

[0031] (7a) Create an image of the same size as the downsampled paper tube image, and initialize all pixels on the image to 0. The image is all black.

[0032] (7b) Draw a circle on this completely black image according to the coordinates and radius of the center of the minimum circumscribed circle, and set the pixel values ​​of the area inside the circle to 255, that is, the area inside the circle becomes white and the area outside the circle is black, thus obtaining a mask image;

[0033] (7c) performing an AND operation on each pixel on the downsampled paper tube image and each pixel on the corresponding position of the mask image to obtain a masked image. The masked image retains the image inside the circle corresponding to the downsampled paper tube image, while the image outside the circle is all black.

[0034] The pixel AND formula is as follows:

[0035] Set the pixel of the downsampled paper tube image to x[i], and the mask image has only black and white, with black pixels being 0 and white pixels being 1;

[0036] x[i]&1=x[i]; AND with the white area on the mask image to get its original image;

[0037] x[i]&0=0; it is ANDed with the black area on the mask image and eventually becomes black.

[0038] In step (7), the step of obtaining the circularity of the final contour specifically includes the following steps:

[0039] (8a) Calculate the perimeter C of the final contour;

[0040] (8b) Calculate the area S of the final contour;

[0041] (8c) Substitute the perimeter C and area S of the final contour into the circularity formula to calculate the circularity corresponding to the final contour. The circularity calculation formula is as follows:

[0042] e=4π*S / (C*C)

[0043] Among them, e represents the circularity of the final contour, C represents the circumference of the final contour, and S represents the area of ​​the final contour.

[0044] It can be seen from the above technical scheme that the beneficial effects of the present invention are: first, the present invention processes a part of the background interference through image pixels, and then uses the minimum circumscribed circle as a mask to remove the final background interference, so that the processed image no longer contains a large amount of interference; second, it solves the problem from staying in the research and verification stage in the laboratory to being able to be directly used in the industrial production line, so that chemical fiber enterprises avoid a series of shortcomings caused by manual detection of paper tube defects in industrial production; third, the present invention comprehensively considers the various background interferences of paper tubes caused by industrial production imaging as well as the characteristics and distribution of the background, so as to completely remove the background interference without affecting the useful foreground information in the original image, and successfully output the shape characteristics of the paper tube; fourth, the present invention has high accuracy and short time for detecting paper tube damage defects. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 is a flow chart of the method of the present invention;

[0046] Figure 2(a) shows a normal paper tube image;

[0047] Figure 2(b) shows an image of a damaged paper tube;

[0048] Figure 3(a) is a normal paper tube image of the minimum circumscribed circle of the final contour;

[0049] FIG3( b ) is an image of a damaged paper tube with the minimum circumscribed circle of the final contour;

[0050] Figure 4(a) is a normal paper tube image with background interference completely removed;

[0051] Figure 4(b) is an image of a damaged paper tube with background interference completely removed;

[0052] Figure 5(a) shows the calculation of the circularity of a normal paper tube image;

[0053] FIG5( b ) shows the calculation of the circularity of the damaged paper tube image. DETAILED DESCRIPTION

[0054] like Figure 1 As shown, a paper tube damage defect detection method based on shape features comprises the following steps in sequence:

[0055] (1) Obtaining a paper tube image and performing downsampling: reading the paper tube image to be detected, and reducing the length and width of the paper tube image to the same size;

[0056] (2) grayscale processing: converting the reduced paper tube image into a grayscale image;

[0057] (3) Gaussian filtering is performed on the grayscale image, followed by pixel transformation;

[0058] (4) Binarization of the image after pixel transformation operation;

[0059] (5) Draw the contours of the binary image and obtain the areas of all contours;

[0060] (6) retaining the maximum contour area according to the iterative method, the contour corresponding to the maximum contour area is the maximum contour, drawing the minimum circumscribed circle of the maximum contour, and obtaining the center and radius of the minimum circumscribed circle;

[0061] (7) performing image mask segmentation on the minimum circumscribed circle to obtain the circularity of the final contour;

[0062] (8) Judging based on the circularity of the final contour: a circularity is selected as an intermediate threshold within the range of circularities of a normal round tube and a damaged round tube. If the circularity of the final contour is greater than or equal to the intermediate threshold, the paper tube in the paper tube image to be detected is judged to be a normal paper tube. Conversely, if the circularity of the final contour is less than the intermediate threshold, the paper tube in the paper tube image to be detected is judged to be a damaged paper tube.

[0063] In step (3), the pixel transformation operation specifically includes the following steps:

[0064] (2a) Obtain all pixel values ​​of the paper tube image after Gaussian filtering;

[0065] (2b) Define a variable and compare all pixel values ​​on the image with this variable. If the pixel value on the image is less than this variable, the pixel value on the image is changed to 255, that is, white. Conversely, if the pixel value on the image is greater than this variable, the pixel value on the image remains unchanged.

[0066] In step (5), drawing the outline of the image after binarization processing specifically includes the following steps:

[0067] (3a) Find the contour of the binarized image, with the background being black and the object being white;

[0068] (3b) Use the findContours() function in the opencv library to find the contour of the white object;

[0069] (3c) After finding the contour, use the drawContours() function in the opencv library to draw the white object contour.

[0070] In step (5), obtaining the areas of all contours means: after finding the contours, using the function contourArea() in the opencv library to calculate the areas of all contours in the image.

[0071] In step (6), retaining the maximum contour area according to the iterative method specifically includes the following steps:

[0072] (5a) Iteration: Arrange the contours from small to large in area;

[0073] (5b) Obtain the largest contour area after iteration, define the largest contour area as a threshold, define the contour area smaller than the threshold as a small contour, and define the contour in the image with the contour area equal to the threshold as a large contour, i.e., the contour that needs to be retained in the end;

[0074] (5c) Delete small contours using the contours.erase(it) function in the opencv library.

[0075] In step (6), drawing the minimum circumscribed circle of the maximum contour specifically includes the following steps:

[0076] (6a) Use the function minEnclosingCircle() in the opencv library to calculate the center coordinates and radius of each contour;

[0077] (6b) Use the circle() function to draw the minimum circumscribed circle on the drawn contour.

[0078] In step (7), the image mask segmentation of the minimum circumscribed circle specifically includes the following steps:

[0079] (7a) Create an image of the same size as the downsampled paper tube image, and initialize all pixels on the image to 0. The image is all black.

[0080] (7b) Draw a circle on this completely black image according to the coordinates and radius of the center of the minimum circumscribed circle, and set the pixel values ​​of the area inside the circle to 255, that is, the area inside the circle becomes white and the area outside the circle is black, thus obtaining a mask image;

[0081] (7c) performing an AND operation on each pixel on the downsampled paper tube image and each pixel on the corresponding position of the mask image to obtain a masked image. The masked image retains the image inside the circle corresponding to the downsampled paper tube image, while the image outside the circle is all black.

[0082] The pixel AND formula is as follows:

[0083] Set the pixel of the downsampled paper tube image to x[i], and the mask image has only black and white, with black pixels being 0 and white pixels being 1;

[0084] x[i]&1=x[i]; AND with the white area on the mask image to get its original image;

[0085] x[i]&0=0; it is ANDed with the black area on the mask image and eventually becomes black.

[0086] In step (7), the step of obtaining the circularity of the final contour specifically includes the following steps:

[0087] (8a) Use the arcLength() function on the drawn contour to calculate the perimeter C of the final contour;

[0088] (8b) Use the function contourArea() on the drawn contour to calculate the area S of the final contour;

[0089] (8c) Substitute the perimeter C and area S of the final contour into the circularity formula to calculate the circularity corresponding to the final contour. The circularity calculation formula is as follows:

[0090] e=4π*S / (C*C)

[0091] Among them, e represents the circularity of the final contour, C represents the circumference of the final contour, and S represents the area of ​​the final contour.

[0092] As shown in Figure 2(a), the image is a normal paper tube image taken by a camera on a textile industry production line. It can be seen from the figure that the outermost contour of the normal paper tube image is close to a circle; as shown in Figure 2(b), the image is a damaged paper tube image taken by a camera on a textile industry production line. It can be seen from the figure that the outermost contour of the damaged paper tube image is a similar circle with a part damaged.

[0093] As shown in Figure 3(a), it is a normal paper tube image with the minimum circumscribed circle of the final contour drawn. It can be seen from the figure that the contour edge of the paper tube is covered by its minimum circumscribed circle; as shown in Figure 3(b), it is a damaged paper tube image with the minimum circumscribed circle of the final contour drawn. It can be seen from the figure that the contour edge of the paper tube is covered by its minimum circumscribed circle;

[0094] As shown in FIG4(a), it is a normal paper tube image with background interference completely removed. It can be seen from the figure that only the required paper tube is left without other interference factors. As shown in FIG4(b), it is a damaged paper tube image with background interference completely removed. It can be seen from the figure that only the required paper tube is left without other interference factors.

[0095] As shown in FIG5(a), in order to calculate the circularity of a normal paper tube image, the circularity of a normal paper tube image is greater than a certain threshold value, and the image is judged to be a normal paper tube image; as shown in FIG5(b), in order to calculate the circularity of a damaged paper tube image, the circularity of a normal paper tube image is less than a certain threshold value, and the image is judged to be a damaged paper tube image.

[0096] In summary, the present invention processes a part of the background interference through image pixels, and then uses the minimum circumscribed circle as a mask to remove the final background interference, so that the processed image no longer contains a large amount of interference; it solves the problem from staying in the research and verification stage in the laboratory to being able to be directly used in the industrial production line, so that chemical fiber enterprises avoid a series of shortcomings caused by manual detection of paper tube defects in industrial production; the present invention comprehensively considers the various background interferences of paper tubes caused by industrial production imaging as well as the characteristics and distribution of the background, so as to completely remove the background interference without affecting the useful foreground information in the original image, and successfully output the shape characteristics of the paper tube.

Claims

1. A paper tube damage defect detection method based on shape features, Features: The method comprises the following steps in order: (1) Obtain the paper tube image and perform downsampling: Read the paper tube image to be detected and reduce the length and width of the paper tube image to the same size; (2) Grayscale processing: convert the reduced paper tube image into a grayscale image; (3) Perform Gaussian filtering on the grayscale image and then perform pixel transformation operations; (4) Binarization of the image after pixel transformation operation; (5) Draw the contours of the binary image and obtain the areas of all contours; (6) According to the iterative method, the maximum contour area is retained, the contour corresponding to the maximum contour area is the maximum contour, the minimum circumscribed circle of the maximum contour is drawn, and the center and radius of the minimum circumscribed circle are obtained; (7) Perform image mask segmentation on the minimum circumscribed circle to obtain the circularity of the final contour; (8) Judging based on the circularity of the final contour: a circularity is selected as an intermediate threshold value within the range of the circularity of a normal round tube and a damaged round tube. If the circularity of the final contour is greater than or equal to the intermediate threshold value, the paper tube in the paper tube image to be detected is judged to be a normal paper tube. Conversely, if the circularity of the final contour is less than the intermediate threshold value, the paper tube in the paper tube image to be detected is judged to be a damaged paper tube. In step (7), the image mask segmentation of the minimum circumscribed circle specifically includes the following steps: (7a) Create an image of the same size as the downsampled paper tube image, and initialize all pixels on the image to 0. The image is all black. (7b) Draw a circle on this completely black image according to the coordinates and radius of the center of the minimum circumscribed circle, and set the pixel values ​​of the area inside the circle to 255. That is, the area inside the circle becomes white and the area outside the circle is black, thus obtaining a mask image. (7c) performing an AND operation on each pixel on the downsampled paper tube image and each pixel on the corresponding position of the mask image to obtain a masked image. The masked image retains the image inside the circle corresponding to the downsampled paper tube image, while the image outside the circle is all black. The pixel AND formula is as follows: Set the pixel of the downsampled paper tube image to x[i], and the mask image has only black and white, with black pixels being 0 and white pixels being 1; x[i] & 1= x[i]; AND with the white area on the mask image to get its original image; x[i] & 0=0; it is ANDed with the black area on the mask image and eventually becomes black.

2. According to the shape feature-based paper tube damage defect detection method of claim 1, Features: In step (3), the pixel transformation operation specifically includes the following steps: (2a) Obtain all pixel values ​​of the paper tube image after Gaussian filtering; (2b) Define a variable and compare all pixel values ​​on the image with this variable. If the pixel value on the image is less than this variable, the pixel value on the image is changed to 255, that is, white. Conversely, if the pixel value on the image is greater than this variable, the pixel value on the image remains unchanged.

3. The paper tube damage defect detection method based on shape features according to claim 1, Features: In step (5), drawing the outline of the image after binarization processing specifically includes the following steps: (3a) Find the contour of the binarized image, with the background being black and the object being white; (3b) Find the outline of the white object; (3c) When finding the contour, the white object contour is drawn.

4. The paper tube damage defect detection method based on shape features according to claim 1, Features: In step (5), obtaining the areas of all contours means: after finding the contours, calculating the areas of all contours in the image.

5. The paper tube damage defect detection method based on shape features according to claim 1, Features: In step (6), retaining the maximum contour area according to the iterative method specifically includes the following steps: (5a) Iteration: Arrange the contours from small to large in area; (5b) Obtain the largest contour area after iteration, define the largest contour area as a threshold, define the contour area smaller than the threshold as a small contour, and define the contour in the image with the contour area equal to the threshold as a large contour, which is the contour that needs to be retained in the end; (5c) Delete small contours.

6. The paper tube damage defect detection method based on shape features according to claim 1, Features: In step (6), drawing the minimum circumscribed circle of the maximum contour specifically includes the following steps: (6a) Calculate the center coordinates and radius of each contour; (6b) Draw the minimum circumscribed circle on the drawn contour.

7. The paper tube damage defect detection method based on shape features according to claim 1, Features: In step (7), the step of obtaining the circularity of the final contour specifically includes the following steps: (8a) Calculate the perimeter C of the final contour; (8b) Calculate the area S of the final contour; (8c) Substitute the perimeter C and area S of the final contour into the circularity formula to calculate the circularity corresponding to the final contour. The circularity calculation formula is as follows: e=4π*S / (C*C) Among them, e represents the circularity of the final contour, C represents the circumference of the final contour, and S represents the area of ​​the final contour.

Citation Information

Patent Citations

  • Method for visual inspection of shortages of automobile sealing strip profile

    CN103914827A

  • Image detection method for detecting foreign matter at bottom of vehicle

    CN103984961A