Image analysis based needle eye positioning method for embroidery machine

By using an image analysis-based method, combining line laser and image sensor with main drive shaft encoder, the problem of insufficient needle eye positioning accuracy in embroidery machines was solved, achieving high-precision three-dimensional coordinate acquisition and low-cost hardware positioning in complex environments.

CN122329151APending Publication Date: 2026-07-03ZHUJI LEYE MASCH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHUJI LEYE MASCH CO LTD
Filing Date
2026-06-05
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing embroidery machines have insufficient precision in needle eye positioning. In particular, mechanical sensors cannot detect the slight deviations caused by the elastic deformation of the needle bar and mechanical wear under high-speed movement. Binocular camera parallax positioning has large positioning deviations in complex backgrounds, and the problems of light spot interference and background noise are serious.

Method used

Modulated light stripes are generated by a line laser emitter. Combined with an image sensor and a main drive shaft encoder, distorted image sequence processing and Gaussian fitting are performed to calculate the absolute axial displacement value of the needle bar. A three-dimensional point cloud model is reconstructed, closed areas on the needle bar surface are identified and ellipse fitting is performed, and needle eye operation pose data is output.

Benefits of technology

It enables the acquisition of the three-dimensional absolute coordinates of a pinhole under strong metal reflection and complex background, improving positioning accuracy and robustness, reducing false detection rate, simplifying system complexity, and reducing failure rate and maintenance cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122329151A_ABST
    Figure CN122329151A_ABST
Patent Text Reader

Abstract

This invention relates to the field of embroidery machinery control technology, specifically to a needle eye positioning method for embroidery machines based on image analysis. The method includes: projecting a horizontal fan-shaped light strip using a line laser emitter to generate modulated light stripes; outputting a distorted image sequence via an image sensor; performing frame-by-frame analysis and background suppression processing to separate the laser signal and output the stripe center coordinates; acquiring phase signals and establishing a mapping table based on the nonlinear transmission relationship of the embroidery machine needle bar drive mechanism to generate the needle bar axial absolute displacement value; reconstructing a three-dimensional point cloud model of the needle bar surface based on the stripe center coordinates and the needle bar axial absolute displacement value; identifying closed regions in the three-dimensional point cloud model of the needle bar surface and outputting the needle eye working pose data through ellipse fitting. This invention simplifies complexity and reduces the deviation of the absolute coordinates of the needle eye in three-dimensional space by introducing front-end physical modulation and mid-end mechanical priors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embroidery machinery control technology, specifically to a needle eye positioning method for embroidery machines based on image analysis. Background Technology

[0002] In the field of modern industrial automated sewing equipment, especially multi-head computerized embroidery machines, the importance of production efficiency and automation is gradually increasing. These machines typically operate at high speeds (up to 1200 rpm or more), requiring the needle bar mechanism to perform high-frequency reciprocating motion. In key processes such as automatic color changing, broken thread repair, or automatic threading, accurately obtaining the three-dimensional spatial position of the needle eye is a prerequisite for automated operation. Traditional embroidery machines rely on manual threading, which is not only inefficient but also severely impacts overall machine productivity when multiple heads are operating in parallel, as downtime for maintenance of a single head can significantly reduce overall production capacity. Therefore, real-time needle eye positioning technology based on machine vision has become the core key to achieving unmanned operation of embroidery machines.

[0003] Despite the widespread application of automation technology, existing technologies still have significant shortcomings in the specific step of needle eye positioning: Mechanical sensor positioning relies primarily on the angle signal fed back from the encoder of the main drive shaft to calculate the needle bar height. However, this open-loop or semi-closed-loop system cannot detect minute offsets caused by needle bar elastic deformation due to high-speed movement, mechanical clearance wear, or installation errors, and cannot meet the micron-level threading accuracy requirements. Binocular camera parallax positioning requires extremely high stability in camera calibration. High-frequency, intense vibrations generated during high-speed operation of embroidery machines can easily cause micron-level offsets in the relative position of the binocular cameras, thereby disrupting calibration parameters and causing depth calculation failures. Furthermore, needle eye positioning suffers from light spot interference and background noise. In environments with complex fabric textures and strong metallic reflections, the visual positioning method cannot obtain the absolute coordinates of the needle eye in three-dimensional space, resulting in significant positioning deviations.

[0004] To address this, an image analysis-based method for embroidery machine needle eye positioning is proposed. Summary of the Invention

[0005] The purpose of this invention is to provide an image analysis-based needle eye positioning method for embroidery machines to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a needle eye positioning method for embroidery machines based on image analysis, comprising: A horizontal fan-shaped light band is projected onto the needle bar of an embroidery machine using a line laser emitter to generate a modulated light stripe. Based on the modulated light stripe, an image sensor captures images as the needle bar of the embroidery machine crosses the horizontal fan-shaped light band, and a distorted image sequence is output through line exposure delay. The distorted image sequence is analyzed frame by frame and the background is suppressed to separate the laser signal; based on the laser signal, the peak value of the laser energy distribution is calculated by Gaussian fitting algorithm, and the coordinates of the stripe center are output. The phase signal of the main drive shaft encoder is collected. Based on the nonlinear transmission relationship of the needle bar drive mechanism of the embroidery machine, a mapping table between the angle of the main drive shaft and the displacement of the needle bar is established. Combined with the line readout time parameter of the image sensor, the photosensitive moment is obtained. By querying the mapping table, the absolute axial displacement value of the needle bar is generated. Based on the center coordinates of the stripes, the original depth data is obtained through laser triangulation. Based on the absolute displacement value of the needle bar axial direction, a three-dimensional point cloud model of the needle bar surface is reconstructed through motion compensation calculation. Through gradient analysis, the closed regions in the three-dimensional point cloud model of the needle bar surface are identified, ellipse fitting is performed, the fitting center is calculated and transformed to the embroidery machine frame coordinate system, and the needle eye operation pose data is output.

[0007] Preferably, the specific process for generating the modulated light stripe includes: A driving line laser emitter excites a narrowband beam of a preset wavelength, performing aspherical beam expansion in the horizontal dimension and focusing compression in the vertical dimension to construct a horizontal fan-shaped light strip. The horizontal fan-shaped light strip is projected to cover the reciprocating stroke of the embroidery machine needle bar, with the normal direction of the light plane set perpendicular to the axial reciprocating motion axis of the embroidery machine needle bar. During the intersection of the horizontal fan-shaped light strip and the cylindrical metal surface of the needle bar, a lateral optical path offset is generated in the propagation path, modulating the horizontal fan-shaped light strip into a curved and distorted light strip that undulates nonlinearly with the depth of the embroidery machine needle bar surface, and outputting the modulated light strip.

[0008] Preferably, the specific generation process of the distorted image sequence includes: The modulated light stripe penetrates a narrowband filter and is projected onto the pixel array of the image sensor. The narrowband filter blocks stray ambient light in non-laser bands. The rolling shutter timing logic of the image sensor is activated, and the pixel array is driven to open the electronic photosensitive window sequentially according to the row readout time interval parameter. During the embroidery machine needle bar's axial movement through the horizontal fan-shaped light strip, the time difference between the opening exposure of different pixel rows is used to force each row of pixels to capture the surface cross-sectional features at different axial heights of the embroidery machine needle bar on an independent time slice. Based on the surface cross-sectional features, the mechanical motion of the embroidery machine needle bar is coupled with the electronic rolling shutter scanning at speed, quantized into a digital grayscale matrix, and the distorted image sequence is output.

[0009] Preferably, the specific process for constructing the fringe center coordinates includes: For the digital grayscale matrix of a single frame in the distorted image sequence, a frame-by-frame parsing process is initiated: For each row of pixel data, a pre-defined Gaussian mixture model is loaded, the difference response between the grayscale value and the Gaussian mixture model is calculated, and a dynamic threshold segmentation algorithm is applied to remove noise interference. The effective region of the laser stripes is separated through a binarization mask operation. Within the effective region of the laser stripes, a grayscale distribution curve is constructed along the pixel row direction. A one-dimensional Gaussian fitting algorithm is performed on the grayscale distribution curve to solve for the peak amplitude and obtain the center coordinates. The distorted image sequence is traversed, and the stripe center coordinate data stream composed of the center coordinates is output.

[0010] Preferably, the specific process for generating the axial absolute displacement value of the needle bar includes: The system receives orthogonal pulse signals from an absolute encoder rigidly connected to the main drive shaft of the embroidery machine, and converts them into main drive shaft phase values ​​through demodulation. It then retrieves a mapping table for the needle bar drive mechanism, which contains the nonlinear transmission relationship between the rotation angle of the main drive shaft and the axial position and instantaneous speed of the needle bar. Based on the inherent row readout time interval parameter of the image sensor, a linear function of the main drive shaft phase value and time delay is constructed, and the photosensitive moment of each row of photosensitive units in the pixel array is calculated row by row. For each photosensitive moment, synchronous interpolation is performed in the main drive shaft phase value stream to lock the corresponding main drive shaft phase. Finally, by querying the mapping table using the main drive shaft phase, the absolute axial displacement value of the needle bar at the corresponding moment is obtained.

[0011] Preferably, the specific generation process of the three-dimensional point cloud model of the needle bar surface includes: The system receives the stripe center coordinate data stream and the needle bar axial absolute displacement value. Based on laser triangulation, the center coordinates in the stripe center coordinate data stream are mapped to the 3D camera coordinate system to calculate the original depth data containing mixed information of rigid body displacement and surface morphology. Through nonlinear motion decoupling, the corresponding needle bar axial absolute displacement value is obtained for each original depth data based on the timestamp index. A reverse displacement compensation vector parallel to the needle bar motion axis is constructed, and motion compensation operation is performed on the original depth data to extract the axial position component from the mixed surface morphology information, obtaining geometric topology data. The geometric topology data is resampled and meshed to output a 3D point cloud model of the needle bar surface.

