Semi-autonomous calligraphy copying implementation method of multi-degree-of-freedom calligraphy robot
Through the multi-degree-of-free calligraphy robot semi-autonomous calligraphy copying implementation method, the problem that the existing technology cannot correctly display the pen height and writing process is solved, and the effect of imitating people to write brushes is achieved, and it has high market value.
Patent Information
- Application Number
- CN202411599802.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-11
AI Technical Summary
Existing writing robots cannot correctly display the pen-fall height and writing process, and cannot meet the needs of learners to write brush words correctly by imitating.
The multi-degree-of-freedom calligraphy robot semi-autonomous calligraphy copying method is adopted. By scanning calligraphy images, image processing, extracting the outline of the characters and the position of the skeleton points, determining the depth of the brush, controlling the robot's movements, imitating human writing calligraphy.
It has achieved the correct display of the pen-taking height and writing process, helping learners to write brushes correctly by imitating them, which has high market value.
Smart Images

Figure CN119407808A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of robots, and in particular to a control method for a multi-degree-of-freedom robot used for calligraphy copying. Background Art
[0002] At present, Chinese traditional culture is becoming more and more popular, and calligraphy is also a highlight of traditional culture. However, how to write calligraphy confuses learners, and learning the correct writing method is urgently needed. Learners can intuitively imitate and learn by observing the correct pen height and stroke writing order. However, the existing writing robots only enrich the characters themselves, using a printing-like enrichment method, rather than the writing method required by learners.
[0003] Therefore, how to correctly display the pen height and writing process is a technical problem that urgently needs to be solved in the field of writing robots. Summary of the invention
[0004] A main purpose of the present invention is to overcome at least one defect of the above-mentioned prior art and to provide a method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot that can correctly display the pen height and the writing process.
[0005] In order to achieve the above-mentioned invention object, the present invention adopts the following technical scheme:
[0006] According to one aspect of the present invention, a method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot is provided, wherein the robot is used to operate a writing brush, and the method comprises the following steps:
[0007] (1) Scan the calligraphy image and perform image processing on specific characters;
[0008] (2) Determine the skeleton and pixel width of the font and extract the glyph outline based on the image processing data;
[0009] (3) Determine the position of the skeleton point based on the skeleton information, the skeleton point spacing and the pixel width;
[0010] (4) determining the brush stroke depth at each skeleton point according to the skeleton point position and the character outline information;
[0011] (5) According to the position of the skeleton point, the pen depth and the pen sequence input by human-computer interaction, the robot's movements are controlled and the three-stroke pen is operated to complete the writing of a single word.
[0012] According to one embodiment of the present invention, in step (1), the image is converted into an image of 512×512 size, the image is grayscaled, binarized, filtered and denoised, 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 graphic refined to obtain a refined font image with a font width of only one pixel, the skeleton of the font is determined, and the edge detection is performed on the generated font preprocessing image to extract the glyph outline.
[0014] According to one embodiment of the present invention, binary image processing is performed on the font to determine the target pixel point and eight pixel points in the surrounding 3X3 area, and the target pixel point is determined.
[0015] According to one embodiment of the present invention, the determination rule of whether to delete the target pixel is:
[0016] a) If the pixel value of the target pixel is 1, then the pixel is on the foreground font, not on the background;
[0017] b) If the pixel value of at least one of the four points above, below, left and right of the target pixel is 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 pixel value of 1, it means that the target pixel is the endpoint of the thin line; if the pixel values of the eight pixels are all 0, it means that the target pixel is an independent point; the points in these two cases cannot be deleted;
[0019] d) If the 8-connectivity number of the target pixel is 2, the point is a connection point; if it is 3, the point is a branch point; if it is 4, the point is an intersection point. These three types of points cannot be deleted;
[0020] e) Deletion and retention of surrounding points of the target pixel are determined.
[0021] According to one embodiment of the present invention, each pixel point 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 point is set as a point to be deleted. When a traversal cycle is completed, all marked points to be deleted are deleted. If there is no point to be deleted in a certain operation cycle, the refined skeleton of the font is obtained.
[0022] According to one embodiment of the present invention, the outer contour of the tip of the three-point pen can be simplified to an isosceles triangle, the height of the isosceles triangle is the brush stroke depth, and the width of the font strokes is the width of the brush tip.
[0023] According to an embodiment of the present invention, the pen movement depth and the handwriting width are in direct proportion.
[0024] According to an embodiment of the present invention, the pen movement depth is determined by the radius of the maximum inscribed circle of the pen tip relative to the outline of the character shape.
[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 writing depth, and determines the walking sequence according to the established writing order.
[0026] As can be seen from the above technical solutions, the advantages and positive effects of the method for realizing semi-autonomous calligraphy copying of the multi-degree-of-freedom calligraphy robot of the present invention are as follows:
[0027] In the present invention, the scanned processed image is used to determine the skeleton and pixel width and extract the glyph outline, then the positions of the skeleton points and the writing depth of each point are determined. According to these data, the robot is controlled to perform actions, imitating a person to write a Chinese brush calligraphy, and presenting it to the learner in the correct stroke writing order, helping the learner to conduct Chinese brush writing training, which has very high market value. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] By considering the following detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings, various objectives, features and advantages of the present invention will become more apparent. The drawings are only illustrative diagrams of the present invention and are not necessarily drawn to scale. In the drawings, the same reference numerals always represent the same or similar components. Among them:
[0029] Figure 1 is a schematic diagram of a binary image.
[0030] Figure 2 is a schematic diagram of a three-part pen structure.
[0031] Figure 3 is a schematic diagram of the coordinate axis relationship of the connecting rod parameters of the robotic arm established by using the M-DH modeling method.
[0032] Figure 4 is a schematic top view of the geometric relationship of the base coordinate system of the robotic arm in the XY plane.
[0033] Figure 5 is a schematic side view of the geometric relationship of the base coordinate system of the robotic arm in the XZ plane.
[0034] Figure 6-Figure 10 is a schematic diagram of the process of writing the character "yong" using the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] Now, the exemplary embodiments will be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the figures denote the same or similar structures, and thus their detailed descriptions will be omitted.
[0036] In the following description of different examples of the present invention, reference is made to the accompanying drawings, which form a part of the present invention and in which different exemplary structures, systems and steps that can implement multiple aspects of the present invention are shown by way of example. It should be understood that other specific schemes of components, structures, exemplary devices, systems and steps can be used, and structural and functional modifications can be made without departing from the scope of the present invention. Moreover, although the terms "top", "bottom", "front", "rear", "side", etc. may be used in this specification to describe different exemplary features and elements of the present invention, these terms are used herein only for convenience, such as according to the direction of the examples described in the accompanying 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 present invention.
[0037] According to one aspect of the present invention, a method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot is provided, wherein the robot is used to operate a writing brush, and the method comprises the following steps:
[0038] (1) Scan the calligraphy image and perform image processing on specific characters;
[0039] (2) Determine the skeleton and pixel width of the font and extract the glyph outline based on the image processing data;
[0040] (3) Determine the position of the skeleton point based on the skeleton information and pixel width;
[0041] (4) determining the three-stroke depth at each skeleton point according to the skeleton point position and the glyph outline information;
[0042] (5) According to the position of the skeleton point, the pen depth and the pen sequence input by human-computer interaction, the robot's movements are controlled and the three-stroke pen is operated to complete the writing of a single word.
[0043] According to one embodiment of the present invention, in step (1), the image is converted into an image of 512×512 size, the image is grayscaled, binarized, filtered and denoised, 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 graphic refined to obtain a refined font image with a font width of only one pixel, the skeleton of the font is determined, and the edge detection is performed on the generated font preprocessing image to extract the glyph outline.
[0045] According to one embodiment of the present invention, binary image processing is performed on the font to determine the target pixel point and eight pixel points in the surrounding 3X3 area, and the target pixel point is determined.
[0046] According to one embodiment of the present invention, the determination rule of whether to delete the target pixel is:
[0047] a) If the pixel value of the target pixel is 1, then the pixel is on the foreground font, not on the background;
[0048] b) If the pixel value of at least one of the four points above, below, left and right of the target pixel is 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 pixel value of 1, it means that the target pixel is the endpoint of the thin line; if the pixel values of the eight pixels are all 0, it means that the target pixel is an independent point; the points in these two cases cannot be deleted;
[0050] d) If the 8-connectivity number of the target pixel is 2, the point is a connection point; if it is 3, the point is a branch point; if it is 4, the point is an intersection point. These three types of points cannot be deleted;
[0051] e) Deletion and retention of surrounding points of the target pixel are determined.
[0052] According to one embodiment of the present invention, each pixel point 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 point is set as a point to be deleted. When a traversal cycle is completed, all marked points to be deleted are deleted. If there is no point to be deleted in a certain operation cycle, the refined skeleton of the font is obtained.
[0053] According to one embodiment of the present invention, the outer contour of the tip of the three-point pen can be simplified to an isosceles triangle, the height of the isosceles triangle is the brush stroke depth, and the width of the font strokes is the width of the brush tip.
[0054] According to an embodiment of the present invention, the pen movement depth and the handwriting width are in direct proportion.
[0055] According to an embodiment of the present invention, the pen movement depth is determined by the radius of the maximum inscribed circle of the pen tip relative to the outline of the character shape.
[0056] According to one 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 pen movement depth, and determines the walking order according to the established pen sequence.
[0057] It can be seen from the above technical solution that the advantages and positive effects of the method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot of the present invention are:
[0058] In the present invention, the image is scanned and processed to determine the skeleton and pixel width and extract the outline of the character shape, and then the position of the skeleton points and the pen depth of each point are determined. The robot is controlled to move according to these data to imitate people writing Chinese calligraphy, and the correct stroke writing order is displayed to learners, thereby helping learners to practice Chinese calligraphy writing, which has a very high market value.
[0059] The important processing nodes in the present invention are described below:
[0060] 1. Grayscale
[0061] The original calligraphy image is described by the three primary colors RGB. The original image can be converted into a grayscale image by weighted averaging the three primary colors R, G, and B. The formula is as follows:
[0062] Gray=0.299*R+0587*G+0.114*B
[0063] 2. Binarization
[0064] Binarization uses the OSTU threshold segmentation method. According to the gray value distribution characteristics of the image, the font part of the calligraphy image is stripped out and assigned a value of 255, and the background part 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 value of the inter-class variance can make the image binarization segmentation effect most significant.
[0065] For binary image A, the segmentation threshold of font and background is T, the proportion of the number of pixels occupied by the font part is p0, and the average grayscale is μ0; the proportion of the number of pixels occupied by the background part is p1, and the average grayscale is μ1. The average grayscale of the entire image is μ, and the inter-class variance is g.
[0066] Assuming that the size of the image is M×N, the number of pixels in the image whose grayscale value is less than the threshold T is recorded as N0, and the number of pixels whose grayscale value is greater than the threshold T is recorded as N1. The between-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 formulas, we get the between-class variance:
[0073] g=p0p1(μ0-μ1) 2
[0074] The T value is obtained by traversing all thresholds (1 to 254) to obtain the maximum inter-class variance, and the corresponding threshold T is taken to perform binary segmentation on the image to obtain the extraction result.
[0075] 3. Skeleton refinement algorithm
[0076] The application object of the font thinning algorithm is binary images. Its core idea is to traverse and judge all pixels of the binary image according to pre-set rules, delete the pixels that meet the rules (change the value of the pixel to the background pixel value) to achieve the purpose of thinning.
[0077] For a binary image, the background color is black (pixel value is 0), the foreground color is white (pixel value is 1), the current target pixel is P, and the eight pixels in the 3X3 area around P are P1~P8. The position relationship is as follows Figure 1 shown.
[0078] 4. The decision rule for whether to delete the target pixel P is:
[0079] 1) The pixel value of the target pixel point P is 1. That is, the point is a point on the foreground font, not a point on the background.
[0080] 2) Among the four points above, below, left and right of the target pixel point P (P1, P3, P5, P7), at least one point has a pixel value of 0. This means that point P is a point on the edge of the font in the foreground, and the points need to be deleted layer by layer from the edge of the font.
[0081] 3) Among points P1 to P8, two or more points have pixel values of 1. If only one point has a pixel value of 1, it indicates that point P is the endpoint of the thin line; if all points have pixel values of 0, it indicates that point P is an independent point. Points in these two cases cannot be deleted.
[0082] 4) Number of 8-connected links of the target pixel P if This point is a connection point. is the branch point, These three types of points cannot be deleted.
[0083] Number of connections Refers to the number of different areas connected to the pixel point P in the 3X3 neighborhood. The connectivity of pixels can be 4-connected or 8-connected. 8-connected means that the point P is connected in eight directions, namely, up, down, left, right, and diagonally. The calculation formula for the number of 8-connected connections is:
[0084]
[0085] If P3 and P5 are marked as pending deletion, then P3=0 and P5=0 are re-substituted into the calculation, and The value of is still 1. Since this algorithm judges each pixel of the binary image from left to right and from top to bottom one by one, when point P is judged, the four points P2, P3, P4, and P5 on its left and top have been judged to be marked, but their values have not changed, so they need to be assigned values manually to calculate the number of connections. Because this article uses the 8-connected connection number, deleting the two diagonal points P2 and P4 will not change the number of connections of point P, so here we only need to consider the two points P3 and P5 located on the axis of point P.
[0086] Each pixel of the binary image is judged one by one from left to right and from top to bottom according to the above five rules. If the above five conditions are met, the point is set as a point to be deleted. When a traversal cycle is completed, all marked points to be deleted are deleted. If there is no point to be deleted in a certain operation cycle, the program ends and the refined skeleton of the font is obtained.
[0087] 5. Extract the width of the inscribed circle
[0088] In the process of calligraphy robot writing, it actually uses the "three-point pen", that is, the tip of the brush, the outline of which can be simplified into an isosceles triangle, such as Figure 2 shown.
[0089] After actual measurement, the angle of the triangle vertex is approximately:
[0090]
[0091] The relationship between the height z and the base d of the isosceles triangle is calculated by trigonometric function relationship:
[0092]
[0093] The height z of the isosceles triangle in the formula is the depth of the brush stroke.
[0094] When calligraphy robots write, they usually use the center of the brush. The width of the strokes of the characters they write is the width d of the brush tip.
[0095] Through experiments, we obtained multiple sets of measurement results of pen depth and handwriting width, and found that within a certain range, the pen depth z and handwriting width d are approximately in direct proportion, that is,
[0096] z=k*d+b
[0097] The maximum inscribed circle method is used to obtain the maximum inscribed circle radius R corresponding to the trajectory point, which is approximately twice the width of the handwriting d, that is,
[0098] d=2R
[0099] The maximum inscribed circle method is used to obtain the maximum inscribed circle radius R corresponding to the trajectory point, and the Z-axis height of the trajectory point can be obtained.
[0100] 6. Robot forward kinematics analysis
[0101] The calligraphy copying system uses the Mirobt six-degree-of-freedom robotic arm as the carrier, and uses the M-DH modeling method to establish the connecting rod parameters of the robotic arm. The coordinate axis relationship is as follows: Figure 3 shown.
[0102] The DH parameters are shown in the following table.
[0103] i <![CDATA[α i-1 ]]> <![CDATA[a i-1 ]]> <![CDATA[d i ]]> <![CDATA[θ i ]]> 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 the robotic arm is to solve the position and posture in the coordinate system of the front end of the robotic arm or any rod of the robotic arm given the six joint angle values of the robotic arm. Its mathematical description is the homogeneous transformation matrix T.
[0105] Homogeneous transformation matrix of adjacent links in improved DH method The general formula is
[0106]
[0107] In the formula, represents the homogeneous transformation matrix of link coordinate system i relative to link coordinate system i-1, θ i Indicates the rotation angle in DH parameters, c represents cosine cos, s represents sine sin, a i-1 Indicates the rod length in DH parameters, b i represents the intercept in the DH parameter, α i-1 Represents the torsion angle in DH parameters.
[0108] According to the DH connecting rod parameters, the transformation matrix of each connecting rod 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 can obtain the homogeneous transformation matrix of the coordinate system n of the robot end effector relative to the fixed reference system 0.
[0116]
[0117] 7. Robot inverse kinematics analysis
[0118] The last three adjacent joint axes of the six-degree-of-freedom manipulator are perpendicular to each other and intersect at one point, satisfying the Pieper criterion. The manipulator must have a closed solution. Inverse kinematics analysis uses the geometric method to solve the first three joint angles, and then uses the inverse Euler angle transformation to solve the last three joint angles.
[0119] (1) Geometric method to solve θ1, θ2 and θ3
[0120] The posture of the end of the robot arm is determined by the angle of rotation of the wrist coordinate system around the base coordinate system according to the XYZ fixed axis, that is, the RPY angle. The end posture represented by the RPY angle is now represented by the rotation matrix R. The rotation around the XYZ fixed axis is represented by first rotating around the X axis by an angle of α, then rotating around the Y axis by an angle of β, and finally rotating around the Z axis by an angle of γ. Each rotation is around the axis of the fixed reference system, and the calculation method of the rotation matrix is:
[0121] R=R z R y R x
[0122] The calculation results are:
[0123]
[0124]
[0125]
[0126]
[0127] In the formula, R x , R y , R z Represents the rotation matrix around the X-axis, Y-axis and Z-axis respectively, R xyz Represents the rotation matrix obtained after rotating around the XYZ fixed axis.
[0128] Given the coordinates of the end effector working point in the base coordinate system as P(p x ,p y ,p z ), the coordinate of the wrist point in the base coordinate system is W(w x ,w y ,w z), the distance between the end and the wrist point is d6, and the posture matrix of the end effector working point is
[0129]
[0130] In the formula, the first column of the matrix X x , X y , X z They represent the direction cosines of the X-axis of the desired posture coordinate system e of the end effector and the X-axis, Y-axis, and Z-axis of the base coordinate system. According to the geometric relationship at the end of the robotic arm,
[0131] p x =w x +d6a x
[0132] p y =w y +d6a y
[0133] p z =w z +d6a z
[0134] The geometric method is used to solve the joint angle θ1:
[0135] θ1=atan2(w y ,w x )
[0136] in,
[0137] This method has multiple solutions, another solution is
[0138] θ 1′ =θ1+π
[0139] Once the joint rotates around the Z axis, the geometric relationship of the base coordinate system of the robot arm is as follows Figure 4 and Figure 5 In triangle ABC, the cosine definition gives
[0140] h 2 =a2 2 +L 2 -2a2Lcos(π-ξ)
[0141] in,
[0142]
[0143] cos(π-ξ)=-cosξ
[0144] In a right triangle,
[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] Among them, sinξ has two solutions, and the corresponding θ3 also has two solutions, denoted as θ3 and θ 3′ .
[0157] Solving for θ2, we can obtain from the geometric relationship:
[0158] θ2=Ω-λ
[0159] in,
[0160] Ω=atan2(S,V)
[0161] λ=atan2(Lsinξ,a2+L cosξ)
[0162] From the DH modeling method, we know that the direction of joint rotation is opposite to the solution direction, and a negative sign needs to be added before the result, that is,
[0163] θ2=-(Ω-λ)
[0164] Since the intermediate variable V has two solutions, the corresponding θ2 also has two solutions, denoted as θ2 and θ 2′ .
[0165] Use the geometric method to solve θ1, θ2, and θ3. There are eight sets of solutions for the first three axes.
[0166] (2) Analytical method to solve θ4, θ5 and θ6
[0167] When the last three joint angles are 0, the posture matrix of coordinate system 6 relative to coordinate system 3 is
[0168]
[0169] The posture of coordinate system 3 relative to base coordinate system 0 can be obtained from the forward kinematics of the robot arm:
[0170]
[0171] The relationship between the desired posture coordinate system e of the end effector and the base coordinate system 0 is:
[0172]
[0173] Available
[0174]
[0175] From the joint structure of the robot arm, it can be seen that 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 opposite directions; the axis of joint 5 coincides with the Z axis of coordinate system 6, but in the same direction; the axis of joint 6 coincides with the Z axis of coordinate system 6, but in the same direction. Therefore, the posture matrix When converted to ZYZ Euler angles, the rotation angles are the same, the direction of θ4 is 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 of the 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] Considering special solutions, when θ5 = 0 or 180°, the solutions of θ4 and θ6 degenerate, and only the sum or difference of the angles can be obtained. Select θ4 = 0.
[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] The following selects specific written characters for detailed description.
[0202] Such as Figures 6 to 10 shown, select calligraphy pictures. The following takes the regular script Chinese characters "Yong" and "Zheng" as examples.
[0203] Adjust the size of the Chinese character image to be copied, and convert the image into an image of 512×512 size.
[0204] Perform grayscale conversion, binarization, filtering and noise reduction on the image, and invert the image to obtain a preprocessed image of the font.
[0205] Thin the main part of the preprocessed font image to obtain a thinned font image with a width of only one pixel for the font, that is, the Chinese character skeleton.
[0206] Perform edge detection on the preprocessed font image generated in the third step to extract the glyph outline.
[0207] The refined font image obtained in step 4 is searched in depth first, that is, starting from the Chinese character skeleton point closest to the coordinate origin (0, 0), the skeleton points in eight directions around the point are recorded one by one and numbered, and the new skeleton points are searched again. When a bifurcation point is encountered, a depth-first search strategy is adopted to complete the recording of all skeleton points in the image one by one. During this period, every time N skeleton points are recorded, a skeleton point is marked as a character point, and a new blank image is written. After the skeleton point search is completed, a character point image can be generated. The character point image basically restores the refined font image, and each character point is separated by about N pixels.
[0208] The figure shows the character dot image when N is 5.
[0209] Add the dot image in step 6 to the glyph outline image in step 5, make the maximum inscribed circle about the glyph outline with the dot in the image as the center, and calculate the maximum inscribed circle radius of each dot.
[0210] Import the dot image in step 6 into the semi-autonomous interactive UI program, use the mouse to manually determine the approximate writing trajectory, and the interactive program records the nearest dot in order according to the real-time mouse contact position to obtain the corrected dot trajectory sequence. (Import the dot image into the UI interactive system, the system records the manually drawn blue trajectory in real time, and records the arrangement order of the dot along the real-time trajectory)
[0211] According to the key response of the UI interaction system, the number of strokes written and their sequence numbers can be determined and recorded.
[0212] Perform coordinate transformation on the character point obtained in step 8; establish the relationship between the maximum inscribed circle radius and the writing height Z according to the experimental data, and transform the Z coordinate of the character point trajectory.
[0213] The new coordinates obtained after the X, Y, and Z coordinates of the character point are transformed (scaling, translation, rotation, etc.) are the crossing points of the end effector of the robot arm, generating a G file that can be read by the robot arm.
[0214] Import G files to realize Chinese character writing.
[0215] Those skilled in the art should understand that the specific structures and processes shown in the above specific embodiments are only exemplary and not restrictive. Moreover, those skilled in the art can combine the various technical features shown above in various possible ways to form new technical solutions, or make other changes, which are all within the scope of the present invention.
Claims
1. A method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot, using a robot to operate a writing brush, characterized in that: The following steps are involved: (1) Scan the calligraphy image and perform image processing on specific characters; (2) Determine the skeleton and pixel width of the font and extract the glyph outline based on the image processing data; (3) Determine the position of the skeleton point based on the skeleton information, the skeleton point spacing and the pixel width; (4) determining the brush stroke depth at each skeleton point according to the skeleton point position and the character outline information; (5) According to the position of the skeleton point, the pen depth and the pen sequence input by human-computer interaction, the robot's movements are controlled and the three-stroke pen is operated to complete the writing of a single word.
2. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 1, characterized in that: In step (1), the image is converted into an image of 512×512 size, grayscaled, binarized, filtered and denoised, and the image is inverted to obtain a preprocessed image of the font.
3. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 2, characterized in that: In step (2), the main part of the font preprocessing image is graphic refined to obtain a refined font image with a font width of only one pixel, the skeleton of the font is determined, and the edge detection is performed on the generated font preprocessing image to extract the font outline.
4. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 1, characterized in that: In step (3), binary image processing is performed on the font to determine the target pixel point and eight pixel points in the surrounding 3×3 area, and the target pixel point is determined.
5. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 4, characterized in that: The decision rule for whether to delete the target pixel is: a) If the pixel value of the target pixel is 1, then the pixel is on the foreground font, not on the background; b) If the pixel value of at least one of the four points above, below, left, and right of the target pixel is 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 pixel value of 1, it means that the target pixel is the endpoint of the thin line; if the pixel values of the eight pixels are all 0, it means that the target pixel is an independent point; the points in these two cases cannot be deleted; d) If the 8-connectivity number of the target pixel is 2, the point is a connection point; if it is 3, the point is a branch point; if it is 4, the point is an intersection point. These three types of points cannot be deleted; e) Deletion and retention of surrounding points of the target pixel are determined.
6. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 5, characterized in that: 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 point is set as a point to be deleted. When a traversal cycle is completed, all marked points to be deleted are deleted. If there is no point to be deleted in a certain operation cycle, the refined skeleton of the font is obtained.
7. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 1, characterized in that: The outline of the tip of the three-point pen can be simplified into an isosceles triangle. The height of the isosceles triangle is the brush stroke depth, and the width of the font strokes is the width of the brush tip.
8. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 7, characterized in that: The depth of the pen and the width of the handwriting are directly proportional.
9. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as claimed in claim 8, characterized in that: The pen depth is determined by the radius of the largest inscribed circle of the pen tip relative to the character outline.
10. The method for implementing semi-autonomous calligraphy copying by a multi-degree-of-freedom calligraphy robot as described in any one of claims 1 to 9, characterized in that: The robot is operated to determine the walking direction according to the skeleton points, to adjust the height position relative to the writing surface according to the pen movement depth, and to determine the walking order according to the established pen sequence.
Citation Information
Patent Citations
Method and device for drawing electronic handwriting
CN102999931A
Method of writing process dynamic reproduction of Chinese character calligraphy works, capable of simulating gesture style
CN104821005A
Robot handwriting method and system
CN109746916A
Mechanical arm calligraphy writing system and method based on boundaries and force feedback
CN110271016A
Hand-writing copying method and device for robot, and robot
CN111152234A