Smart extraction and adaptation of embroidery patterns across media content
By using cross-media feature regularization and anisotropic diffusion control model, the problems of misjudgment and missuppression of thin lines in the denoising process of existing technologies are solved, and the structural integrity and clarity of cross-media embroidery patterns are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 广州新华学院
- Filing Date
- 2026-04-24
- Publication Date
- 2026-07-14
Smart Images

Figure CN122391167A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embroidery image processing, specifically a method and system for intelligent extraction and adaptation of embroidery patterns across media content. Background Technology
[0002] With the development of digital image processing technology and automated embroidery equipment, users can input images via mobile terminals or computers. Image processing algorithms then extract the pattern structure information, converting it into embroidery path data to drive automated embroidery. The core of this process lies in accurately extracting line structures, contour information, and local texture features from the input image and transforming them into an executable embroidery trajectory. Therefore, the main task in this field is to achieve stable pattern extraction and structure reconstruction for image data of diverse sources and varying quality, ensuring the integrity and precision of the final embroidery product.
[0003] In existing technologies, the extraction of embroidery patterns from cross-media images (such as images taken by mobile phones, screenshots, and images downloaded from the internet) typically employs a "denoise first, then extract" processing flow. Specifically, the input image is first denoised to eliminate compression artifacts, sensor noise, and background interference, resulting in a smoother, cleaner image. Then, based on the denoised image, edge detection algorithms (such as gradient-based operators), line extraction methods, and morphological processing techniques are used to extract structural information from the image. Furthermore, contour tracking or path planning algorithms are used to generate embroidery trajectory data. In general scenarios, when the image has high contrast and clear structural boundaries, this type of method can achieve effective pattern extraction to a certain extent.
[0004] However, in real-world embroidery pattern applications, the aforementioned methods have significant limitations. Embroidery stitches typically appear as thin, elongated structures with a width of only 1 to 3 pixels. These structures exhibit weak contrast, local discontinuities, and high-frequency distribution, visually resembling compressed noise or random noise. When images undergo denoising, existing algorithms often prioritize retaining large, continuous areas based on principles of local smoothing or statistical consistency, misjudging these small, discontinuous, and low-contrast stitches as noise and weakening or even deleting them. While this process superficially makes the image smoother, it actually leads to the irreversible loss of crucial structural information, a phenomenon known as "structural false positives." Since subsequent pattern extraction and embroidery path generation both depend on the denoised image structure, once the initial structure is destroyed, the final embroidery result will exhibit problems such as missing lines, structural breaks, and distorted details. This problem is particularly pronounced when the user's input image quality is low (e.g., due to multiple compressions or low-light photography). Therefore, in the field of embroidery pattern processing, how to remove noise while avoiding misjudgment and suppression of thin, continuous lines with structural continuity, and thus fully preserve key structural information while ensuring image purity, has become an urgent technical problem to be solved. Summary of the Invention
[0005] This application provides a method and system for intelligent extraction and adaptation of embroidery patterns across media content, which solves the problem that existing technologies, while removing noise, may misjudge and suppress thin, continuous lines with structural continuity.
[0006] To achieve the above objectives, the embodiments of this application disclose the following technical solutions:
[0007] On the one hand, this solution discloses a method for intelligent extraction and adaptation of embroidery patterns across media content. Step S1: Obtain original embroidery image data from different acquisition sources, and perform cross-media feature regularization processing on the original embroidery image data. Cross-media feature regularization processing is used to eliminate statistical distribution shifts caused by differences in shooting equipment, compression methods and imaging conditions, so that images from different sources are comparable in terms of brightness distribution, contrast structure and frequency response. Standardized image data is obtained, and directional coherence features, phase consistency features and structural tensor features are extracted based on the standardized image data to construct the corresponding directional coherence field, phase consistency feature map and structural tensor field.
[0008] Step S2: Perform joint mapping processing based on directional coherence field, phase consistency feature map and structural tensor field. The joint mapping processing is used to establish structural consistency correspondence between different feature spaces to enhance the consistency of cross-scale structural expression and generate structural saliency protection mask. The structural saliency protection mask is used to characterize candidate regions with structural continuity in the image.
[0009] Step S3: Construct an anisotropic diffusion control model using the structure tensor field. The anisotropic diffusion control model is used to constrain the diffusion behavior based on the local structural directionality, so that the diffusion process changes from "indiscriminate smoothing" to "structure-guided smoothing". Perform denoising processing on the original embroidery image data to obtain the denoised image, and constrain and control the diffusion process based on the structural saliency protection mask. Reduce the diffusion intensity in the area covered by the structural saliency protection mask, and increase the diffusion intensity in the non-structure area.
[0010] Step S4: Generate a residual signal based on the differences between the images before and after denoising, and perform structural candidate region extraction processing on the residual signal to obtain a set of residual candidate structures;
[0011] Step S5: Perform topological connectivity analysis and geometric constraint determination on the residual candidate structure set, identify the target structure region that meets the structural continuity condition, and perform structural compensation processing on the denoising result based on the target structure region to output the embroidery pattern data after structural repair.
[0012] Furthermore, instead of simply calculating local gradients in the image, the existing scheme establishes a gradient covariance structure for the original embroidery image data, explicitly transforming the directional relationships of local pixels into a computable tensor representation. Based on this, eigenvalue decomposition of the tensor separates the principal and secondary directions originally implicit in pixel variations. An anisotropy index is then introduced to quantify the "directional consistency" of the local structure, enabling the structural tensor field to not only describe edge existence but also characterize the stability and extension features of the structure.
[0013] Furthermore, the cross-media feature regularization processing in this application is not a single brightness adjustment step, but rather a process that progressively eliminates the statistical distribution differences between images from different sources. First, brightness normalization eliminates the global offset caused by exposure differences, ensuring alignment of different images at the basic grayscale level. Then, a contrast redistribution mechanism reconstructs the local grayscale gradient structure, making the image's edge response independent of the acquisition device's characteristics. Further, color compensation and grayscale conversion strategies are introduced to compress the color dimension deviations of multi-source images into a unified expression space. Finally, multi-scale normalization ensures consistent responses at different frequency levels, providing stable input for subsequent structure extraction.
[0014] Furthermore, in the construction of the phase-consistent feature map, this application does not rely on edge detection results at a single scale. Instead, it performs multi-scale frequency domain decomposition on the image, allowing structural information to be simultaneously unfolded at different frequency levels. Based on this, by calculating the phase alignment degree at each scale and in each direction, the structural information is transformed from a "brightness-dependent expression" to a "phase-consistent expression." Finally, through cross-scale fusion, structural saliency information can be stably extracted even under conditions of significant changes in illumination or imaging differences.
[0015] Furthermore, in the process of generating the structural saliency protection mask, instead of directly using a single threshold segmentation, the phase consistency feature map and the structural tensor field are first weighted and fused to form a continuous response distribution of different structural representation information in a unified space. Then, the distribution is normalized to make it comparable. Next, the structural region and the unstructured region are divided through a threshold mechanism, and local fractures are eliminated through morphological optimization, so that the final generated structural protection region has topological connectivity, thereby ensuring that it can serve as a stable constraint basis for subsequent diffusion control.
[0016] Furthermore, in the anisotropic diffusion control process, this application does not employ the traditional uniform diffusion model. Instead, it first determines the main directional structure of the local space through the structural tensor field, making the diffusion process direction-dependent. Based on this, the diffusion process is decomposed into low-intensity diffusion along the main direction and high-constraint diffusion in the vertical direction, thereby avoiding unnecessary expansion of the structure in the vertical direction. Simultaneously, a structural saliency protection mask is introduced, causing the diffusion intensity to exhibit spatially partitioned modulation characteristics. In addition, a structural anchor point constraint mechanism is used to maintain the stable position of key structural nodes during the diffusion process, thereby preventing the thin-line structure from breaking or drifting during denoising.
[0017] Furthermore, the generation process of the residual signal is not a simple difference operation, but rather involves structurally extracting the pixel-level differences between the original image and the denoised image, so that the weakened structural information is revealed again in an explicit form. Subsequently, through thresholding and connected component analysis, the structural components in the residual are separated from the random noise, thereby constructing a set of residual candidate structures, making it possible for the structural information hidden in the denoising process to be identified and recovered again.
[0018] Furthermore, in the topological connectivity analysis process, this application does not directly rely on pixel connectivity relationships. Instead, it first performs skeletonization on the residual structure, compressing the complex structure into a one-dimensional topological path. Based on this, the geometric stability of the structure is quantified by calculating the path length and curvature changes. Then, a continuity determination mechanism is used to screen out structural segments with stable topological relationships, thereby identifying them as target structural regions.
[0019] Furthermore, structural compensation is not simply pixel backfilling, but rather mapping the target structural region back to the original spatial coordinate system to align it with the denoising result under the same geometric reference. Subsequently, the structural information is reconstructed through weighted fusion, so that the restored structure retains the original morphological features while avoiding abrupt changes with the denoised background, thereby achieving a unity of structural continuity and visual consistency.
[0020] On the other hand, this solution discloses a cross-media content intelligent extraction and adaptation system for embroidery patterns, including:
[0021] The data acquisition module is used to acquire the original embroidery image data;
[0022] The structural feature extraction module is used to perform cross-media feature regularization processing on the original embroidery image data. After regularization processing, it extracts directional coherence features, phase consistency features, and structural tensor features, and constructs directional coherence field, phase consistency feature map, and structural tensor field.
[0023] The structural protection generation module generates a saliency protection mask for the structure based on the directional coherence field, phase consistency feature map, and structural tensor field.
[0024] A controlled denoising module is used to perform anisotropic diffusion denoising based on a structural saliency protection mask and a structural tensor field.
[0025] The residual analysis module is used to generate residual signals and extract a set of candidate residual structures.
[0026] The structural compensation module is used to perform topological connectivity analysis on the residual candidate structure set and perform structural compensation processing to output embroidery pattern data.
[0027] This system, in addition to the traditional approach of "denoising before extracting structure," introduces a structural saliency protection mask and a residual structure feedback mechanism. This transforms the denoising process from a one-way information compression process into a reversible process of structure preservation and restoration. By constraining the diffusion direction through a structural tensor field, the smoothing process is ensured to always proceed along the main structural direction. This physically avoids lateral damage to delicate embroidery stitches, thus maintaining structural integrity while reducing noise and providing a highly consistent structural foundation for subsequent embroidery pattern reconstruction.
[0028] This invention addresses the technical problem in existing embroidery pattern denoising processes: embroidery stitches typically exhibit thin, elongated structures of 1 to 3 pixels with weak contrast, local discontinuities, and high-frequency distribution characteristics, making them easily confused with noise or compression artifacts during the denoising stage. This leads to erroneous smoothing or deletion, resulting in structural misidentification, missing lines, and structural breaks. The invention proposes a cross-media content intelligent extraction and adaptation method for embroidery patterns. By introducing directional coherence fields, phase consistency feature maps, and structural tensor fields to construct a structural saliency protection mask, the system can distinguish between critical lines and noise based on structural continuity. Furthermore, an anisotropic diffusion control model is used to reduce diffusion intensity in areas covered by the structural saliency protection mask and increase diffusion intensity in unstructured areas, thereby achieving targeted protection of fine stitches and preventing their removal during denoising. Simultaneously, residual signal-driven structural candidate region extraction, topological connectivity analysis, and structural compensation mechanisms are used to re-identify and restore thin, elongated structures weakened or mistakenly deleted during denoising. Therefore, this solution can effectively remove noise while significantly reducing misjudgment and false suppression of fine embroidery stitches, achieving complete preservation of key structural information, and ensuring that the embroidery pattern maintains line continuity and structural clarity even under complex acquisition conditions. Attached Figure Description
[0029] Figure 1 This is an overall flowchart of the method according to an embodiment of the present invention;
[0030] Figure 2 This is a flowchart illustrating the construction process of the structural tensor field according to an embodiment of the present invention.
[0031] Figure 3 This is a flowchart of cross-media feature regularization processing according to an embodiment of the present invention;
[0032] Figure 4 This is a flowchart illustrating the generation process of the structural saliency protection mask in an embodiment of the present invention.
[0033] Figure 5 This is a system module structure diagram of an embodiment of the present invention;
[0034] Figure 6 This is a system interaction timing diagram according to an embodiment of the present invention. Detailed Implementation
[0035] 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 a part of the embodiments of the present invention, and not all of them. 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. In the following description, numerous specific details are set forth to provide a comprehensive understanding of the present invention. The present invention may be practiced without some or all of these specific details. In other instances, well-known processes have not been described in detail to avoid unnecessarily obscuring the present invention.
[0036] When used in conjunction with the terms "comprising," "method comprising," or similar language in this specification and appended claims, the singular forms "a," "some," and "the" include plural references unless the context clearly indicates otherwise. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0037] Terminology definition: Cross-media feature regularization refers to the process of performing a uniform dynamic range mapping on raw image data from different acquisition sources. The process includes brightness normalization, contrast remapping, and color space conversion to ensure that the grayscale distribution of images from different sources meets a preset statistical range.
[0038] Directional coherence field refers to a scalar or vector field calculated based on the directional consistency of local pixel gradients, used to characterize the degree of directional consistency of local structures in an image.
[0039] A phase consistency feature map is a structural response map generated by calculating the phase alignment of each frequency component through multi-scale frequency domain filtering. It is used to characterize structural consistency regions that are independent of grayscale values.
[0040] The structural tensor field refers to the set of characteristic matrices calculated based on the local gradient covariance matrix, which is used to characterize the distribution of principal and secondary directions in a local region.
[0041] Example 1
[0042] This embodiment discloses a method for intelligent extraction and adaptation of embroidery patterns across media content. It controls the diffusion coefficient distribution through a structural saliency protection mask and applies a diffusion restriction term to the target pixels based on a structural anchor point constraint mechanism. This achieves differentiated diffusion control of structural regions during anisotropic diffusion denoising. Furthermore, it performs structural compensation processing on candidate structural regions through residual analysis, including the following steps:
[0043] Step 1: Acquire raw embroidery image data from different sources and perform cross-media feature regularization on the raw embroidery image data to obtain standardized image data, so as to reduce the influence of different imaging conditions on brightness and contrast. Based on the standardized image data, extract directional coherence features, phase consistency features and structural tensor features, and construct the corresponding directional coherence field, phase consistency feature map and structural tensor field.
[0044] The construction of the structure tensor field includes: performing gradient calculation on the original embroidery image data to obtain the gradient components of each pixel; constructing a local gradient covariance matrix based on the gradient components, and performing eigenvalue decomposition on the local gradient covariance matrix to obtain principal direction eigenvalues and secondary direction eigenvalues; calculating the structure anisotropy index based on the principal direction eigenvalues and secondary direction eigenvalues, and generating a structure tensor field based on the structure anisotropy index, wherein the structure tensor field is used to describe the directional distribution characteristics and structural stability information of local regions in the image.
[0045] Cross-media feature regularization processing includes: performing brightness normalization on the original embroidery image data to eliminate global brightness shifts under different acquisition conditions; performing contrast redistribution processing on the brightness-normalized image, using histogram alignment or adaptive contrast stretching to ensure the grayscale distribution meets a preset range; the preset range is determined by statistical analysis of the grayscale histogram, selecting a preset quantile interval (including low and high quantiles).
[0046] After contrast redistribution processing, color shift compensation or grayscale conversion is performed on the image to reduce color differences caused by different imaging devices. Based on the above processing results, multi-scale normalization processing is performed to make the spatial frequency response of images from different sources more consistent, thereby generating standardized image data.
[0047] The construction of the phase consistency feature map includes: performing multi-scale frequency domain decomposition on the original embroidery image data to obtain frequency components at multiple scales and in multiple directions; calculating the phase alignment degree of the frequency components to generate corresponding phase response values; and performing fusion processing based on the phase response values at each scale and in each direction to obtain the phase consistency feature map, wherein the phase consistency feature map is used to characterize the structural saliency information in the image that is independent of brightness.
[0048] In this step, the image signal is first read in through a standard interface. To address the noise distribution differences caused by the "cross-media" interaction, cross-media feature regularization is performed. Preferably, a global histogram matching algorithm is used to eliminate brightness shifts, and the Laplacian operator is used to align the spatial frequency response across multiple scales. When extracting the structure tensor field, the Gaussian derivative operator is used to extract the components of the horizontal and vertical gradients, constructing a second-order symmetric matrix, i.e., the local gradient covariance matrix, within a local window. Subsequently, eigenvalue decomposition is performed on this matrix to extract the principal and secondary eigenvalues.
[0049] To maintain the stability of line trace recognition under different imaging conditions when there are local overexposed or shadowed areas in the image, a nonlinear mapping based on energy normalization and contrast sensitivity factor is introduced, thereby obtaining the equation for calculating the structural anisotropy index:
[0050] ;
[0051] in, and Let represent the principal and secondary eigenvalues of the local gradient covariance matrix in the structure tensor field, respectively. The principal and secondary eigenvalues are obtained through the following process: First, gradient calculation is performed on the standardized image data to obtain the gradient components of each pixel in the horizontal and vertical directions; then, the gradient covariance matrix is constructed within a preset neighborhood window, which is a fixed-size window centered on the current pixel; next, eigenvalue decomposition is performed on the gradient covariance matrix to obtain the corresponding principal and secondary eigenvalues, where the principal eigenvalues correspond to the gradient energy distribution in the principal direction of the structure tensor, and the secondary eigenvalues correspond to the gradient energy distribution in the direction perpendicular to the principal direction of the structure tensor. The preset stability parameter is a constant with a value greater than zero, used to avoid numerical instability when the denominator is zero or close to zero. The structural anisotropy index obtained by the above calculation is used to characterize the degree of directional concentration in a local region. When the structural anisotropy index is close to the preset upper limit, it indicates that the region has obvious unidirectional structural characteristics. When the structural anisotropy index is close to the preset lower limit, it indicates that the structural direction distribution in the region tends to be uniform. In one embodiment, the preset upper limit and preset lower limit of the structural anisotropy index are determined based on statistical distribution. Specifically, the structural anisotropy index of all pixels in the standardized image data is statistically analyzed globally to obtain the corresponding numerical distribution interval. A preset quantile is selected as the threshold according to the distribution interval, wherein the preset upper limit corresponds to the value in the high quantile interval and the preset lower limit corresponds to the value in the low quantile interval.
[0052] This index can be used to filter candidate structural regions in an image and serve as an input variable for calculating the structural saliency response value.
[0053] The construction of the phase consistency feature map involves multi-scale, multi-directional convolution of the image using a Log-Gabor filter bank to extract the local phase of each point. A Log-Gabor filter bank is constructed at a preset number of scales and directions. After convolution operations on the image, the phase response values at each scale and direction are obtained, and then fused using a weighted summation or maximum response method.
[0054] Cross-media images exhibit significant differences in contrast and signal-to-noise ratio due to variations in imaging pathways. Regularization can align signals from different sources to a similar dynamic range, preventing subsequent feature extraction operators from failing in low-light or overexposed areas. By utilizing the dual constraints of structural tensor and phase consistency, randomly distributed photosensitive noise (phase clutter) can be effectively distinguished from embroidery stitch structures with spatial connectivity and directional consistency, serving as input data for generating structurally salient protective masks.
[0055] Step 2: Perform joint mapping processing based on the directional coherence field, phase consistency feature map and structural tensor field to generate a structural saliency protection mask, which is used to characterize candidate regions with structural continuity in the image.
[0056] The generation of the structural saliency protection mask includes: weighted fusion of the phase consistency feature map and the structural tensor field to obtain the structural saliency distribution result; normalization and threshold segmentation of the structural saliency distribution result to generate a binary structural protection region; and morphological optimization of the binary structural protection region to obtain the structural saliency protection mask, wherein the structural saliency protection mask is used to identify the image region that needs structural protection.
[0057] In this step, the phase coherence eigenvalues and structural anisotropy indices obtained in step 1 are nonlinearly fused. Specifically, the phase coherence response intensity is used as a benchmark weight and modulated by the coherence coefficients extracted from the structural tensor field. Through a logistic mapping function, regions satisfying strong coherence and high phase alignment are identified as salient structures.
[0058] To distinguish between structurally continuous and unstructured regions in embroidery images and achieve stable discrimination even when their features highly overlap, a multi-feature weighted fusion mapping function based on phase consistency features and structural tensor features is constructed to generate structural saliency response values. This provides a quantitative basis for the subsequent construction of structural saliency protection masks.
[0059] ;
[0060] : Indicates pixel position The structural saliency response value at a location, ranging from 0 to 1, is used to characterize the probability that the location belongs to a structurally continuous region. As input data for generating a saliency protection mask for the structure, the protection area of the structure is determined by threshold segmentation.
[0061] : Represents the pixel coordinates in the input image, derived from the spatial location index of the standardized image data.
[0062] : Indicates pixel position The phase consistency feature value at a given location is used to characterize the phase alignment degree of that location across multiple scales and multiple directions of frequency components. The phase consistency feature value is obtained by performing multi-scale Log-Gabor filtering on the standardized image data. Specifically, the image is convolved at multiple scales and in multiple directions to extract the local phase information of each frequency component, and then fused based on the phase consistency calculation rules. It reflects the stability of the structure in the frequency domain and is independent of changes in image brightness and contrast.
[0063] : Indicates pixel position The structural anisotropy index at a given location is used to characterize the directional consistency and structural extension characteristics of a local region. The structural anisotropy index is calculated based on the structural tensor field, specifically: gradient calculation is performed on the standardized image data to obtain the gradient components of each pixel; a gradient covariance matrix is constructed within a local window; and eigenvalue decomposition is performed on this matrix to obtain the principal direction eigenvalues and secondary direction eigenvalues. The structural anisotropy index is then calculated based on the difference between these two eigenvalues. ; Used to characterize the geometric features of a structure.
[0064] : Indicates pixel position The directional coherence field response value at a given location, ranging from 0 to 1, is used to characterize the consistency of gradient directions within the neighborhood of that pixel.
[0065] First, a first-order gradient calculation is performed on the standardized image data to obtain the gradient components of each pixel in the horizontal and vertical directions; then, the corresponding local gradient direction is calculated based on the gradient components; and finally, the gradient direction is calculated in pixels. Within a predefined neighborhood window centered on the image (determined based on image resolution or target structure width), the gradient directions of all pixels within the neighborhood are statistically analyzed. The magnitude of the direction vectors is calculated by synthesizing and summing them in complex form to characterize the concentration of the direction distribution. Finally, the concentration is normalized to obtain a directional coherence field response value ranging from 0 to 1. .
[0066] when When the value is close to 1, it indicates that the pixel gradient direction in the neighborhood of that location is concentrated, exhibiting a clear characteristic of unidirectional extension; when... A value close to 0 indicates that the gradient direction distribution within the neighborhood of that location is discrete, with weak directional consistency. This is determined by calculating the directional coherence field response value. This allows us to obtain the directional consistency distribution information of each pixel location in the image; this response value serves as the modulation factor in the structural saliency mapping function, and is related to the phase consistency feature value. and structural anisotropy index Together, they enhance the response of linear regions with stable directional structures while suppressing noise regions with random directional distributions, thereby improving the accuracy of structurally salient protective masks in recognizing real embroidery stitches.
[0067] : Represents the structural saliency determination threshold, which is a parameter determined based on the statistical distribution of structural saliency response values; in one embodiment, it includes all pixel positions. The product results form a set of response values. The set of response values is sorted, and the value corresponding to a preset quantile is selected as τ. In one embodiment, the preset quantile ranges from 70% to 95%. In another embodiment, the preset quantile is adaptively adjusted according to the proportion of structural regions in the image.
[0068] : Represents the Sigmoid mapping function, which maps input values to the interval between 0 and 1; the function is a monotonically increasing function, and its input is the difference between the fused feature and the threshold. This mapping achieves a continuous expression of structural saliency.
[0069] Subsequently, a preliminary binary map is generated by performing dynamic threshold segmentation on the probability distribution map, and morphological closing operations are used to fill the tiny holes, while opening operations are used to remove isolated noise points, ultimately outputting a structural saliency protection mask.
[0070] Relying solely on phase or gradient features is often insufficient to address the breakage phenomenon in extremely fine stitches. By combining phase features, which reflect "existence," with tensor features, which reflect "direction," a topology-aware mask can be generated. This mask can accurately identify stitch regions with a width of only 1-3 pixels, marking them out from the noisy background and preventing them from being smoothed as noise in subsequent denoising stages.
[0071] Step 3: Construct an anisotropic diffusion control model using the structure tensor field, perform denoising processing on the original embroidery image data to obtain the denoised image, and constrain and control the diffusion process according to the structural saliency protection mask. Reduce the diffusion intensity in the area covered by the structural saliency protection mask, and increase the diffusion intensity in the non-structure area.
[0072] The anisotropic diffusion control model includes: determining the local diffusion direction based on the structural tensor field and constructing a diffusion tensor; during the diffusion process, low-intensity diffusion control is performed on the direction consistent with the principal direction of the structural tensor, and high-constraint diffusion control is performed on the direction perpendicular to the principal direction of the structural tensor; at the same time, the diffusion coefficient of each pixel is adjusted according to the structural saliency protection mask to achieve differentiated diffusion processing for structural and unstructured regions.
[0073] A structural anchor point constraint mechanism is introduced during the diffusion process. Normal diffusion constraints are applied to pixels within the area covered by the structural saliency protection mask, and smoothing is performed on pixels along the principal direction of the structural tensor. This maintains the continuity and directional consistency of the structural boundaries during denoising. The structural anchor point constraint mechanism includes: determining a set of structural anchor points based on the structural saliency protection mask. The set of structural anchor points is the set of pixels in the structural saliency protection mask whose response values are greater than a preset threshold. The preset threshold is determined based on the statistical distribution of pixel response values in the structural saliency protection mask. In one embodiment, the response values are sorted, and the value corresponding to a preset quantile position is selected as the preset threshold. During anisotropic diffusion, diffusion constraints are applied to the region where the set of structural anchor points is located, ensuring that the set of structural anchor points maintains positional stability and structural continuity during the diffusion process.
[0074] In this step, anisotropic diffusion is achieved by solving partial differential equations. Specifically, a diffusion tensor capable of controlling the diffusion flux is constructed based on the principal directions provided by the structure tensor field.
[0075] To achieve a controlled effect of "smoothing along the stitch direction and locking across stitch directions" during the denoising process of embroidery patterns, a diffusion tensor is constructed to jointly control the diffusion direction and diffusion intensity. Based on the principal and secondary direction vectors of the structure tensor field, the diffusion tensor calculation equation is constructed as follows:
[0076] ;
[0077] in, The diffusion weights along the principal directions of the structure tensor are preset parameters obtained from the statistics of the sample images or parameters that are adaptively updated based on the features of the structure tensor. The preset parameters are obtained by statistical analysis of the directional consistency distribution of the structural regions in the training images. This represents the diffusion weight along the direction of the structure tensor, which is protected by a structure saliency protection mask. The response value is adjusted so that a lower value is taken when the pixel is in the structural saliency protection area, and a higher value is taken otherwise, thereby suppressing diffusion across the structural direction;
[0078] Tangential diffusion weight Maintain a high position to complete the stitch, normal diffusion weight It decreases with structural salience.
[0079] This represents the diffusion tensor, used to describe the diffusion direction and intensity at each pixel location. Its data source is the eigenvalue decomposition result of the structure tensor field. The eigenvectors representing the principal eigenvalues in the structural tensor field, and the principal directions of the local structure, are obtained by eigenvalue decomposition of the local gradient covariance matrix. The eigenvector representing the corresponding second eigenvalue in the structure tensor field, and the direction orthogonal to the principal direction, are also obtained through eigenvalue decomposition. and These represent the projection matrices along the principal and secondary directions, respectively, used to construct a direction-selective diffusion structure.
[0080] During the computational iteration process, a structural saliency protection mask is introduced as a damping factor for the diffusion rate. Simultaneously, a structural anchor constraint mechanism is activated, identifying pixels within the structural saliency protection mask whose response values exceed a preset threshold as structural anchors, and adding a position penalty term to the diffusion equation. The preset threshold is obtained based on the statistical distribution of the response values of the structural saliency protection mask. In one embodiment, the threshold is determined by sorting the response values of all pixels and selecting the value corresponding to a preset quantile position.
[0081] To strongly suppress cross-media imaging noise while ensuring that the identified structural anchors do not experience spatial shift or contrast collapse, an anisotropic diffusion evolution equation constrained by the anchors is constructed based on the mapping relationship between the diffusion tensor and the structural saliency protection mask:
[0082] ;
[0083] in, The image intensity function represents the current iteration time, which is derived from the intermediate images in the denoising iteration process; t represents the diffusion iteration time or the number of iterations; The image gradient is represented by the spatial derivative of the current image. This represents the divergence operator, used to calculate the spatial rate of change of diffusion flux; This represents the direction and intensity of gradient propagation under the diffusion tensor constraint.
[0084] This indicates the structural saliency protection mask at the pixel location. The response value at the location is obtained by normalizing the result after jointly mapping the phase consistency feature map and the structure tensor field; the spatial position corresponding to the path parameter s is mapped to the pixel coordinates through the skeleton path coordinates. to obtain Corresponding value; The structural constraint strength coefficient is a preset parameter (based on an empirical parameter library determined from experimental sample data, and obtained by table lookup matching in the parameter library according to the global structural density of the input image) or calculated based on the global structural density, used to control the suppression strength of the structural region on diffusion evolution. This represents standardized image data after cross-media feature regularization, which serves as a reference image to limit pixel shifts during diffusion.
[0085] By calculating the aforementioned diffusion tensor and diffusion evolution equation, a denoising result that is continuous in the principal direction of the structural tensor but constrained in the secondary direction can be obtained. Simultaneously, a structural saliency protection mask and structural anchor point constraint mechanism are used to apply stable constraints to high-response regions, thereby suppressing noise while maintaining the continuity and positional consistency of the embroidery stitch structure. The diffusion process terminates when a preset number of iterations is reached or the change in the image structural tensor field between adjacent iterations is less than a preset convergence threshold. The preset number of iterations is pre-set based on the resolution of the input image and the initial noise intensity, and the convergence threshold is determined based on the Frobenius norm difference between the structural tensor fields obtained from two adjacent iterations.
[0086] Traditional denoising algorithms tend to blur edges when eliminating high-frequency noise. This scheme, guided by a diffusion tensor, enables the denoising process to exhibit "smoothness along lines and blocking across lines." By introducing a structural saliency protection mask and anchor point mechanism, a diffusion constraint term is applied to the set of structural anchor points to maintain their spatial stability. This significantly suppresses background noise while preserving the sharpness and continuity of line edges, preventing the disappearance of fine structures.
[0087] Step 4: Generate residual signals based on the differences between the images before and after denoising, and perform structural candidate region extraction processing on the residual signals to obtain a set of residual candidate structures;
[0088] The generation of residual signals includes: performing pixel-level difference operations on the original embroidery image data and the denoised image to obtain a residual image; performing threshold filtering and connected component extraction on the residual image to generate a set of residual candidate structures, wherein the set of residual candidate structures is used to represent the image components that are weakened or removed during the denoising process.
[0089] In this step, the denoised image obtained in step 3 is subtracted from the original standardized image data to obtain a residual image containing suppressed information. High-frequency components are extracted from the residual signal using a dual-threshold segmentation technique, and then the scattered residual points are clustered into blocks using a connected component labeling algorithm.
[0090] The logic of this step lies in constructing structural feedback information based on the difference in response between the structural saliency protection mask and the anisotropic diffusion control process. Through structural consistency analysis of the residual signal, structural components that were not sufficiently preserved during the diffusion constraint process are identified, and these structural components are used as feedback constraint inputs for subsequent structural compensation processing. These signals typically have extremely low contrast and exhibit connectivity or directional consistency characteristics within their spatial neighborhood.
[0091] Step 5: The residual signal is used to characterize the weakened image components during the denoising process and serves as the input data for the structure restoration process in Step 5. Topological connectivity analysis and geometric constraint determination are performed on the residual candidate structure set to identify target structure regions that meet the structural continuity conditions. Based on these target structure regions, structural compensation processing is applied to the denoising results, outputting the embroidery pattern data after structural restoration.
[0092] Topological connectivity analysis includes: performing skeleton extraction on the residual candidate structure set to obtain the corresponding structural skeleton; calculating the length parameters and curvature variation parameters of each connected segment based on the structural skeleton; determining whether the connected segments meet the preset structural continuity conditions based on the length parameters and curvature variation parameters, and identifying the connected segments that meet the conditions as target structural regions. The preset threshold parameters are determined by the system based on the statistical distribution of training samples or empirical calibration.
[0093] The structural compensation process includes: mapping the target structural region back to the corresponding position in the original embroidery image data; performing pixel value restoration or weighted fusion processing on the target structural region; and fusing the restored structural information with the denoising results to generate the final embroidery pattern data.
[0094] In this step, the tensor thinning algorithm is applied to the binary connected regions corresponding to the residual candidate structure set to extract single-pixel skeletons. For each skeleton, its geometric feature parameters are calculated.
[0095] ;
[0096] This represents a single structural skeleton curve obtained in step S4 through connected component extraction and skeletonization. Its data source is a single-pixel-width connected path generated after each connected region in the residual candidate structure set is processed by the Zhang Yan thinning algorithm.
[0097] Ps(s) represents the structural saliency protection mask along the skeleton path. The response value at the corresponding position is obtained by mapping the pixel coordinates on the skeleton path to the structural saliency protection mask generated in step S2, and then performing integral calculation along the path.
[0098] κ(s) represents the skeleton path The local curvature of each point is calculated based on the rate of change of direction of adjacent pixels after performing discrete curve fitting on the skeleton path, and is used to characterize the curvature of the path.
[0099] This represents a preset stability parameter used to avoid calculation instability caused by a denominator that is zero or too small. This parameter is a constant set during system initialization and is determined based on the distribution range of the input image feature amplitude during the initialization phase.
[0100] The length of the skeleton path is represented by summing the number of pixels in the path or by accumulating the number of pixels based on Euclidean distance.
[0101] This represents the average area of all connected regions in the residual candidate structure set, which is obtained by statistically calculating the areas of all connected regions extracted in step S4.
[0102] By calculating the structural topology evaluation function The system obtains a comprehensive structural score for each skeleton path and compares the score with a preset geometric constraint threshold. When the score meets the preset conditions, the corresponding skeleton path is identified as the target structural region and used for subsequent structural compensation processing to restore the suppressed structure during the denoising process.
[0103] When the score exceeds a preset geometric constraint threshold, the target structural region is determined to be a falsely identified target structural region. Finally, a controlled fusion process is performed on the target structural region based on structural saliency weights, ensuring consistent reconstruction with the denoising results while maintaining structural continuity. The preset geometric constraint threshold is based on a structural topology evaluation function derived from historical skeleton paths. The statistical distribution characteristics were determined, including statistical analysis of the mean and standard deviation of scores for normal structure samples, and generation of threshold parameters based on the weighted combination of the mean and standard deviation.
[0104] Topological connectivity analysis can filter out signals with linear geometric features from messy residual noise. A feedback processing procedure based on structural topological constraints can recover details lost due to extremely poor image quality to a great extent, ensuring that the output embroidery pattern is topologically closed and complete, providing a reliable geometric path for subsequent stitch planning.
[0105] Example 2
[0106] This embodiment discloses an intelligent extraction and adaptation system for cross-media embroidery patterns. In this embodiment, the intelligent extraction system for embroidery patterns consists of a data acquisition module, a structural feature extraction module, a structural protection generation module, a controlled denoising module, a residual analysis module, and a structural compensation module. Each module is cascaded through a unified data interface to form a sequential processing link from front-end acquisition to back-end output. Data is transmitted between modules using standardized image data and its derived features as carriers. The whole system constitutes a closed-loop processing system of "feature construction - structural protection - controlled denoising - residual feedback - structural repair" to achieve stable extraction and reconstruction of the structural information of embroidery patterns.
[0107] In this embodiment, the data acquisition module acquires the original embroidery image data and transmits it to the structural feature extraction module via an image acquisition interface or a storage interface. The structural feature extraction module performs cross-media feature regularization on the original embroidery image data to generate standardized image data. Based on the standardized image data, it extracts directional coherence features, phase consistency features, and structural tensor features to construct directional coherence fields, phase consistency feature maps, and structural tensor fields, respectively. The phase consistency feature maps and structural tensor fields are then transmitted as input to the structural protection generation module. Feature alignment is achieved through a unified data format, thereby avoiding fusion errors caused by inconsistencies in different feature dimensions.
[0108] The structural protection generation module performs joint mapping processing based on the phase consistency feature map and the structural tensor field to generate a structural saliency protection mask. The structural saliency protection mask and the structural tensor field are synchronously output to the controlled denoising module. The structural saliency protection mask is used as a diffusion coefficient modulation factor to realize the differentiated marking of the structural region and the unstructured region, providing a constraint basis for subsequent diffusion control.
[0109] The controlled denoising module receives the structural saliency protection mask and the structural tensor field, determines the diffusion direction based on the structural tensor field, and spatially modulates the diffusion intensity according to the structural saliency protection mask. It reduces the diffusion intensity in the structural region and increases the diffusion intensity in the non-structural region, and outputs the denoised image data to the residual analysis module. This process effectively suppresses the damage of noise diffusion to the structural boundary through the coupling effect of directional constraints and position constraints.
[0110] The residual analysis module receives the original embroidery image data and the denoised image data, performs pixel-level difference operations to generate residual signals, and generates a set of residual candidate structures based on threshold filtering and connected component extraction. The set of residual candidate structures is then passed to the structure compensation module, which realizes the feedback input of structural information by constructing the difference data before and after denoising.
[0111] The structural compensation module performs topological connectivity analysis on the residual candidate structure set, identifies target structural regions that meet the structural continuity conditions, and maps the target structural regions to the denoised image data for structural compensation processing. Finally, it outputs embroidery pattern data. This feedback repair mechanism compensates for the structural loss during the denoising process, thereby improving the overall structural integrity and continuity.
[0112] Example 3
[0113] This embodiment uses a specific application scenario, taking the mobile application of an online custom clothing platform as an example. A user takes a photo of an old Suzhou embroidery cheongsam stored in a dimly lit environment. Due to insufficient ambient light and severe ISO noise, the silk embroidery threads in the image appear as a messy mixture of fine textures and noise, resulting in extremely low contrast. After applying this solution, the system first performs cross-media feature regularization to automatically compensate the low-light image taken by the phone to standard brightness and contrast. Subsequently, during processing, the algorithm identifies the phase consistency characteristics of the embroidery threads and constructs a protective mask to prevent the denoising algorithm from misinterpreting tiny embroidery thread fibers as photosensitive noise. In the denoising stage, the outline of the embroidery threads is locked through structural anchor point constraints, and the colored noise in the background is smoothed. Finally, through residual compensation, the fine, blurred stitches that were blurred during denoising are successfully recovered. Compared to the broken embroidery threads and loss of detail resulting from traditional algorithms, the embroidery pattern output by this solution has a clear structure and continuous path, which can be directly used in the production of automated embroidery machines.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them; although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications can still be made to the specific implementation methods of the present invention or equivalent substitutions can be made to some technical features without departing from the spirit of the technical solutions of the present invention, and all such modifications should be covered within the scope of the technical solutions claimed in the present invention.
Claims
1. A method for intelligent extraction and adaptation of embroidery patterns across media content, characterized in that, Includes the following steps: Step S1: Obtain raw embroidery image data from different acquisition sources, and perform cross-media feature regularization processing on the raw embroidery image data to obtain standardized image data. Based on the standardized image data, extract directional coherence features, phase consistency features, and structural tensor features, and construct the corresponding directional coherence field, phase consistency feature map, and structural tensor field. Step S2: Perform joint mapping processing based on the directional coherence field, phase consistency feature map and structural tensor field to generate a structural saliency protection mask, wherein the structural saliency protection mask is used to characterize candidate regions with structural continuity in the image; Step S3: Construct an anisotropic diffusion control model using the structure tensor field, perform denoising processing on the original embroidery image data to obtain the denoised image, and constrain and control the diffusion process according to the structural saliency protection mask, reducing the diffusion intensity in the area covered by the structural saliency protection mask, while increasing the diffusion intensity in the non-structure area. Step S4: Generate a residual signal based on the differences between the images before and after denoising, and perform structural candidate region extraction processing on the residual signal to obtain a set of residual candidate structures; Step S5: Perform topological connectivity analysis and geometric constraint determination on the residual candidate structure set, identify the target structure region that meets the structural continuity condition, and perform structural compensation processing on the denoising result based on the target structure region to output the embroidery pattern data after structural repair.
2. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The construction of the structural tensor field in step S1 includes: performing gradient calculation on the original embroidery image data to obtain the gradient components of each pixel; constructing a local gradient covariance matrix based on the gradient components, and performing eigenvalue decomposition on the local gradient covariance matrix to obtain principal direction eigenvalues and secondary direction eigenvalues; calculating the structural anisotropy index based on the principal direction eigenvalues and secondary direction eigenvalues, and generating a structural tensor field based on the structural anisotropy index to characterize the principal direction and anisotropy degree of the local region.
3. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, According to the method of claim 1, the cross-media feature regularization process includes: The original embroidery image data is subjected to brightness normalization processing. Based on the image after brightness normalization, contrast redistribution processing is performed. Histogram alignment or adaptive contrast stretching is used to make the grayscale distribution meet the preset range. Based on the image after contrast redistribution processing, color shift compensation or grayscale conversion processing is performed. Based on the above processing results, multi-scale normalization processing is performed to generate standardized image data.
4. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The construction of the phase consistency feature map in step S1 includes: performing multi-scale frequency domain decomposition processing on the original embroidery image data to obtain frequency components at multiple scales and in multiple directions; calculating the phase alignment degree of the frequency components to generate corresponding phase response values; and performing fusion processing based on the phase response values at each scale and in each direction to obtain the phase consistency feature map, wherein the phase consistency feature map is used to characterize the structural saliency information in the image that is independent of brightness.
5. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The generation of the structural saliency protection mask in step S2 includes: performing weighted fusion processing on the phase consistency feature map and the structural tensor field to obtain the structural saliency distribution result; performing normalization processing on the structural saliency distribution result and threshold segmentation to generate a binary structural protection region; and performing morphological optimization processing on the binary structural protection region to obtain the structural saliency protection mask, wherein the structural saliency protection mask is used to identify the image region that needs to be structurally protected.
6. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The anisotropic diffusion control model in step S3 includes: determining the local diffusion direction based on the structural tensor field and constructing a diffusion tensor; during the diffusion process, performing low-intensity diffusion control on directions consistent with the directions corresponding to the principal eigenvectors in the structural tensor field, and performing high-constraint diffusion control on directions orthogonal to the principal eigenvectors in the structural tensor field; and adjusting the diffusion coefficient of each pixel according to the structural saliency protection mask. Step S3 also includes: introducing a structural anchor point constraint mechanism during the diffusion process, applying normal diffusion constraints to the pixels in the area covered by the structural saliency protection mask, and performing smoothing processing on the pixels along the direction corresponding to the principal eigenvector in the structural tensor field. Structural anchor point constraint mechanisms include: The set of structural anchor points is determined based on the structural saliency protection mask, wherein the set of structural anchor points is the set of pixels in the structural saliency protection mask whose response value is greater than a preset threshold; During the anisotropic diffusion process, diffusion constraints are applied to the region where the set of structural anchor points is located.
7. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The generation of residual signals in step S4 includes: performing pixel-level difference operations on the original embroidery image data and the denoised image to obtain a residual image; performing threshold filtering and connected component extraction on the residual image to generate a set of residual candidate structures, wherein the set of residual candidate structures is used to represent the image components that are weakened or removed during the denoising process.
8. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, Step S5, topological connectivity analysis, includes: performing skeleton extraction on the residual candidate structure set to obtain the corresponding structural skeleton; calculating the length parameters and curvature change parameters of each connected segment based on the structural skeleton; determining whether the connected segments meet the preset structural continuity conditions based on the length parameters and curvature change parameters, and identifying the connected segments that meet the conditions as the target structural region.
9. The method for intelligent extraction and adaptation of embroidery patterns across media content according to claim 1, characterized in that, The structural compensation process in step S5 includes: mapping the target structural region back to the position corresponding to the original embroidery image data; performing pixel value restoration or weighted fusion processing on the target structural region; and fusing the restored structural information with the denoising result to generate the final embroidery pattern data.
10. A cross-media content intelligent extraction and adaptation system for embroidery patterns, characterized in that, include: The data acquisition module is used to acquire the original embroidery image data; The structural feature extraction module is used to perform cross-media feature regularization processing on the original embroidery image data. After regularization processing, it extracts directional coherence features, phase consistency features, and structural tensor features, and constructs directional coherence field, phase consistency feature map, and structural tensor field. The structural protection generation module generates a saliency protection mask for the structure based on the directional coherence field, phase consistency feature map, and structural tensor field. A controlled denoising module is used to perform anisotropic diffusion denoising based on a structural saliency protection mask and a structural tensor field. The residual analysis module is used to generate residual signals and extract a set of candidate residual structures. The structural compensation module is used to perform topological connectivity analysis on the residual candidate structure set and perform structural compensation processing to output embroidery pattern data.