[0012] Preferably, the specific process for generating the needle hole operation pose data includes: The system receives a 3D point cloud model of the needle bar surface and performs differential geometric topology analysis: For discrete 3D spatial points in the 3D point cloud model of the needle bar surface, a local differential operator is constructed, and the depth gradient vector field along the needle bar axis of the embroidery machine is calculated to generate a gradient feature matrix reflecting the abrupt changes in surface depth; elements in the gradient feature matrix whose values ​​exceed a preset gradient threshold are marked as closed regions, and morphological closing operations and connected component topology analysis are performed in the closed regions. Based on the closure constraint, open pseudo-edge interference is eliminated, and the needle eye contour region with a closed geometric path is locked; the edge coordinate data of the needle eye contour region is extracted, and spatial ellipse fitting is performed using the least squares method to solve the coordinates of the fitting center; a preset hand-eye calibration transformation matrix is ​​called to perform rigid body mapping operation on the fitting center coordinates, transforming them into the embroidery machine frame coordinate system to obtain the needle eye working pose data.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By combining the rolling shutter characteristics of an image sensor with the high-speed movement of the needle bar, the three-dimensional absolute coordinates of the needle eye were obtained against a background of strong metallic reflection and complex surfaces. A line exposure delay mechanism was used to transform a two-dimensional area scan camera into a high-frequency one-dimensional line scan device, enabling dense sampling of the needle bar surface. Narrow-band filters and horizontal fan-shaped light strips were employed to physically filter out stray ambient light and diffuse reflection interference from the fabric background. This process allows for the acquisition of a complete three-dimensional topographic data stream of the needle bar surface in a single pass, thus avoiding the feature overload problem caused by light spot interference in two-dimensional images and achieving three-dimensional data acquisition with low-cost hardware.

[0014] 2. By introducing the encoder signal of the main drive shaft of the embroidery machine and the kinematic model of the needle bar drive mechanism, the problem of large visual positioning deviation under high-speed operation of the embroidery machine is effectively solved. In actual operation of the embroidery machine, the needle bar undergoes complex variable acceleration motion. Through the mapping table, the absolute physical position of the needle bar at the moment of exposure of each row of pixels in the image can be calculated. Thus, at the algorithm level, the macroscopic motion of the needle bar is decoupled from the microscopic morphology of the surface, ensuring that the reconstructed point cloud model has higher measurement accuracy and improving the positioning robustness and absolute coordinate accuracy in dynamic environments.

[0015] 3. By using depth gradient analysis and closed region identification based on a 3D point cloud model, the false detection rate caused by light spot noise on metal surfaces was reduced. Utilizing the unique depth step and closed topological properties of a pinhole as a physical opening in 3D space, pinhole targets were located under multiple interference environments, reducing the false detection rate and achieving highly reliable pinhole localization.

[0016] 4. Utilizing the inherent mechanical structure and motion characteristics of the embroidery machine, the motion of the object being measured is converted into the scanning driving force of the measurement system, achieving a symbiotic relationship between the sensing system and the actuator. By relying solely on mature CMOS sensors and the main drive shaft encoder, the system failure rate and maintenance costs are reduced. Through strict phase-locking of the sampling rate and needle bar movement speed via the encoder, the spatial resolution remains consistent regardless of whether the machine is in low-speed debugging or high-speed production mode, eliminating the need for complex dynamic parameter adjustments. The introduction of front-end physical modulation and mid-range mechanical priors simplifies the complexity and significantly increases the possibility of obtaining the absolute coordinates of the needle eye in three-dimensional space. Attached Figure Description

[0017] Figure 1 This is a flowchart of the image analysis-based needle eye positioning method for embroidery machines proposed in an embodiment of this invention application; Figure 2 This is a flowchart of the multi-source data spatiotemporal synchronization and displacement calculation proposed in an embodiment of this invention application; Figure 3 This is a flowchart of the 3D point cloud reconstruction and pinhole localization algorithm proposed in an embodiment of this invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Please see Figures 1-3 The image analysis-based needle eye positioning method for embroidery machines provided by this invention has the following specific steps: A horizontal fan-shaped light band is projected onto the needle bar of an embroidery machine using a line laser emitter to generate a modulated light stripe. Based on the modulated light stripe, an image sensor captures images as the needle bar of the embroidery machine crosses the horizontal fan-shaped light band, and a distorted image sequence is output through line exposure delay. The distorted image sequence is analyzed frame by frame and the background is suppressed to separate the laser signal; based on the laser signal, the peak value of the laser energy distribution is calculated by Gaussian fitting algorithm, and the coordinates of the stripe center are output. The phase signal of the main drive shaft encoder is collected. Based on the nonlinear transmission relationship of the needle bar drive mechanism of the embroidery machine, a mapping table between the angle of the main drive shaft and the displacement of the needle bar is established. Combined with the line readout time parameter of the image sensor, the photosensitive moment is obtained. By querying the mapping table, the absolute axial displacement value of the needle bar is generated. Based on the center coordinates of the stripes, the original depth data is obtained through laser triangulation. Based on the absolute displacement value of the needle bar axial direction, a three-dimensional point cloud model of the needle bar surface is reconstructed through motion compensation calculation. Through gradient analysis, the closed regions in the three-dimensional point cloud model of the needle bar surface are identified. Through ellipse fitting, the coordinates of the fitting center are calculated, transformed to the coordinate system of the embroidery machine frame, and the needle eye operation pose data is output.

[0020] The technical solution of the present invention will be further described in detail below with reference to specific embodiments.

[0021] Example 1 This application discloses a needle eye positioning method for embroidery machines based on image analysis. (See attached document.) Figure 1 The specific steps proposed in this invention include: S1, projecting a horizontal fan-shaped light stripe onto the needle bar of an embroidery machine using a line laser emitter to generate a modulated light stripe; based on the modulated light stripe, acquiring images using an image sensor as the needle bar crosses the horizontal fan-shaped light stripe, and outputting a distorted image sequence through line exposure delay; S2, performing frame-by-frame analysis and background suppression processing on the distorted image sequence to separate the laser signal; based on the laser signal, calculating the peak value of the laser energy distribution using a Gaussian fitting algorithm, and outputting the center coordinates of the stripe; S3, acquiring the phase signal of the main drive shaft encoder, and based on the nonlinear transmission of the embroidery machine needle bar drive mechanism... The following steps are performed: S4. Establish a mapping table between the angle of the main drive shaft and the displacement of the needle bar. Combine this with the line readout time parameter of the image sensor to obtain the photosensitive moment. By querying the mapping table, the absolute axial displacement value of the needle bar is generated. S5. Based on the coordinates of the stripe center, the original depth data is obtained through laser triangulation. Based on the absolute axial displacement value of the needle bar, a three-dimensional point cloud model of the needle bar surface is reconstructed through motion compensation calculation. S6. Through gradient analysis, the closed regions in the three-dimensional point cloud model of the needle bar surface are identified. Through ellipse fitting, the coordinates of the fitting center are calculated, transformed to the coordinate system of the embroidery machine frame, and the needle eye operation pose data is output.

[0022] Furthermore, a horizontal fan-shaped light band is projected onto the needle bar of the embroidery machine using a line laser emitter to generate a modulated light stripe; corresponding to step S1 above; the specific implementation process includes: A driving line laser emitter excites a narrowband beam of a preset wavelength, performing aspherical beam expansion in the horizontal dimension and focusing compression in the vertical dimension to construct a horizontal fan-shaped light strip. The horizontal fan-shaped light strip is projected to cover the reciprocating stroke of the embroidery machine needle bar, with the normal direction of the light plane set perpendicular to the axial reciprocating motion axis of the embroidery machine needle bar. During the intersection of the horizontal fan-shaped light strip and the cylindrical metal surface of the needle bar, a lateral optical path offset is generated in the propagation path, modulating the horizontal fan-shaped light strip into a curved and distorted light strip that undulates nonlinearly with the depth of the embroidery machine needle bar surface, and outputting the modulated light strip.

[0023] Specifically, a line laser emitter excites a narrowband beam of a preset wavelength, performing aspherical beam expansion in the horizontal dimension and focusing compression in the vertical dimension to construct a horizontal fan-shaped light band. In this embodiment, the line laser diode is first precisely controlled by a constant current source driving circuit. The input is a regulated DC voltage, and the laser driving current is adjusted by a pulse width modulation signal to set a blue-violet narrowband beam with a center wavelength of 405nm. The original beam output from the laser diode exhibits an elliptical Gaussian distribution with a certain divergence angle and requires multiple stages of optical shaping. The beam first passes through a collimating lens group to correct the divergent beam into a parallel beam, and then enters an aspherical beam expander lens (such as a Powell prism). This lens, through a specially designed aspherical curvature at the top, redistributes the energy of the Gaussian distribution, transforming the energy density distribution of the beam in the fan-shaped expansion direction from strong at the center and weak at the edges to a uniform distribution across the entire width, with the uniformity error controlled within 5%. Finally, the beam is compressed in a dimension perpendicular to the propagation direction by a cylindrical focusing lens group, forming an extremely fine horizontal fan-shaped light band with a width of less than 50μm and a preset vertical width (e.g., covering 0.5mm to 1mm in the vertical direction) at a preset working distance (e.g., 100mm from the emission port). During projection, the central optical axis of this fan-shaped light band is set to be perpendicular to the axial reciprocating motion axis of the embroidery machine needle bar, and the measurement is performed using the approximately parallel characteristic of the central region of the fan-shaped light band.

