Position classification-based open type soft pen calligraphy character trifurcate skeleton precise segmentation method
By using an open-type triangular skeleton-based segmentation method for soft-pen calligraphy based on position classification, the problem of inaccurate triangular skeleton processing in traditional methods is solved, achieving smooth stroke transitions and optimizing the robot's imitation effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAN UNIV OF TECH
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-24
AI Technical Summary
When processing calligraphy characters, existing technologies often struggle to distinguish the functional attributes of the three-pronged skeleton, leading to problems such as stroke fragmentation and skeleton reconnection, which affect the robot's imitation and recognition performance.
An open-type triangular skeleton segmentation method based on position classification is adopted. By combining corner detection and multi-structure segmentation with the positional distribution features of the triangular skeleton for classification, differentiated segmentation and retention rules are formulated to optimize the processing flow of the triangular skeleton.
It effectively solves the problems of stroke fragmentation and skeleton reconnection, achieves smooth transition of stroke width, and improves the robot's imitation effect and the accuracy of motion trajectory.
Smart Images

Figure CN121921787A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of calligraphy digitization technology, and in particular to a method for precise segmentation of the three-pronged skeleton of open-type soft-pen calligraphy characters based on position classification. Background Technology
[0002] In digital applications such as robot copying and Chinese character recognition, the extraction and processing of the skeleton of calligraphy characters is a core and crucial step. Chinese characters have complex structures and stroke widths vary greatly. Therefore, a thinning algorithm is needed to reduce the stroke width of the character image to a single pixel to obtain a skeleton that reflects the core features of the strokes. This process is also known as skeleton extraction. This step effectively reduces the amount of data, highlights the key features of Chinese characters, and lays the foundation for subsequent operations such as stroke segmentation and robot motion trajectory planning.
[0003] Currently, traditional thinning techniques such as the Zhang-Suen thinning algorithm are widely used in the field of Chinese character skeleton extraction. However, these algorithms have significant limitations when processing calligraphy characters: due to the special characteristics of calligraphy strokes, thinning easily generates a large number of triangular skeleton structures. These triangular skeletons are not only key nodes for stroke connections but also important parts that reflect the brushwork characteristics of calligraphy. Their processing effect directly determines the accuracy of subsequent robot imitation or recognition.
[0004] Existing technologies lack targeted solutions for processing triangular skeletons: on the one hand, traditional methods do not consider the large variations in stroke width in calligraphy, making it difficult to distinguish the functional attributes of the triangular skeleton and easily leading to the accidental deletion of key connection points or the retention of redundant skeletons; on the other hand, they lack classification processing logic for the positional distribution and quantitative features of the triangular skeleton, resulting in stroke fragmentation and skeleton reconnection after segmentation, failing to meet the fine-grained requirements for robot motion trajectory and posture adjustment, ultimately affecting the imitation or recognition results. Furthermore, existing thinning algorithms may also suffer from skeleton asymmetry and incomplete thinning, further exacerbating the difficulty of processing triangular skeletons and making it difficult to adapt to the complex structural features of calligraphy characters. Summary of the Invention
[0005] The purpose of this invention is to provide an open-type, precise segmentation method for the triangular skeleton of Chinese characters based on position classification. This method solves the problem of segmenting and preserving triangular skeletons distributed in different positions within the Chinese character skeleton, reduces the defects of stroke fragmentation and skeleton reconnection that are easily caused by traditional segmentation methods, compensates for the shortcomings of robot motion trajectory posture adjustment, and achieves a smooth transition of stroke width, thereby achieving an ideal imitation effect.
[0006] To achieve the above objectives, this invention provides a method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification, comprising the following steps: S1. Acquire the soft-pen calligraphy image to be processed, and perform binarization processing on the acquired soft-pen calligraphy image to obtain the preprocessed image; S2. Use the Zhang-Suen thinning algorithm to skeletonize the preprocessed image to obtain the Chinese character skeleton; perform corner detection on the Chinese character skeleton, and define the skeleton point with 3 other skeleton points in the 8-neighborhood of the skeleton point as a triangular corner point, and define the skeleton of the neighborhood around the triangular corner point as a triangular skeleton. S3. Perform multi-structure segmentation on Chinese characters containing a three-pronged skeleton to obtain multiple single-structure Chinese characters; S4. By analyzing the positional distribution of single-structure triangular skeletons, triangular skeleton Chinese characters with different positional distribution characteristics are classified. S5. Based on the number of triangular skeleton points within a single structure, differentiated segmentation and retention rules are formulated, and single-structure Chinese characters with 1, 2, or more than or equal to 3 triangular skeleton points are processed respectively.
[0007] Preferably, in S2, the specific method for defining the triangular corner point and the triangular skeleton is as follows: traverse all skeleton points on the skeleton, take each skeleton point as the center, detect the number of other skeleton points in its 8-neighborhood, determine the center skeleton point with 3 other skeleton points in its 8-neighborhood as the triangular corner point, and the skeleton in the neighborhood range around the triangular corner point is the triangular skeleton.
[0008] Preferably, in S3, the segmentation process for multi-structured Chinese characters is as follows: S3.1, Traverse the skeleton of Chinese characters containing a triangular skeleton and obtain the pixel coordinates (x, y, y) of each structural endpoint of the Chinese character. i ,y i ); S3.2 For each single structure, compare the x and y values of the coordinates of all its internal endpoint pixels to determine the minimum value x in the x-direction of that single structure. min Maximum value x max and the minimum value y in the y direction min Maximum value y max ; S3.3, with (x min y min ), (x max y min) 、(x min y max ), (x max y max Draw a rectangle around the four vertices, and use the rectangle to enclose each single structure independently, thereby dividing the multi-structure Chinese character into multiple single-structure Chinese characters.
[0009] Preferably, in S4, the classification rule for the triangular skeleton is: If there is only 1 three - fork skeleton point in a single structure, no classification is required; If there are 2 three - fork skeleton points in a single structure, output the coordinate information of the two three - fork corner points, compare the x - values and y - values of the two three - fork corner points, and obtain the minimum value x min and the maximum value x max in the x - direction, and the minimum value y min and the maximum value y max in the y - direction; Define the three - fork corner point corresponding to x min as the left - most point, the three - fork corner point corresponding to x max as the right - most point, the three - fork corner point corresponding to y min as the top - most point, and the three - fork corner point corresponding to y max as the bottom - most point; Calculate the straight - line distance between the right - most point and the left - most point and denote it as A, calculate the straight - line distance between the bottom - most point and the top - most point and denote it as B; Only when A < N, determine that the three - fork skeleton of this structure is of the "|" type; Only when B < M, determine that the three - fork skeleton of this structure is of the "-" type; N and M are preset constants adapted to 256×256 pixel images; If there are greater than or equal to 3 three - fork skeleton points in a single structure, output the coordinate information of all three - fork corner points, and determine x min and x max , y min and y max , as well as the left - most point, the right - most point, the top - most point, and the bottom - most point, and calculate the distances A and B; When A > N and B > M, determine that the three - fork skeleton of this structure is of the type; Otherwise, determine that the three - fork skeleton of this structure is of other types; N and M are preset constants adapted to 256×256 pixel images.
[0010] Preferably, the processing flow when there is only 1 three - fork skeleton point in a single structure in S5.1 is as follows: ① Set the image size to 256×256 pixels, and calculate the width w, height h, and area S of the rectangular frame corresponding to this single structure; ② When S ≤ 2000, retain this three - fork skeleton point and do not perform additional processing on this three - fork skeleton; ③ When S > 2000, calculate the tangent values of this three - fork skeleton point and each connected end - point:
[0011] where, is the three - fork skeleton point, , , is the horizontal and vertical coordinates of the center of the three - fork skeleton point, is the pixel coordinate of the end - point e; Calculate the absolute value of the difference between the tangent values of this three - fork skeleton point and any two connected end - points:
[0012] in, , Let be any two distinct endpoints, and .
[0013] Calculate all paths to be verified Length of surrounding skeleton path :
[0014] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels; For the triangular skeleton point The set of connection points to the endpoint e of the connected skeleton; if If so, then the skeleton is defined as a "virtual skeleton"; like Then delete the first skeleton point of the black skeleton path between the three-way skeleton point and the other endpoint:
[0015] in, The value of the white BGR pixel. To and The "other connected endpoint" where Δtan < 0.1 The set of coordinates of all pixels in the image ; like The skeleton around this triangular skeleton point is not processed, and this triangular skeleton is preserved.
[0016] Preferably, the processing flow for S5.2, when a single structure contains only two triangular skeleton points, is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length :
[0017] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels.
[0018] ③ No processing is done on the skeleton around the triangular skeleton point containing the "virtual skeleton"; the triangular skeleton is preserved.
[0019] For a ternary skeleton point that does not have a "virtual skeleton" in its surroundings, delete the first skeleton point of the valid connection path between it and a ternary skeleton point that does have a "virtual skeleton":
[0020] in, The first skeleton point of the valid connection path between the three skeleton points (from) or ).
[0021] Preferably, in S5.3, the processing method for a single structure containing three or more triangular skeleton points is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length :
[0022] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels.
[0023] ③ Define connectivity as the number of other skeleton points connected to a ternary skeleton point within its 8-neighborhood; If the connectivity of the three-pronged skeleton is 1 and it contains a "virtual skeleton", that is... If the three-pronged skeleton is not processed, the skeleton around the point will be retained. ④ If the connectivity of the triangular skeleton point is 1 but does not contain a "virtual skeleton", is located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, then... ,in , for If there is only one connected ternary skeleton point, then the skeleton around the ternary skeleton point will not be processed, and the ternary skeleton will be preserved. ⑤ If the connectivity of the triangular skeleton point is 1 but it does not contain a "virtual skeleton", is not located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, then... Calculate the tangent values of the longitudinal and lateral distances between each pair of the connected triangular skeleton points and the two skeleton endpoints. If there is a unique tangent value less than 0.2 or greater than 5 ("T" or "|" distribution), for any two participants The tangent value is defined as:
[0024] in, , (If t is a point on a triangular skeleton, take the center coordinates; if it is an endpoint, take the pixel coordinates).
[0025] Delete the first skeleton point of the black skeleton path between the triangular skeleton point and the participant (skeleton or triangular skeleton point) with a non-tangent value less than 0.2 or greater than 5, as shown below:
[0026] in, For participants who are not special tangent values, for To the first skeleton point of path t.
[0027] If there is a unique tangent value that is neither less than 0.2 nor greater than 5, then delete the first skeleton point of the skeleton connected to the lower endpoint of the ternary skeleton point, as shown below:
[0028] in, for Connected lower skeleton points.
[0029] If all tangent values are less than 0.2 or greater than 5 ("I" or "|" type distribution), then delete the first skeleton point of the skeleton between the given triangular skeleton point and the connected triangular skeleton points, represented as:
[0030] ⑥ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain previously unprocessed dummy skeletons and other skeletons, then calculate the tangent value of the connected ternary skeleton points. ,if The first skeleton point of the black skeleton path between the ternary skeleton point and the previously unprocessed ternary skeleton point is deleted, as shown below:
[0031] in, for The first skeleton point of the path.
[0032] if Delete the first skeleton point of the black skeleton path between the three-way skeleton point and its connected endpoints, as shown below:
[0033] in, for Connected skeleton endpoints.
[0034] ⑦ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain previously processed ternary skeleton points, or if the ternary skeleton point contains a "virtual skeleton". If the three-pronged skeleton is not processed, the skeleton around the point will be retained. If the triangular skeleton point does not contain a "virtual skeleton". Delete the first skeleton point of the black skeleton path between the current ternary skeleton point and the previously unprocessed ternary skeleton point, as shown below:
[0035] in, for Connected, unprocessed triangular skeleton points.
[0036] ⑧ If the connectivity of the ternary skeleton point is 3, calculate the tangent between the ternary skeleton point and its connected ternary skeleton points. ,statistics and The quantity is expressed as:
[0037] if Then the triangular skeleton point and The first white skeleton point of the white skeleton path between the three-way skeleton points is deleted, represented as:
[0038] in, for The set of points of the triangular skeleton.
[0039] if Then the triangular skeleton point and The deletion of the first skeleton point of the black skeleton path between the three-way skeleton points is represented as:
[0040] in, for The set of points of the triangular skeleton.
[0041] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: (1) It effectively solves the core problems of stroke fragmentation and skeleton reconnection in traditional skeleton processing. By accurately defining the triangular corner points and triangular skeletons, multi-structured Chinese characters are split into independent single structures, and the single structure is classified and processed according to the number and position distribution of triangular skeleton points. This avoids the destruction of stroke integrity caused by traditional unified segmentation and ensures the continuity and accuracy of Chinese character skeletons.
[0042] (2) This method perfectly adapts to the characteristic of large variation in stroke width in soft brush calligraphy and realizes smooth transition of stroke width. By distinguishing edge and middle three-way skeleton points and combining judgment criteria such as pixel-level distance and rectangle frame parameters, different differential retention and segmentation rules are formulated for different types of three-way skeletons, enabling the processed skeleton to accurately reflect the thickness change rule of soft brush writing.
[0043] (3) Significantly optimizes the robot copying effect and provides accurate reference for robot motion trajectory planning. The processed skeleton effectively reduces trajectory breakpoints, clarifies the processing priority of main strokes and branch strokes, compensates for the deficiencies of traditional methods in robot motion trajectory posture adjustment, and makes the copied works more conform to the artistic style and writing logic of the original calligraphy.
[0044] The technical solution of the present invention will be further described in detail below through the accompanying drawings and embodiments. Description of the Drawings
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings required for use in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0046] Figure 1 It is a flowchart of the accurate segmentation method for the three-way skeleton of open soft brush calligraphy characters based on position classification in the embodiments of the present invention; Figure 2 It is a schematic diagram of the largest inscribed circle at the three-way skeleton points of different Chinese characters in the present invention. Among them, (a) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "ting", (b) is a skeleton structure segmentation diagram of (a); (c) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "jiang", (d) is a skeleton structure segmentation diagram of (c); (e) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "gong", (f) is a skeleton structure segmentation diagram of (e); (g) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "yong", (h) is a skeleton structure segmentation diagram of (g); (i) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "yi", (j) is a skeleton structure segmentation diagram of (i); (k) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "guang", (l) is a skeleton structure segmentation diagram of (k); (m) is a schematic diagram of the largest inscribed circle at the three-way skeleton points of the character "guang", (n) is a skeleton structure segmentation diagram of (m). <000吗289> Figure 3These are comparison images of the skeleton before and after segmentation in this invention. Column (a) shows the standard characters, column (b) shows the Chinese characters before skeleton segmentation, the circled part is the pre-segmented part, and column (c) is a magnified view of the pre-segmented part. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0049] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] Example like Figure 1 As shown, the steps of the open-type soft-pen calligraphy character triangular skeleton accurate segmentation method based on position classification are as follows: S1. Acquire the soft-pen calligraphy image to be processed, and perform binarization processing on the acquired soft-pen calligraphy image to obtain the preprocessed image; S2. Use the Zhang-Suen thinning algorithm to skeletonize the preprocessed image to obtain the Chinese character skeleton; perform corner detection on the Chinese character skeleton, and define the skeleton point with 3 other skeleton points in the 8-neighborhood of the skeleton point as a triangular corner point, and define the skeleton of the neighborhood around the triangular corner point as a triangular skeleton. The specific method for defining triangular corner points and triangular skeletons is as follows: traverse all skeleton points on the skeleton, take each skeleton point as the center, detect the number of other skeleton points in its 8-neighborhood, and determine the center skeleton point with 3 other skeleton points in its 8-neighborhood as the triangular corner point. The skeleton within the neighborhood range around the triangular corner point is the triangular skeleton.
[0051] S3. Perform multi-structure segmentation on Chinese characters containing a triangular skeleton to obtain multiple single-structure Chinese characters. The segmentation process is as follows: S3.1, Traverse the skeleton of Chinese characters containing a triangular skeleton and obtain the pixel coordinates (x, y, y) of each structural endpoint of the Chinese character. i ,y i ); S3.2 For each single structure, compare the x and y values of the coordinates of all its internal endpoint pixels to determine the minimum value x in the x-direction of that single structure. min Maximum value x max and the minimum value y in the y direction min Maximum value y max ; S3.3. Draw a rectangular box with (x min , y min ), (x max , y min) ), (x min , y max ), (x max , y max ) as the four vertices, and independently enclose each single structure through the rectangular box, so as to split the multi-structure Chinese characters into multiple single-structure Chinese characters.
[0052] After the execution of step S3, the multi-structure Chinese characters have been split into independent single structures. The skeleton state before splitting and the pre-segmentation area to be processed are as Figure 3 shown. Figure 3 In (a) column is the reference of standard characters, (b) column is the skeleton refined by Zhang-Suen (the circled part is the pre-segmentation area containing the three-fork skeleton), and (c) column is the partial enlarged view of the pre-segmentation area. It can be seen that there are redundant three-fork skeleton points and paths in the pre-segmentation area.
[0053] S4. Classify the three-fork skeleton Chinese characters with different position distribution characteristics by analyzing the position distribution of the single-structure three-fork skeleton. The classification rules are as follows: If there is only 1 three-fork skeleton point in the single structure, no classification is required; If there are 2 three-fork skeleton points in the single structure, output the coordinate information of the two three-fork corner points, compare the x values and y values of the two three-fork corner points, and obtain the minimum value x min and the maximum value x max in the x direction, and the minimum value y min and the maximum value y max in the y direction; define the three-fork corner point corresponding to x min as the leftmost point, the three-fork corner point corresponding to x max as the rightmost point, the three-fork corner point corresponding to y min as the uppermost point, and the three-fork corner point corresponding to y max as the lowermost point; calculate the straight-line distance between the rightmost point and the leftmost point and denote it as A, and calculate the straight-line distance between the lowermost point and the uppermost point and denote it as B; only when A < N, determine that the three-fork skeleton of this structure is of the "|" type; only when B < M, determine that the three-fork skeleton of this structure is of the "-" type; N and M are preset constants adapted to 256×256 pixel images. It can be expressed as:
[0054] If there are greater than or equal to 3 three-fork skeleton points in the single structure, output the coordinate information of all three-fork corner points, and determine x min , x max , y min , y maxGiven the leftmost, rightmost, topmost, and bottommost points, calculate distances A and B; when A > N and B > M, determine that the triangular skeleton of the structure is... If the structure is of type 1, then the three-pronged skeleton is determined to be of type 2; otherwise, it is determined to be of other types; N and M are preset constants adapted to 256×256 pixel images. This can be expressed as:
[0055] S5. Based on the number of triangular skeleton points within a single structure, differentiated segmentation and retention rules are formulated, and single-structure Chinese characters with 1, 2, or more than or equal to 3 triangular skeleton points are processed respectively.
[0056] S5.1 The processing flow when a single structure contains only one triangular skeleton point is as follows: ① Set the image size to 256×256 pixels, and calculate the width w, height h, and area S of the rectangle corresponding to this single structure; ②If S≤2000 (image size is 256×256), such as Figure 2 Structure (b) 3 in the middle Figure 2 (d) structure 4 Figure 2 Structure (j) in (j) and Figure 2 As shown in structure 1 (l), this triangular skeleton point is retained, and no processing is done on this triangular skeleton; ③ If S>2000, calculate the tangent values between the triangular skeleton point and each connected endpoint:
[0057] in, , , Let x and y be the center coordinates of the triangular skeleton point. Let be the pixel coordinates of endpoint e; Calculate the absolute value of the difference between the tangent values of the triangular skeleton point and any two connected endpoints:
[0058] in, , Let be any two distinct endpoints, and .
[0059] Calculate all paths to be verified Length of surrounding skeleton path :
[0060] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels. For the triangular skeleton point The set of connection points to the endpoint e of the connected skeleton; In order to reproduce the skeletal features of the copied Chinese character image to the greatest extent possible, 20 is used as the cutoff value to avoid deleting short skeletons with fewer than 20 pixels; if If so, then the skeleton is defined as a "virtual skeleton"; like ,like Figure 2 As shown in structure (d) 3, the first skeleton point of the black skeleton path between the three-way skeleton point and the other endpoint is deleted:
[0061] in, The value of the white BGR pixel. To and The other endpoint of Δtan<0.1 The set of coordinates of all pixels in the image ; like ,like Figure 2 As shown in (d) structure 1 and 2 (f) structure 2, the skeleton around this triangular skeleton point is not processed, and this triangular skeleton is retained.
[0062] S5.2 The processing flow for a single structure containing only 2 triangular skeleton points is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length :
[0063] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels.
[0064] ③ For the three-pronged skeleton containing a "virtual skeleton", the skeleton around the point is not processed in any way, and the three-pronged skeleton is preserved, such as... Figure 2 In structure (b), the triangular skeleton ② and ③ are part of structure 1. Figure 2 The triangular skeleton ② and ③ in structure 2 (d) and Figure 2 The triangular skeleton ② in structure 1 (f) is shown.
[0065] For triangular skeleton points that do not have a "virtual skeleton" in the surrounding area, such as Figure 2As shown in the triangular skeleton ③ in structure 1 (f), delete the first skeleton point of the effective connection path between it and the triangular skeleton point containing the "virtual skeleton". The effective connection path refers to the shortest path between two triangular points that is 8-neighborhood connected and consists entirely of black skeleton pixels.
[0066] in, The first skeleton point of the valid connection path between the three skeleton points (from) or ).
[0067] S5.3 The method for handling single structures containing more than or equal to 3 triangular skeleton points is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length :
[0068] in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels.
[0069] ③ If the connectivity of the three-pronged skeleton is 1 and it contains a "virtual skeleton", that is... ,like Figure 2 In structure (h), the triangular skeleton ③ and ④ are part of structure 1. Figure 2 The triangular skeleton ③ in structure 1 of (j) Figure 2 The triangular skeleton in structure 2 (l) and Figure 2 As shown in the triangular skeleton ① of structure 1 in (n), the skeleton around the triangular skeleton point is not processed, and the triangular skeleton is retained. ④ If the connectivity of the triangular skeleton point is 1 but does not contain a "virtual skeleton", is located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, then... ,in , for The only connected point in the ternary skeleton. For example... Figure 2 As shown in the skeleton ② of structure 1 (h), the skeleton around the triangular skeleton point is not processed, and the triangular skeleton is retained. ⑤ If the connectivity of the triangular skeleton point is 1 but it does not contain a "virtual skeleton", is not located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, then... Calculate the tangent values of the longitudinal and lateral distances between each pair of the connected triangular skeleton points and the two skeleton endpoints. If there is a unique tangent value less than 0.2 or greater than 5 ("T" or "|" distribution), for any two participants The tangent value is defined as:
[0070] in, , (If t is a point on a triangular skeleton, take the center coordinates; if it is an endpoint, take the pixel coordinates).
[0071] like Figure 2 In structure (j), the skeleton ⑤ and Figure 2 As shown in skeletons ② and ④ of structure 2 (l), the first skeleton point of the black skeleton path between the triangular skeleton point and the participant (skeleton or triangular skeleton point) with a non-tangent value less than 0.2 or greater than 5 is deleted:
[0072] in, This refers to participants with non-special tangent values. Special tangent values are defined as tan < 0.2 or tan > 5, while non-special tangent values are defined as tan ∈ [0.2, 5]. for To the first skeleton point of path t.
[0073] If there is a unique tangent value that is neither less than 0.2 nor greater than 5, such as Figure 2 As shown in skeleton ⑥ of structure 1 (j), the first skeleton point of the skeleton connected to the lower endpoint of the three-pronged skeleton point is deleted:
[0074] in, for Connected lower skeleton points.
[0075] If all tangent values are less than 0.2 or greater than 5 (a "-" or "|" type distribution), such as Figure 2 As shown in skeleton ④ of structure 1 (n), delete the first skeleton point of the skeleton between the three-way skeleton point and the connected three-way skeleton points:
[0076] ⑥ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain previously unprocessed dummy skeletons and other skeletons, then calculate the tangent value of the connected ternary skeleton points. ,if ,like Figure 2As shown in skeleton ① of structure 1 (h), delete the first skeleton point of the black skeleton path between the ternary skeleton point and the previously unprocessed ternary skeleton point, that is:
[0077] in, for The first skeleton point of the path.
[0078] if ,like Figure 2 The skeleton in structure 1 (h) in the middle, such as ⑥, Figure 2 As shown in the skeleton ⑤ of structure 2 (l), the first skeleton point of the black skeleton path between the three-way skeleton point and its connected endpoints is deleted, that is:
[0079] in, for Connected skeleton endpoints.
[0080] ⑦ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain previously processed ternary skeleton points, and if the ternary skeleton point contains a "virtual skeleton", that is... ,like Figure 2 As shown in the skeleton ③ of structure 1 in (n), the skeleton around the triangular skeleton point is not processed, and the triangular skeleton is retained. If the triangular skeleton point does not contain a "virtual skeleton", that is ,like Figure 2 As shown in skeleton ① of structure 1 (j), delete the first skeleton point of the black skeleton path between the ternary skeleton point and the previously unprocessed ternary skeleton point, that is:
[0081] in, for Connected, unprocessed triangular skeleton points.
[0082] ⑧ If the connectivity of the ternary skeleton point is 3, calculate the tangent between the ternary skeleton point and its connected ternary skeleton points. ,statistics and The quantity, that is:
[0083] if ,like Figure 2 The skeleton ⑤ in structure 1 of (h) and Figure 2 As shown in the skeleton ② of structure 1 (j), the three-pronged skeleton point is then connected to... Delete the first white skeleton point of the white skeleton path between the three-way skeleton points, that is:
[0084] in, for The set of points of the triangular skeleton.
[0085] if ,like Figure 2 As shown in the skeleton ③ of structure 2 (l) in the diagram, the point of the triangular skeleton is then connected to... Delete the first skeleton point of the black skeleton path between the three skeleton points, that is:
[0086] in, for The set of points of the triangular skeleton.
[0087] The remaining technical features in the above embodiments can be flexibly selected by those skilled in the art to meet different specific practical needs according to actual circumstances. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims. In the above description, numerous specific details have been set forth to provide a thorough understanding of the present invention. However, it will be apparent to those skilled in the art that these specific details are not necessary to implement the present invention. In other instances, to avoid obscuring the present invention, well-known techniques, such as specific construction details, operating conditions, and other technical conditions, have not been specifically described.
[0088] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A precise segmentation method for the three-pronged skeleton of open-type soft-pen calligraphy characters based on position classification, characterized in that, Includes the following steps: S1. Acquire the soft-pen calligraphy image to be processed, and perform binarization processing on the acquired soft-pen calligraphy image to obtain the preprocessed image; S2. Use the Zhang-Suen thinning algorithm to skeletonize the preprocessed image to obtain the Chinese character skeleton; perform corner detection on the Chinese character skeleton, and define the skeleton point with 3 other skeleton points in the 8-neighborhood of the skeleton point as a triangular corner point, and define the skeleton of the neighborhood around the triangular corner point as a triangular skeleton. S3. Perform multi-structure segmentation on Chinese characters containing a three-pronged skeleton to obtain multiple single-structure Chinese characters; S4. By analyzing the positional distribution of single-structure triangular skeletons, triangular skeleton Chinese characters with different positional distribution characteristics are classified. S5. Based on the number of triangular skeleton points within a single structure, differentiated segmentation and retention rules are formulated, and single-structure Chinese characters with 1, 2, or more than or equal to 3 triangular skeleton points are processed respectively.
2. The method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification according to claim 1, characterized in that: In S2, the specific method for defining the triangular corner point and the triangular skeleton is as follows: traverse all skeleton points on the skeleton, take each skeleton point as the center, detect the number of other skeleton points in its 8-neighborhood, determine the center skeleton point with 3 other skeleton points in its 8-neighborhood as the triangular corner point, and the skeleton in the neighborhood range around the triangular corner point is the triangular skeleton.
3. The method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification according to claim 1, characterized in that: In S3, the segmentation process for multi-structured Chinese characters is as follows: S3.1, Traverse the skeleton of Chinese characters containing a triangular skeleton and obtain the pixel coordinates (x, y, y) of each structural endpoint of the Chinese character. i ,y i ); S3.2 For each single structure, compare the x and y values of the coordinates of all its internal endpoint pixels to determine the minimum value x in the x-direction of that single structure. min Maximum value x max and the minimum value y in the y direction min Maximum value y max ; S3.3, with (x min y min ), (x max y min) 、(x min y max ), (x max y max Draw a rectangle around the four vertices, and use the rectangle to enclose each single structure independently, thereby dividing the multi-structure Chinese character into multiple single-structure Chinese characters.
4. The method for precise segmentation of the open-type three-pronged skeleton of soft-pen calligraphy characters based on position classification according to claim 3, characterized in that: In S4, the classification rules for the triangular skeleton are as follows: If a single structure contains only one triangular skeleton point, then no classification is required; If a single structure contains 2 three - prong skeleton points, output the coordinate information of the two three - prong corner points, compare the x - values and y - values of the two three - prong corner points, and obtain the minimum value x min and the maximum value x max in the x - direction, and the minimum value y min and the maximum value y max in the y - direction; Define the three - prong corner point corresponding to x min as the left - most point, and the three - prong corner point corresponding to x max as the right - most point, the three - prong corner point corresponding to y min as the top - most point, and the three - prong corner point corresponding to y max as the bottom - most point; Calculate the straight - line distance between the right - most point and the left - most point and denote it as A, calculate the straight - line distance between the bottom - most point and the top - most point and denote it as B; Only when A < N, determine that the three - prong skeleton of this structure is of the "|" type; Only when B < M, determine that the three - prong skeleton of this structure is of the "-" type; N and M are preset constants adapted to 256×256 pixel images; If a single structure contains three or more triangular skeleton points, output the coordinates of all triangular corner points to determine x. min x max y min y max Given the leftmost, rightmost, topmost, and bottommost points, calculate distances A and B; when A > N and B > M, determine that the triangular skeleton of the structure is... If the structure is of type 1, then the three-pronged skeleton is determined to be of type 2; otherwise, the structure is determined to be of other types; N and M are preset constants for adapting to 256×256 pixel images.
5. The method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification according to claim 4, characterized in that: S5.1 The processing flow when a single structure contains only one triangular skeleton point is as follows: ① Set the image size to 256×256 pixels, and calculate the width w, height h, and area S of the rectangle corresponding to this single structure; ② When S≤2000, retain the triangular skeleton point and do not perform any additional processing on the triangular skeleton; ③ When S>2000, calculate the tangent values between the triangular skeleton point and each connected endpoint: in, For triangular skeleton points, , , Let x and y be the center coordinates of the triangular skeleton point. Let be the pixel coordinates of endpoint e; Calculate the absolute value of the difference between the tangent values of the triangular skeleton point and any two connected endpoints: in, , Let be any two distinct endpoints, and ; Calculate all paths to be verified Length of surrounding skeleton path : in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels; For the triangular skeleton point The set of connection points to the endpoint e of the connected skeleton; like If so, then the skeleton is defined as a "virtual skeleton"; like Then delete the first skeleton point of the black skeleton path between the three-way skeleton point and the other endpoint: in, The value of the white BGR pixel. To and of "Another connected endpoint" <0.1 The set of coordinates of all pixels in the image ; like The skeleton around this triangular skeleton point is not processed, and this triangular skeleton is preserved.
6. The method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification according to claim 4, characterized in that: S5.2 The processing flow for a single structure containing only 2 triangular skeleton points is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length : in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels; ③ No processing is done on the skeleton around the triangular skeleton point containing the "virtual skeleton"; the triangular skeleton is preserved. For a ternary skeleton point that does not have a "virtual skeleton" in its surroundings, delete the first skeleton point of the valid connection path between it and a ternary skeleton point that does have a "virtual skeleton": in, The first skeleton point of the valid connection path between the three skeleton points, from or .
7. The method for precise segmentation of the triangular skeleton of open-type soft-pen calligraphy characters based on position classification according to claim 4, characterized in that: S5.3 The method for handling single structures containing more than or equal to 3 triangular skeleton points is as follows: ① Search separately to the surrounding skeletal endpoints All skeleton paths ; ② Calculate all paths to be verified length : in, The condition for existence is: existence from The 8-neighbor connected skeleton path to e, and the entire path consists of black skeleton pixels; ③ Define connectivity as the number of other skeleton points connected to a ternary skeleton point within its 8-neighborhood; If the connectivity of the three-way skeleton is 1 and it contains a "virtual skeleton". If the three-pronged skeleton is not processed, the skeleton around the point will be retained. ④ If the connectivity of the triangular skeleton point is 1 but does not contain a "virtual skeleton", is located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, then... ,in , for If there is only one connected ternary skeleton point, then the skeleton around the ternary skeleton point will not be processed, and the ternary skeleton will be preserved. ⑤ If the connectivity of the triangular skeleton point is 1 but does not contain a "virtual skeleton", is not located on the leftmost side of the structure, and has a lateral distance greater than 20 from the connected triangular skeleton point, Calculate the tangent values of the longitudinal and lateral distances between each pair of the connected triangular skeleton points and the two skeleton endpoints. If there is a unique tangent value less than 0.2 or greater than 5, exhibiting a "T" or "|" shaped distribution, for any two participants... The tangent value is defined as: in, , If t is a point on a triangular skeleton, then the center coordinates are taken; if t is an endpoint, then the pixel coordinates are taken. Delete the first skeleton point of the black skeleton path between the triangular skeleton point and participants whose non-tangent value is less than 0.2 or greater than 5: in, For participants who are not special tangent values, for The first skeleton point on path t; If there is a unique tangent value that is neither less than 0.2 nor greater than 5, then delete the first skeleton point of the skeleton connected to the lower endpoint of that ternary skeleton point: in, for Connected lower skeleton points; If all tangent values are less than 0.2 or greater than 5, and the distribution is in the shape of an "I" or "|", then delete the first skeleton point of the skeleton between the given triangular skeleton point and the connected triangular skeleton points. ⑥ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain unprocessed virtual skeletons and other skeletons, then calculate the tangent value of the connected ternary skeleton points. ,like The first skeleton point of the black skeleton path between the ternary skeleton point and the previously unprocessed ternary skeleton point is deleted, as shown below: in, for The first skeleton point of the path; if Delete the first skeleton point of the black skeleton path between the three-way skeleton point and its connected endpoints, as shown below: in, for Connected skeleton endpoints; ⑦ If the connectivity of the ternary skeleton point is 2 and the connected ternary skeleton points contain the ternary skeleton point being processed, and if the ternary skeleton point contains a "virtual skeleton". If the three-pronged skeleton is not processed, the skeleton around the point will be retained. If the triangular skeleton point does not contain a "virtual skeleton". The first skeleton point of the black skeleton path between the ternary skeleton point and the unprocessed ternary skeleton point is deleted, represented as: in, for Connected, unprocessed triangular skeleton points; ⑧ If the connectivity of the ternary skeleton point is 3, calculate the tangent between the ternary skeleton point and its connected ternary skeleton points. ,statistics and The quantity is expressed as: if Then the triangular skeleton point and The first white skeleton point of the white skeleton path between the three-way skeleton points is deleted, represented as: in, for The set of points of the triangular skeleton; if Then the triangular skeleton point and The deletion of the first skeleton point of the black skeleton path between the three-way skeleton points is represented as: in, for The set of points of the triangular skeleton.