Structured texture seamless processing method

By adopting structured texture seamless processing methods in texture synthesis, the problems of feature loss and manual neighborhood setting in texture synthesis are solved, achieving a more natural texture transition and seamless effect with convenient use.

CN119444602APending Publication Date: 2025-02-14四川易方智慧科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411445351.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, in texture synthesis, there are missing features of some texture block areas and the need to manually set up neighborhoods, resulting in inconvenience in use.

Method used

Using a seamless process of structured textures, select fixed-size subtexture blocks from the input texture, set the overlap area of ​​the texture blocks in the order of scan lines, calculate the minimum cumulative error to determine the optimal stitching path, and make rough Smoothing the dots to optimize seamless effects.

Benefits of technology

While maintaining the original image texture structure, the seamless effect of structured texture is optimized, avoiding the tedious process of feature loss and manual neighborhood setting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444602A_ABST
    Figure CN119444602A_ABST
Patent Text Reader

Abstract

The invention discloses a structured texture seamless processing method. The method comprises the following steps: S1, selecting a sub-texture block with a fixed size from an input texture; s2, setting an overlapping region of texture blocks, selecting a texture block set meeting similarity limitation from the input texture every time, calculating to obtain the texture blocks meeting conditions in the set according to an error matching formula, selecting a texture block with the minimum error from the texture blocks, and copying the texture block to a target texture; s3, calculating an optimal splicing path; s4, smoothing the rough points on the optimal splicing path, and stitching the two texture blocks according to the path; and S5, judging whether the size of the image meets the size of N * N of the source image or not. According to the method, a rough point smoothing method is provided in the process of a common texture seamless processing algorithm, the unsmooth points at the joints are processed, and the seamless effect of the structured texture is optimized while the texture structure of the original image is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a method for seamlessly processing structured textures. Background Art

[0002] Procedural texture generation is a computer graphics technology that is mainly favored by 3D modelers and film and television production practitioners because it uses different algorithms to create more natural and complex texture images. These texture images can add more details to 3D models and can be rendered quickly, which improves image quality while also improving creation efficiency. When a large number of texture surfaces are involved in a 3D scene, it is necessary to automatically generate textures. At present, procedural texture generation has been widely used in many applied research and application fields.

[0003] In a three-dimensional scene, when an unprocessed single-sample texture is tiled onto a model, there will be boundary seams. This seam is mainly caused by pixel mutations at the texture boundary. There are usually two methods for texture seamlessness technology, both of which belong to the field of texture synthesis. Texture synthesis has always been an active research field in the field of computer graphics. Texture synthesis methods mainly include textures based on pixel synthesis and textures based on sample image synthesis.

[0004] The existing technologies mainly have the following disadvantages: the texture synthesis method based on Markov random fields can synthesize a target texture with a similar appearance to the source texture, but there is a disadvantage that the features of some texture blocks are lost; the pixel-based texture synthesis algorithm is more feasible and applicable to various textures, but the user needs to specify the neighborhood size. If the neighborhood is too small, the output texture will appear too random; if the neighborhood is set too large, the output texture will have overly regular areas, which has certain limitations. Summary of the invention

[0005] The purpose of the present invention is to provide a seamless processing method for structured textures to solve the problems in the prior art proposed in the background technology, that is, some texture block area features are lost and the neighborhood needs to be manually set during use, which is inconvenient to use.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A method for seamlessly processing structured textures comprises the following steps:

[0008] Step S1, selecting a sub-texture block of a fixed size from the input texture and copying it to the upper left corner of the target texture;

[0009] Step S2, setting the overlapping area of ​​the texture blocks in the order of the scan lines from left to right and from top to bottom, selecting a set of texture blocks that meet the similarity restriction from the input texture each time, calculating the texture blocks that meet the conditions in the set according to the error matching formula, selecting a texture block with the smallest error from them, and copying it to the target texture;

[0010] Step S3, calculating the minimum cumulative error E and the minimum cost of the overlapping part as the optimal splicing path;

[0011] Step S4, smoothing the rough points on the optimal stitching path, recording the smoothed path, and stitching the two texture blocks according to the path;

[0012] Step S5, determine whether the image size meets the size of the source image N*N. If so, end; if not, jump back to step S2 and repeat steps S2, S3 and S4 until the size of the source image N*N is reached.

