Self-adaptive layout method of multi-stroke image in irregular region

By generating an overall skeleton and using an iterative optimization algorithm to search for the optimal transformation parameters, the problem of automated layout of multiple strokes in irregular areas was solved, enabling the painting robot to draw efficiently and accurately in complex scenes.

CN122049112APending Publication Date: 2026-05-15ZHOUSHAN YIJIA ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHOUSHAN YIJIA ELECTRONIC TECH CO LTD
Filing Date
2026-02-03
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies have failed to effectively solve the problem of automating and optimizing the layout of multiple independent strokes within any irregular closed geometric region, thus limiting the application of painting robots in complex scenarios.

Method used

By acquiring data from the target region and the source image, an overall skeleton is generated. An iterative optimization algorithm is used to search for the optimal transformation parameters, including scaling and translation, to ensure the reasonable layout of stroke elements in irregular areas. A comprehensive evaluation scoring method is used to select the best parameters and generate an ordered coordinate sequence file.

Benefits of technology

It achieves precise adaptation of multi-stroke images in any irregular area and maximizes space utilization, supporting efficient and automated drawing by drawing robots in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122049112A_ABST
    Figure CN122049112A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive layout method of a multi-stroke image in an irregular region. The method mainly solves the specific technical problem that automation and optimal layout are not involved in any closed geometric area by taking a plurality of independent strokes as a whole at present. The invention provides a self-adaptive layout method of a multi-stroke image in an irregular region, which can accurately adapt a target image to any closed polygonal region defined by a series of coordinate points and realize automation and optimization of layout. The core idea of the method is that all strokes are regarded as an inseparable whole, and comprehensive optimization of global size zooming and translation is carried out on the strokes; and finally, under the rigid constraint that all stroke elements completely fall into the polygon boundary, a group of optimal transformation parameters are automatically calculated, so that the space utilization rate of the whole graph in the plane area is maximized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of painting robots, specifically to an adaptive layout method for multi-stroke images in irregular areas and a computer-readable storage medium. Background Technology

[0002] In recent years, with the rapid development of electronic information technology, painting robots, as a special automated device that integrates computer vision, motion control and artistic creation, have shown great application potential in fields such as artistic creation, advertising drawing, personalized customization and architectural decoration.

[0003] One of the core technologies for automated painting lies in the efficient and accurate conversion of digitized image information into a sequence of physical motion coordinates that can be recognized by the robot's end effector. Currently, coordinate transformation and path planning technologies for single images or overall graphics are relatively mature. For example, bitmaps can be converted into vector paths using vectorization algorithms, and then adapted to a rectangular or regular-shaped canvas via affine transformations (such as scaling, translation, and rotation), and finally mapped to the robot's workspace. This type of technology enables high-precision single-drawing.

[0004] While some existing technologies focus on curve data extraction (such as CN119722725A) or content-aware scaling and deformation of single images (such as CN105427242B), these methods mainly address issues such as graphic separation, feature preservation, or single-image adaptation to rule-based display areas. They do not address the specific technical issues of automating and optimizing the layout of multiple independent strokes as a whole within any closed geometric region.

[0005] Therefore, there is an urgent need in this field for a method that can automatically and efficiently arrange multiple independent stroke combinations into any irregular closed area and maximize space utilization, so as to expand the application capabilities of painting robots in complex scenarios. Summary of the Invention

[0006] To overcome the shortcomings of the prior art, the present invention provides an adaptive layout method for multi-stroke images in irregular regions, which mainly solves the specific technical problem that the present invention does not address the automatic and optimized layout of multiple independent strokes as a whole in any closed geometric region.

[0007] The technical solution of the present invention is as follows:

[0008] An adaptive layout method for multi-stroke images in irregular regions includes the following steps: Step 1: Source data acquisition and overall skeleton generation. Acquire the vertex coordinate sequence of the target polygon region and multiple independent stroke bitmaps that constitute the source image in a preset order; preprocess and merge each of the independent stroke bitmaps to generate a source skeleton representing the overall geometric structure of the graphic. Step 2: Search for optimal transformation parameters. Based on the source skeleton and the target polygon region, the optimal transformation parameters, including scaling ratio, X-axis translation, and Y-axis translation, are determined through iterative optimization. The iterative optimization employs a dimensionality reduction search, reducing the search space of the three-dimensional parameters (scaling ratio, X-axis translation, and Y-axis translation) to two dimensions (scaling ratio and Y-axis translation). Dynamic calculation is used to ensure that the transformed source skeleton is horizontally centered within the target region's bounding box by the X-axis translation. For each set of candidate transformation parameters, it is determined whether all coordinate points of the transformed source skeleton are strictly located within the target polygon region. For combinations of candidate transformation parameters that pass boundary constraints, a comprehensive evaluation score is calculated based on multiple predefined evaluation metrics, and the combination with the highest comprehensive evaluation score is selected as the optimal transformation parameter. Step 3: Generate an ordered coordinate sequence. Apply the optimal transformation parameters, return and traverse each independent stroke initially arranged in a preset order, perform the same coordinate transformation on the skeleton coordinates of each independent stroke, and take the transformed coordinate point set as a data block. Finally, organize these data blocks according to the original stroke order to generate an ordered final coordinate sequence file for the painting robot to execute directly.

[0009] In step one, the independent stroke bitmap file adopts a naming rule that includes stroke order numbers, and the method includes sorting all stroke files according to the naming rule to generate an ordered list of stroke files.

[0010] In step one, the preprocessing of the independent stroke bitmap includes: traversing the ordered list of stroke files, filling each bitmap with pixels in the alpha channel, then performing grayscale and binarization, then using the Zhang-Suen iterative thinning algorithm to extract the single-pixel width skeleton that retains the topological structure and path information of the strokes, and finally merging the skeletons of all strokes to form a complete source skeleton image for overall layout calculation.

[0011] The bounding box parameter calculation step is included before step two: Calculate the bounding box of the source skeleton to obtain its width and height; Calculate the bounding box of the target polygonal region to obtain its maximum width and maximum height; Based on a preset safety margin coefficient, the bounding box of the target polygon region is scaled to obtain the width and height of the effective target region; wherein the safety margin coefficient ranges from 0.01 to 0.20.

[0012] Step two, the search for the optimal transformation parameters, specifically includes the following sub-steps: Sub-step 1: Calculate the theoretical maximum scaling ratio: Calculate the scaling ratios in the x-axis and y-axis directions respectively: max_scale_x = effective_target_width / src_width and max_scale_y = effective_target_height / src_height; to keep the aspect ratio of the source image unchanged, take the smaller of the two values ​​as the theoretical maximum scaling ratio: theoretical_max_scale = min(max_scale_x, max_scale_y).

[0013] Sub-step 2: Constructing the parameter search space: Define a search space containing multiple candidate transformation parameters (scale and y-axis offset). Within a large range, generate candidate scales with large step sizes; for example, between 40% and 100% of theoretical_max_scale, generate candidate scale values ​​with a step size of 10%. For each candidate scale, within a preset y-axis offset range (e.g., [-10mm, 10mm]), generate candidate offset_y values ​​with a large step size (e.g., 2mm). Near the optimal parameter combination (best_scale_coarse, offset_y_coarse) determined by the coarse search above, generate denser candidate scale and offset_y values ​​with smaller step sizes for fine-tuning. Sub-step 3, Iterative Evaluation and Optimization: For each set of candidate parameters (scale, offset_y) in the parameter search space, perform the evaluation.

[0014] The execution evaluation mentioned in sub-step three is Coordinate transformation: Transform the pixel coordinates (src_x, src_y) on the source skeleton according to the current scale and offset_y; First, to keep the image centered, calculate the x-axis offset offset_x = (target_x_min + target_x_max) / 2 - ((src_x_min + src_x_max) / 2) The design aims to reduce the three-dimensional (scaling, X-translation, Y-translation) search space to two dimensions (scaling, Y-translation). By dynamically calculating the X-axis offset to maintain horizontal centering, it significantly improves the search efficiency for optimal parameters while ensuring a reasonable layout. The transformed coordinates are transformed_x = src_x scale + offset_x, transformed_y = src_y scale + offset_y. This method, compared to traditional 3D mesh search, theoretically reduces the search complexity from O(N_scale) to O(N_offset_y). N_x N_y) reduced to O(N_scale) While ensuring the quality of the optimal solution, N_y) greatly shortens the computation time, giving it the potential for real-time applications.

