A method for extracting smooth outer contours of hand-drawn vehicle sketches

CN122887939APending Publication Date: 2026-10-09SOUTHWEST JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611065782.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0004]本发明的目的在于:解决目前现有草图矢量化/轮廓提取方法往往对噪声敏感,容易出现外边界断裂、误连通或拓扑错误;直接对高密度像素轮廓拟合会引入冗余点、局部抖动与曲线震荡,导致生成轮廓不稳定,难以满足仿真对“闭合、连续、平滑、拓扑一致”的几何输入要求的技术问题

Benefits of technology

(1)本发明在轮廓提取前引入基于控制点的几何校正(透视/单应变换),将输入草图统一映射到标准侧视平面,显著降低由视角误差造成的几何失真;利用三角剖分建立邻域拓扑,通过背景三角形剔除与区域生长机制对断裂区域进行自动回填闭合。在保证闭合性的同时更好保留局部几何细节,减少误连接与过度填充,提高闭合轮廓的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122887939A_ABST
    Figure CN122887939A_ABST
Patent Text Reader

Abstract

The application discloses a kind of smooth contour extraction methods of hand-drawn vehicle sketch, solve the technical problems that existing sketch vectorization / contour extraction method is sensitive to noise, and easy to appear outer boundary fracture, misconnection or topological error.The present application significantly reduces the geometric distortion caused by perspective error through five steps of perspective correction and geometric normalization, contour extraction, key point determination and segmented fitting reconstruction, contour coordinate post-processing and unified format export, two-dimensional CFD modeling and solving, while ensuring closure, better preserving local geometric details, reducing misconnection and overfilling, improving the accuracy of closed contour;While maintaining shape feature points, reducing fitting complexity, improving the smoothness and controllability of curve reconstruction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for extracting outer contours, specifically, to a method for extracting smooth outer contours from hand-drawn vehicle sketches. Background Technology

[0002] Current aerodynamic assessments in the conceptual design phase rely heavily on subsequent CAD modeling or 3D model creation, making it difficult to obtain quantitative aerodynamic feedback during the sketching stage. Furthermore, conceptual sketches are typically composed of freehand lines, which suffer from perspective distortion, broken lines, and ambiguous intersections, making it difficult to directly extract simulable closed geometric shapes from the sketches.

[0003] Existing sketch vectorization / contour extraction methods are often sensitive to noise and prone to outer boundary breaks, false connectivity, or topological errors. At the same time, directly fitting high-density pixel contours introduces redundant points, local jitter, and curve oscillations, resulting in unstable generated contours that are difficult to meet the simulation requirements for "closed, continuous, smooth, and topologically consistent" geometric inputs. Summary of the Invention

[0004] The purpose of this invention is to solve the technical problems that existing sketch vectorization / contour extraction methods are often sensitive to noise and prone to outer boundary breaks, false connections, or topological errors; direct fitting of high-density pixel contours introduces redundant points, local jitter, and curve oscillations, resulting in unstable generated contours and making it difficult to meet the simulation requirements for "closed, continuous, smooth, and topologically consistent" geometric inputs.

[0005] To achieve the above-mentioned objectives, the present invention provides the following technical solution: A method for extracting the smooth outer contour of a hand-drawn vehicle sketch includes the following steps: Step S1: Perspective Correction and Geometric Normalization. The input sketch is mapped from the perspective view to a unified 2D plane representation, eliminating perspective distortion.

[0006] Step S2: Contour extraction. Adaptive binarization of the sketch, gap filling based on Delaunay triangulation, and skeleton topology.

[0007] Step S3: Key point determination and piecewise fitting reconstruction. RDP simplification is performed on the contour point sequence to obtain candidate key points, which are then selected to determine the segmentation points. Under the constraint of the segmentation points, a greedy point selection method is used to generate a set of fitting points, and a smooth closed curve contour is generated using piecewise fitting.

[0008] Step S4: Contour Coordinate Post-processing and Unified Format Export. The train and car contours undergo mirror closure / bottom simplification coordinate processing, and are exported in a unified format as input for 2D modeling and CFD geometry.

[0009] Step S5: Two-dimensional CFD modeling and solution. Based on the reconstructed two-dimensional profile, the computational domain and boundary conditions are established, and steady-state RANS simulation is performed to output the drag coefficient and pressure distribution.

[0010] Specifically, step S1 includes the following steps S11–S13: Step S11: Select control points.

[0011] Step S12: Solve for the perspective transformation matrix.

[0012] Step S13: Coordinate normalization and image resampling.

[0013] Specifically, step S2 includes the following steps S21–S25: Step S21: Otsu adaptive threshold binarization.

[0014] The perspective-corrected image obtained in step S1 is used as input, and it is converted to grayscale. Then, the Otsu adaptive threshold binarization method is used to segment the image into foreground and background to obtain a binary image. .

[0015] Step S22: Foreground set construction and Delaunay triangulation.

[0016] Step S23: Background triangle discrimination and iterative removal.

[0017] Step S24: Growth of multiple sub-regions and gap backfilling closure.

[0018] Step S25: Skeleton topology repair and outer contour tracking output ordered point series.

[0019] Extraction and processing diagram The corresponding ordered outer contour point sequence .

[0020] Specifically, step S3 includes the following steps S31–S34: Step S31: Extraction of RDP candidate key points.

[0021] Step S32: Filter candidate key points and determine segmentation points.

[0022] The set obtained in step S31 As a set of candidate split points.

[0023] Step S33: Greedy point selection under the split point constraint.

[0024] Step S34: Segmented fitting generates a smooth closed curve.

[0025] The fitted point sequence obtained in step S33 As input, and with a set of split points Each segmentation point serves as the boundary for the segmentation, and the fitted point sequence is then processed. Perform piecewise fitting.

[0026] Step S4 specifically includes the following steps S41–S43: Step S41: Object difference closure processing.

[0027] Discrete sampling is performed on the fitted contour obtained in step S3, and the contour point set is output in a clockwise direction with a preset starting point as a reference.

[0028] Step S42: Unify scale and coordinates.

[0029] The closed contour obtained in step S41 is scaled and aligned.

[0030] Step S43: Export in a uniform format.

