Method and device for determining walking speed of cloth inspecting machine
The walking speed of the fabric inspection machine is calculated through image stitching and template matching algorithms, which solves the error and damage problems caused by contact measurement and realizes high-precision non-contact measurement.
Patent Information
- Application Number
- CN202510789620.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-26
AI Technical Summary
Existing cloth inspection machines use contact encoders to measure cloth speed, which causes the measurement results to be affected by the surface characteristics of the cloth and the contact pressure, resulting in inaccurate measurements and possible damage to the cloth.
By acquiring and splicing cloth images, the target pattern is identified using a template matching algorithm, and the walking speed is calculated based on the number of image pixels and time interval to achieve non-contact measurement.
It achieves high-precision, real-time measurement of cloth speed and position, avoids errors and cloth damage caused by encoder wheel contact measurement, and improves detection efficiency and accuracy.
Smart Images

Figure CN120707593A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cloth defect quality inspection, and in particular to a method and device for determining the walking speed of a cloth inspection machine. Background Art
[0002] In the process of intelligent upgrading of the modern textile industry, intelligent fabric inspection machines, leveraging image recognition technology, enable efficient detection of fabric defects, significantly improving quality inspection efficiency and accuracy, becoming a key piece of equipment for technological innovation in the industry. During the fabric inspection process, it is essential to know the precise fabric travel position. Based on this travel position, detected defects can be accurately mapped to the actual physical location of the fabric. However, measuring real-time fabric travel speed is crucial for measuring travel position, and precise fabric travel speed measurement is also required for precisely controlling fabric movement and stop positions. Therefore, accurate fabric travel speed measurement is a key function of intelligent fabric inspection machines.
[0003] At present, the industry generally adopts the method of contact between encoder and fabric to measure position and speed. The principle is to use the movement of fabric to drive the encoder wheel to rotate, and calculate the fabric length through the output pulse of the encoder. However, this contact measurement method still has significant defects: (1) The encoder wheel and the fabric surface are prone to slipping due to insufficient friction, which makes the pulse count inaccurate and affects the accuracy of the fabric position information; (2) Under different tensions, the degree of fabric stretching varies, resulting in the encoder wheel rotation distance not matching the actual fabric movement distance, causing measurement errors; (3) When the fabric moves backward, the encoder wheel pulse counting logic cannot accurately match the actual movement direction, further accumulating measurement errors; (4) The continuous pressure of the encoder wheel can easily cause indentations or damage to the fabric surface, damaging the fabric quality, especially for high-end fabrics with soft textures such as silk and chiffon.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] The embodiments of the present application provide a method and device for determining the walking speed of a cloth inspection machine, so as to at least solve the technical problem that the related art uses a contact method to measure the walking speed of the cloth inspection machine, and the measurement results are affected by the surface characteristics of the cloth and the contact pressure, resulting in inaccurate measurement results.
[0006] According to one aspect of an embodiment of the present application, a method for determining the cloth traveling speed of a cloth inspection machine is provided, comprising: during the cloth traveling process of the cloth inspection machine, obtaining at least two frames of cloth images continuously collected within a preset time interval, and splicing the at least two frames of cloth images to obtain a spliced image; determining the cloth movement direction of the cloth inspection machine within the preset time interval and the number of first pixel points corresponding to the traveling amount based on the spliced image; determining from a preset pattern template library, by using a template matching algorithm, at least one target pattern and a target pattern size of each target pattern in the spliced image, and counting the number of second pixel points occupied by at least one target pattern in the cloth movement direction, wherein the pattern template library includes multiple pattern templates and the pattern size of each pattern template; determining the traveling speed of the cloth inspection machine based on the preset time interval, the first number of pixel points, the second number of pixel points, and the target pattern size of any target pattern.
[0007] Optionally, at least two frames of cloth images are spliced to obtain a spliced image, including: performing a two-dimensional Fourier transform on each frame of cloth image to obtain a phase spectrum of each frame of cloth image; for two consecutive frames of cloth images, calculating the phase correlation of the phase spectra of each of the two consecutive frames of cloth images to obtain displacement information between the two consecutive frames of cloth images, and translating one frame of the two consecutive frames of cloth images based on the displacement information to align it with the other frame of the two consecutive frames of cloth images; and splicing the aligned frames of cloth images to obtain a spliced image.
[0008] Optionally, splicing at least two frames of cloth images to obtain a spliced image also includes: using a feature point detection algorithm to extract the feature point sets of each frame of cloth image; for two consecutive frames of cloth images, performing feature point matching on the feature point sets of each of the two consecutive frames of cloth images, and determining the transformation matrix between the two consecutive frames of cloth images based on the successfully matched feature points; performing a geometric transformation on one frame of the two consecutive frames of cloth images based on the transformation matrix to align it with the other frame of the two consecutive frames of cloth images; and splicing the aligned frames of cloth images to obtain a spliced image.
[0009] Optionally, the cloth movement direction and the first pixel point number corresponding to the walking amount of the cloth inspection machine within a preset time interval are determined based on the stitched image, including: respectively determining the first pixel coordinates and the second pixel coordinates of the midpoints of the first frame cloth image and the last frame cloth image in at least two frames of cloth images in the stitched image; determining the difference between the first pixel coordinate and the second pixel coordinate; when the difference is greater than zero, determining that the cloth movement direction of the cloth inspection machine within the preset time interval is a positive direction, and using the difference as the first pixel point number corresponding to the walking amount of the cloth inspection machine within the preset time interval; when the difference is less than zero, determining that the cloth movement direction of the cloth inspection machine within the preset time interval is a reverse direction, and using the absolute value of the difference as the first pixel point number corresponding to the walking amount of the cloth inspection machine within the preset time interval.
[0010] Optionally, a template matching algorithm is used to determine at least one target pattern pattern and a target pattern size of each target pattern pattern in the stitched image from a preset pattern template library, including: determining multiple sliding windows of the same size as each pattern template in the pattern template library; for each sliding window, sliding the stitched image within the sliding window, and calculating the normalized mutual correlation coefficient between the pattern template and the local stitched image at each sliding position; taking the pattern pattern corresponding to the local stitched image whose normalized mutual correlation coefficient is higher than a preset first threshold value as the target pattern pattern contained in the stitched image, and determining the target pattern size corresponding to the target pattern image from the pattern template library.
[0011] Optionally, a template matching algorithm is used to determine from a preset pattern template library that at least one target pattern and a target pattern size of each target pattern are contained in the stitched image, and the method also includes: performing convolution operations on the stitched image with multiple pattern templates in the pattern template library to obtain multiple response images, wherein the pixel value of each pixel point in the response image is used to characterize the similarity between the stitched image and the pattern template at the pixel point; for each response image, the pattern pattern corresponding to the local stitched image whose pixel value in the response image is higher than a preset second threshold value is used as the target pattern pattern contained in the stitched image, and determining the target pattern size corresponding to the target pattern image from the pattern template library.
[0012] Optionally, the walking speed of the cloth inspection machine is determined based on a preset time interval, the first number of pixels, the second number of pixels and the target pattern size, including: calculating the quotient of the target pattern size and the second number of pixels, and using the quotient as the physical size of the pixel; calculating the product of the physical size of the pixel and the first number of pixels, and dividing the resulting product by the preset time interval to obtain the walking speed of the cloth inspection machine.
[0013] According to another aspect of an embodiment of the present application, a device for determining the cloth traveling speed of a cloth inspection machine is provided, comprising: an image processing module for acquiring at least two frames of cloth images continuously collected within a preset time interval during the cloth traveling process of the cloth inspection machine, and splicing the at least two frames of cloth images to obtain a spliced image; a second image analysis module for determining, based on the spliced image, the cloth movement direction of the cloth inspection machine within the preset time interval and the number of first pixel points corresponding to the walking amount; a first image analysis module for determining, from a preset pattern template library, from a preset pattern template library, at least one target pattern pattern and a target pattern size of each target pattern pattern contained in the spliced image by using a template matching algorithm, and counting the number of second pixel points occupied by at least one target pattern pattern in the cloth movement direction, wherein the pattern template library includes multiple pattern templates and the pattern size of each pattern template; a determination module for determining the walking speed of the cloth inspection machine based on the preset time interval, the first number of pixel points, the second number of pixel points, and the target pattern size of any target pattern pattern.
[0014] According to another aspect of an embodiment of the present application, a computer program product is further provided, comprising: a computer program, wherein when the computer program is executed by a processor, the method for determining the cloth running speed of the cloth inspection machine described above is implemented.
[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned method for determining the cloth running speed of the cloth inspection machine through the computer program.
[0016] In an embodiment of the present application, by splicing together cloth images collected continuously within a preset time interval, and determining the cloth movement direction and the first number of pixels of the cloth moving pixels based on the spliced images, and combining the template matching algorithm to determine the second number of pixels occupied by the target pattern in the spliced image and the actual physical size, the walking speed of the cloth inspection machine is comprehensively determined. This non-contact cloth inspection machine cloth speed measurement method based on image recognition achieves the technical effect of high-precision, real-time cloth cloth speed and position measurement, achieving the purpose of improving the detection efficiency and accuracy of the cloth inspection machine and avoiding errors and cloth damage caused by encoder wheel contact measurement. This solves the technical problem that the related art uses a contact method to measure the cloth inspection machine's cloth speed, and the measurement results are affected by the surface characteristics of the cloth and the contact pressure, resulting in inaccurate measurement results. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 This is a flow chart of an optional method for determining the walking speed of a cloth inspection machine according to an embodiment of the present application;
[0019] Figure 2 1 is a schematic structural diagram of an optional device for determining walking speed of a cloth inspection machine according to an embodiment of the present application;
[0020] Figure 3 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0022] It should be noted that the terms "first", "second", etc. in the specification, claims, and drawings of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0023] In order to better understand the embodiments of the present application, some nouns or terms that appear in the description of the embodiments of the present application are first translated and explained as follows:
[0024] The fabric inspection machine is a specialized device for inspecting large-format, double-width, and single-width fabrics such as cotton, linen, wool, silk, and chemical fibers before production in the garment industry. It automatically records length and organizes rolls, and is equipped with an electronic defect detection device. Computerized statistical analysis assists with fabric inspection and prints output.
[0025] Template matching is an advanced computer vision technique that identifies portions of an image that match a predefined template. It works by moving a template across the image and calculating the similarity between the template and the overlaid window on the image. Therefore, template matching can be achieved through two-dimensional convolution. During convolution, the output pixel value is obtained by multiplying the elements of two matrices together and summing the results. One matrix represents the image itself, and the other represents the template (i.e., the convolution kernel).
[0026] Normalized Cross-Correlation (NCC): A statistical method used to measure the similarity between two sets of data. In computer vision, NCC is often used in template matching to determine the similarity between different regions in an image and a specific template. NCC values range from -1 to 1, where 1 indicates perfect correlation, 0 indicates no correlation, and -1 indicates no correlation at all.
[0027] Example 1
[0028] According to an embodiment of the present application, a method for determining the cloth running speed of a cloth inspection machine is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0029] Figure 1 1 is a flow chart of a method for determining the cloth speed of a cloth inspection machine according to an embodiment of the present application. Figure 1 As shown, the method includes the following steps:
[0030] Step S102 : during the cloth running process of the cloth inspection machine, obtaining at least two consecutive cloth image frames collected within a preset time interval, and splicing the at least two cloth image frames to obtain a spliced image.
[0031] Step S104 , determining the cloth movement direction and the number of first pixel points corresponding to the movement amount of the cloth inspection machine within a preset time interval based on the spliced image.
[0032] In step S106, a template matching algorithm is used to determine, from a preset pattern template library, at least one target pattern and a target pattern size for each target pattern in the stitched image, and the number of second pixels occupied by the at least one target pattern in the direction of cloth movement is counted. The pattern template library includes multiple pattern templates and a pattern size for each pattern template.
[0033] Step S108 , determining the walking speed of the fabric inspection machine according to the preset time interval, the number of the first pixel points, the number of the second pixel points, and the target pattern size of any target pattern.
[0034] Based on the scheme defined in steps S102 to S108 above, it can be seen that in the embodiment of the present application, by splicing the cloth images continuously collected within a preset time interval, and determining the cloth movement direction and the first number of pixels of the cloth moving pixels based on the spliced images, and combining the template matching algorithm to determine the second number of pixels occupied by the target pattern in the spliced image and the actual physical size, the walking speed of the cloth inspection machine is comprehensively determined. This non-contact cloth inspection machine cloth speed measurement method based on image recognition achieves the technical effect of high-precision, real-time cloth cloth speed and position measurement, achieving the purpose of improving the detection efficiency and accuracy of the cloth inspection machine and avoiding errors and cloth damage caused by encoder wheel contact measurement.
[0035] The following describes the steps of the method for determining the cloth speed of the cloth inspection machine in combination with a specific implementation process.
[0036] As an optional implementation, the system can first use an industrial camera (including but not limited to high-speed cameras, high-resolution cameras, etc.) to shoot the cloth at a fixed frame rate during the cloth inspection machine's cloth feeding process, thereby obtaining at least two frames of cloth images continuously collected within a preset time interval to ensure the clarity and continuity of the collected cloth images.
[0037] Next, an image stitching algorithm precisely aligns and stitches the continuously captured fabric images, eliminating any overlapping areas and creating a complete, non-repetitive stitched image. This process not only ensures the continuity and integrity of the image information but also provides an accurate image basis for calculating fabric travel.
[0038] Optionally, in the technical solution provided in step S102 above, the system may stitch at least two frames of cloth images through the following steps, including:
[0039] Step 1: Perform a 2D Fourier transform on each frame of the cloth image to obtain its phase spectrum. This step utilizes frequency domain analysis techniques from image processing. By performing a 2D Fourier transform on each frame of the cloth image, the image is converted from the spatial domain to the frequency domain, thereby extracting the phase information from the cloth image. The phase spectrum reflects characteristics such as texture and edges of the cloth image.
[0040] Step 2: For two consecutive frames of cloth images, the phase correlation of their respective phase spectra is calculated to obtain the displacement information between the two consecutive frames of cloth images. Based on the displacement information, one of the two consecutive frames of cloth images is translated to align it with the other frame of cloth images. In other words, the system accurately calculates the displacement information along the x-axis and y-axis between the two consecutive frames of cloth images by analyzing the similarity of the two consecutive cloth images in the frequency domain. Then, based on the calculated displacement information, one of the frames of cloth images is translated to achieve visual alignment with the other frame of cloth image. This displacement calculation based on phase information can accurately capture subtle changes in cloth movement and improve the accuracy of image stitching.
[0041] Step 3: Stitch the aligned cloth image frames together to create a stitched image. Specifically, an image stitching algorithm seamlessly connects the aligned consecutive cloth image frames, ensuring smooth transitions at the stitching points and avoiding obvious boundaries or overlaps, to form a stitched image that fully reflects the cloth's motion trajectory.
[0042] In the above-mentioned phase-based image stitching algorithm, the phase spectrum is used to calculate the image displacement and perform translational alignment before image stitching. This series of operations effectively overcomes the challenges in traditional image stitching, especially for objects such as cloth with complex textures and potential motion changes. It achieves high-precision image stitching and provides technical support for the accurate measurement of cloth running speed.
[0043] As an optional implementation, in the technical solution provided in the above step S102, the system may stitch at least two frames of cloth images through the following steps, including:
[0044] Step 1: Use a feature point detection algorithm to extract a set of feature points for each frame of the cloth image. This set of feature points includes points with unique properties in the cloth image, such as corners, edges, or other texture features. These feature points are typically scale- and rotation-invariant, allowing them to be accurately detected even when the image is scaled or rotated.
[0045] Step 2: For two consecutive frames of cloth images, perform feature point matching on the feature point sets of each of the two consecutive frames of cloth images, and determine the transformation matrix between the two consecutive frames of cloth images based on the successfully matched feature points; perform geometric transformation on one frame of cloth image in the two consecutive frames of cloth images based on the transformation matrix to align it with the other frame of cloth image in the two consecutive frames of cloth images.
[0046] In this step, the matching of feature points can be based on local descriptors of feature points, such as SIFT (Scale-Invariant Feature Transform), SURF (Speeded Up Robust Features) or ORB (Oriented FAST and Rotated BRIEF), etc. By comparing the descriptors of feature points, it is determined which feature points represent the same object or texture in the two cloth images, so as to find multiple sets of successfully matched feature point pairs; the successfully matched feature points are then analyzed by the least squares method to estimate the optimal perspective transformation, affine transformation or Euclidean transformation parameters, that is, the transformation matrix between the two consecutive frames of cloth images is obtained, wherein the matrix describes the translation, rotation and possible scaling relationship between the two consecutive frames of cloth images; next, one of the two consecutive frames of cloth images is geometrically transformed according to the transformation matrix to align it with the other frame of the two consecutive frames of cloth images.
[0047] Step 3: Stitch the aligned cloth image frames together to create a stitched image. Similarly, an image stitching algorithm seamlessly connects the aligned consecutive cloth image frames, ensuring smooth transitions at the stitching points and avoiding obvious boundaries or overlaps, to form a stitched image that fully reflects the cloth's motion trajectory.
[0048] This feature-point-based image stitching method achieves precise alignment and stitching of cloth images through feature point extraction, matching, and transformation matrix estimation. Even with rapid or irregular cloth movement, high-quality stitched images can be obtained, providing accurate data support for the next step of cloth speed measurement.
[0049] In addition to the several implementation schemes listed above, based on the basic concept of the present invention, those skilled in the art can also implement image stitching through other technical solutions. For example, those skilled in the art may make changes to the above implementation schemes, which should also be within the scope of protection of the present invention.
[0050] As an optional implementation, in the technical solution provided in the above step S104, the method may include:
[0051] Step 1: Determine the first pixel coordinate (y1, x1) and the second pixel coordinate (y2, x2) of the midpoint of the first and last cloth frames in the stitched image. This embodiment of the present application focuses on the coordinate change along the direction of cloth movement, i.e., the coordinate difference in the y direction.
[0052] Step 2: Determine the difference between the first pixel coordinate and the second pixel coordinate. That is, calculate the difference in the y-axis direction, Δy = y2 - y1. This difference indicates the relative movement of the cloth in the cloth image from the previous frame to the next.
[0053] Step 3: If the difference is greater than zero (i.e., Δy>0), it means that the y coordinate of the middle point in the next frame of the cloth image is higher than the y coordinate of the middle point in the previous frame, indicating that the cloth movement direction of the cloth inspection machine within the preset time interval is positive (i.e., moving in the normal walking direction). In this case, the difference can be used as the number of first pixels corresponding to the walking distance (i.e., the cloth movement distance) of the cloth inspection machine within the preset time interval;
[0054] Step 4: If the difference is less than zero (i.e., Δy < 0), it means that the y coordinate of the midpoint in the next frame of the cloth image is lower than the y coordinate of the midpoint in the previous frame, indicating that the cloth movement direction of the cloth inspection machine during the preset time interval is in the opposite direction (i.e., cloth backing has occurred). In this case, the absolute value of the difference can be used as the number of first pixels corresponding to the amount of movement (i.e., the amount of cloth movement) of the cloth inspection machine during the preset time interval.
[0055] In the above embodiment, quantitative analysis within the image coordinate system not only identifies the direction of cloth movement within the inspection machine, but also accurately measures the amount of cloth movement within a preset time interval, expressing this movement as a number of pixels. This method is advantageous in that it accommodates both forward and reverse cloth movement and requires no additional hardware contact, thus avoiding the potential errors and damage to the fabric associated with traditional contact measurement.
[0056] As an optional implementation, in the technical solution provided in the above step S106, the method may include:
[0057] Step 1: Determine a plurality of sliding windows having the same size as the pattern templates in the pattern template library.
[0058] Step 2: For each sliding window, slide the stitched image within the sliding window and calculate the normalized cross-correlation (NCC) coefficient between the pattern template and the local stitched image at each sliding position.
[0059] The Normalized Cross Correlation Coefficient (NCC) is a metric that measures the degree of similarity between a local region of an image and a template. Therefore, in this embodiment, the template is compared with the local image within each sliding window on the stitched image. By calculating the NCC value, a similarity score between the local image and the pattern template is obtained. The NCC value ranges from -1 to 1, with values closer to 1 indicating a higher similarity, closer to -1 indicating an anti-correlation, and 0 indicating no correlation.
[0060] Step 3: taking the pattern corresponding to the local stitching image whose normalized correlation coefficient is higher than a preset first threshold as the target pattern contained in the stitching image, and determining the target pattern size corresponding to the target pattern image from the pattern template library.
[0061] The normalized cross-correlation-based template matching algorithm utilizes the statistical properties of NCC values and, by setting a threshold to filter regions of high similarity, automatically identifies the target pattern and its size within the stitched image. This method not only handles complex backgrounds and lighting variations, but also ensures consistent and robust recognition results.
[0062] As another optional implementation, in the technical solution provided in the above step S106, the method may include:
[0063] Step 1: Perform convolution operations on multiple pattern templates in the pattern template library and the spliced image respectively to obtain multiple response images.
[0064] The convolution operation essentially compares the stitched image with each pattern template pixel by pixel, calculating the correlation between the two at each position to generate a series of response images. The pixel value of each response image reflects the degree of similarity between the stitched image and the specific pattern template at that position, that is, the match / similarity between the stitched image and the pattern template at that position. This process utilizes convolutional neural networks or convolution filters in traditional image processing to efficiently search for patterns similar to the template in large-scale images.
[0065] Step 2: For each response image, the pattern corresponding to the local stitching image whose pixel value in the response image is higher than the preset second threshold value is used as the target pattern contained in the stitching image, and the target pattern size corresponding to the target pattern image is determined from the pattern template library.
[0066] The aforementioned feature-point-based template matching algorithm utilizes convolution operations for efficient image feature extraction and comparison, combined with threshold filtering techniques to automatically identify target patterns and their sizes within the stitched image. This automated processing method not only improves recognition speed but also accurately determines the presence and size of different patterns, ensuring accurate recognition even against complex fabric textures.
[0067] Furthermore, the number of second pixel points occupied by at least one target pattern in the moving direction of the cloth is counted.
[0068] As an optional implementation, in the technical solution provided in the above step S108, the method may include:
[0069] Step 1: Calculate the quotient of the target pattern size and the number of the second pixel points, and use this quotient as the physical size of the pixel points. The target pattern size is the actual physical size of the template, manually collected before operation and stored in the system database. It generally refers to the length of the target pattern in the direction of cloth movement.
[0070] Therefore, by dividing the actual physical size of the target pattern by the number of pixels it occupies in the image, we can obtain the physical size k corresponding to a single pixel, that is, the length of a single pixel. This physical size k is a key parameter in the entire velocity calculation process. It establishes the connection between image pixels and the real physical world, allowing the fabric movement changes in the image to be converted into actual physical displacement.
[0071] Step 2: Calculate the product of the physical size of the pixel and the number of the first pixel points, and divide the obtained product by the preset time interval to obtain the walking speed of the fabric inspection machine.
[0072] The product of the physical size of the pixel and the number of the first pixel points is the actual physical displacement of the cloth within the preset time interval. Since the preset time interval is known, the travel speed of the cloth inspection machine can be obtained by dividing the above product by the time interval. If the cloth is moving in the positive direction, the travel speed is positive; conversely, if the cloth is moving in the negative direction (i.e., retracting the cloth), the travel speed is negative.
[0073] This method uses the correspondence between image pixels and physical dimensions, combined with time intervals, to achieve accurate non-contact measurement of walking speed, avoiding the limitations and errors of traditional contact measurement methods.
[0074] In the aforementioned, rarely used method for determining the cloth speed of a cloth inspection machine, an image stitching algorithm is used to automatically identify the forward and reverse motion of the cloth. This allows the correct cloth speed to be obtained regardless of whether the cloth is moving forward or backward, resolving the measurement difficulty during reverse motion. Simultaneously, a template matching algorithm accurately identifies the patterns on the cloth and calculates the ratio of the number of pixels of these patterns in the image to their actual physical dimensions, establishing a correspondence between the image pixels and the real physical world. This avoids measurement errors caused by encoder wheel slippage and cloth stretching, and improves the accuracy of speed and position measurements. Furthermore, the embodiments of the present application primarily rely on automated processing of image recognition and algorithms, reducing reliance on hardware and lowering maintenance and upgrade costs. Furthermore, the operator does not need to perform complex adjustments and calibrations, improving the device's ease of use. Therefore, the embodiments of the present application effectively address many of the difficulties in measuring the cloth speed of traditional cloth inspection machines, not only improving measurement accuracy but also significantly enhancing the flexibility and applicability of the equipment. This has important practical significance for improving quality control and production efficiency in the textile industry.
[0075] Example 2
[0076] According to an embodiment of the present application, a device for determining the cloth running speed of a cloth inspection machine is provided for implementing the method for determining the cloth running speed of the cloth inspection machine in embodiment 1. Figure 2 As shown, the cloth speed determination device of the cloth inspection machine includes at least: an image processing module 22, a first image analysis module 24, a second image analysis module 26 and a determination module 28, wherein:
[0077] The image processing module 22 is used to obtain at least two frames of cloth images continuously collected within a preset time interval during the cloth running process of the cloth inspection machine, and to splice the at least two frames of cloth images to obtain a spliced image;
[0078] The first image analysis module 24 is used to determine the cloth movement direction and the number of first pixel points corresponding to the movement amount of the cloth inspection machine within a preset time interval based on the spliced image;
[0079] a second image analysis module 26 for determining, using a template matching algorithm, from a preset pattern template library that includes a plurality of pattern templates and a target pattern size of each target pattern in the stitched image, and counting the number of second pixels occupied by the at least one target pattern in the direction of movement of the cloth;
[0080] The determination module 28 is used to determine the walking speed of the cloth inspection machine according to the preset time interval, the number of the first pixel points, the number of the second pixel points and the target pattern size of any target pattern.
[0081] The functions of each module of the cloth speed determination device of the cloth inspection machine are described below in conjunction with a specific implementation process.
[0082] Optionally, the image processing module 22 may splice at least two frames of cloth images through the following steps, including:
[0083] Step 1: Perform two-dimensional Fourier transform on each frame of cloth image to obtain the phase spectrum of each frame of cloth image.
[0084] Step 2: For two consecutive frames of cloth images, calculate the phase correlation of the phase spectra of the two consecutive frames of cloth images to obtain the displacement information between the two consecutive frames of cloth images, and translate one frame of the two consecutive frames of cloth images based on the displacement information to align it with the other frame of the two consecutive frames of cloth images.
[0085] Step 3: Stitch the aligned cloth image frames together to produce a stitched image. In the phase-based image stitching algorithm described above, the first image analysis module 24 uses the phase spectrum to calculate image displacement and perform translational alignment before stitching. This series of operations effectively overcomes the challenges of traditional image stitching, particularly for objects with complex textures and potential motion changes, such as cloth. This enables high-precision image stitching and provides technical support for accurate measurement of cloth travel speed.
[0086] Optionally, the image processing module 22 may further splice at least two frames of cloth images through the following steps, including:
[0087] Step 1: Use the feature point detection algorithm to extract the feature point sets of each frame of cloth image.
[0088] Step 2: For two consecutive frames of cloth images, perform feature point matching on the feature point sets of each of the two consecutive frames of cloth images, and determine the transformation matrix between the two consecutive frames of cloth images based on the successfully matched feature points; perform geometric transformation on one frame of cloth image in the two consecutive frames of cloth images based on the transformation matrix to align it with the other frame of cloth image in the two consecutive frames of cloth images.
[0089] Step 3: stitch the aligned cloth image frames together to obtain a stitched image.
[0090] Image processing module 22 uses this feature-point-based image stitching method, extracting and matching feature points, and estimating transformation matrices to achieve precise alignment and stitching of cloth images. Even with rapid or irregular cloth movement, high-quality stitched images can be obtained, providing accurate data support for subsequent cloth speed measurement.
[0091] Furthermore, the first image analysis module 24 may process the stitched image according to the following steps, including:
[0092] Step 1: Determine the first pixel coordinate (y1, x1) and the second pixel coordinate (y2, x2) of the midpoint of the first and last cloth frames in the stitched image. This embodiment of the present application focuses on the coordinate change along the direction of cloth movement, i.e., the coordinate difference in the y direction.
[0093] Step 2: Determine the difference between the first pixel coordinate and the second pixel coordinate. That is, calculate the difference in the y-axis direction, Δy = y2 - y1. This difference indicates the relative movement of the cloth in the cloth image from the previous frame to the next.
[0094] Step 3: If the difference is greater than zero (i.e., Δy>0), it means that the y coordinate of the middle point in the next frame of the cloth image is higher than the y coordinate of the middle point in the previous frame, indicating that the cloth movement direction of the cloth inspection machine within the preset time interval is positive (i.e., moving in the normal walking direction). In this case, the difference can be used as the number of first pixels corresponding to the walking distance (i.e., the cloth movement distance) of the cloth inspection machine within the preset time interval;
[0095] Step 4: If the difference is less than zero (i.e., Δy < 0), it means that the y coordinate of the midpoint in the next frame of the cloth image is lower than the y coordinate of the midpoint in the previous frame, indicating that the cloth inspection machine has moved in the opposite direction (i.e., regressed) during the preset time interval. In this case, the absolute value of the difference can be used as the number of first pixels corresponding to the amount of movement (i.e., the amount of cloth movement) of the cloth inspection machine during the preset time interval.
[0096] Optionally, the second image analysis module 26 may perform processing according to the following steps, including:
[0097] Step 1: Determine multiple sliding windows with the same size as the pattern templates in the pattern template library.
[0098] Step 2: For each sliding window, slide the stitched image within the sliding window and calculate the normalized correlation coefficient between the pattern template and the local stitched image at each sliding position.
[0099] The Normalized Cross Correlation Coefficient (NCC) is a metric that measures the degree of similarity between a local region of an image and a template. Therefore, in this embodiment, the template is compared with the local image within each sliding window on the stitched image. By calculating the NCC value, a similarity score between the local image and the pattern template is obtained. The NCC value ranges from -1 to 1, with values closer to 1 indicating a higher similarity, closer to -1 indicating an anti-correlation, and 0 indicating no correlation.
[0100] Step 3: taking the pattern corresponding to the local stitching image whose normalized correlation coefficient is higher than a preset first threshold as the target pattern contained in the stitching image, and determining the target pattern size corresponding to the target pattern image from the pattern template library.
[0101] The template matching algorithm based on normalized cross-correlation utilizes the statistical properties of normalized cross-correlation and uses a threshold to filter out regions of high similarity, automatically identifying the target pattern and its size within the stitched image. This method not only handles complex backgrounds and lighting variations, but also ensures consistent and robust recognition results.
[0102] Optionally, the second image analysis module 26 may also perform processing according to the following steps, including:
[0103] Step 1: Perform convolution operations on multiple pattern templates in the pattern template library and the spliced image respectively to obtain multiple response images.
[0104] The convolution operation essentially compares the stitched image with each pattern template pixel by pixel, calculating the correlation between the two at each position to generate a series of response images. The pixel value of each response image reflects the degree of similarity between the stitched image and the specific pattern template at that position, that is, the match / similarity between the stitched image and the pattern template at that position. This process utilizes convolutional neural networks or convolution filters in traditional image processing to efficiently search for patterns similar to the template in large-scale images.
[0105] Step 2: For each response image, the pattern corresponding to the local stitching image whose pixel value in the response image is higher than the preset second threshold value is used as the target pattern contained in the stitching image, and the target pattern size corresponding to the target pattern image is determined from the pattern template library.
[0106] The aforementioned feature-point-based template matching algorithm utilizes convolution operations for efficient image feature extraction and comparison, combined with threshold filtering techniques to automatically identify target patterns and their sizes within the stitched image. This automated processing method not only improves recognition speed but also accurately determines the presence and size of different patterns, ensuring accurate recognition even against complex fabric textures.
[0107] Optionally, the determination module 28 may determine the walking speed of the cloth inspection machine according to the following steps, including:
[0108] Step 1: Calculate the quotient of the target pattern size and the number of the second pixel points, and use this quotient as the physical size of the pixel points. The target pattern size is the actual physical size of the template, manually collected before operation and stored in the system database. It generally refers to the length of the target pattern in the direction of cloth movement.
[0109] Therefore, by dividing the actual physical size of the target pattern by the number of pixels it occupies in the image, we can obtain the physical size k corresponding to a single pixel, that is, the length of a single pixel. This physical size k is a key parameter in the entire velocity calculation process. It establishes the connection between image pixels and the real physical world, allowing the fabric movement changes in the image to be converted into actual physical displacement.
[0110] Step 2: Calculate the product of the physical size of the pixel and the number of the first pixel points, and divide the obtained product by the preset time interval to obtain the walking speed of the fabric inspection machine.
[0111] The product of the physical size of the pixel and the number of the first pixel is the actual physical displacement of the cloth within the preset time interval. The preset time interval is known, and the travel speed of the cloth inspection machine can be obtained by dividing the above product by the time interval.
[0112] This method uses the correspondence between image pixels and physical dimensions, combined with time intervals, to achieve accurate non-contact measurement of walking speed, avoiding the limitations and errors of traditional contact measurement methods.
[0113] It should be noted that the modules in the device for determining the cloth running speed of the cloth inspection machine in the embodiment of the present application correspond one to one with the implementation steps of the method for determining the cloth running speed of the cloth inspection machine in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be elaborated on here.
[0114] Example 3
[0115] According to an embodiment of the present application, a computer program product is further provided, which includes a computer program, wherein when the computer program is executed by a processor, the method for determining the cloth speed of the cloth inspection machine in Example 1 is implemented.
[0116] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method for determining the cloth speed of the cloth inspection machine in Example 1 by running the computer program.
[0117] According to an embodiment of the present application, a processor is further provided, which is used to run a computer program, wherein the computer program executes the method for determining the cloth speed of the cloth inspection machine in Example 1 when running.
[0118] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the method for determining the cloth speed of the cloth inspection machine in Example 1 through the computer program.
[0119] Specifically, the computer program executes the following steps when it is running: during the cloth movement of the cloth inspection machine, at least two frames of cloth images continuously collected within a preset time interval are obtained, and the at least two frames of cloth images are spliced to obtain a spliced image; the cloth movement direction of the cloth inspection machine within the preset time interval and the number of first pixel points corresponding to the walking amount are determined based on the spliced image; a template matching algorithm is used to determine from a preset pattern template library that the spliced image contains at least one target pattern and a target pattern size of each target pattern, and the number of second pixel points occupied by at least one target pattern in the cloth movement direction is counted, wherein the pattern template library includes multiple pattern templates and the pattern size of each pattern template; the walking speed of the cloth inspection machine is determined based on the preset time interval, the first number of pixel points, the second number of pixel points and the target pattern size of any target pattern.
[0120] As an optional implementation, the electronic device may be in the form of a mobile terminal, a computer terminal or a similar computing device. Figure 3 The hardware structure block diagram of an electronic device for implementing a method for determining the cloth speed of a cloth inspection machine is shown. Figure 3 As shown, the electronic device 30 may include one or more (illustrated as 302a, 302b, ..., 302n in the figure) processors 302 (the processor 302 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 304 for storing data, and a transmission device 306 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 3 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 3 More or fewer components than shown, or with Figure 3 Different configurations shown.
[0121] It should be noted that the one or more processors 302 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the electronic device 30. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0122] The memory 304 can be used to store software programs and modules for application software, such as the program instructions / data storage device corresponding to the method for determining the cloth speed of the cloth inspection machine in the embodiment of the present application. The processor 302 executes the software programs and modules stored in the memory 304 to execute various functional applications and data processing, thereby implementing the aforementioned application vulnerability detection method. The memory 304 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 304 may further include memory remotely located relative to the processor 302, and such remote memory may be connected to the electronic device 30 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0123] The transmission device 306 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by the communications provider of the electronic device 30. In one embodiment, the transmission device 306 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, the transmission device 306 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0124] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 30 .
[0125] The serial numbers of the above embodiments are for description only and do not represent the advantages or disadvantages of the embodiments.
[0126] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0127] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0128] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.
[0129] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0130] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program code.
[0131] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining the cloth speed of a cloth inspection machine, characterized in that: include: During the cloth running process of the cloth inspection machine, at least two frames of cloth images continuously captured within a preset time interval are acquired, and the at least two frames of cloth images are spliced to obtain a spliced image; Determining, based on the stitched image, the cloth movement direction and the number of first pixel points corresponding to the walking amount of the cloth inspection machine within the preset time interval; Determining, using a template matching algorithm, from a preset pattern template library, at least one target pattern and a target pattern size of each target pattern in the stitched image, and counting the number of second pixels occupied by the at least one target pattern in the direction of movement of the cloth, wherein the pattern template library includes a plurality of pattern templates and a pattern size of each pattern template; The walking speed of the fabric inspection machine is determined according to the preset time interval, the number of the first pixel points, the number of the second pixel points, and the target pattern size of any target pattern.
2. The method according to claim 1, characterized in that The at least two frames of cloth images are stitched together to obtain a stitched image, comprising: Performing a two-dimensional Fourier transform on each frame of the cloth image to obtain a phase spectrum of each frame of the cloth image; For two consecutive frames of cloth images, the phase correlation of the phase spectra of the two consecutive frames of cloth images is calculated to obtain the displacement information between the two consecutive frames of cloth images, and one of the two consecutive frames of cloth images is translated according to the displacement information to align it with the other frame of cloth image in the two consecutive frames of cloth images; The aligned frames of the cloth images are spliced together to obtain the spliced image.
3. The method according to claim 1, characterized in that The method further comprises: stitching the at least two frames of cloth images to obtain a stitched image; Extracting feature point sets of each of the cloth images in each frame using a feature point detection algorithm; For two consecutive frames of cloth images, feature point matching is performed on the feature point sets of each of the two consecutive frames of cloth images, and a transformation matrix between the two consecutive frames of cloth images is determined based on the successfully matched feature points; a geometric transformation is performed on one of the two consecutive frames of cloth images based on the transformation matrix to align it with the other frame of cloth image in the two consecutive frames of cloth images; The aligned frames of the cloth images are spliced together to obtain the spliced image.
4. The method according to claim 1, wherein Determining the cloth movement direction and the number of first pixel points corresponding to the walking amount of the cloth inspection machine within the preset time interval based on the spliced image includes: respectively determining first pixel coordinates and second pixel coordinates of midpoints of a first frame of cloth image and a last frame of cloth image in the at least two frames of cloth image in the stitched image; determining a difference between the first pixel coordinate and the second pixel coordinate; When the difference is greater than zero, determining that the cloth movement direction of the cloth inspection machine within the preset time interval is a positive direction, and using the difference as the first pixel number corresponding to the movement amount of the cloth inspection machine within the preset time interval; When the difference is less than zero, it is determined that the cloth movement direction of the cloth inspection machine within the preset time interval is in the opposite direction, and the absolute value of the difference is used as the first pixel point number corresponding to the walking amount of the cloth inspection machine within the preset time interval.
5. The method according to claim 1, wherein Determining at least one target pattern and a target pattern size of each target pattern in the spliced image from a preset pattern template library using a template matching algorithm, including: determining a plurality of sliding windows having the same size as the respective pattern templates in the pattern template library; For each sliding window, sliding the stitched image within the sliding window, and calculating the normalized correlation coefficient between the pattern template and the local stitched image at each sliding position; The pattern corresponding to the local stitched image whose normalized correlation coefficient is higher than a preset first threshold value is used as the target pattern contained in the stitched image, and the target pattern size corresponding to the target pattern image is determined from the pattern template library.
6. The method according to claim 1, wherein The method further comprises: determining, from a preset pattern template library, at least one target pattern and a target pattern size of each target pattern in the spliced image using a template matching algorithm; performing convolution operations on the stitched image with multiple pattern templates in the pattern template library to obtain multiple response images, wherein the pixel value of each pixel in the response image is used to represent the similarity between the stitched image and the pattern template at the pixel point; For each of the response images, a pattern corresponding to a local stitched image having pixel values higher than a preset second threshold value in the response image is used as a target pattern contained in the stitched image, and a target pattern size corresponding to the target pattern image is determined from the pattern template library.
7. The method according to claim 1, characterized in that Determining the walking speed of the fabric inspection machine according to the preset time interval, the number of the first pixel points, the number of the second pixel points, and the target pattern size includes: Calculating a quotient of the target pattern size and the second number of pixels, and using the quotient as the physical size of the pixel; The product of the physical size of the pixel and the number of the first pixel points is calculated, and the obtained product is divided by the preset time interval to obtain the walking speed of the fabric inspection machine.
8. A device for determining the cloth speed of a cloth inspection machine, characterized in that: include: An image processing module is used to obtain at least two frames of cloth images continuously collected within a preset time interval during the cloth running process of the cloth inspection machine, and to splice the at least two frames of cloth images to obtain a spliced image; A second image analysis module is configured to determine, based on the stitched image, a cloth movement direction and a number of first pixel points corresponding to a walking amount of the cloth inspection machine within the preset time interval; a first image analysis module, configured to determine, from a preset pattern template library using a template matching algorithm, at least one target pattern and a target pattern size of each target pattern in the stitched image, and to count the number of second pixels occupied by the at least one target pattern in the direction of movement of the cloth, wherein the pattern template library includes a plurality of pattern templates and a pattern size of each pattern template; A determination module is used to determine the walking speed of the fabric inspection machine based on the preset time interval, the first number of pixels, the second number of pixels and the target pattern size of any target pattern.
9. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the method for determining the cloth speed of the cloth inspection machine according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the method for determining the cloth running speed of the cloth inspection machine according to any one of claims 1 to 7 through the computer program.