[0015] Validity Judgment: Check whether all transformed coordinate points fall within the closed polygon boundary of the target area. This validity judgment can be implemented using well-known polygon-testing algorithms, such as the RayCasting Algorithm or the Winding Number Algorithm. Specifically, a ray is emitted from the point to be tested in any direction, and the number of intersections with the polygon boundary is calculated. If the number is odd, the point is inside the polygon; if even, it is outside. If any point exceeds the boundary, the parameter combination is invalid, and the evaluation score is 0 or negative infinity.

[0016] In step two, the composite score is calculated by weighted summation: ; Where S_margin is the safety margin score, S_scale is the theoretical scaling utilization score, and S_area is the actual space utilization score; w1, w2, and w3 are preset non-negative weight coefficients, and w1 + w2 + w3 = 1.

[0017] The safety margin score S_margin is calculated based on the minimum distance min_dist between the transformed point set and the boundary of the target polygon, specifically S_margin = min(1.0, min_dist / D_safe), where D_safe is the preset expected safety distance.

[0018] The theoretical scaling utilization score S_scale is the ratio of the current candidate scaling ratio to the theoretical maximum scaling ratio; the actual space utilization score S_area is the ratio of the convex hull area of ​​the transformed source skeleton to the area of ​​the target polygon region.

[0019] The iterative optimization in step two employs a phased grid search method, simulated annealing algorithm, genetic algorithm, or particle swarm optimization algorithm.

[0020] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described above.

[0021] The beneficial effects of this invention are as follows: This invention provides an adaptive layout method for multi-stroke images within irregular regions. This method can accurately adapt a target image to an arbitrary closed polygonal region defined by a series of coordinate points, and achieve automated and optimized layout. Its core idea is to treat all strokes as an indivisible whole, performing comprehensive optimization through global scaling and translation. Finally, under the hard constraint of ensuring that all stroke elements completely fall within the polygonal boundary, a set of optimal transformation parameters is automatically calculated, thereby maximizing the space utilization of the overall graphic within the planar region. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of a source image to be processed, consisting of multiple independent stroke bitmaps, according to an embodiment of the present invention.

[0023] Figure 2 This is the result of adapting the source image to the target area within a regular hexagonal region.

[0024] Figure 3 This is the result of adapting the source image to the target area within a square quadrilateral.

[0025] Figure 4 This is the result of adapting the source image to an irregular quadrilateral target area.

[0026] Figure 5 This is the result of adapting the source image to an irregular pentagonal target area.

[0027] Figure 6 This is the result of adapting the source image to an irregular hexagonal target area.

[0028] Figure 7 This is a rendering of the source image achieving adaptive scaling and layout within an irregular concave quadrilateral target area.

[0029] Figure 8 This is an example file for defining the boundary coordinates of the target region, where the coordinate units are millimeters.

[0030] Figure 9 This is a schematic diagram of a bitmap file with a transparent background.

[0031] Figure 10 This is the result of adaptive layout of the source image within the four-curved edge target area, with a safety margin of 0.03.

[0032] Figure 11 This is the result of adaptively laying out the source image within the four-curved edge target area, with a safety margin of 0.05.

[0033] Figure 12 This is the result of adaptive layout of the source image within the four-curved edge target area, with a safety margin of 0.07. Detailed Implementation

[0034] The present invention will be further described below with reference to the accompanying drawings. The present invention provides an adaptive layout method for multi-stroke images in irregular regions, which includes the following steps: Step 1: Data Acquisition and Preprocessing.

[0035] This step includes acquiring the boundary data of the target region and acquiring and processing the stroke data of the source image according to a preset order.