[0024] Specifically, the horizontal fan-shaped light strip is projected to cover the reciprocating stroke of the embroidery machine needle bar, with the normal direction of the light plane perpendicular to the axial reciprocating motion axis of the embroidery machine needle bar. During the intersection of the horizontal fan-shaped light strip and the cylindrical metal surface of the needle bar, a lateral optical path offset is generated in the propagation path, modulating the horizontal fan-shaped light strip into a curved, distorted light strip that nonlinearly undulates with the depth of the embroidery machine needle bar surface, and outputting the modulated light strip. In this embodiment, the line laser emitter is rigidly fixed to the side of the embroidery machine head, and its optical axis forms a preset triangulation angle with the optical axis of the image sensor. This angle is typically set between 30° and 45° to balance depth resolution and measurement range. The normal direction of the horizontal fan-shaped light strip is strictly calibrated to be perpendicular to the axial reciprocating motion axis (i.e., the Z-axis) of the embroidery machine needle bar, ensuring that the light plane is defined in space as a tangent with a constant Z-coordinate. The needle bar diameter is set to the industrial standard value of 7.24mm. During the reciprocating stroke of embroidery, when the needle bar is at any position between the bottom dead center and the top dead center, as long as it passes through the horizontal fan-shaped light band, the cylindrical surface of the needle bar acts as the intersection surface. At this time, the two-dimensional light plane that originally propagated in free space is cut off by the three-dimensional solid surface of the needle bar, forming a diffuse reflection light strip attached to the curvature of the cylinder on the side of the needle bar facing the image sensor, i.e., the modulation light strip.

[0025] Specifically, in this embodiment, the geometric mapping process of light stripe modulation involves the following: when a horizontal fan-shaped light strip illuminates the needle bar surface, the needle bar surface exhibits continuous changes in depth (i.e., distance relative to the camera). According to the principle of laser triangulation, this depth change is mapped to a lateral positional shift on the image sensor plane. Assuming the camera's principal optical axis is parallel to the ground plane and perpendicular to the needle bar's motion plane, for any point P on the needle bar surface, the change in depth Z and the lateral displacement of that point on the image sensor's imaging plane follow a trigonometric geometric relationship. That is, the depth change equals the product of the lateral displacement and the pixel's physical size divided by the product of the optical magnification and the sine of the trigonometric angle. Since the needle bar is a cylinder, its surface depth Z follows a circular equation distribution with the horizontal coordinate x, i.e., Z equals the square root of the difference between the square of the needle bar's radius and the square of x. Therefore, in the distorted image captured by the image sensor, the originally straight laser line undergoes a bending distortion with nonlinear fluctuations in the depth of the needle bar's cylindrical surface when passing through the needle bar region, forming an arc-shaped modulated light stripe. The curvature of the modulated light stripe directly reflects the current lateral position and diameter information of the needle bar. Meanwhile, considering the potential for lighting interference in the embroidery workshop, a narrowband filter with a center wavelength of 405nm and a full width at half maximum (FWHM) of 10nm is configured at the optical path receiver, allowing only the modulated laser signal to pass through, thereby suppressing ambient stray light noise to an extremely low level.

[0026] By performing aspherical beam expansion and vertical focusing compression, a high-energy-density horizontal fan-shaped light strip was constructed. The normal to the light plane was strictly constrained to be perpendicular to the needle bar's motion axis. This ensured that when the light plane intersected the needle bar, significant nonlinear bending distortion would occur due to the depth undulations of the needle bar's cylindrical surface, whereas the background fabric is typically flat, resulting in a distinctly different light stripe shape. This morphologically specific modulation allows the modulated light stripe to physically carry the high-frequency depth characteristic signal of the needle bar, effectively enhancing the signal-to-noise ratio between the target signal and stray light from the ambient background. This provides a clear and sharp physical benchmark for subsequent image segmentation, avoiding feature blurring caused by light source divergence.

[0027] Furthermore, based on the modulated light stripe, an image sensor captures images as the needle bar of the embroidery machine traverses the horizontal fan-shaped light stripe, and through line exposure delay, outputs a distorted image sequence; corresponding to step S1 above; the specific implementation process includes: The modulated light stripe penetrates a narrowband filter and is projected onto the pixel array of the image sensor. The narrowband filter blocks stray ambient light in non-laser bands. The rolling shutter timing logic of the image sensor is activated, and the pixel array is driven to open the electronic photosensitive window sequentially according to the row readout time interval parameter. During the embroidery machine needle bar's axial movement through the horizontal fan-shaped light strip, the time difference between the opening exposure of different pixel rows is used to force each row of pixels to capture the surface cross-sectional features at different axial heights of the embroidery machine needle bar on an independent time slice. Based on the surface cross-sectional features, the mechanical motion of the embroidery machine needle bar is coupled with the electronic rolling shutter scanning at speed, quantized into a digital grayscale matrix, and the distorted image sequence is output.

[0028] Specifically, the modulated light stripe penetrates a narrowband filter and is projected onto the pixel array of the image sensor. The narrowband filter blocks stray ambient light in non-laser bands. The rolling shutter timing logic of the image sensor is activated, driving the pixel array to sequentially open the electronic photosensitive windows according to the row readout time interval parameter. In this embodiment, a 405nm blue-violet linear laser module is used as the light source. After optical shaping, the laser beam penetrates the air medium in a horizontal slice manner and is projected onto the front of the pixel array of the image sensor. Along this path, there is a narrowband filter with a center wavelength matched to 405nm, whose bandwidth is strictly limited to ±10nm. This filter physically blocks stray photons of the full spectrum in ambient light, allowing only photons of a preset wavelength carrying information about the surface morphology of the needle bar to pass through. After the photons reach the surface of the CMOS sensor, they are converted into photoelectrons. At this time, the sensor does not instantly complete the full-frame exposure, but rather activates the rolling shutter timing logic. This logic is precisely controlled by the row readout time interval parameter, which is set to 18.904μs in this specific setting. This means that there is a strict time-dependent relationship between the opening times of the electronic photosensitive windows in each row of the pixel array inside the CMOS sensor. The exposure start time of the Nth row of pixels is about 18.9 μs later than that of the N-1th row. Since the horizontal fan-shaped light band has a preset vertical width (e.g., 0.5 mm to 1 mm), at any given time, only one set of pixel rows (e.g., rows 30 to 50) on the pixel array of the image sensor is within the laser illumination field of view, while the remaining pixel rows are in a dark state.

[0029] Specifically, during the axial movement of the embroidery machine needle bar through the horizontal fan-shaped light band, the time difference in exposure between different pixel rows forces each row of pixels to capture the surface cross-sectional features of the needle bar at different axial heights on an independent time slice. In this embodiment, when the main drive shaft of the embroidery machine is running, the needle bar reciprocates up and down, with a maximum instantaneous linear velocity exceeding 6 m / s, allowing for high-dimensional information capture using a rolling shutter. When the needle bar rapidly traverses the horizontal fan-shaped light band axially, the pixel row index of the image sensor acts as the sampling point of the time axis, forcing the pixel array to sequentially open the electronic photosensitive windows according to the row index order, performing continuous time slice scanning of the high-speed moving needle bar. For example, when the image sensor scans to row 0, the needle bar may be at the top dead center; while when it scans to row 500, after a cumulative delay of approximately 9.45 ms, the needle bar has moved downwards to the middle of its stroke. Therefore, in the output image sequence, each row of pixels does not record the needle bar state at the same moment, but rather the instantaneous surface cross-sectional features of the needle bar at different axial heights. This acquisition method forcibly maps the dynamic displacement trajectory of the needle bar over time into geometric deformations in a single-frame image space. The originally straight needle bar appears stretched, compressed, or even twisted into an S-shape in the image. These distortions are not noise, but rather encrypted data encoding the needle bar's speed and position information. Simultaneously, to eliminate motion blur caused by the high-speed movement of the needle bar, an independently configured electronic shutter control logic for the pixel array sets the actual exposure time of each row of photosensitive units to an extremely short microsecond window (e.g., 2μs). This exposure time must satisfy the following constraint: the product of the needle bar's instantaneous maximum linear velocity and the exposure time should be less than the full width at half maximum (FWHM) of the laser stripe. Although there is only a narrow bright band in a single-frame image, each row of pixel data within this bright band corresponds to the surface features of the needle bar at different axial positions (e.g., covering approximately 3-4mm of travel), thus completing a dense slice scan of the needle eye area within a single-frame exposure cycle.

[0030] Specifically, based on surface cross-sectional features, the mechanical motion of the embroidery machine needle bar is velocity-coupled with electronic roller shutter scanning, quantized into a digital grayscale matrix, and a distorted image sequence is output. In this embodiment, to demodulate the precise needle eye position from the distorted image, a time-based mapping relationship is established between the mechanical motion of the embroidery machine needle bar and the electronic roller shutter scanning. That is, the pixel row index is mapped to physical time, and then the physical time is correlated to the axial displacement of the needle bar. The inputs include the real-time rotation angle signal of the main drive shaft of the embroidery machine (provided by the encoder) and timing parameters. The output layer is the predicted lateral deviation between the pixel row coordinates and the laser stripes. The mechanical motion of the needle bar follows the kinematic equations of the needle bar drive mechanism, and its vertical displacement is described as a nonlinear combination of the crank radius multiplied by the cosine of the rotation angle and the connecting rod geometry. At the same time, the electronic scanning process is modeled as a linear time function, that is, the pixel row coordinates are proportional to physical time. By combining these two equations, the velocity coupling between the mechanical velocity field and the electronic scanning field is achieved. In terms of specific parameter settings, the crank radius is set to 15.35mm, the connecting rod length is 60.0mm, and the sensor line readout time needs to be calibrated through a high-frequency stroboscopic experiment. In this embodiment, the line readout time is fixed at 18.904μs. To ensure time alignment between mechanical motion and electronic scanning, hardware triggering logic is adopted: the Z-phase zero-position pulse signal of the embroidery machine's main drive shaft encoder is connected to the external trigger pin of the image sensor, forcing the frame start time of image acquisition to be physically phase-locked with the mechanical zero point, thereby eliminating random jitter caused by operating system scheduling. This coupling process is finally quantized into a digital grayscale matrix through an analog-to-digital converter. In the matrix, the center position of the laser stripe not only represents the geometric contour of the needle bar but also implies time synchronization information, finally outputting a distorted image sequence.

