A method for realizing semi-autonomous calligraphy copying of a multi-degree-of-freedom calligraphy robot
Patent Information
- Application Number
- CN202411599802.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2044-11-11
AI Technical Summary
但是现有的书写机器人则仅是充实字本身,采用的类似打印充实方式,而非学习者需要的书写方式
[0026] It can be seen from the above technical solutions that the semi-autonomous calligraphy copying implementation method for the multi-degree-of-freedom calligraphy robot of the present invention has the following advantages and beneficial effects:
Smart Images

Figure CN119407808B_ABST
Abstract
Description
Technical Field
[0001] This invention generally relates to the field of robotics, and more specifically, to a control method for a multi-degree-of-freedom robot used for calligraphy copying. Background Technology
[0002] Currently, traditional Chinese culture is gaining increasing popularity, and calligraphy is a significant part of it. However, how to write calligraphy effectively remains a challenge for learners, and observing correct writing techniques is urgently needed. Learners can directly imitate and learn by observing the correct pen stroke height and stroke order. However, existing writing robots merely fill in the characters themselves, using a printing-like method, rather than the writing style that learners require.
[0003] Therefore, how to accurately display the pen's height and the writing process is a technical problem that urgently needs to be solved in the field of writing robots. Summary of the Invention
[0004] A primary objective of this invention is to overcome at least one of the deficiencies of the prior art and provide a semi-autonomous calligraphy copying method for a multi-degree-of-freedom calligraphy robot that can accurately display the pen stroke height and writing process.
[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0006] According to one aspect of the present invention, a semi-autonomous calligraphy copying method using a multi-degree-of-freedom calligraphy robot is provided, which uses a robot to operate a calligraphy brush, including the following steps:
[0007] (1) Scan the calligraphy image and perform image processing on the specific characters;
[0008] (2) Based on the image processing data, determine the skeleton and pixel width of the font and extract the outline of the character;
[0009] (3) Determine the position of the skeleton points based on the skeleton information, the spacing between skeleton points, and the pixel width;
[0010] (4) Determine the brush stroke depth at each skeleton point based on the location of the skeleton points and the outline of the characters;
[0011] (5) Based on the position of the skeleton point, the depth of the stroke and the stroke sequence input by human-computer interaction, control the robot's actions and operate the three-part pen to complete the writing of a single character.
[0012] According to one embodiment of the present invention, in step (1), the image is converted to a 512×512 image, the image is subjected to grayscale conversion, binarization, filtering and noise reduction processing, and the image is inverted to obtain a preprocessed image of the font.
[0013] According to one embodiment of the present invention, in step (2), the main part of the font preprocessing image is graphicly thinned to obtain a thinned font image with a font width of only one pixel, the skeleton of the font is determined, edge detection is performed on the generated font preprocessing image, and the character outline is extracted.
[0014] According to one embodiment of the present invention, the font is subjected to binary image processing to determine the target pixel and eight pixels in the surrounding 3x3 area, and the target pixel is determined.
[0015] According to one embodiment of the present invention, the rule for determining whether to delete a target pixel is as follows:
[0016] a) If the pixel value of the target pixel is 1, then the point is a point on the foreground text, not a point on the background;
[0017] b) If at least one of the four points above, below, left, and right of the target pixel has a pixel value of 0, it means that the point is on the edge of the font in the foreground and needs to be deleted layer by layer from the edge of the font.
[0018] c) If only one of the eight pixels has a value of 1, it indicates that the target pixel is the endpoint of the thin line; if all eight pixels have a value of 0, it indicates that the target pixel is an independent point; points in either of these cases cannot be deleted.
[0019] d) If the 8-connectivity of the target pixel is 2, the pixel is a connection point; if it is 3, the pixel is a branch point; if it is 4, the pixel is an intersection point. None of these three types of pixels can be deleted.
[0020] e) Determine whether to delete or retain the surrounding points of the target pixel.
[0021] According to one embodiment of the present invention, each pixel of the binary image is judged one by one from left to right and from top to bottom according to the above rules. If the above conditions are met, the pixel is set as a point to be deleted. When a traversal cycle ends, all marked points to be deleted are deleted. If there are no points to be deleted in a certain running cycle, the thinned skeleton of the font is obtained.
[0022] According to one embodiment of the present invention, the outline of the tip of the three-part pen can be simplified to an isosceles triangle, the height of which is the depth of the brush stroke, and the width of the character strokes is the width of the brush tip.
[0023] According to one embodiment of the present invention, the pen depth and the pen stroke width are directly proportional.
[0024] According to one embodiment of the present invention, the pen stroke depth is determined by the radius of the largest inscribed circle of the character outline relative to the pen tip.
[0025] According to an embodiment of the present invention, the operating robot determines the walking direction according to the skeleton points, adjusts the height position relative to the writing surface according to the brush application depth, and determines the walking sequence according to the established stroke sequence.
[0026] It can be seen from the above technical solutions that the semi-autonomous calligraphy copying implementation method for the multi-degree-of-freedom calligraphy robot of the present invention has the following advantages and beneficial effects:
[0027] In the present invention, images are scanned and processed to determine the skeleton and pixel width, extract the character contour, then determine the positions of skeleton points and the brush application depth at each point, and control the robot to perform actions based on these data to imitate human writing of Chinese brush calligraphy, and present the writing to learners with correct stroke order, helping learners to conduct brush writing training, which has very high market value. Description of Drawings
[0028] Various objects, features and advantages of the present invention will become more apparent when considered in conjunction with the accompanying drawings following the detailed description of the preferred embodiments of the present invention. The accompanying drawings are merely exemplary illustrations of the present invention, and are not necessarily drawn to scale. In the accompanying drawings, the same reference numerals always represent the same or similar components, wherein:
[0029] Figure 1 is a schematic diagram of a binary image.
[0030] Figure 2 is a schematic diagram of a three-section brush structure.
[0031] Figure 3 is a schematic diagram of the link parameter coordinate axis relationship of a mechanical arm established by the M-DH modeling method.
[0032] Figure 4 is a top-view schematic diagram of the XY plane showing the geometric relationship of the base coordinate system of a mechanical arm.
[0033] Figure 5 is a side-view schematic diagram of the XZ plane showing the geometric relationship of the base coordinate system of a mechanical arm.
[0034] Figures 6-10 is a schematic diagram of the process of writing the character "Yong" using the present invention. Detailed Description of Embodiments
[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; on the contrary, these embodiments are provided so that the present invention will be comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the drawings represent the same or similar structures, and thus detailed descriptions thereof will be omitted.
[0036] In the following description of various examples of the invention, reference is made to the accompanying drawings, which form part of the invention, and in which different exemplary structures, systems, and steps that can implement various aspects of the invention are shown by way of example. It should be understood that other specific embodiments of the components, structures, exemplary devices, systems, and steps may be used, and structural and functional modifications may be made without departing from the scope of the invention. Furthermore, while the terms “top,” “bottom,” “front,” “rear,” “side,” etc., may be used in this specification to describe various exemplary features and elements of the invention, these terms are used herein only for convenience, such as the orientation according to the examples shown in the drawings. Nothing in this specification should be construed as requiring a specific three-dimensional orientation of the structure to fall within the scope of the invention.
[0037] According to one aspect of the present invention, a semi-autonomous calligraphy copying method using a multi-degree-of-freedom calligraphy robot is provided, which uses a robot to operate a calligraphy brush, including the following steps:
[0038] (1) Scan the calligraphy image and perform image processing on the specific characters;
[0039] (2) Based on the image processing data, determine the skeleton and pixel width of the font and extract the outline of the character;
[0040] (3) Determine the skeleton point positions based on the skeleton information and pixel width;
[0041] (4) Determine the depth of the three strokes at each skeleton point based on the position of the skeleton point and the outline of the character.
[0042] (5) Based on the position of the skeleton point, the depth of the stroke and the stroke sequence input by human-computer interaction, control the robot's actions and operate the three-part pen to complete the writing of a single character.
[0043] According to one embodiment of the present invention, in step (1), the image is converted to a 512×512 image, the image is subjected to grayscale conversion, binarization, filtering and noise reduction processing, and the image is inverted to obtain a preprocessed image of the font.
[0044] According to one embodiment of the present invention, in step (2), the main part of the font preprocessing image is graphicly thinned to obtain a thinned font image with a font width of only one pixel, the skeleton of the font is determined, edge detection is performed on the generated font preprocessing image, and the character outline is extracted.
[0045] According to one embodiment of the present invention, the font is subjected to binary image processing to determine the target pixel and eight pixels in the surrounding 3x3 area, and the target pixel is determined.
[0046] According to one embodiment of the present invention, the rule for determining whether to delete a target pixel is as follows:
[0047] a) If the pixel value of the target pixel is 1, then the point is a point on the foreground text, not a point on the background;
[0048] b) If at least one of the four points above, below, left, and right of the target pixel has a pixel value of 0, it means that the point is on the edge of the font in the foreground and needs to be deleted layer by layer from the edge of the font.
[0049] c) If only one of the eight pixels has a value of 1, it indicates that the target pixel is the endpoint of the thin line; if all eight pixels have a value of 0, it indicates that the target pixel is an independent point; points in either of these cases cannot be deleted.
[0050] d) If the 8-connectivity of the target pixel is 2, the pixel is a connection point; if it is 3, the pixel is a branch point; if it is 4, the pixel is an intersection point. None of these three types of pixels can be deleted.
[0051] e) Determine whether to delete or retain the surrounding points of the target pixel.
[0052] According to one embodiment of the present invention, each pixel of the binary image is judged one by one from left to right and from top to bottom according to the above rules. If the above conditions are met, the pixel is set as a point to be deleted. When a traversal cycle ends, all marked points to be deleted are deleted. If there are no points to be deleted in a certain running cycle, the thinned skeleton of the font is obtained.
[0053] According to one embodiment of the present invention, the outline of the tip of the three-part pen can be simplified to an isosceles triangle, the height of which is the depth of the brush stroke, and the width of the character strokes is the width of the brush tip.
[0054] According to one embodiment of the present invention, the pen depth and the pen stroke width are directly proportional.
[0055] According to one embodiment of the present invention, the pen stroke depth is determined by the radius of the largest inscribed circle of the character outline relative to the pen tip.
[0056] According to one embodiment of the present invention, the robot determines its walking direction according to the skeleton points, adjusts its height relative to the writing surface according to the pen depth, and determines its walking sequence according to a predetermined pen order.
[0057] As can be seen from the above technical solution, the advantages and positive effects of the multi-degree-of-freedom calligraphy robot semi-autonomous calligraphy copying method of the present invention are as follows:
[0058] In this invention, the image is scanned and processed to determine the skeleton and pixel width and extract the character outline. Then, the position of the skeleton points and the depth of each point are determined. Based on these data, the robot is controlled to perform actions that imitate human calligraphy writing and present the correct stroke order to the learner, helping the learner to practice calligraphy. This invention has very high market value.
[0059] The following is a detailed explanation of the important processing nodes in this invention:
[0060] 1. Grayscale
[0061] The original calligraphy image is described by the RGB three primary colors. By performing a weighted average of the R, G, and B primary colors on the original image, it can be converted into a grayscale image. The formula is as follows:
[0062] Gray = 0.299 * R + 0.587 * G + 0.114 * B
[0063] 2. Binarization
[0064] Binarization employs the OTU thresholding method. Based on the grayscale distribution characteristics of the image, the font portion of the calligraphy image is extracted and assigned a value of 255, while the background portion is assigned a value of 0. The larger the inter-class variance between the font and the background in the original calligraphy image, the better the segmentation effect. Therefore, extracting the maximum and minimum values of the inter-class variance will result in the most significant binarization segmentation effect.
[0065] For a binary image A, let T be the segmentation threshold for the font and the background. Let p0 be the proportion of pixels occupied by the font and μ0 be the average gray level. Let p1 be the proportion of pixels occupied by the background and μ1 be the average gray level. Let μ be the overall average gray level of the image and g be the inter-class variance.
[0066] Assuming the image size is M×N, the number of pixels with gray values less than a threshold T is denoted as N0, and the number of pixels with gray values greater than the threshold T is denoted as N1. The inter-class variance is calculated as follows:
[0067] p0 = N0 / (M × N)
[0068] p1 = N1 / (M × N)
[0069] N0 + N1 = M × N
[0070] μ=p0μ0+p1μ1
[0071] g = p0(μ0 - μ) 2 +p1(μ1-μ) 2
[0072] Combining the above equations, we get the variance between classes as:
[0073] g = p0p1(μ0 - μ1) 2
[0074] The T-value is obtained by iterating through all thresholds (1 to 254) to find the maximum inter-class variance. The corresponding threshold T is then used to perform binarization segmentation on the image to obtain the extraction result.
[0075] 3. Skeleton Refinement Algorithm
[0076] The font thinning algorithm is applied to binary images. Its core idea is to traverse and judge all pixels of the binary image according to pre-set rules, delete pixels that meet the rules (and change the value of the pixel to the background pixel value) in order to achieve the purpose of thinning.
[0077] For a binary image with a black background (pixel value 0) and a white foreground (pixel value 1), the current target pixel is P, and the eight pixels in a 3x3 neighborhood around P are P1 to P8, with their positional relationships as follows: Figure 1 As shown.
[0078] 4. The rule for determining whether to delete target pixel P is as follows:
[0079] 1) The pixel value of the target pixel P is 1. That is, this point is on the foreground text, not on the background.
[0080] 2) Of the four points (P1, P3, P5, P7) above, below, left, and right of the target pixel P, at least one point has a pixel value of 0. This indicates that point P is a point on the foreground located on the edge of the text, and points need to be deleted layer by layer from the text edge.
[0081] 3) Two or more points among points P1 to P8 have a pixel value of 1. If only one point has a pixel value of 1, it means that point P is the endpoint of the thin line; if all points have a pixel value of 0, it means that point P is an independent point. Points in either of these cases cannot be deleted.
[0082] 4) The number of 8-connected nodes of the target pixel P if Then this point is the connection point. As a branch point, These are intersection points, and none of these three types of points can be deleted.
[0083] Number of connections This refers to the number of different regions connected to pixel P in a 3x3 neighborhood. Pixel connectivity can be 4-connectivity or 8-connectivity. 8-connectivity means that pixel P is connected in eight directions: up, down, left, right, and diagonally. The formula for calculating the number of 8-connectivity connections is:
[0084]
[0085] If P3 and P5 are marked as pending deletion, then recalculate by substituting P3=0 and P5=0, and ensuring that... The value remains 1. Since this algorithm checks each pixel in the binary image from left to right and top to bottom, when point P is checked, the four points P2, P3, P4, and P5 to its left and top have already been checked and marked, but their values haven't changed. Therefore, they need to be manually assigned values to calculate the connectivity number. Because this paper uses 8-connectivity, deleting the two diagonal points P2 and P4 will not change the connectivity number of point P. Therefore, we only need to consider the two points P3 and P5 located on the axis of point P.
[0086] For each pixel in the binary image, proceed from left to right and from top to bottom according to the five rules mentioned above. If all five conditions are met, the pixel is marked as a point to be deleted. After one iteration cycle, all marked points to be deleted are removed. If no points to be deleted are found in a given cycle, the program terminates, and the refined skeleton of the font is obtained.
[0087] 5. Extract the width of the inscribed circle
[0088] During the calligraphy robot's writing process, it actually only uses the "three-part brush," that is, the tip of the brush. The outline of the brush tip can be simplified to an isosceles triangle, such as... Figure 2 As shown.
[0089] According to actual calculations, the angle of the vertex angle of the triangle is approximately:
[0090]
[0091] The relationship between the altitude z and the base d of an isosceles triangle, calculated using trigonometric functions, is as follows:
[0092]
[0093] The height z of the isosceles triangle in the formula is the depth of the brushstroke.
[0094] During the writing process, the calligraphy robot mostly uses the central brush stroke, and the width of the strokes and characters it writes is the width d of the brush tip.
[0095] Through experiments, multiple sets of measurement results for pen stroke depth and stroke width were obtained. It was found that within a certain range, the pen stroke depth z and the stroke width d are approximately directly proportional, i.e.
[0096] z = k * d + b
[0097] The radius R of the maximum inscribed circle corresponding to the trajectory point is obtained using the maximum inscribed circle method. Its relationship with the stroke width d is approximately twice that of the radius R.
[0098] d = 2R
[0099] The Z-axis height of a trajectory point can be obtained by using the maximum inscribed circle method to obtain the radius R of the maximum inscribed circle corresponding to the trajectory point.
[0100] 6. Forward Kinematics Analysis of Robots
[0101] The calligraphy copying system uses the Mirobt six-DOF robotic arm as its platform. The M-DH modeling method is employed to establish the link parameters of the robotic arm, with the coordinate axis relationships as follows: Figure 3 As shown.
[0102] The DH parameters are shown in the table below.
[0103] 1 0 0 80 <![CDATA[θ1]]> 2 -π / 2 32 0 <![CDATA[θ2]]> 3 0 108 0 <![CDATA[θ3]]> 4 -π / 2 20 175 <![CDATA[θ4]]> 5 π / 2 0 0 <![CDATA[θ5]]> 6 -π / 2 0 20 <![CDATA[θ6]]>
[0104] The forward kinematics of a robotic arm is to determine the position and orientation in the coordinate system of the front end of the robotic arm or any link of the robotic arm, given the angle values of the six joints of the robotic arm. Its mathematical description is the homogeneous transformation matrix T.
[0105] Homogeneous transformation matrix of adjacent links in the improved DH method The general formula is
[0106]
[0107] In the formula, Let θ represent the homogeneous transformation matrix of link coordinate system i relative to link coordinate system i-1. i The DH parameters represent the rotation angle, where c represents cosine (cos), s represents sine (sin), and a... i-1 b represents the rod length in the DH parameters. i α represents the intercept in the DH parameters. i-1 This represents the twist angle in the DH parameters.
[0108] Based on the DH link parameters, the transformation matrices for each link can be obtained as follows:
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115] After obtaining the transformation matrix between each adjacent link from the above formula, multiplying them together yields the homogeneous transformation matrix of the robot end effector's coordinate system n relative to the fixed reference system 0.
[0116]
[0117] 7. Inverse Kinematics Analysis of Robots
[0118] The last three adjacent joint axes of this six-DOF robotic arm are perpendicular to each other and intersect at a single point, satisfying the Pieper criterion. Therefore, the robotic arm must have a closed-form solution. Inverse kinematics analysis uses a geometric method to solve for the first three joint angles, and then uses an inverse Euler angle transformation to solve for the last three joint angles.
[0119] (1) Solving θ1, θ2 and θ3 using the geometric method
[0120] The posture of the robotic arm's end effector is determined by the angle of rotation of the wrist coordinate system around the base coordinate system along the fixed XYZ axes, i.e., the RPY angle. The end effector posture represented by the RPY angle is now expressed using a rotation matrix R. The rotation around the fixed XYZ axes is defined as first rotating around the X-axis by an angle α, then around the Y-axis by an angle β, and finally around the Z-axis by an angle γ. Each rotation is around an axis of the fixed reference frame. The rotation matrix is calculated as follows:
[0121] R = R z R y R x
[0122] The calculation result is:
[0123]
[0124]
[0125]
[0126]
[0127] In the formula, R x R y R z R represents the rotation matrices for rotations about the X, Y, and Z axes, respectively. xyz This represents the rotation matrix obtained after rotating around the fixed XYZ axes.
[0128] Given the coordinates of the end effector's operating point in the base coordinate system as P(p x ,p y ,p z The wrist point's coordinates in the base coordinate system are W(w x ,w y ,w zThe distance from the end effector to the wrist point is d6, and the attitude matrix of the end effector's working point is...
[0129]
[0130] In the formula, X in the first column of the matrix x X y X z Let X and Y represent the direction cosines of the X-axis of the desired attitude coordinate system e of the end effector, and the X, Y, and Z axes of the base coordinate system, respectively. Based on the geometry of the robotic arm's end effector, we have...
[0131] p x =w x +d6a x
[0132] p y =w y +d6a y
[0133] p z =w z +d6a z
[0134] The joint angle θ1 is obtained by geometric method.
[0135] θ1=atan2(w y ,w x )
[0136] in,
[0137] This method has multiple solutions; another solution is...
[0138] θ 1′ =θ1+π
[0139] As joint one rotates around the Z-axis, the geometric relationship of the robot arm's base coordinate system is as follows: Figure 4 and Figure 5 As shown. In triangle ABC, by the definition of cosine, we have...
[0140] h 2 =a2 2 +L 2 -2a2Lcos(π-ξ)
[0141] in,
[0142]
[0143] cos(π-ξ)=-cosξ
[0144] In a right triangle there are
[0145] S 2+V 2 =h 2
[0146] Right now
[0147]
[0148]
[0149] in,
[0150] S = w z -d1
[0151]
[0152]
[0153] have to
[0154] ξ = atan2(sinξ,cosξ)
[0155] θ3=-[ξ+atan2(d4,a3)]
[0156] Here, sinξ has two solutions, and the corresponding θ3 also has two solutions, denoted as θ3 and θ. 3′ .
[0157] Solving for θ2, we obtain the following from geometric relations:
[0158] θ2=Ω-λ
[0159] in,
[0160] Ω=atan2(S,V)
[0161] λ=atan2(Lsinξ,a2+L cosξ)
[0162] As can be seen from the DH modeling method, the direction of joint rotation is opposite to the solution direction, so a negative sign needs to be added before the result, i.e.
[0163] θ2=-(Ω-λ)
[0164] Since the intermediate variable V has two solutions, the corresponding θ2 also has two solutions, denoted as θ2 and θ. 2′ .
[0165] Using the geometric method to solve for θ1, θ2, and θ3, there are a total of eight solutions for the first three axes.
[0166] (2) Solve for θ4, θ5 and θ6 using analytical method
[0167] When the angles of the last three joints are 0, the attitude matrix of coordinate system 6 relative to coordinate system 3 is:
[0168]
[0169] The orientation of coordinate system 3 relative to the base coordinate system 0 can be obtained from the forward kinematics of the robotic arm.
[0170]
[0171] The relationship between the desired attitude coordinate system e of the end actuator and the base coordinate system 0 is as follows:
[0172]
[0173] achievable
[0174]
[0175] Based on the joint structure of the robotic arm, when the angles of the last three joints are all 0, the axis of joint 4 coincides with the Z-axis of coordinate system 6, but in the opposite direction; the axis of joint 5 coincides with the Z-axis of coordinate system 6, but in the same direction; and the axis of joint 6 coincides with the Z-axis of coordinate system 6, but in the same direction. Therefore, the attitude matrix... When converting to ZYZ Euler angles, the rotation angles are the same, the directions of θ4 are opposite, and the directions of θ5 and θ6 are the same. The Euler angles α, β, and γ corresponding to θ4, θ5, and θ6 are as follows:
[0176] θ4=-α
[0177] θ5=β
[0178] θ6=γ
[0179] The rotation matrix for ZYZ Euler angles is as follows:
[0180]
[0181]
[0182]
[0183]
[0184] make The general form is
[0185]
[0186] It can be solved
[0187]
[0188]
[0189]
[0190] There are multiple solutions
[0191]
[0192]
[0193]
[0194] Special solutions are considered. When θ5=0 or 180°, the solutions of θ4 and θ6 degenerate, and only the sum or difference of angles can be obtained, thus θ4=0 is selected.
[0195] When θ5=0,
[0196] θ4=0
[0197] θ6=atan2(-r 12 ,r 11 )
[0198] When θ5=180°,
[0199] θ4=0
[0200] θ6=atan2(r 12 ,-r 11 )
[0201] Determined Chinese characters are selected below for detailed description.
[0202] As shown in Figures 6 to 10 , a calligraphy image is selected, and the regular script Chinese characters "Yong" and "Zheng" are taken as examples below.
[0203] Size adjustment is performed on the Chinese character image to be copied, and the image is converted into an image with a size of 512×512.
[0204] The image is subjected to grayscaling, binarization, filtering and noise reduction, and the image is inverted to obtain a preprocessed image of the font.
[0205] Graphic thinning is performed on the main part of the preprocessed font image to obtain a thinned font image with a font width of only one pixel, that is, a Chinese character skeleton.
[0206] Edge detection is performed on the preprocessed font image generated in the third step to extract the glyph contour.
[0207] The refined font image obtained in step 4 is subjected to a depth-first search. Starting from the Chinese character skeleton point closest to the origin (0, 0), each skeleton point in the eight directions surrounding that point is recorded and labeled. The search continues with new skeleton points. When a branching point is encountered, the depth-first search strategy is applied to record all skeleton points in the image. During this process, every N skeleton points recorded are marked as character points and written into a new blank image. After the skeleton point search is complete, a character point image is generated. This character point image essentially reproduces the refined font image, with each character point spaced approximately N pixels apart.
[0208] The figure shows the character dot image when N is 5.
[0209] Add the character point image from step 6 to the character outline image from step 5. Using the character points in the image as the center, construct the largest inscribed circle about the character outline and calculate the radius of the largest inscribed circle for each character point.
[0210] Import the character point image from step 6 into the semi-autonomous interactive UI program. The user manually determines the approximate writing trajectory using the mouse. The interactive program records the nearest character points sequentially based on the real-time mouse touch position, thus obtaining the corrected character point trajectory order. (The UI interactive system imports the character point image, records the manually drawn blue trajectory in real-time, and records the arrangement order of the character points along the real-time trajectory.)
[0211] Based on the key responses of the UI interaction system, the number and sequence number of the written strokes can be determined and recorded.
[0212] Perform coordinate transformation on the character points obtained in step 8; establish the relationship between the maximum inscribed circle radius and the writing height Z based on experimental data, and transform the Z coordinate of the character point trajectory.
[0213] The new coordinates obtained after transforming the X, Y, and Z coordinates of the text point (scaling, translation, rotation, etc.) are the crossing points of the end effector of the robotic arm, generating a G-file that the robotic arm can read.
[0214] Import the G file to enable Chinese character writing.
[0215] Those skilled in the art should understand that the specific structures and processes shown in the above detailed embodiments are merely exemplary and not restrictive. Furthermore, those skilled in the art can combine the various technical features described above in various possible ways to form new technical solutions or make other modifications, all of which fall within the scope of this invention.
Claims
1. A method for semi-autonomous calligraphy copying using a multi-degree-of-freedom calligraphy robot, characterized by the robot operating a calligraphy brush, wherein... Includes the following steps: (1) Scan the calligraphy image and perform image processing on the specific characters; (2) Based on the image processing data, determine the skeleton and pixel width of the font, and extract the outline of the character; (3) Determine the skeleton point position based on the skeleton information, the skeleton point spacing, and the pixel width; perform binary image processing on the font to determine the target pixel and the eight pixels in the surrounding 3x3 neighborhood, and determine whether to delete the target pixel. a) If the pixel value of the target pixel is 1, then the point is a point on the foreground text, not a point on the background; b) If at least one of the four points above, below, left, and right of the target pixel has a pixel value of 0, it means that the point is on the edge of the font in the foreground and needs to be deleted layer by layer from the edge of the font. c) If only one of the eight pixels has a value of 1, it indicates that the target pixel is the endpoint of the thin line; if all eight pixels have a value of 0, it indicates that the target pixel is an independent point; points in either of these cases cannot be deleted. d) If the 8-connectivity of the target pixel is 2, the pixel is a connection point; if it is 3, the pixel is a branch point; if it is 4, the pixel is an intersection point. None of these three types of pixels can be deleted. e) Determine the deletion and retention of the surrounding points of the target pixel. For each pixel of the binary image, judge it one by one from left to right and from top to bottom according to the above rules. If the above rules are met, set the point to be deleted. When a traversal cycle ends, delete all marked points to be deleted. If there are no points to be deleted in a certain running cycle, the thinned skeleton of the font is obtained. (4) Determine the brushstroke depth at each skeleton point based on the location of the skeleton points and the outline of the characters; (5) Based on the position of the skeleton points, the depth of the stroke, and the stroke sequence input by the human-computer interaction, control the robot's actions to operate the three-part pen to complete the writing of a single character. The outline of the pen tip of the three-part pen is simplified to an isosceles triangle, and the height of the isosceles triangle is the depth of the brush stroke. The width of the character strokes is the width of the brush tip. The depth of the stroke is determined by the radius of the largest inscribed circle of the character outline. The depth of the stroke z and the width of the stroke d are directly proportional, i.e. The radius R of the maximum inscribed circle corresponding to the trajectory point is obtained using the maximum inscribed circle method. This radius R is twice the width d of the handwriting. .
2. The method for semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as described in claim 1, characterized in that, In step (1), the image is converted to a 512×512 image, grayscale, binarization, filtering and noise reduction are performed on the image, and the image is inverted to obtain the preprocessed image of the font.
3. The method for semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as described in claim 2, characterized in that, In step (2), the main part of the font preprocessing image is thinned to obtain a thinned font image with a font width of only one pixel. The skeleton of the font is determined, and edge detection is performed on the generated font preprocessing image to extract the character outline.
4. The method for semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as described in any one of claims 1-3, characterized in that, The robot determines its walking direction based on the skeleton points, adjusts its height relative to the writing surface according to the depth of the stroke, and determines its walking sequence according to the predetermined stroke order.
Citation Information
Patent Citations
Hand-writing copying method and device for robot, and robot
CN111152234A
Mechanical arm regular script style calligraphy writing method based on handwritten Chinese characters
CN111475667A
Calligraphy Chinese character judgment method based on feature fusion
CN112597876A