[0036] 1. Obtain target region boundary data: Obtain the vertex coordinate sequence { (x1, y1), (x2, y2), ..., (x...} for one or more closed polygon regions used to define the drawing area. n , y n This coordinate sequence defines the hard boundary constraints of the layout. Figure 8 An example of a boundary coordinate file is shown.

[0037] 2. Obtain and sort the stroke data of the source image: Obtain multiple independent stroke bitmap files that constitute the source image (e.g., Figure 1 and Figure 9 (As shown). To ensure the robot can draw according to the preset stroke order, the stroke bitmap files must follow a sortable naming rule, such as naming them in the format of "main stroke order number - sub-stroke number - optional identifier" (e.g., 1-1-A.png, 1-2-A.png, 2-1-A.png, etc.). When reading the files, the algorithm sorts all stroke files in alphanumeric order according to this naming rule, generating an ordered list of stroke files. All subsequent processing involving individual strokes strictly follows the order of this list.

[0038] 3. Image Preprocessing and Overall Skeleton Generation: The ordered list of stroke files is traversed. Each bitmap is first filled with pixels in the alpha channel, then grayscale and binarized. Next, the Zhang-Suen iterative thinning algorithm is used to extract a single-pixel-width skeleton that preserves the topological structure and path information of the strokes. Finally, the skeletons of all strokes are merged to form a complete source skeleton image for overall layout calculation. The set of coordinates of all pixels in the source skeleton image constitutes the source data for subsequent transformation operations. The merging process refers to superimposing coordinates in a unified virtual two-dimensional coordinate system based on the inherent relative positions of each independent stroke bitmap in the original design. One specific implementation is to assume that all input stroke bitmap files share the same canvas origin, thus directly superimposing the skeleton points of all strokes to form a "source skeleton" that maintains the relative positions of the original design.

[0039] Step 2: Calculate the bounding box parameters.

[0040] This step is used to calculate the geometric dimensions of the source skeleton and the target region.

[0041] 1. Calculate the source skeleton bounding box: Traverse all pixels of the source skeleton and determine its minimum and maximum coordinates on the x and y axes, denoted as src_x_min, src_x_max, src_y_min, and src_y_max. Based on this, calculate the width of the source skeleton: src_width = src_x_max - src_x_min and the height: src_height = src_y_max - src_y_min.

[0042] 2. Calculate the target region bounding box: Traverse the vertex coordinates of the target region and determine its minimum and maximum coordinate values ​​on the x and y axes, denoted as target_x_min, target_x_max, target_y_min, and target_y_max. Based on this, calculate the maximum width of the target region: target_width = target_x_max - target_x_min, and the maximum height: target_height = target_y_max - target_y_min.

[0043] 3. Calculate the effective target region: To prevent the transformed image from touching or exceeding the boundary, a safety margin factor is set, and the width and height of the effective target region are calculated: effective_target_width = target_width (1 – safety margin); effective_target_height = target_height (1 – Safety margin). The safety margin value reflects the distance between the transformed image edge and the target region boundary. The larger the value, the more the overall image tends to shrink towards the center, thus moving away from the boundary.

[0044] In a preferred embodiment of the present invention, the selection of the safety margin value follows an "effect-driven heuristic": if, after transformation using an initial preset value (e.g., 0.03), the resulting layout achieves the desired visual fullness, and the distance between the source skeleton pixels and the target region boundary satisfies the safety constraint, then the parameter is determined to be a valid adaptation value. In this state, the system will directly output the current layout scheme without needing to perform a secondary iteration optimization with a smaller step size within a small neighborhood of this value (e.g., within the range of 0.028 to 0.032), thereby effectively reducing computational redundancy and improving the convergence efficiency of the algorithm while ensuring layout quality.

[0045] As an example, attached Figure 10 The safety margin value shown is 0.03. Figure 11 The safety margin value shown is 0.05. Figure 12 The safety margin value shown is 0.07. Preferably, the safety margin value ranges from 0.01 to 0.20. In a specific embodiment of the present invention, as shown in the appendix... Figure 2 To be continued Figure 7 As shown, the safety margin value used is 0.03.

[0046] Step 3: Search for the optimal transformation parameters.

[0047] This step is the core of the invention: through iterative optimization, the optimal scaling ratio and translation amount are determined.

[0048] 1. Calculate the theoretical maximum scaling ratio: Calculate the scaling ratios along the x-axis and y-axis respectively: max_scale_x = effective_target_width / src_width and max_scale_y = effective_target_height / src_height. To maintain the aspect ratio of the source image, take the smaller of the two values ​​as the theoretical maximum scaling ratio: theoretical_max_scale = min(max_scale_x, max_scale_y).

[0049] 2. Constructing the parameter search space: Define a search space containing multiple candidate transformation parameters (scaling scale and y-axis offset_y). This search process can be divided into two stages: coarse search and fine search.

[0050] 2.1 Coarse Search: Generate candidate scaling ratios with large step sizes over a large range. For example, generate candidate scale values ​​with a step size of 10% between 40% and 100% of theoretical_max_scale. For each candidate scale, generate candidate offset_y values ​​with a large step size (e.g., 2mm) within a preset y-axis offset range (e.g., [-10mm, 10mm]).

[0051] 2.2 Fine Search: In the vicinity of the optimal parameter combination (best_scale_coarse, offset_y_coarse) determined by the coarse search, generate denser candidate scale and offset_y values ​​with a smaller step size for fine optimization.

[0052] 3. Iterative Evaluation and Optimization: For each set of candidate parameters (scale, offset_y) in the parameter search space, perform the following evaluation process: 3.1 Coordinate Transformation: Transform the coordinates (src_x, src_y) of all (or sampled) pixels on the source skeleton according to the current scale and offset_y. First, to keep the image centered, calculate the x-axis offset offset_x = (target_x_min + target_x_max) / 2 - ((src_x_min + src_x_max) / 2). The design aims to reduce the three-dimensional (scaling, X-translation, Y-translation) search space to two dimensions (scaling, Y-translation). By dynamically calculating the X-axis offset to maintain horizontal centering, it significantly improves the search efficiency for optimal parameters while ensuring a reasonable layout. The transformed coordinates are transformed_x = src_x scale + offset_x, transformed_y = src_y scale + offset_y. This method, compared to traditional 3D mesh search, theoretically reduces the search complexity from O(N_scale) to O(N_offset_y). N_x N_y) reduced to O(N_scale) While ensuring the quality of the optimal solution, N_y) greatly shortens the computation time, giving it the potential for real-time applications.