[0031] Specifically, regarding the calibration steps and deviation calculation logic, although this method primarily relies on an analytical model, rigorous calibration steps must be performed to eliminate manufacturing tolerances and assembly errors. First, static geometric calibration is performed by manually rotating the machine while it is stopped, recording the needle bar position and stripe center coordinates every 1mm to construct a reference lookup table. This is equivalent to the annotation process of training data, establishing the input-output mapping under ideal conditions. Second, row time calibration is performed by measuring the actual row readout time using a high-frequency flicker light source to correct the model's time parameters. In the real-time detection phase, the core loss function is defined as the Euclidean distance between the measured laser center coordinates and the reference coordinates predicted by the model. Specifically, the absolute physical time is first calculated by inverting the row number of the current pixel row, then substituted into the kinematic model to predict the theoretical height of the needle bar at this time. Finally, the theoretical laser coordinates corresponding to this height are obtained from the reference lookup table through interpolation. The specific form of the loss function is: the difference between the measured coordinates and the theoretical coordinates. If the absolute value of the difference exceeds a preset threshold (e.g., 30μm), or if the difference exhibits a specific linear or Gaussian distribution characteristic between consecutive rows, it will be judged as a fault such as needle bar bending, needle breakage, or motion lag.

[0032] By utilizing narrowband filters to block ambient light and cleverly activating the rolling shutter timing logic of the image sensor, the sensor's row readout time interval is used as a time slicing tool. During the high-speed reciprocating motion of the needle bar, each row of pixels is forced to be exposed at different time points, enabling dense scanning of the needle bar along its axial direction. This method couples the mechanical motion speed of the needle bar with the electronic scanning speed, using a single-frame distorted image sequence to record the complete surface cross-sectional features of the needle bar at different axial heights. This solves the problem of rapidly acquiring full surface topography data in dynamic scenes and achieves efficient digital grayscale matrix quantization.

[0033] Furthermore, the distorted image sequence is analyzed frame by frame and background suppression is performed to separate the laser signal; based on the laser signal, the peak value of the laser energy distribution is calculated using a Gaussian fitting algorithm, and the coordinates of the stripe center are output; this corresponds to step S2 above; the specific implementation process includes: For the digital grayscale matrix of a single frame in the distorted image sequence, a frame-by-frame parsing process is initiated: For each row of pixel data, a pre-defined Gaussian mixture model is loaded, the difference response between the grayscale value and the Gaussian mixture model is calculated, and a dynamic threshold segmentation algorithm is applied to remove noise interference. The effective region of the laser stripes is separated through a binarization mask operation. Within the effective region of the laser stripes, a grayscale distribution curve is constructed along the pixel row direction. A one-dimensional Gaussian fitting algorithm is performed on the grayscale distribution curve to solve for the peak amplitude and obtain the center coordinates. The distorted image sequence is traversed, and the stripe center coordinate data stream composed of the center coordinates is output.

[0034] Specifically, for the digital grayscale matrix of a single frame in the distorted image sequence, a frame-by-frame analysis process is initiated: for each row of pixel data, a pre-defined Gaussian mixture model is loaded, the difference response between the grayscale value and the Gaussian mixture model is calculated, and a dynamic threshold segmentation algorithm is applied to remove noise interference. The effective region of the laser stripes is separated through a binarization mask operation. In this embodiment, after receiving the distorted image sequence, the digital grayscale matrix of a single frame is extracted. The dimension of the digital grayscale matrix is ​​determined by the sensor resolution, for example, 3280×2464. A Gaussian mixture model is used, whose hierarchical structure contains K Gaussian distribution components, typically K is set to 3 to 5, to simulate the multimodal background distribution of each pixel over time, such as metallic reflections, shadows, and ambient light fluctuations. During the model training phase, the specific steps are: with the laser off, 50 to 100 consecutive frames of images are acquired as a training set. The expectation-maximization algorithm is used to iteratively update the weights, mean vectors, and covariance matrices of each Gaussian component until the log-likelihood function converges, establishing a background statistical model. During real-time detection, for each row of pixel data in the input matrix, the Mahalanobis distance between the grayscale value and the background model is calculated. If this distance exceeds a set confidence threshold (typically 2.5 to 3 times the standard deviation), the pixel is identified as a foreground laser signal. Subsequently, a dynamic threshold segmentation algorithm is applied, combined with the grayscale statistical characteristics of the local neighborhood, to further remove salt-and-pepper noise. Holes are filled using morphological closing operations to generate a binary mask and lock the effective area of ​​the laser stripes. The initialization process of the Gaussian mixture model involves turning off the control line laser emitter, acquiring 50 to 100 consecutive frames of environmental background images using the image sensor, and training the Gaussian mixture model using the expectation-maximization algorithm to adapt to the current lighting environment of the workshop. This model is used to subtract the ambient light base from the image to eliminate fixed-pattern noise.

[0035] In this embodiment, an adaptive spot suppression mechanism based on neighborhood statistical characteristics is introduced. A local signal-to-noise ratio weight matrix is ​​constructed, and nonlinear gain attenuation is performed on highly reflective areas. Combined with the Otsu multi-level threshold strategy, the optimal segmentation boundary for each category is dynamically calculated. Before segmentation, a 5×5 sliding window is defined to traverse the differential response image. For each window, the local mean and local standard deviation are calculated, and the coefficient of variation is constructed. The coefficient of variation is equal to the local standard deviation divided by the local mean. For highly reflective areas on metal surfaces (usually characterized by high brightness and low variation), a saturation threshold of 245 (8-bit grayscale) is set. If the grayscale of the center pixel is greater than the saturation threshold and the coefficient of variation is less than 0.1, it is determined to be specular reflection noise. A fixed constant attenuation coefficient is applied to suppress it, that is, the new grayscale value is equal to the original grayscale value multiplied by the attenuation coefficient (the value of which is the negative α power of the natural constant e (α takes the value of 0.8)). Subsequently, a local signal-to-noise ratio (SNR) map is constructed and used as weights to input the Otsu algorithm. The histogram is divided into three categories: background, interference spots, and laser signals. By maximizing the inter-class variance, specifically defined as the sum of the squares of the differences between the occurrence probabilities of the foreground and background classes multiplied by their respective means and the global mean, two optimal segmentation thresholds k1 and k2 are iteratively searched. k1 is used to distinguish between background and interference spots, and k2 is used to distinguish between interference spots and laser signals. Only pixels with grayscale values ​​between k2 and 255 are retained as candidate regions for laser stripes. Thus, even under extremely strong physical illumination, effective signals can still be extracted from saturated spots through statistical characteristics, improving the purity of signal extraction and effectively preventing large-area spots formed on the surface of the metal needle rod due to strong reflection from obscuring the laser stripes.

[0036] Specifically, within the effective area of ​​the laser stripes, a gray-level distribution curve is constructed along the pixel row direction. A one-dimensional Gaussian fitting algorithm is applied to the gray-level distribution curve to solve for the peak amplitude and obtain the center coordinates. In this embodiment, sub-pixel center extraction is performed along the pixel row direction within the effective area of ​​the laser stripes. For each row in the image, a gray-level distribution curve is constructed within a binary mask area, typically exhibiting a bell-shaped distribution. A one-dimensional Gaussian fitting algorithm is used as the fitting model, and its mathematical expression includes four core parameters: peak amplitude, center position, standard deviation, and basis gray-level offset. The model's input is a discrete set of pixel gray-level values, and the output is the center coordinates in the continuous domain. A nonlinear least squares method is used for solving the problem, and the specific loss function is defined as the sum of squared residuals between the actual observed gray-level values ​​and the Gaussian model's predicted values. The optimization process typically uses the Levenberg-Marquardt algorithm for iterative solving. In the specific parameter settings, the iteration termination condition is set to the residual change being less than 10 to the power of -6 or reaching the maximum number of iterations of 20. This process can improve the positioning accuracy of the laser center from the whole pixel level to 0.1 or even 0.01 pixel level. For example, the original coarse position of 1024 can be refined to 1024.56, thereby capturing the tiny deformation of the needle bar surface.

[0037] Specifically, the distorted image sequence is traversed, and a stripe center coordinate data stream composed of center coordinates is output. In this embodiment, as the line-by-line fitting process progresses, the entire distorted image sequence is traversed. For each frame, an independent center coordinate value is output for each effective scan line. This process reduces the dimensionality of the two-dimensional image matrix to a one-dimensional time-space coordinate sequence. Each node of the stripe center coordinate data stream not only contains the lateral position information (U coordinate) of the laser stripe on the sensor array, but also implicitly associates it with the absolute physical timestamp of the exposure of that line. To ensure data integrity and robustness, the output logic includes an outlier removal mechanism: when the fitting residual of a line (i.e., the final value of the loss function) exceeds a preset quality threshold, the data point is marked as invalid and does not enter the final data stream to prevent spot distortion caused by scratches or oil stains on the metal surface from misleading subsequent trajectory reconstruction. The final output stripe center coordinate data stream is a structured floating-point sequence that quantifies the surface cross-sectional position of the needle bar at each moment during high-speed movement.

[0038] By employing a Gaussian mixture model and a dynamic threshold segmentation algorithm, background noise interference is removed at a coarse-grained level. Furthermore, within the effective region of the laser stripes, leveraging the physical property that laser energy follows a Gaussian distribution, a one-dimensional Gaussian surface fitting operation is performed to penetrate the high-light saturation region. Based on the energy distribution trend, extreme points are solved, thereby calculating the coordinates of the stripe center. This effectively overcomes the problems of uneven stripe width and edge jitter caused by metallic reflection, ensuring higher geometric accuracy of the data source for subsequent 3D reconstruction.