[0013] According to the above technical solution, in step S2, calculating and obtaining the texture blocks that meet the conditions in the set according to the error matching formula includes the following steps:

[0014] First, calculate the Euclidean distance between corresponding pixels of the source image and the target image:

[0015]

[0016] The functions R, G, and B represent the values ​​of the three primary colors of the image blocks respectively. The smaller the value of D(p,q), the smaller the color error between the two image blocks and the higher the similarity. Conversely, the larger the color error, the lower the similarity.

[0017] Then perform error matching calculation, the error matching formula is as follows:

[0018] D(N(p),N(q))=λ||F ov (p)-F ov (q))||+(1-λ)||F(p)-F(q)||

[0019] In the formula, F ov (p) represents the overlapping area of ​​the texture blocks to be selected in the sample image, F ov (q) represents the overlapping area of ​​the synthesized texture blocks, F(p) is the texture block to be selected in the sample image, F(q) is the texture block to be synthesized, ||·|| represents the F norm, and λ is a constraint parameter used to control the corresponding balance relationship between the sample image and the target image.

[0020] According to the above technical solution, in step S3, the minimum cumulative error E is calculated to calculate the minimum cost of the overlapping part as the optimal splicing path, specifically:

[0021] Assume that B1 and B2 represent two texture blocks to be synthesized, and their overlapping areas are B1(0) and B2(O). E is the minimum cumulative difference from the bottom edge of the overlapping area to each point (i, j), and e is the pixel error corresponding to each point in the overlapping area. The calculation formula is as follows:

[0022] e i,j =(r1-r2) 2 +(g1-g2) 2 +(b1-b2) 2

[0023] Where r, g, and b are the R, G, and B color values ​​of the corresponding points in the texture blocks B1 and B2 respectively;

[0024] Starting from the top row of the overlapping area, the minimum cumulative error E of each point in the area is:

[0025]

[0026] It can be seen from the above formula that the minimum cumulative error of each point in the overlapping area is obtained by adding the minimum cumulative error of the adjacent points in the previous row to the error of the point itself. For the bottom edge of the overlapping area, the minimum cumulative error of each point is the error of the point itself.

[0027] According to the above technical solution, after the pixel points corresponding to the minimum error segmentation value of the last row of the overlapping area are calculated, the optimal stitching route of the overlapping area is obtained by reverse tracing.

[0028] According to the above technical solution, in step S4, smoothing the rough points on the optimal stitching path specifically includes the following steps: tracking and detecting the cutting points on the optimal path, calculating the gradient value of each pixel point on the path, setting the average gradient value of the path as a threshold, comparing the gradient value of each cutting point with the threshold, marking the points above the threshold as rough points, recalculating these marked rough points through an algorithm and outputting the values, and finally obtaining an image that is smoother than the above.

[0029] According to the above technical solution, the gradient value of the cutting point on the optimal path is calculated, and the formula is as follows:

[0030] S(x,y)=ABC

[0031] In the formula, S(x, y) represents the gradient value of each cutting point, A, B, and C represent sub-texture blocks respectively; the gradient value is finally compared with the gradient average value, and the points above the threshold are marked as rough points. These rough points are recalculated and output by the algorithm, and finally a smoother image is obtained compared with the above.

[0032] According to the above technical solution, the calculation of sub-texture block A is specifically as follows:

[0033] A=[f(x-1,y-1)+2*f(x-1,y)+f(x-1,y+1)]

[0034] In the formula, f(x-1, y-1) means to obtain the grayscale value at the coordinate point (x-1, y-1); f(x-1, y) means to obtain the grayscale value at the coordinate point (x-1, y); f(x-1, y+1) means to obtain the grayscale value at the coordinate point (x-1, y+1);

[0035] The calculation of sub-texture block B is as follows:

[0036] B=[f(x-1,y-1)+2*f(x,y-1)+f(x+1,y-1)]

[0037] In the formula, f(x-1, y-1) means to obtain the grayscale value at the coordinate point (x-1, y-1); f(x, y-1) means to obtain the grayscale value at the coordinate point (x, y-1); f(x+1, y-1) means to obtain the grayscale value at the coordinate point (x+1, y-1);