[0053] 3.2 Validity Judgment: Check whether all transformed coordinate points fall within the closed polygon boundary of the target area. This validity judgment can be implemented using well-known point-within-polygon testing algorithms, such as the RayCasting Algorithm or the Winding Number Algorithm. Specifically, a ray is emitted from the point to be tested in any direction, and the number of intersections with the polygon boundary is calculated. If the number is odd, the point is inside the polygon; if even, it is outside. If any point exceeds the boundary, the parameter combination is invalid, and the evaluation score is 0 or negative infinity.

[0054] 3.3 Calculate the overall evaluation score: The score is calculated by weighted summation of the scores for each sub-item.

[0055] Where W1, W2, and W3 are preset non-negative weight coefficients, and W1 + W2 + W3 = 1. In a preferred embodiment, to balance the fullness and security of the layout, W1 = 0.4, W2 = 0.4, and W3 = 0.2 can be set. However, in other application scenarios, these weights can be adjusted according to specific needs. For example, in scenarios requiring absolute security, the value of W1 can be increased.

[0056] 3.3.1 Safety Margin Score (S_margin): Calculates the minimum distance from all transformed points to the boundary of the target region. The larger this distance, the higher the score. Here, a desired safety distance D_safe can be defined, and the score can be calculated by normalizing S_margin = min(1.0, min_dist / D_safe), where min_dist is the minimum distance between the transformed point set and the polygon boundary; D_safe is target_width × safety margin.

[0057] 3.3.2 Theoretical Scaling Utilization Score (S_scale): Calculates the ratio of the current scaling ratio to the theoretical maximum scaling ratio: scale / theoretical_max_scale. The closer this ratio is to 1, the higher the score.