[0039] Further, the phase signal of the main drive shaft encoder is acquired. Based on the nonlinear transmission relationship of the embroidery machine needle bar drive mechanism, a mapping table between the main drive shaft angle and the needle bar displacement is established. Combined with the line readout time parameter of the image sensor, the photosensitive moment is obtained. By querying the mapping table, the absolute axial displacement value of the needle bar is generated; this corresponds to step S3 above; see reference. Figure 2 The specific implementation process includes: The system receives orthogonal pulse signals from an absolute encoder rigidly connected to the main drive shaft of the embroidery machine, and converts them into main drive shaft phase values ​​through demodulation. It then retrieves a mapping table for the needle bar drive mechanism, which contains the nonlinear transmission relationship between the rotation angle of the main drive shaft and the axial position and instantaneous speed of the needle bar. Based on the inherent row readout time interval parameter of the image sensor, a linear function of the main drive shaft phase value and time delay is constructed, and the photosensitive moment of each row of photosensitive units in the pixel array is calculated row by row. For each photosensitive moment, synchronous interpolation is performed in the main drive shaft phase value stream to lock the corresponding main drive shaft phase. Finally, by querying the mapping table using the main drive shaft phase, the absolute axial displacement value of the needle bar at the corresponding moment is obtained.

[0040] Specifically, the quadrature pulse signal output from the absolute encoder rigidly connected to the main drive shaft of the embroidery machine is received and demodulated into the phase value of the main drive shaft. In this embodiment, the core timing reference originates from the absolute encoder rigidly connected to the main drive shaft of the embroidery machine. This embodiment selects a multi-turn absolute encoder with a resolution of 17 bits or higher, and its communication protocol typically adopts a bidirectional synchronous serial interface. In the specific implementation process, every tiny rotation of the main drive shaft triggers the signal flip of the photoelectric code disk inside the encoder, outputting two quadrature pulse signals (phase A and phase B) with a phase difference of 90 degrees, as well as a zero-position pulse (phase Z) per revolution. Through FPGA hardware logic, the quadrature pulses are subjected to a fourfold frequency multiplication, improving the physical resolution to the 0.01-degree level. After digital filtering to remove glitches, the signals are accumulated by a real-time counter and converted into normalized main drive shaft phase values, defined in the range of 0 to 2π radians. To eliminate the initial phase deviation caused by mechanical installation, the Z-phase pulse is automatically detected during the initialization phase, and the corresponding physical position is forcibly reset to the phase zero point, that is, the upper dead point position of the needle bar, thereby establishing an absolute mechanical reference coordinate system.

[0041] Specifically, a mapping table for the needle bar drive mechanism is retrieved. This mapping table contains the nonlinear transmission relationship between the rotation angle of the main drive shaft of the embroidery machine and the axial position and instantaneous speed of the needle bar. In this embodiment, the reciprocating motion of the needle bar follows the typical principle of an offset needle bar drive mechanism, and its mechanical transmission characteristics are nonlinear. A mapping table is pre-constructed and calibrated based on these mechanical transmission characteristics. Based on the offset crank-slider model of the needle bar drive mechanism, a mapping table between the main drive shaft angle and the needle bar displacement is constructed: the input is the rotation angle of the main drive shaft, and the output is the axial displacement and instantaneous speed of the needle bar. The rotation angle of the main drive shaft is set as the reference variable (with the top dead center of the needle bar as the zero-degree reference). The physical parameters include the radius of the drive crank, the length of the drive connecting rod, and the horizontal offset distance from the rotation center of the drive crank to the center of the needle bar guide rail. Based on the kinematics of planar mechanisms, the calculation logic for the axial displacement of the embroidery machine needle bar is as follows: First, calculate the product of the radius of the driving crank and the cosine of the rotation angle of the main drive shaft of the embroidery machine, as the first component; second, calculate the difference between the square of the length of the driving link and the square of the intermediate term, and take the arithmetic square root of this difference, as the second component, where the intermediate term is equal to the product of the radius of the driving crank and the sine of the rotation angle minus the horizontal offset distance; the sum of the first and second components, minus the initial theoretical height value of the needle bar when it is at the top dead center, yields the absolute axial displacement value of the needle bar with the top dead center as the zero point. Based on this calculation logic, the entire circumferential phase is traversed in steps of 1 / 100th of a degree, calculating the corresponding displacement value and its derivative with respect to time, generating a lookup mapping table containing the correspondence between the rotation angle of the main drive shaft of the embroidery machine and the axial position and instantaneous velocity of the embroidery machine needle bar. The specific mathematical expression involves the crank radius (set to 15.35mm), the link length (set to 60.0mm), and the offset (set to 0mm or 2mm). During the parameter identification phase, encoder angle and high-frequency non-contact displacement sensor synchronous data are collected at multiple sets of stepped speeds from low speed (e.g., 60 rpm) to the highest operating speed (e.g., 3000 rpm) (sampling frequency not less than 10 kHz, with the laser spot aligned with the needle tip). A correction model including a dynamic compensation term is constructed, which superimposes the geometric displacement calculated based on angle and the dynamic deformation calculated based on angular velocity. In this embodiment, the dynamic deformation is approximated as the linear stretching caused by inertial centrifugal force, i.e., the product of the centrifugal stretching coefficient and the square of the main drive shaft angular velocity. Alternatively, a nonlinear lookup table of angular velocity and deformation can be directly established using the collected synchronous data. The typical order of magnitude of the centrifugal stretching coefficient is approximately 1.52 × 10⁻⁶. -6 mm / (rad / s) 2The loss function is defined as the mean square error between the model's predicted displacement and the measured displacement under all operating conditions. The geometric parameters (crank radius, connecting rod length) and dynamic parameters (eccentric tensile coefficient) are jointly iteratively optimized using gradient descent until the maximum position error over the entire cycle is less than 5 μm. After calibration, a discretized lookup table with 36,000 nodes is generated, covering the entire cycle from 0 to 360 degrees, with an angular resolution of 0.01 degrees. The initialization process of the mapping table is as follows: the main drive shaft is controlled to run slowly under no-load (e.g., 60 rpm), encoder angle and displacement sensor data are collected synchronously, the geometric parameters of the crank-connecting rod mechanism are calibrated using gradient descent, and the mapping table is updated.

[0042] Specifically, based on the inherent row readout time interval parameter of the image sensor, a linear function of the main drive shaft phase value and time delay is constructed, and the light-sensing time of each row of photosensitive units in the pixel array is calculated row by row. For each row light-sensing time, synchronous interpolation is performed in the main drive shaft phase value stream to lock the corresponding main drive shaft phase. In this embodiment, in the rolling shutter imaging mode, each row of the image has its own independent exposure time window. Specifically, based on the inherent row readout time interval parameter (18.904μs) of the image sensor, a linear time model is constructed. For the Vth row in the image, the light-sensing time is defined as the frame trigger time plus V multiplied by the row readout time interval parameter and then subtracted from the time difference. The specific calculation process is as follows: the embroidery machine is controlled to run at a set speed, the image sensor acquires an image sequence containing needle tip features, identifies the row index where the needle tip reaches its lowest point (i.e., the bottom dead center) in the image, obtains the phase corresponding to the physical time of the bottom dead center fed back by the encoder, and calculates the time difference between the theoretical bottom dead center and the image observed bottom dead center. This time difference includes transmission delay and processing jitter. However, the phase data of the main drive shaft encoder is discretely sampled, with sampling frequencies typically ranging from 10kHz to 50kHz. This means that there is a time gap of tens of microseconds between two sampling points. To obtain the phase at the moment of exposure of the Vth line, a synchronous interpolation operation is performed: first, the two phase sampling points before and after the exposure moment of the line are located in the encoder data stream; then, using a linear interpolation formula, the estimated value of the main drive shaft phase at the moment of exposure is calculated based on the time proportion weight. For example, if the exposure moment of the 500th line falls between sampling points T1 and T2, and the time difference from T1 is Δt, then the main drive shaft phase of that line is equal to the phase at time T1 plus the phase change rate multiplied by Δt.

[0043] Specifically, the axial absolute displacement value of the embroidery machine needle bar at the corresponding moment is obtained by using the main drive shaft phase lookup mapping table. In this embodiment, once the main drive shaft phase at the exposure time of each row of pixels is locked, the final displacement calculation stage begins. Specifically, the interpolated main drive shaft phase is used as an index to perform a linear interpolation lookup in the mapping table. The value output by the mapping table is the axial absolute displacement value of the needle bar at the corresponding moment, accurate to the micrometer. For example, when the queried phase is 90 degrees, the mapping table directly returns the corresponding displacement value (approximately 15.35 mm, depending on the link ratio). This process is executed in parallel for each row in the distorted image sequence, generating a displacement data stream of the same length as the number of image rows.

[0044] By acquiring orthogonal pulses from an absolute encoder and establishing a phase mapping table, combined with the sensor's inherent row readout time parameters, a rigorous time-space synchronization mechanism was constructed. This mechanism calculates the photosensitive moment for each row of photosensitive units in the pixel array and locks the corresponding main drive shaft phase through interpolation, thereby retrieving the needle bar's axial displacement and instantaneous velocity at that moment. This data association and encapsulation eliminates spatial position estimation errors caused by needle bar speed fluctuations, ensuring that each row of image data can be mapped to the actual physical stroke of the needle bar, thus solving the coordinate distortion problem caused by nonlinear motion.