[0031] The processed closed contour is exported as a point sequence data in a unified format. The point sequence is a two-dimensional coordinate sequence arranged in the contour order, which is used as input for two-dimensional CFD modeling.

[0032] Step S5 specifically includes the following steps S51–S54: Step S51: Computational domain settings and grid settings.

[0033] A two-dimensional external flow field computational domain is constructed based on the object type and contour scale, and inlet boundary, outlet boundary, top boundary and bottom gap are set.

[0034] Step S52: Boundary condition setting.

[0035] Set boundary conditions for the computational domain obtained in step S51.

[0036] Step S53: Solver and turbulence model settings.

[0037] The steady-state pressure-based RANS solution method is used to numerically solve the computational domain set in step S52.

[0038] Step S54: Output the result.

[0039] Output drag coefficient Results such as pressure distribution are used for rapid relative evaluation and screening of conceptual schemes.

[0040] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) This invention introduces geometric correction based on control points (perspective / homography transformation) before contour extraction, which maps the input sketch to a standard side view plane, significantly reducing geometric distortion caused by perspective error; it uses triangulation to establish neighborhood topology, and automatically backfills and closes broken areas through background triangle culling and region growing mechanisms. While ensuring closure, it better preserves local geometric details, reduces misconnection and overfilling, and improves the accuracy of closed contours.

[0041] (2) To address the problem that a single length threshold cannot distinguish between noise burrs and real sharp corner structures during short branch pruning after skeletonization, this invention proposes a short branch discrimination method combining two-level candidate and local geometric verification. This method first performs coarse screening using a length threshold. For the shortest branches selected, a circular domain centered at the intersection point is constructed. The angle between the vectors at the intersection of the circular domain and the skeleton trunk is calculated. The angle relationship is used to determine whether the short branch conforms to a real acute angle geometric configuration. If it does, it is retained and reconstructed; otherwise, it is discarded. This innovation solves the problem of traditional methods mistakenly deleting real sharp corner features (such as the tip of the car head and corners) due to their inability to distinguish shapes. It effectively suppresses noise while accurately protecting key sharp corner structures in vehicle styling.

[0042] (3) To address the issue that the standard Moore neighborhood tracking algorithm outputs non-unique contour point sequences and requires closed curves when the starting point is offset or there are multiple candidate neighborhoods, this invention introduces a skeleton centroid guidance mechanism into the tracking rules. In the first step of tracking, the candidate point closest to the centroid of the skeleton pixel set is preferentially selected as the tracking point for the second step; in subsequent cases with multiple candidates, it is mandatory to remove the points from the previous step and select the first valid pixel clockwise. This innovation ensures that the output of the same sketch is a completely consistent ordered sequence of contour points in multiple tracking iterations, while also ensuring that both closed and non-closed curves can be effectively output.

[0043] (4) Addressing the limitations of both the RDP algorithm and the greedy point selection algorithm. RDP is based solely on global geometric deviation decisions, which can easily output multiple clustered candidate points in areas with large curvature or transitions, resulting in point clusters at the same structural transition points. This leads to non-unique segment endpoints and difficulty in locating the true key inflection points. Greedy point selection, on the other hand, is only constrained by the maximum chord length and foreground validity, lacking key point guidance, resulting in excessive smoothing and loss of important local structural features. This invention combines RDP and greedy point selection: first, RDP outputs a set of candidate key points, and then filters and determines a unique segmentation point to fix the segment boundary; then, under the constraint of the segmentation point, greedy point selection is performed to search for the farthest feasible point that satisfies the chord length and foreground validity constraints among adjacent segmentation points. This combined strategy compresses redundant points while ensuring the segment boundary of key points, making the simplified point set both faithful to the original design features and smooth.

[0044] (5) This invention directly uses the reconstructed two-dimensional closed contour for the generation and solution of the two-dimensional CFD computational domain, and outputs indicators such as drag coefficient and pressure distribution for relative evaluation. It achieves rapid iteration from sketch to aerodynamic feedback with low modeling cost, significantly improving the efficiency of multi-scheme comparison and selection in the conceptual design stage; it provides object-driven post-processing rules (such as semi-contour symmetrical closure, simplified replacement of vehicle bottom, etc.). This improves the applicability of the method to sketches of different vehicle models and reduces the amount of manual repair work. Attached Figure Description

[0045] Figure 1 This is a flowchart of the overall scheme; it illustrates that the present invention starts from "sketch input" and sequentially completes perspective correction and geometric normalization, closed contour extraction, key point determination and segmented fitting reconstruction, contour post-processing and unified export, as well as the overall process of 2D CFD modeling and simulation and result output.

[0046] Figure 2 This is a schematic diagram of perspective transformation; it illustrates establishing a four-point correspondence between the input image and the target plane, and mapping the input sketch to a unified two-dimensional plane through perspective transformation. The transformation reduces the impact of shooting angle and perspective distortion on contour geometry, providing a consistent coordinate basis for subsequent contour extraction.

[0047] Figure 3 This is an example of Otsu adaptive thresholding binarization; it illustrates how Otsu adaptive thresholding is used to binarize a sketch, separating the stroke regions into foreground and suppressing background interference.

[0048] Figure 4 This is a schematic diagram of Delaunay triangulation generated based on the center points of foreground pixels. It illustrates how the center points of foreground pixels in a binary image are extracted as a point set, and then Delaunay triangulation is performed on this point set to obtain a triangular mesh and its adjacency relationships. This mesh is used for subsequent topology processing such as background triangle discrimination, region growing, and gap filling.

[0049] Figure 5 This diagram illustrates background triangle detection and removal based on edge sharing and edge length criteria. It shows how background triangles are identified using the "number of shared edges" and "edge length threshold" criteria, and then iteratively removed. By removing background triangles, background areas unrelated to the main strokes can be separated at the triangular mesh level, reducing subsequent seam-filling errors.

[0050] Figure 6 To illustrate, after removing the background triangles, a geometrically stable triangle is selected as the seed, and region growth is performed based on the triangle adjacency relationship to achieve the connected division of the main area; the narrow triangles that are not included in the main area and are located at the stroke break are judged as gap areas and backfilled as foreground, thereby achieving contour closure.