[0038] The calculation of sub-texture block C is as follows:

[0039] C=[f(x-1,y+1)+2*f(x,y+1)+f(x+1,y+1)]

[0040] In the formula, f(x-1, y+1) represents the grayscale value at the coordinate point (x-1, y+1); f(x, y+1) represents the grayscale value at the coordinate point (x, y+1); f(x+1, y+1) represents the grayscale value at the coordinate point (x+1, y+1).

[0041] According to the above technical solution, after the gradient values ​​of all pixels on the cutting path are obtained, the average value of the gradient sum of all pixels is calculated using the following formula:

[0042]

[0043] Where d represents the gradient average, which is used as the threshold for detecting cutting points. N represents the number of all pixels on the optimal path. Path is the cutting path, and p is a pixel on the cutting path. The gradient value of each cutting point is compared with the gradient average. When s(x,y)>d, the point is marked as a rough point and the point information is saved and recorded.

[0044] According to the above technical solution, based on the rough point information, a rectangular area centered on the rough point is defined, and the pixel points in the area are recorded as Q; the RGB distance formula between the rough points P and Q is as follows:

[0045]

[0046] The distance formula between points P and Q is as follows:

[0047]

[0048] The final smoothing value P of point P out for:

[0049]

[0050] Among them, α is the influence factor of other pixels in the area on the smoothing value of the point P, and 0.1 is taken as the value of α.

[0051] According to the above technical solution, P out The final color value is obtained by weighting it with the original RGB value of the point:

[0052] (R, G, B) = (R*P out , G*P out , B*P out )

[0053] Calculate the weighted value of all recorded Point points according to the above formula, use this value to replace the original RGB value, and re-output this part of the texture.

[0054] Compared with the prior art, the present invention has the following beneficial effects:

[0055] The method of the present invention proposes a method for smoothing rough points in the process of a commonly used texture seamless processing algorithm, processes the non-smooth points at the seams, and optimizes the seamless effect of the structured texture while maintaining the texture structure of the original image. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 This is a flow chart of the structured texture synthesis algorithm of the present invention; Figure 2 Schematic diagram of dividing the source texture into a small sample texture set in the present invention; Figure 3 This is a schematic diagram of the optimal cutting path of the present invention; Figure 4 It is a cutting point tracking information diagram on the optimal path of the present invention; Figure 5 This is a schematic diagram of the experimental results of the seamless processing algorithm of the present invention; Figure 6Schematic diagram of the experimental results of edge detection evaluation index of the present invention; Figure 7 Schematic diagram of comparative experimental results of different algorithms. DETAILED DESCRIPTION

[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0064] Embodiment 1

[0065] like Figure 1 As shown, a method for processing structured texture seamlessly includes the following steps:

[0066] Step S1, selecting a sub-texture block of a fixed size from the input texture and copying it to the upper left corner of the target texture;

[0067] Step S2, setting the overlapping area of ​​the texture blocks in the order of the scan lines from left to right and from top to bottom, selecting a set of texture blocks that meet the similarity restriction from the input texture each time, calculating the texture blocks that meet the conditions in the set according to the error matching formula, selecting a texture block with the smallest error from them, and copying it to the target texture;

[0068] Step S3, calculating the minimum cumulative error E and the minimum cost of the overlapping part as the optimal splicing path;

[0069] Step S4, smoothing the rough points on the optimal stitching path, recording the smoothed path, and stitching the two texture blocks according to the path;

[0070] Step S5, determine whether the image size meets the size of the source image N*N. If so, end; if not, jump back to step S2 and repeat steps S2, S3 and S4 until the size of the source image N*N is reached.

[0071] The method of the present invention proposes a method for smoothing rough points in the process of a commonly used texture seamless processing algorithm, processes the non-smooth points at the seams, and optimizes the seamless effect of the structured texture while maintaining the texture structure of the original image.

[0072] Embodiment 2

[0073] This embodiment provides a specific implementation method:

[0074] The implementation steps of the seamless algorithm for structured textures are as follows:

[0075] (1) Select a sub-texture block of fixed size from the input texture and copy it to the upper left corner of the target texture;