[0045] Furthermore, based on the fringe center coordinates, the original depth data is obtained using laser triangulation; based on the absolute displacement value of the needle bar axial direction, a three-dimensional point cloud model of the needle bar surface is reconstructed through motion compensation calculation; corresponding to step S4 above; the specific implementation process includes: The system receives the stripe center coordinate data stream and the needle bar axial absolute displacement value. Based on laser triangulation, the center coordinates in the stripe center coordinate data stream are mapped to the 3D camera coordinate system to calculate the original depth data containing mixed information of rigid body displacement and surface morphology. Through nonlinear motion decoupling, the corresponding needle bar axial absolute displacement value is obtained for each original depth data based on the timestamp index. A reverse displacement compensation vector parallel to the needle bar motion axis is constructed, and motion compensation operation is performed on the original depth data to extract the axial position component from the mixed surface morphology information, obtaining geometric topology data. The geometric topology data is resampled and meshed to output a 3D point cloud model of the needle bar surface.

[0046] Specifically, the system receives the stripe center coordinate data stream and the absolute displacement value of the needle bar axial direction. Based on laser triangulation, the center coordinates in the stripe center coordinate data stream are mapped to the three-dimensional camera coordinate system to calculate the original depth data containing mixed information of rigid body displacement and surface morphology. In this embodiment, after acquiring the stripe center coordinate data stream, it is first necessary to map it to the three-dimensional spatial coordinate system. Based on the principle of laser triangulation, parameterized adaptation was performed for the rolling shutter acquisition. The core conversion formula describes the geometric relationship between the original depth data and the stripe center coordinates: the lateral offset of the stripe center coordinates relative to the reference position is multiplied by the magnification, and the product is divided by the sine of the laser incident angle. The calculated result is equal to the original depth data. The reference position is determined using a dynamic cylindrical fitting strategy: in the distorted image, the laser stripe area on the surface of the needle bar cylinder is selected as the region of interest, and the center line at that instant is fitted by a fast linear regression algorithm. This instantaneous center line is used as the reference position for the current calculation. By calculating the lateral offset of the stripe center coordinates relative to the instantaneous center line, common-mode interference caused by the lateral vibration of the needle bar can be effectively eliminated. Specific parameter settings: The laser incident angle is set between 30 and 45 degrees to balance depth resolution and measurement blind zone; the magnification is calibrated to 30 micrometers per pixel. This means that for every pixel of lateral displacement detected by the image sensor, there is approximately 60 micrometers of depth change in actual physical space. Through linear transformation, the one-dimensional pixel coordinate stream is converted into a raw depth data stream containing mixed information of the microscopic morphology of the needle surface and the macroscopic rigid body displacement.

[0047] In this embodiment, an outlier removal mechanism based on cylindrical manifold geometric constraints is introduced. A standard needle bar parametric surface model is constructed, the radial residual of depth data points is calculated, and temporal bilateral filtering is used to smooth high-frequency noise. After laser triangulation calculates the original depth data stream, the data often contains outliers caused by reflections from scratches on the metal surface. Using the needle bar as a geometric prior for a standard cylinder, a parametric cylindrical surface model is constructed. The original depth data points are mapped to a cylindrical coordinate space, i.e., a radius, polar angle, and height coordinate system, and the radial Euclidean distance from each sampling point to the ideal cylindrical surface is calculated. An adaptive threshold is set, which is three times the standard deviation of the historical radial error. If the radial Euclidean distance of a point is greater than this adaptive threshold, the point is determined to be a depth artifact caused by reflection. For these outliers, a temporal sliding window of five frames is used, and the depth values ​​of adjacent normal points within the window are interpolated using a weighted moving average algorithm for repair. Subsequently, a one-dimensional bilateral filter was applied to the repaired depth data stream, with the spatial domain kernel parameter set to 2.0 and the value domain kernel parameter set to 0.15. Utilizing the edge-preserving property of bilateral filtering, the subtle depth fluctuations caused by complex textures were smoothed out while fully preserving the steep depth step information of the pinhole edge. An outlier removal mechanism corrected depth calculation deviations caused by reflections and textures, ensuring the realism and accuracy of the 3D point cloud model at the micrometer scale.

[0048] Specifically, through nonlinear motion decoupling, for each original depth data point, the corresponding axial absolute displacement value of the needle bar is obtained based on the timestamp index. A reverse displacement compensation vector parallel to the needle bar's motion axis is constructed, and motion compensation calculation is performed on the original depth data to extract the axial position component from the mixed surface topography information, obtaining geometric topology data. In this embodiment, the nonlinear motion decoupling operation is essentially a coordinate system transformation, aiming to eliminate the interference of the high-speed reciprocating motion of the needle bar on the measurement data. Specifically, for each original depth data point, the corresponding axial absolute displacement value of the needle bar is obtained from the synchronously generated axial absolute displacement data stream based on the associated timestamp index. By constructing a reverse displacement compensation vector parallel to the needle bar's motion axis, the modulus is strictly equal to the displacement of the needle bar relative to the top dead center at that moment, and the direction is opposite. During the calculation, the reverse displacement compensation vector is superimposed on the spatial coordinates of the original depth data point, i.e., a subtraction operation is performed: the corrected axial position component is equal to the fixed scan line position of the sensor minus the instantaneous mechanical displacement of the needle bar, obtaining the discrete depth point set after motion compensation, which is the geometric topology data. For example, the coordinates of a point collected when the needle bar moves downward by 10mm are backed to the relative zero point of the needle bar coordinate system after compensation.

[0049] Specifically, the geometric topology data is resampled and meshed to output a 3D point cloud model of the needle bar surface. In this embodiment, although the geometric topology data after motion compensation is accurate in location, the non-linear sinusoidal variation of the needle bar's motion speed results in extremely uneven spatial distribution of data points: sampling is extremely dense near the upper and lower dead points where the speed is zero, while sampling is relatively sparse in the middle of the stroke where the speed is highest. To generate a standardized 3D model, resampling and meshing steps are required: First, a standard voxel mesh with a spatial resolution of 10μm is defined, covering the entire length and circumference of the needle bar. Then, a cubic spline interpolation algorithm is used to smoothly fit the discrete points in the sparse region, filling the data gaps caused by high-speed motion; simultaneously, voxel filtering is performed on the data in the dense region, and the centroid of all points in the mesh is calculated to replace the original point group, thereby achieving noise reduction and data compression. Finally, the processed ordered point sequence is topologically stitched according to the cylindrical geometry of the needle bar, outputting a 3D point cloud model of the needle bar surface containing hundreds of thousands of vertices.

[0050] By constructing a reverse displacement compensation vector, vector difference operations are performed on the original depth data after laser triangulation. Using motion state data, the axial displacement component generated by the high-speed motion of the needle bar is subtracted from the mixed information, thereby restoring the geometric topology data of the needle bar surface. This effectively reduces the interference of motion components on topography measurement during dynamic measurement and ensures that the generated three-dimensional point cloud model of the needle bar surface truly reflects the physical structure of the needle bar and needle eye.

[0051] Furthermore, through gradient analysis, closed regions in the 3D point cloud model of the needle bar surface are identified. Ellipse fitting is used to calculate the coordinates of the fitting center, which are then transformed to the embroidery machine frame coordinate system to output the needle eye pose data; this corresponds to step S5 above; see [link to relevant documentation]. Figure 3 The specific implementation process includes: The system receives a 3D point cloud model of the needle bar surface and performs differential geometric topology analysis: For discrete 3D spatial points in the 3D point cloud model of the needle bar surface, a local differential operator is constructed, and the depth gradient vector field along the needle bar axis of the embroidery machine is calculated to generate a gradient feature matrix reflecting the abrupt changes in surface depth; elements in the gradient feature matrix whose values ​​exceed a preset gradient threshold are marked as closed regions, and morphological closing operations and connected component topology analysis are performed in the closed regions. Based on the closure constraint, open pseudo-edge interference is eliminated, and the needle eye contour region with a closed geometric path is locked; the edge coordinate data of the needle eye contour region is extracted, and spatial ellipse fitting is performed using the least squares method to solve the coordinates of the fitting center; a preset hand-eye calibration transformation matrix is ​​called to perform rigid body mapping operation on the fitting center coordinates, transforming them into the embroidery machine frame coordinate system to obtain the needle eye working pose data.

[0052] Specifically, a 3D point cloud model of the needle bar surface is received, and differential geometric topology analysis is performed: For discrete 3D spatial points in the 3D point cloud model of the needle bar surface, a local differential operator is constructed, and the depth gradient vector field along the axial direction of the embroidery machine needle bar is calculated to generate a gradient feature matrix reflecting the abrupt change in surface depth. In this embodiment, differential geometric topology analysis is performed on the 3D point cloud model of the needle bar surface. Since the needle eye is geometrically represented as an inward deep indentation on a cylindrical surface, this feature is reflected in the point cloud data as a sharp change in the local normal vector and an abrupt change in the depth value. The specific process of differential geometric topology analysis is as follows: For any target point in the point cloud, a local neighborhood matrix containing three rows and three columns of pixels is selected, and the local differential operator, namely the Sobel edge detection operator, is used to calculate the depth gradient value along the axial direction (i.e., the vertical direction) of the embroidery machine needle bar. The specific calculation process is as follows: Obtain the pixel depth values ​​in the row below and above the target point within the neighborhood; calculate the weighted sum of the pixel depth values ​​in the lower row, subtract the weighted sum of the pixel depth values ​​in the upper row, and take the absolute value of the difference as the depth gradient value; during the weighted calculation, the pixel weight in the middle column is set to 2, and the pixel weight in the left and right columns is set to 1. After generating the gradient feature matrix, a depth gradient judgment threshold is set. The value of the depth gradient judgment threshold is set based on the geometric depth abrupt change characteristics of the needle eye edge, typically ranging from 5% to 10% of the embroidery machine needle diameter. All points with depth gradient values ​​greater than this threshold are marked as candidate edge points.

