A packaging film quality detection method and system based on machine vision
Through machine vision-based detection methods, the images of film samples are obtained for analysis, which solves the problem that traditional detection methods are difficult to accurately identify and evaluate film defects, and achieves more efficient quality control and more accurate quality evaluation.
Patent Information
- Application Number
- CN202411137842.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-08-19
AI Technical Summary
Traditional packaging film quality detection methods are difficult to accurately identify and evaluate defects of varying degrees, resulting in a decrease in detection accuracy.
Using machine vision-based detection methods, by obtaining the top and side images of the film sample, circular fitting, threshold segmentation and chain code analysis are performed, defects such as dirt and bubbles are identified and evaluated, and defect correction is carried out.
It improves the accuracy of packaging film quality detection, can more accurately identify and quantify the impact of dirt on the film, reduce the defective yield rate, and improve production efficiency.
Smart Images

Figure CN119107300B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a packaging film quality detection method and system based on machine vision. Background Art
[0002] In today's manufacturing industry, packaging film is an important component of protection and appearance display, and its quality directly affects the market competitiveness and consumer satisfaction of products. With the help of advanced image processing and pattern recognition algorithms, machine vision technology can accurately and quickly identify and analyze complex visual information. During the production process of packaging film, the machine vision system uses a high-resolution camera to capture images of the film surface in real time, achieving efficient quality control, improving production efficiency and reducing the defective product rate.
[0003] In the actual production process of film, due to the influence of various factors, defects such as dirt and bubbles will appear on the surface of the film, which seriously affects the quality of the film. Traditional quality inspection methods often treat defects of different degrees equally when detecting defects in packaging films, thereby reducing the accuracy of packaging film quality inspection. Summary of the invention
[0004] The present invention provides a packaging film quality detection method and system based on machine vision to solve the existing problems.
[0005] The present invention provides a packaging film quality detection method and system based on machine vision, which adopts the following technical solutions:
[0006] An embodiment of the present invention provides a packaging film quality detection method based on machine vision, the method comprising the following steps:
[0007] Acquire a top image and a side image of the film sample and initial pixel points of the top image and the side image; the initial pixel points are located on the boundary of the top image and the side image and are located at the same position on the boundary of the film sample;
[0008] Perform circle fitting on all edge points of the top image of the film sample to obtain a number of fitting circles, fitting centers of all fitting circles, fitting residuals and fitting residuals of all edge points; the fitting center that appears most frequently at the same position among the fitting centers of all fitting circles is recorded as the fitting center of the top image; the degree of dirt influence on the film sample is obtained according to the fitting residuals of all fitting circles;
[0009] Perform threshold segmentation on the side image of the film sample to obtain several suspected areas; obtain the chain code of all pixels on the boundary of each suspected area; obtain the defect evaluation of each suspected area according to the grayscale of the pixels in each suspected area and the chain code of all pixels on the boundary of each suspected area; screen out several defective areas in all suspected areas according to the defect evaluation of all suspected areas;
[0010] According to all defect areas of the side image, the fitting center of the top image, the fitting residuals of all edge points, and the initial pixel points, all raised edge curves of the top image and the defect area caused by dirt corresponding to each raised edge curve are obtained; according to the distance between each raised edge curve and the fitting center of the top image and the grayscale values of the pixel points of the defect area caused by dirt corresponding to all raised edge curves, the weakening degree of the defect area caused by dirt corresponding to each raised edge curve is obtained;
[0011] According to the defect evaluation of the defect area caused by dirt corresponding to each raised edge curve, the weakening degree and the degree of influence of dirt on the film sample, the corrected defect evaluation of the defect area caused by dirt corresponding to each raised edge curve is obtained; according to the defect evaluation of all defect areas and the corrected defect evaluation of the defect area caused by dirt corresponding to all raised edge curves, it is judged whether the film sample is a qualified product.
[0012] Furthermore, the method of obtaining the degree of dirt influence on the film sample according to the fitting residuals of all fitting circles includes the following specific steps:
[0013] The normalized value of the mean of the fitting residuals of all fitting circles is recorded as the degree of dirt influence of the film sample.
[0014] Furthermore, the specific calculation formula for obtaining the defect evaluation of each suspected area according to the grayscale of the pixels in each suspected area and the chain code of all pixels on the boundary of each suspected area is:
[0015]
[0016] In the formula, p j represents the defect evaluation of the jth suspected area; v j represents the number of pixels in the jth suspected area; q j,a Represents the variance of the grayscale values of all pixels in the 8-neighborhood of the a-th pixel in the j-th suspected area; Represents the mean value of the grayscale value variance of all pixels in the 8-neighborhood of the side image; l j It represents the maximum value of the length of the boundary segment composed of adjacent pixels corresponding to the same chain code value on the boundary of the j-th suspected area; norm() is a linear normalization function.
[0017] Furthermore, the method of screening out a number of defective areas from all suspected areas according to the defect evaluation of all suspected areas includes the following specific steps:
[0018] Among all the suspected areas, all the suspected areas whose defect evaluation is greater than a preset first judgment threshold are recorded as defect areas.
[0019] Furthermore, the method of obtaining all the raised edge curves of the top image and the defective area caused by dirt corresponding to each raised edge curve according to all the defective areas of the side image, the fitting center of the top image, the fitting residuals of all edge points, and the initial pixel points includes the following specific steps:
[0020] Among all edge points of the top image of the film sample, the edge points whose fitting residuals are greater than the average of the fitting residuals of all edge points are recorded as convex edge points; the continuous curve composed of consecutive adjacent convex edge points is recorded as a convex edge curve; a ray is constructed starting from the fitting center of the top image and passing through the midpoint of each convex edge curve, and the intersection of the ray and the boundary of the top image is recorded as the corresponding point of each convex edge curve;
[0021] On the boundary of the top image, the length of the boundary segment between the corresponding point of each convex edge curve and the initial pixel point of the top image is recorded as the side length of the midpoint of each convex edge curve in the side image;
[0022] With the initial pixel point of the side image as the origin, the horizontal rightward as the horizontal axis, and the vertical downward as the vertical axis, a rectangular coordinate system is constructed to obtain the horizontal coordinates of the regional centroids of all defective areas in the side image;
[0023] Among the abscissas of the area centroids of all defective areas in the side image, the defective area corresponding to the abscissa having the smallest absolute value of the difference in the side length of the midpoint of each raised edge curve in the side image is recorded as the defective area caused by the dirt corresponding to each raised edge curve.
[0024] Furthermore, the method of obtaining the weakening degree of the defect area caused by the dirt corresponding to each convex edge curve according to the distance between each convex edge curve and the fitting circle center of the top image and the grayscale value of the pixel point of the defect area caused by the dirt corresponding to all convex edge curves includes the following specific steps:
[0025] Calculate the ratio of the mean grayscale value of the pixel points in the defect area caused by dirt corresponding to the x-th raised edge curve to the mean grayscale value of the pixel points in the defect area caused by dirt corresponding to all raised edge curves, and record the normalized value of the ratio and the product of the longest distance between the x-th raised edge curve and the center of the fitting circle of the top image as the weakening degree of the defect area caused by dirt corresponding to the x-th raised edge curve.
[0026] Further, the method of obtaining a corrected defect evaluation of the defect area caused by dirt corresponding to each convex edge curve according to the defect evaluation of the defect area caused by dirt corresponding to each convex edge curve, the weakening degree and the degree of dirt influence of the film sample, comprises the following specific steps:
[0027] Calculate the sum of the product of the weakening degree of the defective area caused by dirt corresponding to the x-th raised edge curve and the dirt influence degree of the film sample plus 1, and multiply the sum by the defect evaluation of the defective area caused by dirt corresponding to the x-th raised edge curve, and record it as the corrected defect evaluation of the defective area caused by dirt corresponding to the x-th raised edge curve.
[0028] Furthermore, judging whether the film sample is a qualified product based on the defect evaluation of all defect areas and the corrected defect evaluation of the defect areas caused by dirt corresponding to all raised edge curves includes the following specific steps:
[0029] Among all defect regions, a defect region that is not a defect region caused by dirt corresponding to the raised edge curve is recorded as a reference defect region, and a defect evaluation of each reference defect region is recorded as a corrected defect evaluation of each reference defect region;
[0030] Based on the corrected defect evaluation of all defect areas, a quality evaluation of the film sample is obtained;
[0031] When the quality evaluation of the film sample is greater than a preset second judgment threshold, the film sample is judged to be a qualified product;
[0032] When the quality evaluation of the film sample is less than or equal to a preset second judgment threshold, the film sample is determined to be an unqualified product.
[0033] Furthermore, the quality evaluation of the film sample is obtained based on the corrected defect evaluation of all defect areas, and the specific steps include the following:
[0034] The product of the corrected defect rating and the area of each defect region is calculated, and the inversely proportional normalized value of the mean of the product of the corrected defect rating and the area of all defect regions is recorded as the quality evaluation of the film sample.
[0035] The present invention also proposes a packaging film quality detection system based on machine vision, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned packaging film quality detection method based on machine vision.
[0036] The beneficial effects of the technical solution of the present invention are:
[0037] In the embodiment of the present invention, the top image and the side image of the film sample are obtained to provide an image basis for subsequent analysis; all edge points of the top image are fitted with a circle to obtain the degree of influence of dirt on the film sample, effectively identifying and quantifying the degree of influence of dirt in the top image on the film sample; the side image is segmented by threshold to obtain several suspected areas, the defect evaluation of each suspected area is calculated and several defect areas are screened out, so as to obtain a more accurate quality evaluation of the film sample; the defect area caused by dirt is marked in all defect areas, and the degree of weakening of each defect area caused by dirt is calculated, which helps to obtain a more accurate defect evaluation of the defect area caused by dirt; and then the defect evaluation of each defect area caused by dirt is corrected, and finally an accurate quality evaluation of the film sample is obtained. So far, the present invention collects top images and side images of the packaging film sample for analysis, and makes an accurate defect evaluation of the defects generated in the production process, thereby improving the accuracy of packaging film quality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 creative work.
[0039] Figure 1 A flowchart of the steps of a packaging film quality detection method based on machine vision of the present invention;
[0040] Figure 2 A schematic diagram of the arrangement of the film samples provided in this embodiment;
[0041] Figure 3 Top image of the film sample provided for this example;
[0042] Figure 4 A schematic diagram of edge deformation of a top image of a thin film sample provided in this embodiment;
[0043] Figure 5 Side view image of the film sample provided for this example. DETAILED DESCRIPTION
[0044] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a packaging film quality detection method and system based on machine vision proposed by the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0045] 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.
[0046] The following is a detailed description of a packaging film quality detection method and system based on machine vision provided by the present invention in conjunction with the accompanying drawings.
[0047] See also Figure 1 , which shows a flowchart of a packaging film quality detection method based on machine vision provided by an embodiment of the present invention, the method comprising the following steps:
[0048] Step S001: Acquire the top image and side image of the film sample and the initial pixel points of the top image and the side image; the initial pixel points are located on the boundary between the top image and the side image and are located at the same position on the boundary of the film sample.
[0049] Cameras are installed above and on the sides of the detection platform to collect top and side images of the film sample; the first imaging pixel in the upper left corner of the side image obtained during the movement of the camera is marked as the initial pixel of the side image, and the corresponding position of the initial pixel of the side image in the top image is marked as the initial pixel of the top image.
[0050] It should be noted that the film sample is a roll of film (cylindrical, viewed from above as a circle) placed vertically. Figure 2As shown, when collecting images, ensure that the film sample can be stably placed in the collection area. Under suitable light conditions, collect the top image of the film sample. After image difference, the background area is removed. The top image is the top area of the circular film sample. The image difference process is to collect the top image with the film sample and the top image without the film sample for difference. Place the side camera on a rotating table that can rotate at a fixed position so that it can move along the film sample for one circle. The camera collects multiple images around the film sample on the side. Use panoramic stitching technology to fuse all images to obtain a rectangular side image. The panoramic stitching technology is a well-known technology. The initial pixel point is on the boundary of the image. This embodiment is aimed at the quality inspection of the film roll before it leaves the factory after it is manufactured.
[0051] It should be further explained that the top image of the film sample is as follows: Figure 3 As shown, the edge deformation diagram of the top image of the film sample is as follows Figure 4 As shown, Figure 4 The dotted line in the middle is the part where the circular edge of the film roll is deformed when there are defects in the film. This is because when there are bubbles in the film, the bubbles will form local expansion in the film roll, affecting the uniformity of the winding and causing the top to be irregular in shape. When there are stains on the film, the stains may cause uneven adhesion of certain areas of the film, thus affecting the round shape during winding and causing bulges or depressions on the top. Therefore, bubbles and stains can cause uneven pressure during the winding process, which will cause the top shape of the film roll to change, such as ripples or irregular circles. The side image of the film sample is shown in Figure 1. Figure 5 As shown, Figure 5 There is a bubble defect in the left picture. Figure 5 There is a stain defect in the right picture.
[0052] Step S002: Perform circle fitting on all edge points of the top image of the film sample to obtain a number of fitting circles, fitting centers of all fitting circles, fitting residuals and fitting residuals of all edge points; the fitting center that appears most times at the same position among the fitting centers of all fitting circles is recorded as the fitting center of the top image; the degree of dirt influence on the film sample is obtained based on the fitting residuals of all fitting circles.
[0053] Generally, packaging film is rolled into a nearly circular cylinder during the production process. However, the presence of dust, impurities, chemicals and other contaminants on the production line may cause the film to appear bulged or irregularly shaped during the winding process. This problem may cause the film to have an uneven outer contour in the top image, or form bulges in certain parts, causing the outer contour that should appear to be approximately circular to appear bulged in a certain section. By analyzing the bulges in the top image of the film sample, the degree of influence of the contaminants on the film sample can be quantified. The more severe the bulge in the top image, that is, the greater the difference from the circle, the greater the degree of influence of the contaminants on the film sample.
[0054] Performing edge detection on the top image of the thin film sample using the Sobel edge detection algorithm to obtain a number of edge points in the top image of the thin film sample; performing circle fitting on all edge points using the least squares method to obtain a number of fitting circles, fitting centers of all fitting circles, fitting residuals, and fitting residuals of all edge points, wherein the Sobel edge detection algorithm and the least squares method are well-known technologies;
[0055] The fitting circle center that appears most frequently at the same position among all the fitting circles is recorded as the fitting circle center of the top image;
[0056] The normalized value of the mean of the fitting residuals of all fitting circles is obtained using a linear normalization function and recorded as the degree of dirt influence on the film sample.
[0057] Step S003: Perform threshold segmentation on the side image of the film sample to obtain several suspected areas; obtain the chain code of all pixels on the boundary of each suspected area; obtain the defect evaluation of each suspected area based on the grayscale of the pixels in each suspected area and the chain code of all pixels on the boundary of each suspected area; based on the defect evaluation of all suspected areas, screen out several defective areas in all suspected areas.
[0058] In the film production process, due to the presence of residual gas or uneven processing pressure during the processing, extrusion or coating of raw materials, bubble defects may be formed. Both bubble defects and dirt will be reflected in the side image, and both will affect the quality of the film sample. The present invention believes that the presence of dirt in the film sample will have a more serious impact on the quality of the film sample. For bubble defects and dirt in the same area, the dirt has a greater impact on the quality of the film sample. Therefore, it is necessary to preliminarily screen out the defective area according to the morphological characteristics of the defective area in the side image, and then mark the defective area caused by the dirt, and correct its defect evaluation, so as to obtain the corresponding defect evaluation for defects of different degrees, so as to make an accurate evaluation of the quality of the film sample, which can maximize the quality and reliability of the film product.
[0059] The side image of the film sample is operated using the Otsu method to obtain the optimal segmentation threshold. Among all the pixels in the side image whose grayscale values are greater than the optimal segmentation threshold, the connected domain composed of consecutive adjacent pixels is recorded as a suspected region; thus, several suspected regions are obtained;
[0060] The Freeman chain code algorithm is used to obtain the chain code of all pixels on the boundary of each suspected area, which is a well-known technology.
[0061] In the side image of the film sample, the defective area has more texture and uneven grayscale than the flat normal film area, and the defective area forms a bulge, and the edge of the area is less smooth. Based on the above morphological characteristics of the defective area, the defective area is screened and a defect evaluation is made for the defective area.
[0062] According to the grayscale of the pixels in each suspected area and the chain code of all pixels on the boundary of each suspected area, the defect evaluation of each suspected area is obtained. The corresponding calculation formula is as follows:
[0063]
[0064] In the formula, p j represents the defect evaluation of the jth suspected area; v j represents the number of pixels in the jth suspected area; q j,a Represents the variance of the grayscale values of all pixels in the 8-neighborhood of the a-th pixel in the j-th suspected area; Represents the mean value of the grayscale value variance of all pixels in the 8-neighborhood of the side image; l j It represents the maximum value of the length of the boundary segment composed of adjacent pixels corresponding to the same chain code value on the boundary of the j-th suspected area; norm() is a linear normalization function that normalizes the data value to the interval [0,1].
[0065] It should be noted that It represents the mean of the variance of the grayscale values of all pixels in the 8-neighborhood of all pixels in the j-th suspected area. The larger the value, the more uneven the texture distribution is. It is also different from the mean of the variance of the grayscale values of all pixels in the 8-neighborhood of all pixels in the side image. The larger the ratio is, the higher the defect evaluation is; the maximum value l in the length of the boundary segment composed of adjacent pixels corresponding to the same chain code value on the boundary of the jth suspected area is j The larger it is, the smoother the edge of the j-th suspected area is, that is, the flatter the outline of the suspected area is, the less it belongs to the defect area, and the smaller the defect evaluation is.
[0066] The first judgment threshold a=0.5 is preset in this embodiment, and is described by taking this as an example. Other values may be set in other implementation modes, and this embodiment does not limit this.
[0067] Among all the suspected areas, all the suspected areas whose defect evaluation is greater than a preset first judgment threshold are recorded as defect areas.
[0068] Step S004: Based on all defect areas of the side image, the fitting center of the top image, the fitting residuals of all edge points and the initial pixel points, all raised edge curves of the top image and the defect area caused by dirt corresponding to each raised edge curve are obtained; based on the distance between each raised edge curve and the fitting center of the top image and the grayscale values of the pixel points of the defect area caused by dirt corresponding to all raised edge curves, the weakening degree of the defect area caused by dirt corresponding to each raised edge curve is obtained.
[0069] Generally speaking, bubble defects are small in size and will be squeezed during the winding process of packaging film production, so they are not easy to observe in the top image, while dirt defects can be clearly distinguished in the side image. Therefore, for all defective areas in the side image, especially those caused by dirt, the defects are more serious and require a higher defect evaluation. Therefore, they need to be accurately positioned and marked, and their defect evaluation must be corrected. The following is to mark the defective areas caused by dirt in all defective areas in the side image, accurately locate the dirt in the side image, and accurately evaluate the quality of the film sample.
[0070] According to the dirt corresponding to the bulge in the top image, there must be a corresponding defect area in the side image. Therefore, according to the position distribution of the outermost edge of each bulge in the top image and the position distribution of the defect area in the side image, the defect area corresponding to the bulge can be obtained. The length of the curve side of the first pixel point imaged when the camera starts to move and the bulge part on the circular curve should be equal to the horizontal coordinate of the defect area corresponding to the bulge part in the side image. The specific process of marking the defect area caused by dirt in all defect areas is:
[0071] Among all edge points of the top image of the film sample, the edge points whose fitting residuals are greater than the average of the fitting residuals of all edge points are recorded as convex edge points; the continuous curve composed of consecutive adjacent convex edge points is recorded as a convex edge curve; a ray is constructed starting from the fitting center of the top image and passing through the midpoint of each convex edge curve, and the intersection of the ray and the boundary of the top image is recorded as the corresponding point of each convex edge curve;
[0072] On the boundary of the top image, the length of the boundary segment between the corresponding point of each convex edge curve and the initial pixel point of the top image is recorded as the side length of the midpoint of each convex edge curve in the side image;
[0073] With the initial pixel point of the side image as the origin, the horizontal rightward as the horizontal axis, and the vertical downward as the vertical axis, a rectangular coordinate system is constructed to obtain the horizontal coordinates of the regional centroids of all defective areas in the side image;
[0074] Among the abscissas of the area centroids of all defective areas in the side image, the defective area corresponding to the abscissa having the smallest absolute value of the difference in the side length of the midpoint of each raised edge curve in the side image is recorded as the defective area caused by the dirt corresponding to each raised edge curve.
[0075] Among all the raised edge curves, they may be caused by dirt of different circumferences in the film sample. When the dirt is located on the periphery of the packaging film, the more obvious the defect area in the side image is, and the more accurate the defect evaluation is; when the dirt is located on the inside of the packaging film, it is wrapped by more film, which affects its defect performance in the side image and weakens some defect features, resulting in a smaller defect evaluation.
[0076] According to the distance between each convex edge curve and the center of the fitting circle and the grayscale value of the pixel point of the defect area caused by the dirt corresponding to all convex edge curves, the weakening degree of the defect area caused by the dirt corresponding to each convex edge curve is obtained. The corresponding calculation formula is as follows:
[0077]
[0078] In the formula, g x Indicates the degree of weakening of the defect area caused by dirt corresponding to the x-th raised edge curve; r x represents the longest distance between the xth raised edge curve and the center of the fitted circle of the top image; h x represents the mean value of the grayscale values of the pixels in the defect area caused by the dirt corresponding to the x-th raised edge curve; It represents the mean gray value of the pixel points in the defect area caused by dirt corresponding to all raised edge curves; norm() is a linear normalization function that normalizes the data value to the [0,1] interval.
[0079] Step S005: Obtain a corrected defect evaluation of the defect area caused by dirt corresponding to each raised edge curve according to the defect evaluation of the defect area caused by dirt corresponding to each raised edge curve, the degree of weakening and the degree of dirt influence on the film sample; determine whether the film sample is a qualified product according to the defect evaluation of all defect areas and the corrected defect evaluation of the defect area caused by dirt corresponding to all raised edge curves.
[0080] Generally speaking, dirt inside the packaging film is more serious than bubble defects. When dirt appears inside the packaging film, it is considered to be a more serious defect, that is, the quality is worse.
[0081] According to the defect evaluation of the defect area caused by dirt corresponding to each raised edge curve, the weakening degree and the degree of dirt influence of the film sample, the corrected defect evaluation of the defect area caused by dirt corresponding to each raised edge curve is obtained, and the corresponding calculation formula is as follows:
[0082] p′ x =p x ×(1+D×g x )
[0083] Where p′ x represents the corrected defect evaluation of the defect area caused by dirt corresponding to the x-th raised edge curve; p x represents the defect evaluation of the defect area caused by dirt corresponding to the x-th raised edge curve; D represents the degree of dirt influence on the film sample; g x Indicates the degree of weakening of the defect area caused by dirt corresponding to the x-th raised edge curve.
[0084] It should be noted that when p′ x When it is greater than 1, it is set to 1 to ensure that the corrected defect evaluation of the defect area caused by dirt corresponding to all raised edge curves does not exceed 1.
[0085] Among all defect areas, the defect area that is not the defect area caused by dirt corresponding to the raised edge curve is recorded as the reference defect area, and the defect evaluation of each reference defect area is recorded as the corrected defect evaluation of each reference defect area; thereby obtaining the corrected defect evaluation of each defect area.
[0086] According to the corrected defect evaluation of all defect areas, the quality evaluation of the film sample is obtained, and the corresponding calculation formula is as follows:
[0087]
[0088] Where Q represents the quality evaluation of the film sample; n represents the number of all defective areas; p′ i represents the corrected defect evaluation of the i-th defect area; s i Represents the area of the i-th defect region; exp() is an exponential function with a natural constant as the base. In this embodiment, exp(-) is used to present the inverse proportional relationship and normalization processing. The implementer can set the inverse proportional function and normalization function according to the actual situation.
[0089] The second judgment threshold value preset in this embodiment is 0.7, which is used as an example for description. Other values may be set in other implementation modes, which are not limited in this embodiment.
[0090] When the quality evaluation of the film sample is greater than a preset second judgment threshold, the film sample is judged to be a qualified product;
[0091] When the quality evaluation of the film sample is less than or equal to a preset second judgment threshold, the film sample is determined to be an unqualified product.
[0092] Thus far, this embodiment has quantified the quality evaluation of the film samples and judged their eligibility, thereby achieving efficient quality control, improving production efficiency and reducing defective product rates, and ensuring that the final product meets the requirements of the market and customers.
[0093] So far, the present invention is completed.
[0094] To summarize, in an embodiment of the present invention, a top image and a side image of a film sample are obtained, circle fitting is performed on all edge points of the top image to obtain the degree of influence of dirt on the film sample, threshold segmentation is performed on the side image to obtain several suspected areas, the defect evaluation of each suspected area is calculated and several defective areas are screened out, the defective areas caused by dirt are marked in all defective areas, the degree of weakening of each defective area caused by dirt is calculated, and then the defect evaluation of each defective area caused by dirt is corrected, and finally the quality evaluation of the film sample is obtained.
[0095] The present invention also provides a packaging film quality detection system based on machine vision, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned packaging film quality detection method based on machine vision.
[0096] 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 principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A packaging film quality detection method based on machine vision, characterized in that: The method comprises the following steps: Acquire a top image and a side image of the film sample and initial pixel points of the top image and the side image; the initial pixel points are located on the boundary of the top image and the side image and are located at the same position on the boundary of the film sample; Performing circle fitting on all edge points of the top image of the film sample to obtain a number of fitting circles, fitting centers of all fitting circles, fitting residuals and fitting residuals of all edge points; recording the fitting center of all fitting circles that appears most times at the same position as the fitting center of the top image; obtaining the degree of dirt influence of the film sample according to the fitting residuals of all fitting circles, including the following specific steps: recording the normalized value of the mean of the fitting residuals of all fitting circles as the degree of dirt influence of the film sample; Threshold segmentation is performed on the side image of the film sample to obtain several suspected areas; the chain code of all pixels on the boundary of each suspected area is obtained; according to the grayscale of the pixels in each suspected area and the chain code of all pixels on the boundary of each suspected area, the defect evaluation of each suspected area is obtained. The specific calculation formula for the defect evaluation of each suspected area is: ; In the formula, Indicates Defect evaluation of suspected areas; Indicates The number of pixels in the suspected area; Indicates In the suspected area The variance of the grayscale values of all pixels in the 8-neighborhood of a pixel; Represents the mean of the grayscale value variance of all pixels in the 8-neighborhood of the side image; Indicates The maximum value of the length of the boundary segment composed of adjacent pixels corresponding to the same chain code value on the boundary of the suspected area; is a linear normalization function; According to the defect evaluation of all suspected areas, several defect areas are screened out from all suspected areas; According to all defect areas of the side image, the fitting center of the top image, the fitting residuals of all edge points, and the initial pixel points, all raised edge curves of the top image and the defect area caused by dirt corresponding to each raised edge curve are obtained; according to the distance between each raised edge curve and the fitting center of the top image and the grayscale values of the pixel points of the defect area caused by dirt corresponding to all raised edge curves, the weakening degree of the defect area caused by dirt corresponding to each raised edge curve is obtained, and the specific steps included are as follows: Calculate the first The ratio of the average grayscale value of the pixel points in the defect area caused by the dirt corresponding to the first convex edge curve to the average grayscale value of the pixel points in the defect area caused by the dirt corresponding to all convex edge curves is added to the ratio. The normalized value of the product of the longest distance between the convex edge curve and the center of the fitting circle of the top image is recorded as The degree of weakening of the defective area caused by dirt corresponding to the raised edge curve; According to the defect evaluation of the defect area caused by the dirt corresponding to each raised edge curve, the weakening degree and the degree of dirt influence of the film sample, the corrected defect evaluation of the defect area caused by the dirt corresponding to each raised edge curve is obtained, including the following specific steps: calculating the first The sum of the product of the weakening degree of the defective area caused by the dirt corresponding to the first raised edge curve and the dirt influence degree of the film sample plus 1 is added, and the sum is added to the first The product of the defect evaluation of the defect area caused by the dirt corresponding to the convex edge curve is recorded as The corrected defect evaluation of the defect area caused by the dirt corresponding to the convex edge curve is performed; and whether the film sample is a qualified product is judged according to the defect evaluation of all defect areas and the corrected defect evaluation of the defect area caused by the dirt corresponding to all convex edge curves.
2. The packaging film quality detection method based on machine vision according to claim 1 is characterized in that: According to the defect evaluation of all suspected areas, a number of defect areas are screened out from all suspected areas, including the following specific steps: Among all the suspected areas, all the suspected areas whose defect evaluation is greater than a preset first judgment threshold are recorded as defect areas.
3. The packaging film quality detection method based on machine vision according to claim 1 is characterized in that: The method of obtaining all the raised edge curves of the top image and the defective area caused by dirt corresponding to each raised edge curve according to all the defective areas of the side image, the fitting center of the top image, the fitting residuals of all edge points, and the initial pixel point includes the following specific steps: Among all edge points of the top image of the film sample, the edge points whose fitting residuals are greater than the average of the fitting residuals of all edge points are recorded as convex edge points; the continuous curve composed of consecutive adjacent convex edge points is recorded as a convex edge curve; a ray is constructed starting from the fitting center of the top image and passing through the midpoint of each convex edge curve, and the intersection of the ray and the boundary of the top image is recorded as the corresponding point of each convex edge curve; On the boundary of the top image, the length of the boundary segment between the corresponding point of each convex edge curve and the initial pixel point of the top image is recorded as the side length of the midpoint of each convex edge curve in the side image; With the initial pixel point of the side image as the origin, the horizontal rightward as the horizontal axis, and the vertical downward as the vertical axis, a rectangular coordinate system is constructed to obtain the horizontal coordinates of the regional centroids of all defective areas in the side image; Among the abscissas of the area centroids of all defective areas in the side image, the defective area corresponding to the abscissa having the smallest absolute value of the difference in the side length of the midpoint of each raised edge curve in the side image is recorded as the defective area caused by the dirt corresponding to each raised edge curve.
4. The packaging film quality detection method based on machine vision according to claim 1 is characterized in that: The specific steps of judging whether the film sample is a qualified product based on the defect evaluation of all defect areas and the corrected defect evaluation of the defect areas caused by dirt corresponding to all raised edge curves are as follows: Among all defect regions, a defect region that is not a defect region caused by dirt corresponding to the raised edge curve is recorded as a reference defect region, and a defect evaluation of each reference defect region is recorded as a corrected defect evaluation of each reference defect region; Based on the corrected defect evaluation of all defect areas, a quality evaluation of the film sample is obtained; When the quality evaluation of the film sample is greater than a preset second judgment threshold, the film sample is judged to be a qualified product; When the quality evaluation of the film sample is less than or equal to a preset second judgment threshold, the film sample is determined to be an unqualified product.
5. The packaging film quality detection method based on machine vision according to claim 4 is characterized in that: The quality evaluation of the film sample is obtained based on the corrected defect evaluation of all defect areas, and the specific steps include the following: The product of the corrected defect rating and the area of each defect region is calculated, and the inversely proportional normalized value of the mean of the product of the corrected defect rating and the area of all defect regions is recorded as the quality evaluation of the film sample.
6. A packaging film quality detection system based on machine vision, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of a packaging film quality detection method based on machine vision as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method for determining large-plastic bending section profile curve of thin-walled pipe
CN108332681A
Integrated circuit wafer surface defect detection method based on artificial intelligence
CN115035122A