[0076] (2) setting the overlapping area of ​​the texture blocks in the order of the scan lines from left to right and from top to bottom, selecting a set of texture blocks that meet the similarity restriction from the input texture each time, calculating the texture blocks that meet the conditions in the set according to the error matching formula, selecting a texture block with the smallest error from them, and copying it to the target texture;

[0077] (3) Calculate the minimum cost of the overlapping part according to the formula of minimum cumulative error E as the optimal splicing path;

[0078] (4) Smoothing the rough points on the optimal stitching path, recording the smoothed path, and stitching the two texture blocks according to the path;

[0079] (5) Repeat the above steps (2), (3), (4) until the size of the source image reaches N*N.

[0080] Table 1 Structured texture seamless algorithm

[0081]

[0082] Minimum error matching calculation: In traditional texture synthesis algorithms, when searching for target matching blocks for error matching calculation, the color information of the overlapping area and non-overlapping area of ​​the target texture block and the synthesized texture block is mainly considered. Then, the optimal cutting path is determined by calculating the Euclidean distance between the corresponding pixels of the sample image and the target image. At the same time, the constraint value λ (0<λ<1) is used to control a balance effect between the sample image and the target image. With different λ values, the obtained effect will also be different. The Euclidean distance between the corresponding pixels of the source image and the target image is expressed as:

[0083]

[0084] The functions R, G, and B represent the values ​​of the three primary colors of the image blocks respectively. The smaller the value of D(p,q), the smaller the color error between the two image blocks and the higher the similarity. Conversely, the larger the color error, the lower the similarity.

[0085] The error matching formula is as follows:

[0086] D(N(p),N(q))=λ||F ov (p)-F ov(q)||+(1-λ)||F(p)-F(q)||

[0087] In the formula, F ov (p) represents the overlapping area of ​​the texture blocks to be selected in the sample image, F ov (q) represents the overlapping area of ​​the synthesized texture blocks, F(p) is the texture block to be selected in the sample image, F(q) is the texture block to be synthesized, ||·|| represents the F norm, and λ is a constraint parameter used to control the corresponding balance relationship between the sample image and the target image.

[0088] as follows Figure 2 As shown in the figure, the left side is the source texture image, and the right side is divided into N sub-texture blocks, and the segmentation rule is equal size and meets the maximum similarity rule. In this way, the texture can maintain the original structured texture and effectively reduce the texture repetition rate of the target texture block. The error between sub-texture blocks A and B is the smallest, the error between B and C is the smallest, and so on. The sub-texture block segmented each time is the minimum error matching block of the previous texture block.

[0089] Solving the optimal path of the boundary: In the texture synthesis algorithm adopted by EFROS et al., for the texture blocks in the overlapping area, the minimum error matching method is used to find the best cutting path in the texture overlapping area. This method refers to calculating an optimal path for the overlapping part between the synthesized texture block and the unsynthesized texture block in the process of re-splicing the segmented texture blocks, so that the boundary connection of the overlapping part of the two texture blocks is the smoothest. If the obtained boundary error is smaller, the degree of fit between the two texture blocks is higher. In the process of searching for matching texture blocks, there must be a path with the smallest error in the overlapping area between the synthesized texture block area and the texture area to be synthesized. This path is the best matching path in the texture synthesis process. The minimum error segmentation method is a segmentation in two different directions, horizontal area segmentation and vertical area segmentation. The principle is similar, and the following will take the minimum error segmentation of the horizontal overlapping area as an example for analysis.

[0090] like Figure 3 As shown in the figure, B1 and B2 represent two texture blocks to be synthesized, the overlapping areas are B1(O) and B2(O), E is the minimum cumulative difference from the bottom edge of the overlapping area to each point (i, j), and e is the pixel error corresponding to each point in the overlapping area. The calculation formula is as follows.

[0091] e i,j =(r1-r2) 2 +(g1-g2) 2 +(b1-b2) 2

[0092] Where r, g, and b are the R, G, and B color values ​​of the corresponding points in the texture blocks B1 and B2 respectively.

[0093] Starting from the top row of the overlapping area, the minimum cumulative error E of each point in the area is:

[0094]

[0095] It can be seen from the above formula that the minimum cumulative error of each point in the overlapping area is obtained by adding the minimum cumulative error of the adjacent points in the previous row to the error of the point itself. For the bottom edge of the overlapping area, the minimum cumulative error of each point is the error of the point itself.