[0053] In this embodiment, curvature tensor analysis from differential geometry is introduced to perform structural tensor decomposition on the gradient feature matrix, calculating the principal curvature and Gaussian curvature. Utilizing the unique hyperbolic paraboloid geometric fingerprint of pinholes, a texture filtering mask is constructed to decouple the disordered fabric texture gradient from the pinhole gradient with its specific topological structure. Fabric textures typically appear as high-frequency, chaotic, small gradients on depth maps, easily confused with pinhole edges. The gradient feature matrix is ​​then expanded using a structural tensor. For each point in the gradient feature matrix, a Hessian matrix composed of second-order partial derivatives is constructed. The two eigenvalues ​​of this matrix are then solved. and The Gaussian curvature (equal to the product of two eigenvalues) and mean curvature (equal to half the sum of the two eigenvalues) are calculated. A needle hole, as a physical opening, has a Gaussian curvature greater than 0 at its edge and a relatively large absolute value of its mean curvature; while fabric textures typically exhibit a chaotic saddle surface or flat disturbances, meaning the Gaussian curvature is approximately 0 or its sign switches randomly. A shape index value is set, and its calculation process is as follows: first, the sum of the eigenvalues ​​is divided by the difference between the eigenvalues ​​(the larger eigenvalue minus the smaller eigenvalue); then, the arctangent operation is performed on the result to obtain the angle value; finally, this angle value is multiplied by a coefficient (2 / π). The SI threshold range for the needle eye edge is set to -0.625 to -0.375 (corresponding to the groove structure). This range can be determined through the needle learning mode: First, under a background without fabric, a standard needle is scanned to extract the shape index value distribution of the needle eye region. The mean and standard deviation of the SI values ​​are calculated. The effective threshold range is set to the range formed by the product of the mean minus the confidence coefficient and the standard deviation to the product of the mean plus the confidence coefficient and the standard deviation (where the confidence coefficient is usually taken as 2.0 to 3.0). A binary texture filter mask is generated, and all gradient points that do not conform to the curvature feature (i.e., pseudo-gradients generated by the fabric texture) are forced to zero, retaining only the gradient signal that conforms to the geometric topological constraints of the needle eye. This process prevents the needle eye features from being submerged by texture noise under a rough fabric background, and realizes the locking of the absolute coordinates of the needle eye in a multi-interference environment.

[0054] Specifically, elements in the gradient feature matrix whose values ​​exceed a preset gradient threshold are marked as closed regions. Morphological closing operations and connected component topology analysis are performed on these closed regions. Based on closure constraints, open false edge interference is eliminated, and pinhole contour regions with closed geometric paths are identified. In this embodiment, based on the gradient feature matrix, an intelligent recognition process for closed regions is initiated: dynamic thresholding technology is applied to binarize the matrix, and elements whose values ​​exceed the preset gradient threshold are marked as candidate edge points. This threshold is typically set to 0.2, meaning regions with a depth change rate exceeding 20% ​​are considered closed regions. The original binarized image often contains a large amount of noise caused by metallic textures and broken, non-closed lines. Therefore, morphological closing operations are performed within the closed regions: first, a dilation operation is performed, using a 3x3 structuring element to connect broken edge fragments; then, an erosion operation is performed to restore the original edge thickness and eliminate isolated noise. Next, connected component topology analysis is performed, traversing all connected pixel blocks and calculating the Euler number and equivalent circle diameter. Based on the physical properties of a pinhole, a closure constraint is introduced: only regions with an Euler number of 0 (i.e., solid areas without holes) or 1 (single-hole areas) are retained, and their areas are between 0.5 mm. 2 Up to 2.0mm 2 The connected regions between them. Through topological filtering, open pseudo-edge interference (such as long strip-shaped scratches) was eliminated, and pinhole contour regions with complete closed geometric paths were identified.

[0055] Specifically, edge coordinate data of the needle-eye contour region is extracted, and spatial ellipse fitting is performed using the least squares method to calculate the coordinates of the fitting center. In this embodiment, after locking the needle-eye contour region, the edge coordinate data of the outer periphery of this region is extracted. These data constitute a discrete sampling set of the needle-eye shape. Since the needle-eye is a hole projected onto a cylindrical surface in three-dimensional space, its edge is approximately a spatial ellipse. To obtain its accurate geometric center, spatial ellipse fitting is performed using the least squares method: the input is the coordinates of N three-dimensional edge points, and the output is the five core parameters of the ellipse: center coordinates (Xc, Yc, Zc), major semi-axis, minor semi-axis, and rotation angle. During the fitting process, the target loss function is constructed as the sum of squares of the algebraic distances from all sampling points to the assumed elliptical model. To solve this nonlinear optimization problem, the three-dimensional points are usually projected onto the least squares plane, simplified to conic section fitting in the two-dimensional plane, and after solving for the plane parameters, they are inversely mapped back to three-dimensional space. During the calculation process, a random sampling consensus algorithm is used to iteratively remove outliers generated by edge burrs. The coordinates of the fitted center were calculated after approximately 50 iterations and convergence.

[0056] Specifically, a preset hand-eye calibration transformation matrix is ​​invoked to perform rigid body mapping operations on the fitted center coordinates, transforming them into the embroidery machine frame coordinate system to obtain the needle eye operation pose data. In this embodiment, the final step is to convert the needle eye fitted center coordinates in the camera coordinate system into the absolute position in the embroidery machine frame coordinate system (usually the mechanical origin coordinate system of the embroidery machine). First, the preset hand-eye calibration transformation matrix is ​​invoked, which is a 4×4 homogeneous transformation matrix containing rotation submatrices and translation subvectors. The specific transformation operation is: the needle eye operation pose data is equal to the hand-eye calibration transformation matrix multiplied by the expanded fitted center coordinates. The hand-eye calibration transformation matrix is ​​obtained using a step-by-step calibration method: the intrinsic parameter matrix of the image sensor is obtained using a standard checkerboard calibration board; in order to calibrate the spatial relationship between the laser light strip plane and the embroidery machine needle bar movement axis (Z-axis), a special calibration fixture (e.g., a double-order cylinder with diameters of 3mm and 6mm) is installed on the needle bar. The needle bar is controlled to move slowly throughout its entire stroke, while an image sensor captures laser stripe images of the standard cylindrical rod at different axial heights. By combining the true axial displacement value fed back by the encoder with the laser center coordinates in the image, the spatial equation of the laser stripe plane and the rigid body transformation matrix from the camera coordinate system to the embroidery machine frame coordinate system (with the needle bar movement axis as the Z-axis) are fitted using the least squares method. In actual operation, this matrix parameter stored in non-volatile memory is called to perform rigid body mapping on the fitted needle eye center coordinates, ultimately outputting the needle eye operation pose data.

[0057] By introducing differential geometric topological analysis, the depth gradient vector field of the point cloud model is calculated. The pinhole, as a physical hole, exhibits a sharp abrupt change in the depth direction, distinguishing it from shallow surface scratches. Furthermore, morphological closing operations and connected component analysis of closed regions are combined to eliminate open pseudo-edge interference using closure constraints. Finally, the validated closed region is fitted with a spatial conic section using the least squares method, ensuring that the located target is the true geometric hole center. This step improves the algorithm's ability to identify complex interference and guarantees the reliability of the output coordinates.

[0058] This invention provides a needle eye localization method for embroidery machines based on image analysis. By coupling the image sensor's readout time with the nonlinear motion of the embroidery machine, a distorted image containing depth information is acquired. Utilizing laser triangulation principles and motion compensation algorithms, a three-dimensional point cloud model of the needle bar surface can be decoupled from the two-dimensional image. Since the depth variation of the laser stripes naturally filters background textures, and gradient-based closed region recognition is based on geometric topology rather than grayscale contrast, it can shield against interference from fabric patterns and oil stains on metal surfaces. By reconstructing the needle bar morphology in three-dimensional space and using ellipse fitting to obtain the geometric center of the needle eye and transforming it to the global coordinate system, the three-dimensional absolute coordinate localization of the needle eye can be obtained under multiple interference environments. This reduces positioning errors, while also reducing data processing volume and detection time, improving the automation efficiency and intelligence level of the equipment.

[0059] Example 2 This embodiment describes the specific implementation process of using an image analysis-based needle eye positioning method on an industrial-grade multi-head embroidery machine: In this embodiment, the industrial-grade multi-head embroidery machine has its main drive shaft operating speed set to 4500 rpm under extreme conditions and is equipped with a 17-bit multi-turn absolute encoder, with a single-turn pulse count as high as 131072. The data acquisition process is advanced in millisecond-level time slices. In the 58th frame of the acquisition sequence, key image data of the needle bar in the rapid downward phase was successfully captured. The hardware trigger time recorded by the FPGA control unit shows that the initial trigger time of this frame is 105200μs of the system clock. Based on the inherent timing characteristics of the image sensor, its row readout interval parameter is precisely locked to 18.904μs. Taking the 850th row of pixel data scanned by the image sensor as an example, a rigorous exposure time calculation was performed: multiplying the row index value 850 by the row readout interval 18.904μs, and adding the initial trigger time 105200μs, the absolute photosensitive time of the photosensitive unit in this row is calculated to be 121268.4μs. Simultaneously, the encoder, synchronized with the main drive shaft, provided a real-time pulse count value of 98304. Based on the encoder resolution, phase conversion was performed: the pulse value 98304 was divided by the total resolution of 131072, then multiplied by 360 degrees, yielding an absolute phase angle of 270.0 degrees for the main drive shaft at that moment of photosensitive sensing. This phase point corresponds mechanically to the region of maximum reverse acceleration of the needle bar. Furthermore, the image acquisition window was dynamically locked to the central 1200-line area in the vertical direction.