[0051] Figure 7 This diagram illustrates the extraction and classification of skeleton pixels. It shows how to refine the skeleton of a closed foreground region to obtain a one-pixel wide skeleton, and how to classify the skeleton pixels into types such as endpoints / intersections based on the number of 8 neighboring intersections, providing a topological basis for branch tracing and short branch repair.

[0052] Figure 8 This diagram illustrates the geometric distinction between effective acute-angle structures and noisy short branches. It shows that at skeleton branches, some short branches may correspond to real acute-angle structures (which should be retained), or they may be pseudo-short branches introduced by skeleton noise (which should be deleted or merged into the main branch). This diagram demonstrates how the present invention improves the topological stability of the skeleton through local geometric configuration discrimination and iterative processing.

[0053] Figure 9 This is an example of contour tracing based on Moore's neighborhood; it illustrates how Moore's neighborhood tracing is used to perform clockwise search and iterative access to skeleton / boundary pixels, obtaining an ordered sequence of contour points starting from the starting pixel. This process ensures that the output point sequence has a clear order, facilitating subsequent RDP keypoint extraction and fitting reconstruction.

[0054] Figure 10 This is an example of contour simplification based on RDP; it illustrates how the RDP algorithm is used to simplify the contour point sequence to obtain a set of candidate key points. This candidate set is used to locate shape transitions and structural segmentation points, providing constraint points for subsequent segmented fitting.

[0055] Figure 11 This diagram illustrates the greedy algorithm for selecting a point set and curve fitting. It shows how, under segmentation point constraints, a greedy point selection strategy is used to select valid points from the original contour sequence that satisfy the "maximum allowable segment length" and "connections do not cross the background," forming a point set suitable for fitting. Subsequently, piecewise curve fitting is performed to generate a smooth contour. This process reduces the number of points while maintaining structural segmentation and geometric validity.

[0056] Figure 12 This is a schematic diagram of post-processing based on RDP coordinates; it illustrates the post-processing of key points and contours for different objects (high-speed trains / passenger vehicles): for example, trains achieve mirror closure by specifying positioning points, and cars achieve bottom simplification and closure by specifying bottom positioning points. The post-processed result is a closed contour that can be used for 2D CFD geometric input.

[0057] Figure 13 This figure shows an example of high-speed train sketch contour extraction and closure results; it illustrates various train sketch inputs and their corresponding closed contour reconstruction results. This figure is used to verify that the present invention can still output topologically closed and shape-feature-consistent train outlines under different sketch styles and noise conditions.

[0058] Figure 14This figure shows an example of contour extraction and closure results for a car sketch; it illustrates various car sketch inputs and their corresponding closed contour reconstruction results. This figure is used to verify that the present invention possesses robust contour extraction and closure capabilities for passenger vehicle side-view shapes, and can obtain simplified shapes suitable for 2D simulation.

[0059] Figure 15 This diagram illustrates the two-dimensional computational domain and boundary conditions for a high-speed train. It shows the dimensional relationships and boundary type settings of the two-dimensional CFD computational domain for a high-speed train, including velocity inlet, pressure outlet, symmetrical boundaries, and ground boundaries. This diagram serves to explain the principles for selecting the computational domain scale and the configuration of boundary conditions under train operating conditions.

[0060] Figure 16 This diagram illustrates the two-dimensional computational domain and boundary conditions for a passenger vehicle. It shows the dimensional relationships and boundary type settings of the two-dimensional CFD computational domain, including parameters such as velocity inlet, pressure outlet, symmetrical boundaries, and ground clearance. This diagram serves to explain the configuration of the computational domain and boundary conditions under automotive operating conditions.

[0061] Figure 17 This diagram illustrates the pressure cloud map of high-speed trains with different shapes. It shows the pressure distribution results obtained after performing two-dimensional CFD simulations on different train shapes, and is used to compare the pressure change characteristics of different styling schemes in the head, roof and tail regions, and to provide a flow field explanation for the differences in drag coefficients.

[0062] Figure 18 This diagram illustrates the pressure cloud map of a car under different shapes; it shows the pressure distribution results obtained after performing two-dimensional CFD simulations on different car outlines, and is used to compare the pressure variation patterns of different styling schemes in the front, roof and rear regions, thereby supporting the relative aerodynamic performance evaluation in the concept stage.

[0063] Figure 19 This is a schematic diagram of the interactive interface in passenger vehicle mode; the interface includes an input area, a parameter setting area, and an output display area, which are used to import passenger vehicle sketches, extract contours, perform simulation calculations, and display results.

[0064] Figure 20 This is a schematic diagram of the interactive interface in high-speed train mode; the interface includes an input area, a parameter setting area, and an output display area, which are used to realize perspective correction, contour extraction, simulation calculation, and result display of high-speed train sketches. Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0066] A method for extracting the smooth outer contour of a hand-drawn vehicle sketch includes the following steps: Step S1: Perspective Correction and Geometric Normalization. The input sketch is mapped from the perspective view to a unified 2D plane representation, eliminating perspective distortion.

[0067] Step S1 specifically includes the following steps S11–S13: Step S11: Select control points.

[0068] Select four control points in the input sketch image. ,in And give the corresponding point in the target side view plane. To ensure the stability of the perspective correction results, the control points are preferably placed at the boundary reference positions of the main outline of the sketch, covering the main range of the vehicle's side view outline. The four control points maintain a clear spatial distribution in the input image, with no three points collinear. These four control points are used to determine the mapping relationship between the area to be corrected and the target plane in the input image.

[0069] Step S12: Solve for the perspective transformation matrix.

[0070] After determining four pairs of corresponding control points, the control points in the input image and their corresponding points in the target plane are represented in homogeneous coordinate form, and a perspective mapping relationship from the input plane to the target side view plane is established. Let the homogeneous coordinates of any pixel in the input image be... Its corresponding coordinates in the target plane are Then the two satisfy the following relationship: , in, This is a non-zero scale factor in homogeneous coordinates, used to represent the proportional equivalence between the coordinates before and after the transformation. Its specific value does not need to be specified in advance and can be eliminated during the subsequent normalization process. The perspective transformation matrix can be represented as: , Perspective transformation matrix The system is determined by the common constraints of four pairs of corresponding control points. After establishing a system of linear equations using these four pairs of corresponding points, the matrix can be obtained. The parameters are set to complete the geometric mapping model from the input sketch to the target side view plane.