[0058] 3.3.3 Actual Space Utilization Score (S_area): The ratio of the convex hull area of ​​the transformed source skeleton to the polygon area of ​​the target region. The larger this ratio, the higher the score. The convex hull area is calculated as follows: Given a set of discrete points, find the smallest convex polygon boundary that completely encloses these points. Using the Quickhull algorithm, the outermost extreme points are found recursively. First, the leftmost and rightmost points are found to form initial line segments, and then the points farthest from the current boundary are recursively searched on each side until all points are included. This method allows for accurate calculation of the area of ​​the transformed source skeleton.

[0059] The calculation formula is as follows:

[0060] 3.4 Update Optimal Parameters: Compare the overall score of the current parameter combination with the highest recorded score. If the current score is higher, update the optimal scaling ratio (best_scale) and the optimal y-axis offset (best_y_offset) to their current values.

[0061] 4. Determine the final transformation parameters: After completing the search, obtain the final optimal scaling factor `final_scale = best_scale` and the optimal y-axis offset `final_offset_y = best_y_offset`. Based on `final_scale`, calculate the final x-axis offset `final_offset_x = (target_x_min + target_x_max) / 2 - ((src_x_min + src_x_max) / 2)`. final_scale.

[0062] The optimal transformation parameter search process can be implemented using a phased grid search method, or other well-known global optimization or heuristic optimization algorithms in the field, such as simulated annealing, genetic algorithm, and particle swarm optimization. The core of each algorithm is to use the comprehensive evaluation score as the objective function and find the optimal combination of transformation parameters.

[0063] Step 4: Coordinate sequence generation and ordered output.

[0064] This step uses the final transformation parameters determined in step three to perform coordinate mapping on each individual stroke, and organizes them according to the preset drawing order to generate the final coordinate sequence file.

[0065] 1. Traverse the ordered stroke list: The algorithm retraces the ordered stroke file list generated in step one.

[0066] 2. Mapping Coordinates One by One: For each stroke in the list, obtain its independent set of skeleton pixel coordinates. Then, using the final transformation parameters (final_scale, final_offset_x, final_offset_y) determined in step three, perform the final coordinate mapping on the coordinates (src_x, src_y) of each pixel on the stroke skeleton: target_x = src_x final_scale + final_offset_x; target_y = src_y final_scale + final_offset_y 3. Organize and output the sequence: All target coordinates (target_x, target_y) generated by the current stroke are treated as a data block and written sequentially to the final output file. After traversing all strokes, the final output file contains a series of coordinate data blocks arranged in the drawing order. The robot can use this file, combined with pen-lifting / pen-falling commands, to achieve orderly drawing stroke by stroke.

[0067] In one embodiment, to improve computational efficiency, during the iterative evaluation process in step three, a portion of representative pixels can be randomly or sampled at intervals from the source skeleton for computation, instead of using all pixels.

[0068] Ultimately, based on the generated ordered coordinate sequence, the robot controls its end effector to draw, thereby accurately and fully presenting a complete image within a target area of ​​arbitrary shape, as shown in the attached figure. Figure 2 Figures 3, 4, 5, 6, and 7 illustrate the adaptive layout effects of the method of the present invention on target areas of different shapes and sizes.

[0069] The embodiments described with reference to the accompanying drawings are exemplary and intended to explain the invention, and should not be construed as limiting the invention. The embodiments should not be considered as limiting the invention, but any improvements made based on the spirit of the invention should be within the scope of protection of the invention.

Claims

