A yarn remainder detection method based on back projection transformation
Through the inverse projection transformation and iterative correction of compensation matrix, the problem of low accuracy of yarn allowance detection caused by the yarn image projection phenomenon is solved, and efficient and accurate yarn allowance detection is achieved.
Patent Information
- Application Number
- CN202211303137.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-24
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-10-24
AI Technical Summary
In the automatic cylinder changing system of textile enterprises, the projection phenomena of the yarn barrel image vary, resulting in low accuracy of yarn margin detection.
Using the method based on inverse projection transformation, the yarn barrel image is obtained through the camera, the spatial position relationship between the yarn barrel and the camera is measured, the initial transformation matrix is calculated, and the inverse projection transformation is performed. Combined with the yarn barrel edge contour filtering, histogram equalization, Ostu algorithm segmentation, Bezier curve fitting and least squares correction, the geometric features of the yarn barrel are calculated, the compensation matrix is set for iterative correction, and finally the yarn margin is calculated through the elliptical polar coordinate transformation model.
It improves the accuracy of yarn allowance detection, eliminates the impact of projection phenomenon, and improves detection efficiency and accuracy.
Smart Images

Figure CN115511872B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image processing, and in particular relates to a method for detecting yarn remainder of a bobbin based on inverse projection transformation. Background Art
[0002] Yarn cones are the primary source of yarn raw material in textile production. Each cone consists of an outer yarn core and an inner paper cylinder. Currently, the most widely used cones are roughly divided into cylindrical and conical types, depending on the inner cylinder type. Compared to conical cones, cylindrical cones have thicker inner cylinder walls and a larger front diameter. When fully loaded with yarn, the yarn width is close to the inner cylinder diameter.
[0003] In textile enterprises, yarn bobbins are installed on yarn bobbin racks equipped with lifting rods. Every two yarn bobbins are counted as a group and their angles are symmetrical about the reinforcing column. In the automatic bobbin changing system, in order to improve the detection efficiency, the robotic arm equipped with a camera collects images of each yarn bobbin rack twice. Therefore, it is difficult for the camera to move to the front of the yarn bobbin to take pictures. As a result, the yarn bobbin image obtained by the camera has obvious projection phenomenon. Moreover, since the spatial position of each yarn bobbin and the camera is different, the corresponding projection phenomenon is different, resulting in low accuracy in the detection of the remaining yarn on the yarn bobbin. Summary of the Invention
[0004] In order to solve the above technical problems, the present invention provides a method for detecting the remaining amount of yarn in a bobbin based on inverse projection transformation, comprising:
[0005] S101: Acquire yarn bobbin images through a camera, each yarn bobbin image including four yarn bobbins to be detected;
[0006] S102: measuring the spatial position relationship between each yarn bobbin and the camera, calculating an initial transformation matrix according to a three-point projection model, and performing a reverse projection transformation on the yarn bobbin image according to the transformation matrix;
[0007] S103: performing yarn bobbin edge contour filtering on the yarn bobbin image after the inverse projection transformation, retaining edge information through high-frequency enhancement, and enhancing contrast through histogram equalization;
[0008] S104: Segment the yarn tube area on the image using the Ostu algorithm, extract the inner and outer tube contour edges of the yarn tube, fit the curve using a double-endpoint Bezier curve, and correct the predicted curvature during the fitting process using the least squares method to fill in the missing edges;
[0009] S105: Calculate the geometric features of the inner and outer cylinder areas, calculate four width differences in two directions of the inner and outer cylinders based on the angle information in the geometric features, and determine the effect of the initial back-projection transformation based on the geometric features and the four width differences;
[0010] S106: setting a compensation matrix for the bobbin image whose initial transformation effect does not meet the preset requirements, and iteratively correcting the compensation matrix according to the element transformation characteristics of the compensation matrix and the quantitative relationship of the four width differences;
[0011] S107: performing a back-projection transformation on the image after the initial transformation according to the corrected compensation matrix, and expanding the circular bobbin area into a matrix area by using an elliptical polar coordinate transformation model considering angle information on the image after the second back-projection transformation;
[0012] S108: performing image segmentation on the unfolded rectangular yarn tube area to segment the yarn area, and calculating the yarn remainder on the yarn tube according to a yarn remainder calculation rule.
[0013] Compared with the prior art, the present invention has at least the following beneficial effects:
[0014] In the present invention, when the effect of a single inverse projection transformation on the yarn bobbin image is not good, an iterative correction is performed by setting a compensation matrix, and then a secondary inverse projection transformation is performed to eliminate the influence of the projection phenomenon on the yarn bobbin image detection and improve the accuracy of the detection of the yarn remainder on the yarn bobbin. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The preferred embodiments will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.
[0016] Figure 1 1 is a flow chart of a method for detecting yarn remainder in a bobbin based on inverse projection transformation provided by the present invention;
[0017] Figure 2 This is a schematic diagram of the angle rotation of the yarn bobbin on the yarn bobbin rack provided by the present invention;
[0018] Figure 3 This is an inner and outer cylinder contour extraction rendering provided by the present invention;
[0019] Figure 4 This is a reverse projection transformation effect diagram provided by the present invention;
[0020] Figure 5 This is a yarn bobbin ellipse polar coordinate transformation effect diagram taking angle information into consideration, provided by the present invention. DETAILED DESCRIPTION
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific embodiments of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings and other embodiments can be obtained based on these drawings without inventive work.
[0022] To simplify the drawings, only portions relevant to the invention are schematically depicted in each figure; they do not represent the actual structure of the product. Furthermore, to simplify the drawings and facilitate understanding, in some figures, only one component with the same structure or function is schematically depicted or labeled. In this document, "one" not only means "only one" but also "more than one."
[0023] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0024] It should be noted that, unless otherwise specified or limited, the terms "mounted," "connected," and "connected" should be understood broadly. For example, they can refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediary; and internal communication between two components. Those skilled in the art will understand the specific meanings of these terms in the present invention based on the specific circumstances.
[0025] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0026] Reference Manual Figure 1 , which shows a flow chart of a method for detecting yarn remainder in a bobbin based on inverse projection transformation provided by the present invention.
[0027] Reference Manual Figure 2 , showing a schematic diagram of the angle rotation of the yarn tube on the yarn tube holder provided by the present invention.
[0028] The present invention provides a method for detecting yarn remainder of a bobbin based on inverse projection transformation, comprising:
[0029] S101: Acquire yarn bobbin images through a camera, each yarn bobbin image including four yarn bobbins to be detected.
[0030] Among them, each yarn bobbin image contains at least four yarn bobbins, and the inverse projection transformation matrix corresponding to each yarn bobbin is different. Compared with the traditional single yarn bobbin detection algorithm, the detection efficiency is significantly improved.
[0031] S102: measuring the spatial position relationship between each yarn bobbin and the camera, calculating an initial transformation matrix according to a three-point projection model, and performing a reverse projection transformation on the yarn bobbin image according to the transformation matrix.
[0032] Among them, the three-point projection transformation model is adopted to calculate the initial transformation matrix according to the spatial position relationship between the camera and the yarn bobbin, which greatly reduces the calculation time of the subsequent compensation matrix and effectively improves the detection efficiency.
[0033] Among them, the initial transformation matrix is obtained by multiplying the axis translation matrix, projection matrix and rotation matrix. The corresponding axis displacement and axis rotation angle are determined by the spatial position relationship between the camera and the yarn tube. The initial transformation matrix T for:
[0034] in, M 1. M 4 are the image rotation around the Z and Y axes θ 、 φ The rotation matrix of degrees, M 2 is the translation matrix, that is, the image is translated by l, m, and n units along the X, Y, and Z axes respectively. M 3 is the projection matrix;
[0035] in, B 、 T are the length and width of the minimum circumscribed rectangle of the bobbin area respectively.
[0036] The image after a back-projection transformation has been corrected to a great extent compared to the original image. In order to evaluate the back-projection effect and facilitate the subsequent correction of the yarn bobbin, it is necessary to extract the inner and outer contours of the yarn bobbin.
[0037] S103: performing yarn bobbin edge contour filtering on the yarn bobbin image after the inverse projection transformation, retaining edge information through high-frequency enhancement, and enhancing contrast through histogram equalization.
[0038] The imaging features of yarn bobbins are relatively complex. The imaging features of yarn bobbins at different positions are different. In addition, since the front of the yarn is uneven, the diffuse reflection of light is obvious, and the grayscale distribution on the surface is uneven, this makes edge extraction difficult. Therefore, the image needs to be filtered before edge extraction to achieve the effect of enhancing the edge information of the image while suppressing the overall noise intensity of the image.
[0039] Among them, in the yarn cone edge profile filtering, the filtering criterion for high-frequency enhancement is:
[0040] in, GrayValue is the grayscale value of the pixel after filtering, round For rounding operation, mean is the overall grayscale mean of the image, Factor is the grayscale gain factor, generally 0.5, origval is the original grayscale value of the pixel.
[0041] S104: The yarn tube area is segmented on the image using the Ostu algorithm, and the inner and outer tube contour edges of the yarn tube are extracted. A double-endpoint Bezier curve is used for fitting, and the predicted curvature in the fitting process is corrected using the least squares method to fill in the missing edges.
[0042] Reference Manual Figure 3 , showing an inner and outer cylinder contour extraction effect diagram provided by the present invention.
[0043] Among them, the yarn tube outer contour curve extraction algorithm takes into account the possible missing edge extraction part under poor lighting conditions. Bezier curve fitting is used to simultaneously predict the edge from two breakpoints, and the two fitting curves are constrained by least squares to continuously correct the predicted curvature of the fitting curve, which can finally obtain a good curve fitting effect.
[0044] In a possible implementation, S104 specifically includes:
[0045] S1041: Obtain the starting point of the known contour and two control points on the contour, and perform cubic Bezier curve fitting.
[0046] S1042: Segment the known arc contour and collect the curvature change rates of different segments.
[0047] S1043: Retrieve the curvature change rate of the known contour based on the curvature change rate of the arc contour near the two breakpoints.
[0048] S1044: Perform contour prediction at two breakpoints simultaneously according to the change rule.
[0049] S1045: Finally, the two predicted contours are corrected by least squares to correct the predicted curvature during the fitting process and fill in the missing edges.
[0050] In the actual production process, due to the uncertainty of natural lighting and the differences in artificial lighting effects under daytime and nighttime conditions, the imaging characteristics of the same bobbin are not fixed when photographed at different times. In addition, due to the obvious reflection of the yarn on the bobbin under strong light conditions, the outline of the yarn on the outer tube of some bobbins will eventually be unclear, and some outlines will be missing during segmentation. In order to facilitate the subsequent calculation of the width of the inner and outer yarns of the bobbins to obtain a suitable compensation matrix, it is necessary to accurately extract the outlines of the inner and outer tubes of the bobbins as much as possible. Therefore, the missing bobbin outline is fitted. The specific method is: the starting points P0 and P3 of the known outline are obtained, as well as the two control points P2 to P3 on the outline, and a cubic Bezier curve is fitted. P0 and P3 represent the starting position and end position of the curve respectively. The direction from P0 to P1 represents the tangent direction of the starting position of the curve, and the direction from P2 to P3 represents the tangent direction of the end position of the curve. Then the known arc contour is segmented, and the curvature change rate of different segments is calculated and learned (calculated based on the first and second derivatives). The curvature change rate of the known contour is retrieved based on the curvature change rate of the arc contour near the two breakpoints. According to the change law, the contour is predicted from the two breakpoints to obtain two predicted contours. At the same time, the prediction error is calculated based on the two predicted contours using the least squares method, and the curvature generation process of the predicted contour is optimized. It is regenerated and continuously approximated, and finally a better curve fitting effect is obtained.
[0051] S105: Calculate the geometric features of the inner and outer cylinder areas, calculate the four width differences in two directions of the inner and outer cylinders according to the angle information in the geometric features, and judge the effect of the initial back projection transformation based on the geometric features and the four width differences.
[0052] The geometric features of the inner and outer cylinders include the roundness of the inner cylinder area, the roundness of the outer cylinder area, the direction and the area.
[0053] Optionally, the roundness, direction angle and center point position difference of the inner and outer cylinder contours are compared to see whether they reach a set threshold value, and a secondary back projection transformation is required for images that do not reach the set threshold value.
[0054] S106: setting a compensation matrix for the bobbin image whose initial transformation effect does not meet the preset requirements, and iteratively correcting the compensation matrix according to the element transformation characteristics of the compensation matrix and the quantitative relationship of the four width differences.
[0055] Among them, the compensation matrix P It is a three-dimensional matrix. The compensation matrix is divided into four parts according to the image projection transformation effect. is the scaling factor, is the shear factor, is the displacement in the X and Y axis directions, Determines the image's vanishing point.
[0056] Specifically, increase , the image will be scaled along the X axis, increasing , the image will be scaled along the Y axis;
[0057] Increase , the lower left corner of the image will move to the right along the X axis, and the upper right corner will move to the left along the X axis, increasing , the lower left corner of the image will move upward along the Y axis, and the upper right corner will move downward along the Y axis;
[0058] Increase , the image moves along the X-axis as a whole, increasing , the entire image moves along the Y-axis;
[0059] when When it is larger, the image vanishing point is closer to the origin and parallel lines converge faster.
[0060] In order to simplify the computational complexity, the four-dimensional transformation matrix needs to be reduced to three dimensions. However, the yarn bobbin has no rotation in the X-axis direction in terms of imaging characteristics. Therefore, in the present invention, the traditional inverse projection transformation matrix is reduced to a three-dimensional matrix.
[0061] In a possible embodiment, the width difference between the inner and outer cylinders in the area direction is recorded from left to right as D 1. D 2. The width difference of the area angle in the vertical direction from left to right is recorded as D 3. D 4. S106 is specifically:
[0062] exist D 1< D 2 and D 4< D 3 o'clock, reduce while increasing Further correction is performed in this iterative cycle until the four width differences in two directions are the same and the roundness of the inner and outer cylinders reaches 1, completing the correction.
[0063] In one possible implementation, since there is axial displacement between the planes where the inner and outer cylinders are located, the corresponding transformation matrices are different. Ultimately, the roundness of the inner and outer cylinders cannot reach 1 at the same time. Therefore, the calculation of the compensation matrix is considered complete when the roundness reaches 0.96 at the same time. The iterative constraint condition is:
[0064] in C 1. C 2 are the roundness values of the inner and outer cylinders respectively, is the variance of the four width differences between the inner and outer cylinders, Set thresholds for the system.
[0065] S107: performing back-projection transformation on the image after the initial transformation again according to the corrected compensation matrix, and expanding the circular bobbin area into a matrix area by using an elliptical polar coordinate transformation model considering angle information on the image after the second back-projection transformation.
[0066] Reference Manual Figure 4 , showing an inverse projection transformation effect diagram provided by the present invention.
[0067] Reference Manual Figure 5 , showing an effect diagram of the yarn bobbin ellipse polar coordinate transformation considering angle information provided by the present invention.
[0068] Among them, the elliptical polar coordinate transformation model considering angle information is:
[0069] in, is the ellipse rotation angle, X 、 Y is the ellipse model variable in the rectangular coordinate system, is the model constant in the rectangular coordinate system, r 、 θ is the ellipse model variable in polar coordinates.
[0070] S108: performing image segmentation on the unfolded rectangular yarn tube area to segment the yarn area, and calculating the yarn remainder on the yarn tube according to a yarn remainder calculation rule.
[0071] Polar coordinate transformation can expand the curve function graph into a rectangle. Polar coordinate transformation can also be used to expand the yarn area of the yarn bobbin after the inverse projection transformation into a rectangle. The length of the transformed rectangle is equal to the outer perimeter of the ellipse before the transformation, and the height of the rectangle is equal to the width of the ellipse. For yarn bobbins with small yarn excess, this method can effectively reduce errors and improve excess detection accuracy.
[0072] The margin calculation criteria are:
[0073] Assume that the polar coordinate expansion of the ellipse is L × W Rectangle, calculate the area of the yarn region in the rectangular region S , then divided by the length of the rectangle L , and obtain the effective width of the yarn area W , the yarn remainder of the bobbin is:
[0074] in, IR is the actual radius of the inner cylinder, The actual remaining amount of yarn on the bobbin.
[0075] In the present invention, when the effect of a single inverse projection transformation on the yarn bobbin image is not good, an iterative correction is performed by setting a compensation matrix, and then a secondary inverse projection transformation is performed to eliminate the influence of the projection phenomenon on the yarn bobbin image detection and improve the accuracy of the detection of the yarn remainder on the yarn bobbin.
[0076] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be noted that those skilled in the art can make several improvements and modifications without departing from the principles of the present invention, and such improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting yarn remainder on a bobbin based on inverse projection transformation, characterized in that: include: S101: Acquire yarn bobbin images through a camera, each of the yarn bobbin images including four yarn bobbins to be detected; S102: measuring the spatial positional relationship between each yarn bobbin and the camera, calculating an initial transformation matrix according to a three-point projection model, and performing a reverse projection transformation on the yarn bobbin image according to the transformation matrix; S103: performing yarn bobbin edge contour filtering on the yarn bobbin image after the inverse projection transformation, retaining edge information through high-frequency enhancement, and enhancing contrast through histogram equalization; S104: Segmenting the yarn tube area on the image using the Ostu algorithm, extracting the inner and outer tube contour edges of the yarn tube, fitting the yarn tube using a double-endpoint Bezier curve, and correcting the predicted curvature in the fitting process using the least square method to fill in the missing edge portions; S105: Calculating geometric features of the inner and outer cylinder regions, calculating four width differences in two directions of the inner and outer cylinders based on angle information in the geometric features, and judging the effect of the initial back-projection transformation based on the geometric features and the four width differences; S106: setting a compensation matrix for the bobbin image whose initial transformation effect does not meet the preset requirements, and iteratively correcting the compensation matrix according to the element transformation characteristics of the compensation matrix and the quantitative relationship of the four width differences; S107: performing a back projection transformation on the image after the initial transformation according to the modified compensation matrix, and expanding the circular bobbin area into a matrix area by using an elliptical polar coordinate transformation model considering angle information on the image after the second back projection transformation; S108: performing image segmentation on the unfolded rectangular yarn tube area to segment the yarn area, and calculating the yarn remainder on the yarn tube according to a yarn remainder calculation rule.
2. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: The initial transformation matrix is obtained by multiplying the axis translation matrix, the projection matrix and the rotation matrix. The corresponding axis displacement and axis rotation angle are determined by the spatial position relationship between the camera and the yarn tube. T for: in, M 1. M 4 are the image rotation around the Z and Y axes θ 、 φ The rotation matrix of degrees, M 2 is the translation matrix, that is, the image is translated by l, m, and n units along the X, Y, and Z axes respectively. M 3 is the projection matrix; in, B 、 T are the length and width of the minimum circumscribed rectangle of the bobbin area respectively.
3. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: In the yarn cone edge profile filtering, the filtering criterion for high-frequency enhancement is: in, GrayValue is the grayscale value of the pixel after filtering, round For rounding operation, mean is the overall grayscale mean of the image, Factor is the grayscale gain factor, which is 0.
5. origval is the original grayscale value of the pixel.
4. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: The S104 specifically includes: S1041: Obtain the starting point of the known contour and two control points on the contour, and perform cubic Bezier curve fitting; S1042: Segment the known arc contour and collect the curvature change rates of different segments; S1043: searching for the curvature change rate of the known contour according to the curvature change rate of the arc contour near the two breakpoints; S1044: Perform contour prediction at two breakpoints simultaneously according to the change rule; S1045: Finally, the two predicted contours are corrected by least squares to correct the predicted curvature during the fitting process and fill in the missing edges.
5. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: The geometric features of the inner and outer cylinders include the roundness of the inner cylinder region, the roundness, direction and area of the outer cylinder region.
6. The method for detecting the remaining amount of yarn in a bobbin based on inverse projection transformation according to claim 1, characterized in that: The compensation matrix P is a three-dimensional matrix. The compensation matrix is divided into four parts according to the image projection transformation effect. 、 is the scaling factor, 、 is the shear factor, 、 is the displacement in the X and Y axis directions, 、 Determines the image's vanishing point.
7. The method for detecting the remaining amount of yarn in a bobbin based on inverse projection transformation according to claim 6, characterized in that: The width difference between the inner and outer cylinders in the regional direction is recorded from left to right as D 1. D 2. The width difference of the area angle in the vertical direction from left to right is recorded as D 3. D 4. The specific steps of S106 are as follows: exist D 1< D 2 and D 4< D 3 o'clock, reduce while increasing Further correction is performed in this iterative cycle until the four width differences in two directions are the same and the roundness of the inner and outer cylinders reaches 1, completing the correction.
8. The method for detecting the remaining amount of yarn in a bobbin based on inverse projection transformation according to claim 7, characterized in that: The iteration constraints are: in C 1. C 2 are the roundness values of the inner and outer cylinders respectively, is the variance of the four width differences between the inner and outer cylinders, Set thresholds for the system.
9. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: The elliptical polar coordinate transformation model considering angle information is: in, is the ellipse rotation angle, X 、 Y is the ellipse model variable in the rectangular coordinate system, a 、 b is the model constant in the rectangular coordinate system, r 、 θ is the ellipse model variable in polar coordinates.
10. The method for detecting yarn remainder of a bobbin based on inverse projection transformation according to claim 1, characterized in that: The margin calculation criteria are: Assume that the polar coordinate expansion of the ellipse is L × W Rectangle, calculate the area of the yarn region in the rectangular region S , then divided by the length of the rectangle L , and obtain the effective width of the yarn area W , the yarn remainder of the bobbin is: in, IR is the actual radius of the inner cylinder, The actual amount of yarn remaining on the bobbin.
Citation Information
Patent Citations
Camera calibration method based on inverse projection transformation
CN106127787A
Yarn cone identification method and system based on circular convolution kernel under complex background
CN114663457A