[0071] Step S13: Coordinate normalization and image resampling.

[0072] After obtaining the perspective transformation matrix Then, a mapping calculation is performed on the pixel coordinates of the input image. For any pixel in the input image to be transformed... The coordinates mapped onto the target's side view plane, after normalization, are: , Based on the mapping relationship, the input image is mapped pixel by pixel, and the mapping result is interpolated and resampled to obtain the corrected image.

[0073] By adopting step S1 of the present invention, the technical problem that concept sketches suffer from perspective distortion due to the influence of viewing angle and are difficult to use directly for two-dimensional contour modeling is solved, and the technical effect of uniformly mapping sketches to two-dimensional planar contours and ensuring the consistency of subsequent geometric processing is achieved.

[0074] Step S2: Contour extraction. Adaptive binarization of the sketch, gap filling based on Delaunay triangulation, and skeleton topology.

[0075] Step S2 specifically includes the following steps S21–S25: Step S21: Otsu adaptive threshold binarization.

[0076] The perspective-corrected image obtained in step S1 is used as input, and it is converted to grayscale. Then, the Otsu adaptive threshold binarization method is used to segment the image into foreground and background to obtain a binary image. .in, The foreground region in the image consists of sketch stroke pixels, while the background region consists of non-stroke areas. The input for this step is a perspective-corrected grayscale image, and the output is a binary image separating the foreground strokes from the background region. It is used for subsequent foreground point set construction and gap closure processing.

[0077] Step S22: Foreground set construction and Delaunay triangulation.

[0078] S221: Convert the binary image The center of each foreground pixel is used as a sampling point to form a point set:

[0079] S222: Pair Set Performing Delaunay triangulation yields a set of triangles. and adjacent relationships.

[0080] Step S23: Background triangle discrimination and iterative removal.

[0081] S231: For each edge in the triangular mesh Calculate the number of shared triangles With side length .

[0082] S232: If a triangle has sides Simultaneously satisfy:

[0083] The triangle will then be identified as a background triangle and deleted.

[0084] S233: Repeat S231–S232 until no triangles satisfy the conditions are found, thus completing the background triangle removal.

[0085] Step S24: Growth of multiple sub-regions and gap backfilling closure.

[0086] S241: Seed triangle selection.

[0087] Calculate the remaining triangle Three sides The longest side length of a triangle. Both of the following conditions must be met:

[0088] And triangle circumcenter If it is located inside the triangle, then... As a seed triangle.

[0089] S242: Zone growth.

[0090] Region growth begins from the seed triangle. For the current region... If there are adjacent triangles Shared sides with triangles within the region And satisfy:

[0091] Then Join the region The region growth process terminates when no adjacent triangles satisfy the conditions.

[0092] S243: Multiple subclass division and gap identification.

[0093] After completing one region growth cycle, repeat S241–S242 on the unlabeled non-background triangles to achieve multi-region partitioning.

[0094] After seed triangle selection and region growth are completed, the remaining triangles that are not absorbed by any region and are located at the gaps between adjacent strokes are identified as gap triangles. These triangles correspond to local gap areas between sketch strokes that need to be closed.

[0095] S244: Gap backfilling.

[0096] Map the gap triangle obtained in step S243 back to the binary image. In the middle, the pixels within the area covered by the slit triangle are set as foreground pixels, i.e., black pixels, to obtain a closed foreground area. .

[0097] In equations (1)-(4), For the foreground collection, For the first One foreground sampling point, The total number of foreground sampling points, For the edge The number of shared triangles, For the edge Length, Threshold for determining the side length of the background. It is a triangle The three sides, The threshold for the seed side length. It is a triangle The circumcenter of the circle For the current growth area, These are shared edges between adjacent triangles. This represents the region growth threshold. All of these thresholds are adjustable parameters used to balance gap closure integrity and local detail preservation.

[0098] Step S25: Skeleton topology repair and outer contour tracking output ordered point series.

[0099] S251: Skeleton refinement.

[0100] For closed foreground regions Perform skeleton thinning to obtain a skeleton image with a width of one pixel. .

[0101] S252: Crossover endpoints / crossover classification.

[0102] Skeleton diagram Medium skeleton pixels The 8-neighborhood is denoted in clockwise order as and order .in, The value can be 0 or 1, indicating whether the corresponding neighboring pixel is a skeleton foreground.

[0103] The crossover number can be defined as:

[0104] when Determined as an endpoint; Determine it as an intersection point. Output the set of endpoints. Intersection set .

[0105] S253: Short branch identification and iterative repair.

[0106] From the endpoint set Selecting endpoints and in the skeleton diagram Search for the set of nearest intersections in the middle. A certain intersection point Connectivity path The path search employs a breadth-first search method: candidate skeleton pixels are expanded layer by layer, with priority given to checking 4-neighbor pixels, followed by checking 8-neighbor pixels, to obtain discrete connected paths from endpoints to the nearest intersection point.

[0107] Let the connected path be ,in The path length is then defined as:

[0108] If the path length satisfies:

[0109] Then the path Marked as a short branch candidate.

[0110] For paths marked as short branch candidates, an acute angle candidate threshold is further introduced. ,in Only if the path length satisfies:

[0111] Only then is the short branch considered a candidate for acute-angle short branch and enters the geometric discrimination process; the remaining short branches that satisfy equation (7) but not equation (8) are treated as ordinary noise short branches and deleted from the path except for the intersection point. External branch pixels. The aforementioned and It can be determined based on the image resolution, stroke width, and skeleton pixel spacing of the input sketch.

[0112] For acute-angled short-branch candidates, the intersection point With the center as the endpoint, to the intersection Construct a circular domain with Euclidean distance as the radius. ,in:

[0113] Find the circular region Set of intersections with the main skeleton and remove the short branch endpoints. In the set of intersections Select the two main trunk intersections that are closest to the direction of the short branch. and Define a vector:

[0114] Further define the included angle:

[0115] When the following conditions are met:

[0116] The short branch is determined to correspond to a true acute-angle structure. At this point, the intersection point... Locally remove unstable skeleton pixels within the neighborhood and merge the intersections. , With endpoints Discrete straight line connections are made to achieve local acute angle structure reconstruction.

[0117] If equation (12) is not satisfied, the short branch is determined to be a noise short branch, and the path is deleted. Except for the intersection The outer branch pixels retain the main structure.

[0118] After deleting or reconstructing a short branch, the skeleton diagram is shown. The local topological relationships will change, so the set of endpoints in the current skeleton graph will be re-detected after each round of processing. Intersection set The process of identifying and repairing short branches is repeated until no new short branch candidates are found, and the processed graph is output. .

[0119] In equations (6)-(12), Endpoints To the nearest intersection The connected path, Indicates the path length. Indicates the short branch length threshold. Let represent the candidate threshold for acute angles, and satisfy ... , Indicated by intersection point Center and radius The circular region This represents the set of intersection points between the circular region and the main skeleton. , , These represent the direction vectors of the short branch and the two main branches, respectively. , , These represent the angles between the corresponding vectors.

[0120] S254: Moore neighborhood contour tracing.

[0121] Extraction and processing diagram The corresponding ordered outer contour point sequence First, determine the starting point in the skeleton pixel set. Let the maximum x-coordinate of the skeleton pixel set be... Prioritize satisfying The pixel with the smallest ordinate among the skeleton pixels is selected as the starting point. The offset is fixed; if there is no starting point that meets the conditions, then... The pixel with the smallest ordinate within the range is selected as the starting point; if there is still no starting point that meets the conditions, a skeleton pixel is selected from the rightmost skeleton pixels as the starting point.

[0122] Calculate the skeleton pixel set center of mass : , At the starting point The centroid is selected from the effective neighborhood. The skeleton pixel with the smallest distance is used as the first tracking point. Then, the set of candidate pixels in its neighborhood is calculated. .like If, then terminate tracking; If there is only one neighboring candidate pixel, then that pixel is taken as the next point; if... If there are multiple candidate points, after removing the previous point, select the first valid skeleton pixel encountered in clockwise order as the next point.

[0123] When the next point returns to the starting point and the current path length is greater than 1, the tracking terminates, and the starting point is added to the end of the ordered outer contour point sequence; otherwise, the tracking continues, and the ordered outer contour point sequence is finally output. :

[0124] In equations (13)-(14), A set of skeleton pixels, This represents the total number of skeleton pixels. The centroid of the skeleton pixel set, The maximum x-coordinate in the skeleton pixel set. It is an ordered sequence of outer contour points. For the first One outer contour point, This represents the total number of points on the outer contour.

[0125] By employing step S2 of this invention, the technical problems of foreground incompatibility caused by broken sketch strokes and pseudo-branches and unstable tracking caused by skeleton noise are solved, achieving the technical effect of automatically closing gaps and outputting a topologically stable, ordered sequence of outer contour points. Step S3: Key point determination and piecewise fitting reconstruction. RDP simplification is performed on the contour point sequence to obtain candidate key points, which are then selected to determine the segmentation points. Under the constraint of the segmentation points, a greedy point selection method is used to generate a set of fitting points, and a smooth closed curve contour is generated using piecewise fitting.

[0126] Step S3 specifically includes the following steps S31–S34: Step S31: Extraction of RDP candidate key points.

[0127] S311: For an ordered sequence of outer contour points Any segment (endpoints are) , The midpoint is Calculate the distance from the point to the line. vertical distance :

[0128] S312: Find the maximum perpendicular distance between all intermediate points of this segment:

[0129] like If the maximum vertical distance is found, the segment is split into two segments and processed recursively; otherwise, the intermediate point is deleted, and only the endpoints are retained. This yields a set of candidate keypoints. .

[0130] In equations (15)-(16): The RDP simplification threshold is used to control the degree of contour simplification and can be preset according to image resolution, contour scale, or dot pitch. and This is the endpoint of the current processing segment. and This is the midpoint within the current processing segment. This represents the maximum vertical distance between all intermediate points in the current processing segment. It is the Euclidean norm.

[0131] Step S32: Filter candidate key points and determine segmentation points.

[0132] The set obtained in step S31 This serves as a candidate segmentation point set. The candidate segmentation points are then manually selected, allowing users to specify structural points with locational significance for retention, resulting in the final segmentation point set. and store it in The index in.

[0133] Step S33: Greedy point selection under the split point constraint.

[0134] Set the maximum allowed segment length Within the constraint interval of adjacent segmentation points, candidate points are expanded forward along the contour sequence from the current retained point, requiring that the following conditions be met simultaneously: 1) Segment length constraint: ; 2) Validity constraint: line segment It falls entirely within the valid foreground region of the binary image (without crossing the background).

[0135] in, This is the current reserved point; Candidate points; This is the maximum allowed segment length.

[0136] If a new split point is encountered during the expansion process, that split point is selected first; otherwise, the furthest feasible candidate point that satisfies the constraints is selected as the next retained point. The fitted point sequence is obtained by traversing all intervals. .

[0137] Step S34: Segmented fitting generates a smooth closed curve.

[0138] The fitted point sequence obtained in step S33 As input, and with a set of split points Each segmentation point serves as the boundary for the segmentation, and the fitted point sequence is then processed. Perform piecewise fitting.

[0139] For segments with a small number of points, a low-order polynomial fitting is used; for segments with a large number of points and requiring local control, a cubic B-spline fitting is used. The endpoints of each segment are fixed at the corresponding segmentation points, ensuring at least positional continuity between adjacent segments. The "maximum normal distance from the ordered outer contour points to the fitted curve" is used as the error metric, and the error control threshold is set to... (Preferred) (pixels), output smooth closed curve .

[0140] By adopting step S3 of the present invention, the technical problems of redundant contour points, unstable segmentation points caused by noise, and easily destructive structural segmentation and cross-background connection generated by global simplification are solved, achieving the technical effect of generating a smooth and stable fitting contour while preserving the shape structure and meeting the requirements of geometric modeling.