[0096] After calculating the pixel points corresponding to the minimum error segmentation value of the last row of the overlapping area, the optimal stitching route of the overlapping area is obtained by reverse tracing. Figure 3 As shown in the right picture in , by solving the optimal paths in the four directions of up, down, left, and right of the texture blocks that are not on the edge, a seamless effect can be obtained after the texture is tiled.

[0097] Rough point recalculation optimization solution: According to the analysis of the above synthesis algorithm results, when the texture is highly structured, it is easy to have an uneven transition between texture blocks. This is because when finding the minimum cost in the overlapping area, there are some sharp points on the optimal path. The characteristic of these points is that there is a huge difference between the point and its neighboring points. This difference can be described by the image gradient. The larger the gradient value, the greater the difference, and the texture transition will appear uneven. In response to this phenomenon, the present invention proposes an improved algorithm, the principle of which is to track and detect the cutting points on the optimal path based on the optimal path obtained by the above algorithm, calculate the gradient value of each pixel point on the path, set the average gradient value of the path as a threshold, compare the gradient value of each cutting point with the threshold, mark the points above the threshold as rough points, recalculate these marked rough points through the algorithm and output the value, and finally obtain an image that is smoother than the above. As follows Figure 4 As shown, (a), (b), (c), and (d) respectively represent the tracking point information in the best path of the top, left, right, and bottom of each texture block.

[0098] The present invention uses the Sobel operator to calculate the gradient value of the cutting point on the optimal path, and the formula is as follows:

[0099] S(x,y)=ABC

[0100] A=[f(x-1,y-1)+2*f(x-1,y)+f(x-1,y+1)]

[0101] B=[f(x-1,y-1)+2*f(x,y-1)+f(x+1,y-1)]

[0102] C=[f(x-1,y+1)+2*f(x,y+1)+f(x+1,y+1)]

[0103] After using this method to find the gradient values ​​of all pixels on the cutting path, use the following formula to calculate the average value of the gradient sum of all pixels:

[0104]

[0105] Where d represents the gradient average, which is used as the threshold for detecting cutting points, N represents the number of all pixels on the optimal path, Path is the cutting path, p is a pixel on the cutting path, and the gradient value of each cutting point is compared with the gradient average. When s(x, y)>d, the point is marked as a rough point, and the point information is saved and recorded. The present invention smoothes the rough points according to the weighted method. The most important influencing factor is the pixel value of the surrounding points. Therefore, it is necessary to define a rectangular area centered on the rough point based on the rough point information recorded above, and the pixel points in the area are recorded as Q. The RGB distance formula of the rough points P and Q is as follows:

[0106]

[0107] The distance formula between points P and Q is as follows:

[0108]

[0109] The final smoothing value P of point P out for:

[0110]

[0111] Among them, α is the influence factor of other pixels in the area on the smoothing value of the point P. Here, 0.1 is taken as the value of α. P is calculated according to the following formula out The final color value is obtained by weighting it with the original RGB value of the point.

[0112] (R, G, B) = (R*P out , G*P out , B*P out )

[0113] Calculate the weighted value of all recorded Point points according to the above formula, use this value to replace the original RGB value, and re-output this part of the texture.

[0114] Embodiment 3

[0115] Figure 5The experimental result images of the structured texture seamless algorithm, Figure (a) shows the input image of the algorithm of the present invention, Figure (b) shows the 2*2 tiled image when the texture is not processed by the algorithm, and Figure (c) shows the experimental result image after the structured texture seamless algorithm of the present invention is processed. The experimental result images show that in the n*n tiling of the structured texture, there are problems such as mutations on the edge pixels of the input image. This problem will cause the texture after tiling to have obvious visual seams. In order to solve this defect, the present invention proposes a structured texture seamless algorithm to eliminate the seams at the edges of the texture. According to the experimental results in Figure (c), the algorithm can achieve a good effect of eliminating the middle seams, and the result can also better maintain the structure of the image.