[0060] Upon receiving the locked 270.0-degree phase angle data, the data processing unit immediately initiates the kinematic inversion process. Considering that this embodiment targets a thick-material sewing machine, the kinematic mapping table is constructed based on the corrected mechanical parameters: the crank radius is set to 17.5 mm, and the connecting rod length is set to 65.0 mm. By querying this high-precision mapping table, the theoretical axial displacement of the needle bar at the 270.0-degree phase angle is found to be -2.450 mm, which is the standard position relative to the geometric midpoint of the needle bar stroke. Simultaneously, the image processing unit performs one-dimensional Gaussian fitting and sub-pixel extraction operations on the 850th row of pixel data, outputting the measured fringe center coordinates as 1450.35 pixels. Next, the reference lookup table is called to retrieve the theoretical laser center coordinates that a standard distortion-free straight needle should present under the theoretical displacement of -2.450 mm, and the lookup table returns 1448.10 pixels. Then, a difference operation is performed to calculate the lateral deviation between the measured value and the theoretical value as +2.25 pixels. To convert this pixel deviation into physical deformation, a triangulation formula is applied based on the calibrated optical magnification of 30 micrometers per pixel and a laser incident angle of 45 degrees. The specific calculation process is as follows: multiply 2.25 pixels by 30 micrometers, then divide by the sine of 45 degrees (0.707), ultimately yielding a slight radial bend of 0.095 mm at that cross-section. Although this value is still within the safe threshold of 0.15 mm, it is approaching the warning line. Therefore, this frame is marked as slightly deformed in the data stream and stored in the trend analysis database for subsequent predictive maintenance. If the deformation deviation exceeds the preset safe stop threshold (e.g., 0.5 mm), the data processing unit will immediately send an emergency stop signal to the embroidery machine's main control system, forcibly braking the main drive shaft.

[0061] After completing the deviation quantization of the single-row data, the continuous data stream from row 800 to row 950 was further aggregated, covering the segment where the needle eye is located in physical space. By performing time-stamp-based reverse motion compensation on each original depth data point within this data segment, the axial displacement component caused by the high-speed movement of the needle shaft was successfully removed, and a static 3D point cloud model of the needle eye surface was reconstructed. Differential geometric topology analysis showed that there is a closed elliptical concave region in the reconstructed point cloud, with a maximum depth gradient of 0.45 at its edge. This feature parameter conclusively confirmed the existence of the needle eye contour. Subsequently, the 3D coordinate point set of the contour edge was extracted, and spatial ellipse fitting was performed using the least squares method. The fitting results showed that the original coordinates of the needle eye geometric center in the camera coordinate system were 5.20mm on the X-axis, -2.45mm on the Y-axis, and 100.15mm on the Z-axis. The final step of the process is a global coordinate system transformation, which calls the hand-eye calibration matrix stored in non-volatile memory. This matrix contains rotation and translation components, and the operational logic involves left-multiplying the camera coordinate system data by the transformation matrix. Specifically, in the numerical calculation, the rotation matrix rotates the coordinate system by 90 degrees and compensates for a 1.5-degree installation tilt angle, while the translation vector is superimposed with the robot arm's origin offset: X-axis 150.00mm, Y-axis 200.00mm, Z-axis 50.00mm. The final calculated needle hole operation pose data is: X-axis 155.20mm, Y-axis 197.55mm, Z-axis 49.85mm.

[0062] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. An image analysis-based eyelet positioning method for embroidery machines, characterized in that, include: A horizontal fan-shaped light band is projected onto the needle bar of an embroidery machine using a line laser emitter to generate a modulated light strip; Based on modulated light stripes, an image sensor captures images as the needle bar of an embroidery machine passes through a horizontal fan-shaped light strip, and a distorted image sequence is output through line exposure delay; The distorted image sequence is analyzed frame by frame and the background is suppressed to separate the laser signal; based on the laser signal, the peak value of the laser energy distribution is calculated by Gaussian fitting algorithm, and the coordinates of the stripe center are output. The phase signal of the main drive shaft encoder is collected. Based on the nonlinear transmission relationship of the needle bar drive mechanism of the embroidery machine, a mapping table between the angle of the main drive shaft and the displacement of the needle bar is established. Combined with the line readout time parameter of the image sensor, the photosensitive moment is obtained. By querying the mapping table, the absolute axial displacement value of the needle bar is generated. Based on the center coordinates of the stripes, the original depth data is obtained through laser triangulation. Based on the absolute displacement value of the needle bar axial direction, a three-dimensional point cloud model of the needle bar surface is reconstructed through motion compensation calculation. Through gradient analysis, the closed regions in the three-dimensional point cloud model of the needle bar surface are identified, ellipse fitting is performed, the fitting center is calculated and transformed to the embroidery machine frame coordinate system, and the needle eye operation pose data is output.

2. The image analysis based eyelet positioning method of claim 1, wherein, The specific process for generating the modulated light stripe includes: A driving line laser emitter excites a narrowband beam of a preset wavelength, performing aspherical beam expansion in the horizontal dimension and focusing compression in the vertical dimension to construct a horizontal fan-shaped light strip. The horizontal fan-shaped light strip is projected to cover the reciprocating stroke of the embroidery machine needle bar, with the normal direction of the light plane set perpendicular to the axial reciprocating motion axis of the embroidery machine needle bar. During the intersection of the horizontal fan-shaped light strip and the cylindrical metal surface of the needle bar, a lateral optical path offset is generated in the propagation path, modulating the horizontal fan-shaped light strip into a curved and distorted light strip that undulates nonlinearly with the depth of the embroidery machine needle bar surface, and outputting the modulated light strip.

3. The image analysis based eyelet positioning method of claim 1, wherein, The specific process for generating the distorted image sequence includes: The modulated light stripe penetrates a narrowband filter and is projected onto the pixel array of the image sensor. The narrowband filter blocks stray ambient light in non-laser bands. The rolling shutter timing logic of the image sensor is activated, and the pixel array is driven to open the electronic photosensitive window sequentially according to the row readout time interval parameter. During the embroidery machine needle bar's axial movement through the horizontal fan-shaped light strip, the time difference between the opening exposure of different pixel rows is used to force each row of pixels to capture the surface cross-sectional features at different axial heights of the embroidery machine needle bar on an independent time slice. Based on the surface cross-sectional features, the mechanical motion of the embroidery machine needle bar is coupled with the electronic rolling shutter scanning at speed, quantized into a digital grayscale matrix, and the distorted image sequence is output.

4. The image analysis based eyelet positioning method of claim 1, wherein, The specific process for constructing the center coordinates of the stripes includes: For the digital grayscale matrix of a single frame in the distorted image sequence, a frame-by-frame parsing process is initiated: For each row of pixel data, a pre-defined Gaussian mixture model is loaded, the difference response between the grayscale value and the Gaussian mixture model is calculated, and a dynamic threshold segmentation algorithm is applied to remove noise interference. The effective region of the laser stripes is separated through a binarization mask operation. Within the effective region of the laser stripes, a grayscale distribution curve is constructed along the pixel row direction. A one-dimensional Gaussian fitting algorithm is performed on the grayscale distribution curve to solve for the peak amplitude and obtain the center coordinates. The distorted image sequence is traversed, and the stripe center coordinate data stream composed of the center coordinates is output.

5. The image analysis based eyelet positioning method of claim 1, wherein, The specific process for generating the axial absolute displacement value of the needle bar includes: The system receives orthogonal pulse signals from an absolute encoder rigidly connected to the main drive shaft of the embroidery machine, and converts them into main drive shaft phase values ​​through demodulation. It then retrieves a mapping table for the needle bar drive mechanism, which contains the nonlinear transmission relationship between the rotation angle of the main drive shaft and the axial position and instantaneous speed of the needle bar. Based on the inherent row readout time interval parameter of the image sensor, a linear function of the main drive shaft phase value and time delay is constructed, and the photosensitive moment of each row of photosensitive units in the pixel array is calculated row by row. For each photosensitive moment, synchronous interpolation is performed in the main drive shaft phase value stream to lock the corresponding main drive shaft phase. Finally, by querying the mapping table using the main drive shaft phase, the absolute axial displacement value of the needle bar at the corresponding moment is obtained.

6. The image analysis based eyelet positioning method of claim 1, wherein, The specific generation process of the three-dimensional point cloud model of the needle bar surface includes: The system receives the stripe center coordinate data stream and the needle bar axial absolute displacement value. Based on laser triangulation, the center coordinates in the stripe center coordinate data stream are mapped to the 3D camera coordinate system to calculate the original depth data containing mixed information of rigid body displacement and surface morphology. Through nonlinear motion decoupling, the corresponding needle bar axial absolute displacement value is obtained for each original depth data based on the timestamp index. A reverse displacement compensation vector parallel to the needle bar motion axis is constructed, and motion compensation operation is performed on the original depth data to extract the axial position component from the mixed surface morphology information, obtaining geometric topology data. The geometric topology data is resampled and meshed to output a 3D point cloud model of the needle bar surface.

7. The image analysis based eyelet positioning method of claim 1, wherein, The specific process for generating the needle hole operation pose data includes: The system receives a 3D point cloud model of the needle bar surface and performs differential geometric topology analysis: For discrete 3D spatial points in the 3D point cloud model of the needle bar surface, a local differential operator is constructed, and the depth gradient vector field along the needle bar axis of the embroidery machine is calculated to generate a gradient feature matrix reflecting the abrupt changes in surface depth; elements in the gradient feature matrix whose values ​​exceed a preset gradient threshold are marked as closed regions, and morphological closing operations and connected component topology analysis are performed in the closed regions. Based on the closure constraint, open pseudo-edge interference is eliminated, and the needle eye contour region with a closed geometric path is locked; the edge coordinate data of the needle eye contour region is extracted, and spatial ellipse fitting is performed using the least squares method to solve the coordinates of the fitting center; a preset hand-eye calibration transformation matrix is ​​called to perform rigid body mapping operation on the fitting center coordinates, transforming them into the embroidery machine frame coordinate system to obtain the needle eye working pose data.