[0141] Step S4: Contour Coordinate Post-processing and Unified Format Export. The train and car contours undergo mirror closure / bottom simplification coordinate processing, and are exported in a unified format as input for 2D modeling and CFD geometry.

[0142] Step S4 specifically includes the following steps S41–S43: Step S41: Object difference closure processing.

[0143] Discrete sampling is performed on the fitted contour obtained in step S3, and the contour point set is output in a clockwise direction with a preset starting point as a reference.

[0144] For the high-speed train object, the head fitting contour is used as the basic boundary, the point set is regularized, and local point segments of the tail and non-target boundary segments at the bottom are deleted. Then, the retained head contour is mirrored to generate the tail contour based on the preset axis of symmetry, and the middle part of the car body and the lower boundary are filled in by linear interpolation, thus forming a continuous closed two-dimensional train outer boundary.

[0145] For passenger vehicle objects, the fitted contour is regularized, and the complex local contours at the bottom are deleted, leaving only the main body's outer boundary. Then, the lower boundary is reconstructed based on the positioning points at both ends of the bottom using linear interpolation or fitting segment connection, thus forming a continuous and closed two-dimensional passenger vehicle outer boundary.

[0146] Through the above processing, the fitted contours of different objects are converted into two-dimensional outer boundaries with ordered point sequence and closed boundaries, forming closed contours.

[0147] Step S42: Unify scale and coordinates.

[0148] The closed contour obtained in step S41 is scaled and aligned.

[0149] For high-speed trains, the outline is scaled using preset feature dimensions as the metric reference; for passenger cars, the outline is scaled using the overall vehicle length or a preset reference dimension as the metric reference. After scaling, the outline is aligned using preset reference points or preset reference axes as the coordinate reference to ensure that different schemes are compared under a unified reference scale and a unified coordinate system.

[0150] Step S43: Export in a uniform format.

[0151] The processed closed contour is exported as a point sequence data in a unified format. The point sequence is a two-dimensional coordinate sequence arranged in the contour order, which is used as input for two-dimensional CFD modeling.

[0152] By employing step S4 of this invention, the problem of different object contour closure methods being used directly in simulation is solved, which easily leads to geometric discontinuities or failure to meet boundary processing requirements. This achieves the technical effect of outputting continuous, closed, and uniformly formatted simulation geometric inputs.

[0153] Step S5: Two-dimensional CFD modeling and solution. Based on the reconstructed two-dimensional profile, the computational domain and boundary conditions are established, and steady-state RANS simulation is performed to output the drag coefficient and pressure distribution.

[0154] Step S5 specifically includes the following steps S51–S54: Step S51: Computational domain settings and grid settings.

[0155] A two-dimensional external flow field computational domain is constructed based on the object type and contour scale, and inlet boundary, outlet boundary, top boundary and bottom gap are set.

[0156] For high-speed trains, the computational domain is set according to the train's characteristic length L, and the distance from the entrance to the front of the train, the distance from the rear of the train to the exit, and the height of the top boundary are determined according to preset ratios; a preset gap is set between the bottom of the train and the ground. For passenger cars, the computational domain is set according to the vehicle's characteristic length W or a preset reference size, and the distance from the entrance to the front of the train, the distance from the rear of the train to the exit, the height of the top boundary, and the ground clearance are determined according to preset ratios or preset sizes.

[0157] The computational domain is discretized by a grid, preferably using an unstructured grid; localized denser regions are set at the front and rear of the vehicle and in areas with large local curvature changes, and boundary layer grids are set in the near-wall region to improve the resolution of flow characteristics in key flow regions and near the wall.

[0158] Step S52: Boundary condition setting.

[0159] Set boundary conditions for the computational domain obtained in step S51. Set the inlet boundary as a velocity inlet and the outlet boundary as a pressure outlet; set the top boundary as a symmetric boundary or a slip boundary; set the model surface as a non-slip wall; set the ground as a moving wall with the same moving velocity as the inlet velocity to account for the ground effect.

[0160] Step S53: Solver and turbulence model settings.

[0161] The steady-state pressure-based RANS solution method is used to numerically solve the computational domain set in step S52.

[0162] For high-speed train operating conditions, when the incoming Mach number is less than 0.3, it is treated as incompressible flow and adopts... Turbulence model. For passenger car operating conditions, the same steady-state pressure basis RANS framework is used for solution, and Realizable... Turbulence model and enhanced wall treatment.

[0163] Preferably, the computational domain is verified for grid independence before solving, and the final computational grid is selected based on the convergence of the drag coefficient.

[0164] Step S54: Output the result.

[0165] Output drag coefficient Results such as pressure distribution are used for rapid relative evaluation and screening of conceptual schemes.

[0166] By employing step S5 of this invention, the problems of lacking rapid quantitative aerodynamic feedback and high costs of 3D modeling and simulation leading to low efficiency in scheme selection during the conceptual design stage are solved. This achieves the technical effect of rapidly obtaining comparable aerodynamic indicators based on 2D reconstructed contours and completing mesh independence verification. This invention can also be implemented through a unified interactive interface. The interactive interface includes an input module, a processing module, and an output module. The input module is used for importing sketch images and performing geometric preprocessing such as perspective transformation, rotation, and mirroring. The processing module is used to perform contour extraction, key point simplification, piecewise fitting, post-processing, and 2D CFD calculation triggering. The output module is used to display the contour processing results, pressure cloud map, and aerodynamic drag coefficient. Continuous execution of the process reduces the operational costs and setting errors caused by repeated switching between multiple software programs, improving the consistency and reproducibility of the multi-scheme processing.

[0167] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described herein. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the specific embodiments described above. Therefore, any modifications or equivalent substitutions to the present invention, as well as all technical solutions and improvements that do not depart from the spirit and scope of the invention, are covered within the scope of the claims of the present invention.

Claims