[0116] Figure 6 The images show the results of the experiment using edge detection to evaluate the index, where (a) shows the grayscale image of the image tiled in 2*2 format, (b) shows the image of (a) after edge detection, (c) shows the grayscale image of the image after seamless processing, and (d) shows the image of (c) after edge detection. Figure 6 The experimental comparison between Figure (b) and Figure (d) in the figure proves the effectiveness of edge detection. The algorithm of the present invention can effectively eliminate the edge seams generated when the middle part of the image is tiled, while also retaining the structural features of the original image.

[0117] Figure 7 The algorithm of the present invention is compared with the synthesis algorithm based on noise and the synthesis algorithm based on sample images. Figure (a) shows the input texture of the algorithm, and Figure (b) shows that the texture synthesis operation is performed based on two-dimensional noise. It mainly solves the color distribution problem of the output texture and the input texture. Therefore, it has a good seamless effect on random textures, but the effect of processing structured textures is not particularly ideal, and texture confusion is easy to appear in the texture. Figure (c) shows the seamless texture generated by the synthesis method based on sample images. This method can better process structured textures and unstructured textures, but the texture block size for structured textures depends on the texture structure of the source texture. The larger the texture structure, the larger the block, and the smaller the texture structure, the smaller the block. When the structure of the texture is larger, the larger texture block will cause the structural deformation between adjacent texture blocks. This is because when the algorithm selects the matching block, it only considers the cumulative error of the overlapping area. If the similarity of adjacent texture blocks is not high, then there will be an obvious splicing feeling of fibers in the texture map. Figure (d) shows a structured seamless texture image generated by the improved algorithm of the present invention. In view of the shortcoming that the similarity on the optimal path of the structured texture is not high, a step of smoothing the gradient value of the rough points is proposed, so that the edge seam transitions naturally without obvious splicing. Therefore, the experimental results of the algorithm of the present invention perform well and can better handle the seam problem when tiling the image.

[0118] It should be noted that, in the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0119] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for seamlessly processing structured textures, characterized in that: The following steps are involved: Step S1, selecting a sub-texture block of a fixed size from the input texture and copying it to the upper left corner of the target texture; Step S2, setting the overlapping area of ​​the texture blocks in the order of the scan lines from left to right and from top to bottom, selecting a set of texture blocks that meet the similarity restriction from the input texture each time, calculating the texture blocks that meet the conditions in the set according to the error matching formula, selecting a texture block with the smallest error from them, and copying it to the target texture; Step S3, calculating the minimum cumulative error E and the minimum cost of the overlapping part as the optimal splicing path; Step S4, smoothing the rough points on the optimal stitching path, recording the smoothed path, and stitching the two texture blocks according to the path; Step S5, determine whether the image size meets the size of the source image N*N. If so, end; if not, jump back to step S2 and repeat steps S2, S3 and S4 until the size of the source image N*N is reached.