1. An adaptive layout method for multi-stroke images in irregular regions, characterized in that: Includes the following steps: Step 1: Source data acquisition and overall skeleton generation. Acquire the vertex coordinate sequence of the target polygon region and multiple independent stroke bitmaps that constitute the source image in a preset order; preprocess and merge each of the independent stroke bitmaps to generate a source skeleton representing the overall geometric structure of the graphic. Step 2: Search for optimal transformation parameters. Based on the source skeleton and the target polygon region, the optimal transformation parameters, including scaling ratio, X-axis translation, and Y-axis translation, are determined through iterative optimization. The iterative optimization employs a dimensionality reduction search, reducing the search space of the three-dimensional parameters (scaling ratio, X-axis translation, and Y-axis translation) to two dimensions (scaling ratio and Y-axis translation). Dynamic calculation is used to ensure that the transformed source skeleton is horizontally centered within the target region's bounding box by the X-axis translation. For each set of candidate transformation parameters, it is determined whether all coordinate points of the transformed source skeleton are strictly located within the target polygon region. For combinations of candidate transformation parameters that pass boundary constraints, a comprehensive evaluation score is calculated based on multiple predefined evaluation metrics, and the combination with the highest comprehensive evaluation score is selected as the optimal transformation parameter. Step 3: Generate an ordered coordinate sequence. Apply the optimal transformation parameters, return and traverse each independent stroke initially arranged in a preset order, perform the same coordinate transformation on the skeleton coordinates of each independent stroke, and take the transformed coordinate point set as a data block. Finally, organize these data blocks according to the original stroke order to generate an ordered final coordinate sequence file for the painting robot to execute directly.

2. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, In step one, the independent stroke bitmap file adopts a naming rule that includes stroke order numbers, and the method includes sorting all stroke files according to the naming rule to generate an ordered list of stroke files.

3. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, In step one, the preprocessing of the independent stroke bitmap includes: traversing the ordered list of stroke files, filling each bitmap with pixels in the alpha channel, then performing grayscale and binarization, then using the Zhang-Suen iterative thinning algorithm to extract the single-pixel width skeleton that retains the topological structure and path information of the strokes, and finally merging the skeletons of all strokes to form a complete source skeleton image for overall layout calculation.

4. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, The bounding box parameter calculation step is included before step two: Calculate the bounding box of the source skeleton to obtain its width and height; Calculate the bounding box of the target polygonal region to obtain its maximum width and maximum height; Based on a preset safety margin coefficient, the bounding box of the target polygon region is scaled to obtain the width and height of the effective target region; wherein the safety margin coefficient ranges from 0.01 to 0.

20.

5. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, Step two, the search for the optimal transformation parameters, specifically includes the following sub-steps: Sub-step 1: Calculate the theoretical maximum scaling ratio: Calculate the scaling ratios in the x-axis and y-axis directions respectively: max_scale_x = effective_target_width / src_width and max_scale_y = effective_target_height / src_height; Sub-step 2: Constructing the parameter search space: Define a search space containing multiple candidate transformation parameters. Within a large range, generate candidate scaling ratios with a large step size. Near the optimal parameter combination determined by the coarse search above, generate denser candidate scale and offset_y values ​​with a smaller step size for fine optimization. Sub-step 3, Iterative Evaluation and Optimization: For each set of candidate parameters (scale, offset_y) in the parameter search space, perform the evaluation.

6. The adaptive layout method for multi-stroke images in irregular regions according to claim 5, characterized in that, The execution evaluation mentioned in sub-step three is Coordinate transformation: Transform the pixel coordinates (src_x, src_y) on the source skeleton according to the current scale and offset_y; Validity check: Check whether all transformed coordinate points fall within the closed polygon boundary of the target area.

7. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, In step two, the composite score is calculated by weighted summation: ; Where S_margin is the safety margin score, S_scale is the theoretical scaling utilization score, and S_area is the actual space utilization score; w1, w2, and w3 are preset non-negative weight coefficients, and w1 + w2 + w3 = 1.

8. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, The safety margin score S_margin is calculated based on the minimum distance min_dist between the transformed point set and the boundary of the target polygon, specifically S_margin = min(1.0, min_dist / D_safe), where D_safe is the preset expected safety distance.

9. The adaptive layout method for multi-stroke images in irregular regions according to claim 1, characterized in that, The theoretical scaling utilization score S_scale is the ratio of the current candidate scaling ratio to the theoretical maximum scaling ratio; the actual space utilization score S_area is the ratio of the convex hull area of ​​the transformed source skeleton to the area of ​​the target polygon region.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 9.