1. A method for extracting the smooth outer contour of a hand-drawn vehicle sketch, comprising the following steps: Step S1: Perspective Correction and Geometric Normalization: Map the input sketch from the perspective view to a unified two-dimensional plane representation to eliminate perspective distortion; Step S2: Contour extraction: Adaptive binarization of the sketch, gap filling based on Delaunay triangulation, and skeleton topology; Step S3: Key point determination and piecewise fitting reconstruction: RDP simplification is performed on the contour point sequence to obtain candidate key points, and the segmentation points are selected and determined; under the constraint of segmentation points, greedy point selection is used to generate a set of fitting points, and a smooth closed curve contour is generated by piecewise fitting. Step S4: Contour coordinate post-processing and unified format export: Perform mirror closure / bottom simplification coordinate processing on the train and car contours, and export them in a unified format as input for 2D modeling and CFD geometry. Step S5: Two-dimensional CFD modeling and solution: Based on the reconstructed two-dimensional profile, establish the computational domain and boundary conditions, and perform steady-state RANS simulation to output the drag coefficient and pressure distribution.

2. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 1, characterized in that: Step S1 further includes the following steps: Step S11: Control point selection; Select four control points in the input sketch image. ,in And give the corresponding point in the target side view plane. ; The four control points maintain a clear spatial distribution in the input image, and no three of them are collinear; the four control points are used to determine the mapping relationship between the region to be corrected and the input image and the target plane; Step S12: Solve for the perspective transformation matrix; After determining four pairs of corresponding control points, the control points in the input image and their corresponding points in the target plane are represented in homogeneous coordinate form, and a perspective mapping relationship from the input plane to the target side view plane is established; let the homogeneous coordinates of any pixel in the input image be... Its corresponding coordinates in the target plane are Then the two satisfy the following relationship: , in, This is a non-zero scale factor in homogeneous coordinates, used to represent the proportional equivalence between the coordinates before and after the transformation. Its specific value does not need to be specified in advance and can be eliminated during the subsequent normalization process. The perspective transformation matrix can be represented as: , Perspective transformation matrix The system is determined by the common constraints of four pairs of corresponding control points; after establishing a system of linear equations using the four pairs of corresponding points, the matrix can be obtained. The parameters are used to complete the geometric mapping model from the input sketch to the target side view plane; Step S13: Coordinate normalization and image resampling; After obtaining the perspective transformation matrix Then, a mapping calculation is performed on the pixel coordinates in the input image; for any pixel in the input image to be transformed... The coordinates mapped onto the target's side view plane, after normalization, are: , Based on the mapping relationship, the input image is mapped pixel by pixel, and the mapping result is interpolated and resampled to obtain the corrected image.

3. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 1, wherein step S2 includes: Step S21: Otsu adaptive threshold binarization; The perspective-corrected image obtained in step S1 is used as input, and it is converted to grayscale. Then, the Otsu adaptive threshold binarization method is used to segment the image into foreground and background to obtain a binary image. ; Step S22: Foreground set construction and Delaunay triangulation; S221: Convert the binary image The center of each foreground pixel is used as a sampling point to form a point set: , S222: Pair Set Performing Delaunay triangulation yields a set of triangles. and adjacency relationships; Step S23: Background triangle identification and iterative removal; S231: For each edge in the triangular mesh Calculate the number of shared triangles With side length ; S232: If a triangle has sides Simultaneously satisfy: , The triangle will then be identified as a background triangle and deleted. S233: Repeat S231–S232 until no triangles satisfy the conditions are found, thus completing the background triangle removal; Step S24: Growth of multiple sub-regions and gap backfilling closure; S241: Seed triangle selection; Calculate the remaining triangle Three sides The longest side length of a triangle; Both of the following conditions must be met: , And triangle circumcenter If it is located inside the triangle, then... As a seed triangle; S242: Zone growth; Perform region growth starting from the seed triangle; for the current region... If there are adjacent triangles Sharing sides with triangles within the region And satisfy: , Then Join the region The region growth ends when no adjacent triangles satisfy the conditions. S243: Multiple sub-segments and gap detection; After completing one region growing operation, repeat S241–S242 on the unlabeled non-background triangles to achieve multi-region division; After completing the seed triangle selection and region growth, the remaining triangles that are not absorbed by any region and are located at the gaps between adjacent strokes are identified as gap triangles. S244: Gap backfilling; Map the gap triangle obtained in step S243 back to the binary image. In the middle, the pixels within the area covered by the slit triangle are set as foreground pixels, i.e., black pixels, to obtain a closed foreground area. ; Step S25: Skeleton topology repair and outer contour tracking output ordered point series; S251: Skeleton refinement; For closed foreground region Perform skeleton thinning to obtain a skeleton image with a width of one pixel. ; S252: Crossover endpoints / Crossover points; Skeleton diagram Medium skeleton pixels The 8-neighborhood is denoted in clockwise order as and order ;in, The value is 0 or 1, indicating whether the corresponding neighboring pixel is a skeleton foreground; The crossover number can be defined as: , when Determined as an endpoint; Determine if it is an intersection point; output the set of endpoints. Intersection set ; S253: Short branch identification and iterative repair; S254: Moore neighborhood contour tracing.

4. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 3, wherein step S253 includes: From the endpoint set Selecting endpoints and in the skeleton diagram Search for the set of nearest intersections in the middle. A certain intersection point Connectivity path The connected path search is performed using a breadth-first search method: candidate skeleton pixels are expanded layer by layer, 4-neighbor pixels are checked first, and then 8-neighbor pixels are checked to obtain discrete connected paths from the endpoints to the nearest intersection. Let the connected path be ,in The path length is then defined as: , If the path length satisfies: , Then the path Marked as a short branch candidate; For paths marked as short branch candidates, an acute angle candidate threshold is further introduced. ,in Only if the path length satisfies: , Only then is the short branch considered a candidate for an acute-angle short branch, and it enters the geometric discrimination process; the aforementioned and It can be determined based on the image resolution, stroke width, and skeleton pixel spacing of the input sketch; For acute-angled short-branch candidates, the intersection point With the center as the endpoints to the intersection Construct a circular domain with Euclidean distance as the radius. ,in: , Find the circular region Set of intersections with the main skeleton and remove the short branch endpoints. ; at the intersection set Select the two main trunk intersections that are closest to the direction of the short branch. and Define a vector: , Further define the included angle: , When the following conditions are met: , The short branch is determined to correspond to a true acute-angle structure; at this point, the intersection point is... Locally remove unstable skeleton pixels within the neighborhood and merge the intersections. , With endpoints Discrete straight line connections are made to reconstruct local acute-angle structures; When not satisfied If the short branch is determined to be a noise short branch, the path is deleted. Except for the intersection The outer branch pixels retain the main structure; After deleting or reconstructing a short branch, the skeleton diagram is shown. The local topological relationships will change, so the set of endpoints in the current skeleton graph will be re-detected after each round of processing. Intersection set The process of identifying and repairing short branches is repeated until no new short branch candidates are found, and the processed graph is output. .

5. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 3, wherein step S254 includes: Extraction and processing diagram The corresponding ordered outer contour point sequence First, determine the starting point in the skeleton pixel set. Let the maximum x-coordinate of the skeleton pixel set be... Prioritize satisfying The pixel with the smallest ordinate among the skeleton pixels is selected as the starting point. The offset is fixed; if there is no starting point that meets the conditions, then... The pixel with the smallest ordinate within the range is selected as the starting point; If there is still no starting point that meets the conditions, then select a skeleton pixel from the rightmost skeleton pixels as the starting point. Calculate the skeleton pixel set center of mass : , At the starting point The centroid is selected from the effective neighborhood. The skeleton pixel with the smallest distance is used as the first tracking point. ; Subsequently, the set of candidate pixels in its neighborhood is calculated. ;like If, then terminate tracking; If there is only one neighboring candidate pixel, then that pixel is taken as the next point; if... If there are multiple candidate points, after removing the previous point, select the first valid skeleton pixel encountered in clockwise order as the next point; When the next point returns to the starting point and the current path length is greater than 1, the tracking is terminated, and the starting point is added to the end of the ordered outer contour point sequence; Otherwise, continue tracing until an ordered sequence of outer contour points is output. .

6. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 1, wherein step S3 includes: Step S31: Extraction of candidate key points for RDP; S311: For an ordered sequence of outer contour points Any segment (endpoints are) , The midpoint is Calculate the distance from the point to the line. vertical distance : , S312: Find the maximum perpendicular distance between all intermediate points of this segment: , like If the maximum vertical distance is obtained, the segment is split into two segments and processed recursively; otherwise, the intermediate point is deleted, and only the endpoints are kept; thus, a set of candidate key points is obtained. ; Step S32: Filter candidate key points and determine segmentation points; The set obtained in step S31 This serves as a candidate segmentation point set; the candidate segmentation points are then manually screened, allowing manual selection of structural points with locational significance for retention, resulting in the final segmentation point set. and store it in Index in; Step S33: Greedy point selection under the split point constraint; Set the maximum allowed segment length Within the constraint interval of adjacent segmentation points, candidate points are expanded forward along the contour sequence from the current retained point, requiring that the following conditions be met simultaneously: Segment length constraint: And validity constraints: line segments It falls entirely within the valid foreground region of the binary image; If the next split point is encountered during the expansion process, the split point is selected first; otherwise, the farthest feasible candidate point that satisfies the constraints is selected as the next retained point. The fitted point sequence is obtained by traversing all intervals. ; Step S34: Piecewise fitting generates a smooth closed curve; The fitted point sequence obtained in step S33 As input, and with a set of split points Each segmentation point serves as the boundary for the segmentation, and the fitted point sequence is then processed. Perform piecewise fitting.

7. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 6, wherein the fitting point sequence... Piecewise fitting includes: For segments with a small number of points, a low-order polynomial fitting is used; for segments with a large number of points and requiring local control, a cubic B-spline fitting is used. The endpoints of each segment are fixed at the corresponding segmentation points, ensuring at least positional continuity between adjacent segments. The maximum normal distance from the ordered outer contour points to the fitted curve is used as the error index, and the error control threshold is set to... Pixels, output smooth closed curves .

8. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 1, wherein step S4 includes: Step S41: Discretely sample the fitted contour obtained in step S3, and output the contour point set in a clockwise direction with a preset starting point as a reference. Step S42: Perform scale normalization and coordinate alignment on the closed contour obtained in step S41; Step S43: Export the processed closed contour as a point sequence data in a uniform format. The point sequence is a two-dimensional coordinate sequence arranged in the contour order, which is used as input for two-dimensional CFD modeling.

9. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 8, wherein step S41 includes: For high-speed train objects, the fitted head contour is used as the basic boundary. The point set is regularized, and local point segments at the tail and non-target boundary segments at the bottom are deleted. Then, based on the preset axis of symmetry, the retained head contour is mirrored to generate the tail contour. The middle body part and the lower boundary are filled in by linear interpolation, thus forming a continuous closed two-dimensional train outer boundary. For passenger car objects, the fitted contour is regularized, and the complex local contours at the bottom are deleted, leaving only the main body shape boundary. The lower boundary is then reconstructed based on the positioning points at both ends of the bottom using linear interpolation or fitted segment connection, thus forming a continuous closed two-dimensional passenger car outer boundary.

10. The method for extracting the smooth outer contour of a hand-drawn vehicle sketch as described in claim 1, wherein step S5 includes: Step S51: Construct a two-dimensional external flow field computational domain according to the object type and contour scale, and set the inlet boundary, outlet boundary, top boundary and bottom gap; The computational domain is discretized using an unstructured mesh; localized denser regions are set at the front and rear of the vehicle and in areas with large local curvature changes, and boundary layer meshes are set in the near-wall region to improve the resolution of flow characteristics in key flow regions and near the wall. Step S52: Set boundary conditions for the computational domain obtained in step S51; set the inlet boundary as a velocity inlet and the outlet boundary as a pressure outlet; set the top boundary as a symmetric boundary or a slip boundary; set the model surface as a non-slip wall; set the ground as a moving wall, and set the moving velocity to be consistent with the inlet velocity to take into account the ground effect; Step S53: The computational domain set in step S52 is numerically solved using the steady-state pressure-based RANS solution method; the computational domain is verified for grid independence before the solution is performed, and the final computational grid is selected based on the convergence of the drag coefficient; Step S54: Output drag coefficient Results such as pressure distribution are used for rapid relative evaluation and screening of conceptual schemes.