2. A method for seamlessly processing structured texture according to claim 1, characterized in that: In step S2, obtaining the texture blocks that meet the conditions in the set by calculating according to the error matching formula includes the following steps: First, calculate the Euclidean distance between corresponding pixels of the source image and the target image: The functions R, G, and B represent the values ​​of the three primary colors of the image blocks respectively. The smaller the value of D(p,q), the smaller the color error between the two image blocks and the higher the similarity. Conversely, the larger the color error, the lower the similarity. Then perform error matching calculation, the error matching formula is as follows: D(N(p),N(q)=λ||F ov (p)-F ov (q)||+(1-λ)||F(p)-F(q)|| In the formula, F ov (p) represents the overlapping area of ​​the texture blocks to be selected in the sample image, F ov (q) represents the overlapping area of ​​the synthesized texture blocks, F(p) is the texture block to be selected in the sample image, F(q) is the texture block to be synthesized, ||·|| represents the F norm, and λ is a constraint parameter used to control the corresponding balance relationship between the sample image and the target image.

3. The method for seamlessly processing structured texture according to claim 1, characterized in that: In step S3, the minimum cumulative error E is calculated to calculate the minimum cost of the overlapping part as the optimal splicing path, specifically: Assume that B1 and B2 represent two texture blocks to be synthesized, and their overlapping areas are B1(O) and B2(O). E is the minimum cumulative difference from the bottom edge of the overlapping area to each point (i, j), and e is the pixel error corresponding to each point in the overlapping area. The calculation formula is as follows: e i,j =(r1-r2) 2 +(g1-g2) 2 +(b1-b2) 2 Where r, g, and b are the R, G, and B color values ​​of the corresponding points in the texture blocks B1 and B2 respectively; Starting from the top row of the overlapping area, the minimum cumulative error E of each point in the area is: It can be seen from the above formula that the minimum cumulative error of each point in the overlapping area is obtained by adding the minimum cumulative error of the adjacent points in the previous row to the error of the point itself. For the bottom edge of the overlapping area, the minimum cumulative error of each point is the error of the point itself.

4. A method for seamlessly processing structured texture according to claim 3, characterized in that: After calculating the pixel points corresponding to the minimum error segmentation value of the last row of the overlapping area, the optimal stitching route of the overlapping area is obtained by reverse tracing.

5. A method for seamlessly processing structured texture according to claim 4, characterized in that: In step S4, smoothing the rough points on the optimal stitching path specifically includes the following steps: tracking and detecting the cutting points on the optimal path, calculating the gradient value of each pixel on the path, setting the average gradient value of the path as a threshold, comparing the gradient value of each cutting point with the threshold, marking the points above the threshold as rough points, recalculating these marked rough points through an algorithm and outputting the values, and finally obtaining an image that is smoother than the above.

6. A method for seamlessly processing structured texture according to claim 5, characterized in that: Calculate the gradient value of the cutting point on the optimal path. The formula is as follows: S(x, y) = ABC In the formula, S(x, y) represents the gradient value of each cutting point, A, B, and C represent sub-texture blocks respectively; the gradient value is finally compared with the gradient average value, and the points above the threshold are marked as rough points. These rough points are recalculated and output by the algorithm, and finally a smoother image is obtained compared with the above.

7. A method for seamlessly processing structured texture according to claim 6, characterized in that: The calculation of sub-texture block A is specifically as follows: A=[f(x-1,y-1)+2*f(x-1,y)+f(x-1,y+1)] In the formula, f(x-1, y-1) means to obtain the grayscale value at the coordinate point (x-1, y-1); f(x-1, y) means to obtain the grayscale value at the coordinate point (x-1, y); f(x-1, y+1) means to obtain the grayscale value at the coordinate point (x-1, y+1); The calculation of sub-texture block B is as follows: B=[f(x-1,y-1)+2*f(x,y-1)+f(x+1,y-1)] In the formula, f(x-1, y-1) means to obtain the grayscale value at the coordinate point (x-1, y-1); f(x, y-1) means to obtain the grayscale value at the coordinate point (x, y-1); f(x+1, y-1) means to obtain the grayscale value at the coordinate point (x+1, y-1); The calculation of sub-texture block C is as follows: C=[f(x-1,y+1)+2*f(x,y+1)+f(x+1,y+1)] In the formula, f(x-1, y+1) represents the grayscale value at the coordinate point (x-1, y+1); f(x, y+1) represents the grayscale value at the coordinate point (x, y+1); f(x+1, y+1) represents the grayscale value at the coordinate point (x+1, y+1).

8. The method for seamlessly processing structured texture according to claim 7, characterized in that: After finding the gradient values ​​of all pixels on the cutting path, use the following formula to calculate the average value of the gradient sum of all pixels: Where d represents the gradient average, which is used as the threshold for detecting cutting points. N represents the number of all pixels on the optimal path. Path is the cutting path, and p is a pixel on the cutting path. The gradient value of each cutting point is compared with the gradient average. When s(x,y)>d, the point is marked as a rough point and the point information is saved and recorded.

9. A method for seamlessly processing structured texture according to claim 8, characterized in that: According to the rough point information, a rectangular area centered on the rough point is defined, and the pixels in the area are recorded as Q; the RGB distance formula between the rough points P and Q is as follows: The distance formula between points P and Q is as follows: The final smoothing value P of point P out for: Among them, α is the influence factor of other pixels in the area on the smoothing value of the point P, and 0.1 is taken as the value of α.

10. The method for seamlessly processing structured texture according to claim 9, characterized in that: P out The final color value is obtained by weighting it with the original RGB value of the point: (R,G,B)=(R*P out ,G*P out ,B*P out ) Calculate the weighted value of all recorded Point points according to the above formula, use this value to replace the original RGB value, and re-output this part of the texture.