CN111152234A - Calligraphy copying method and device for robot and robot - Google Patents

Calligraphy copying method and device for robot and robot Download PDF

Info

Publication number
CN111152234A
CN111152234A CN201911380411.7A CN201911380411A CN111152234A CN 111152234 A CN111152234 A CN 111152234A CN 201911380411 A CN201911380411 A CN 201911380411A CN 111152234 A CN111152234 A CN 111152234A
Authority
CN
China
Prior art keywords
similarity
stroke
mechanical arm
strokes
skeleton
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911380411.7A
Other languages
Chinese (zh)
Inventor
刘培超
邢淑敏
郎需林
刘主福
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yuejiang Technology Co Ltd
Original Assignee
Shenzhen Yuejiang Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yuejiang Technology Co Ltd filed Critical Shenzhen Yuejiang Technology Co Ltd
Priority to CN201911380411.7A priority Critical patent/CN111152234A/en
Publication of CN111152234A publication Critical patent/CN111152234A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J11/00Manipulators not otherwise provided for
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1602Programme controls characterised by the control system, structure, architecture
    • B25J9/161Hardware, e.g. neural networks, fuzzy logic, interfaces, processor
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B25HAND TOOLS; PORTABLE POWER-DRIVEN TOOLS; MANIPULATORS
    • B25JMANIPULATORS; CHAMBERS PROVIDED WITH MANIPULATION DEVICES
    • B25J9/00Programme-controlled manipulators
    • B25J9/16Programme controls
    • B25J9/1656Programme controls characterised by programming, planning systems for manipulators
    • B25J9/1664Programme controls characterised by programming, planning systems for manipulators characterised by motion, path, trajectory planning

Landscapes

  • Engineering & Computer Science (AREA)
  • Robotics (AREA)
  • Mechanical Engineering (AREA)
  • Automation & Control Theory (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a calligraphy copying method and device for a robot and the robot. The method comprises the following steps: obtaining style characteristic description parameters of the Chinese character to be copied from the reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and ending points of strokes, average width of the strokes, coordinates of skeleton points and stroke width at the skeleton points, inclination angles of the strokes and skeleton lengths of the strokes; determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters; determining the joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using the inverse kinematics solution of the robot; and controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform. The method quantifies the characteristics of the Chinese characters to be copied through the style characteristic description parameters, and improves the accuracy and similarity of the robot copying calligraphy.

Description

Calligraphy copying method and device for robot and robot
Technical Field
The invention relates to the technical field of robot motion control and trajectory planning, in particular to a calligraphy copying method and device for a robot and the robot.
Background
Chinese calligraphy has a long history for thousands of years, is a cultural treasure of Chinese nationality, and is a precious wealth of civilization of human beings. The importance of the inheritance and development of the calligraphy as one of the most Chinese-featured traditional cultures is self-evident. However, because the styles of calligraphy are various and the writing process is varied, people usually spend years practicing to reach a better writing level.
With the rapid development of science and technology, robots can simulate human beings to perform various complex tasks. In particular, in recent years, with the advent of a cooperative robot arm having a smaller size and higher operation accuracy, the robot arm has been tried to be applied to the field of calligraphy reproduction and teaching, and for example, the robot arm can be used for teaching demonstration for a calligraphy beginner, and human resources can be released to some extent. However, when the existing robot is used for calligraphy copying, the reduction degree and the accuracy of the style of the original calligraphy font cannot achieve the ideal effect. Therefore, there is a need for an improved method of calligraphy copying for robots.
Disclosure of Invention
The embodiment of the invention provides a calligraphy copying method and device for a robot and the robot.
In a first aspect, an embodiment of the present invention provides a calligraphy copying method for a robot, including:
obtaining style characteristic description parameters of the Chinese character to be copied from the reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and ending points of strokes, average width of the strokes, coordinates of skeleton points and stroke width at the skeleton points, inclination angles of the strokes and skeleton lengths of the strokes;
determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters;
determining the joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using the inverse kinematics solution of the robot;
and controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform.
In one embodiment, the obtaining style characteristic description parameters of the Chinese character to be copied from the reference image comprises:
denoising and binarizing the reference image;
extracting skeleton lines of the Chinese characters to be copied;
determining the stroke sequence of the Chinese character to be copied according to the extracted skeleton line;
the coordinates of skeleton points included in each stroke and the stroke width at the skeleton points are determined.
In one embodiment, the determining the three-dimensional motion trajectory control parameter when the mechanical arm moves according to the style characteristic description parameter comprises:
determining XY plane track coordinates when the mechanical arm moves according to the coordinates of the skeleton points;
and determining the Z-axis coordinate of the mechanical arm during movement according to the stroke width at the skeleton point.
In one embodiment, the method further comprises:
determining the similarity between the actual written image and the reference image according to the following formula:
S=k1I+k2B+k3E;k1+k2+k3=1;
wherein I represents gradient similarity for measuring the similarity degree of the inclination angles of the strokes in the actual written image and the reference image, and k1A weight representing the similarity of the gradients; b represents the similarity of the balance degree, which is used for measuring the similarity degree of the relative size between the strokes in the fonts in the actual written image and the reference image, and k2A weight representing similarity of the degrees of balance; e represents the similarity of writing force and is used for measuring strokes in the actual written image and the reference imageDegree of similarity of widths, k3A weight representing the similarity of writing strengths; s represents the similarity of the actual written image and the reference image.
In one embodiment, the slope similarity is determined according to the following formula:
Figure BDA0002342091540000021
wherein I represents the gradient similarity, N represents the total stroke number, InRepresents the gradient similarity, theta ', of the nth stroke'nRepresenting the tilt angle, θ, of the nth stroke in the reference imagenRepresenting the tilt angle of the nth stroke in the actual written image.
In one embodiment, the similarity of the degrees of balance is determined according to the following formula:
Figure BDA0002342091540000022
where B represents the similarity of the degree of balance, N represents the total number of strokes, BnRepresenting balance similarity, l 'of the nth stroke'nRepresenting the skeleton length, l, of the nth stroke in the reference imagenRepresenting the skeleton length of the nth stroke in the actual writing image.
In one embodiment, the writing force similarity is determined according to the following formula:
Figure BDA0002342091540000031
wherein E represents writing force similarity, N represents total stroke number, EnRepresenting writing force similarity, D 'of the nth stroke'nRepresenting the variance of the width of the nth stroke in the reference image and the average width of the nth stroke in the reference image, DnRepresenting the variance of the width of the nth stroke in the actual written image and the average width of the nth stroke in the actual written image.
In one embodiment, the method further comprises: and if the similarity does not meet the preset requirement, adjusting the style characteristic description parameters according to the similarity until the similarity meets the preset requirement.
In a second aspect, an embodiment of the present invention provides a calligraphy copying apparatus, including:
the style characteristic extraction module is used for acquiring style characteristic description parameters of the Chinese character to be copied from the reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and end points of strokes, average width of the strokes, coordinates of skeleton points, stroke width at the skeleton points, inclination angles of the strokes and skeleton length of the strokes;
the determining module is used for determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters;
the processing module is used for determining a joint value of the mechanical arm according to the three-dimensional motion track control parameters by utilizing the inverse kinematics solution of the robot;
and the motion control module is used for controlling the mechanical arm to move according to the determined joint value of the mechanical arm and driving the writing tool clamped by the mechanical arm to write on the writing platform.
In a third aspect, an embodiment of the present invention provides a robot, including: a base, a robotic arm, at least one processor, and a memory;
the memory stores computer-executable instructions;
the at least one processor executes the memory-stored computer-executable instructions to cause the at least one processor to perform the method for calligraphy copying for a robot as set forth in any one of the first aspects.
In a fourth aspect, the embodiment of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the method for copying calligraphy for a robot according to any one of the first aspect is implemented.
The calligraphy copying method, the calligraphy copying device and the robot for the robot, provided by the embodiment of the invention, have the advantages that style characteristic description parameters of Chinese characters to be copied are obtained from a reference image, and the style characteristic description parameters comprise the total number of strokes, the stroke sequence, the starting point and the ending point of the strokes, the average width of the strokes, the coordinates of skeleton points, the stroke width of the skeleton points, the inclination angle of the strokes and part or all of the skeleton length of the strokes; determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters; determining the joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using the inverse kinematics solution of the robot; and controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform. The method quantifies the characteristics of the Chinese characters to be copied through the style characteristic description parameters, and improves the accuracy and similarity of the robot copying calligraphy.
Drawings
FIG. 1 is a diagram illustrating a layout of a writing environment according to one embodiment;
FIG. 2 is a flowchart of a calligraphy copying method for a robot according to an embodiment;
3A-3C are schematic diagrams of a reference image and an actual writing image provided in accordance with an embodiment;
fig. 4 is a flowchart of a calligraphy copying method for a robot according to yet another embodiment;
fig. 5 is a schematic structural diagram of a calligraphy copying apparatus according to an embodiment;
fig. 6 is a schematic structural diagram of a robot according to an embodiment.
Detailed Description
The present invention will be described in further detail with reference to the following detailed description and accompanying drawings. Wherein like elements in different embodiments are numbered with like associated elements. In the following description, numerous details are set forth in order to provide a better understanding of the present application. However, those skilled in the art will readily recognize that some of the features may be omitted or replaced with other elements, materials, methods in different instances. In some instances, certain operations related to the present application have not been shown or described in detail in order to avoid obscuring the core of the present application from excessive description, and it is not necessary for those skilled in the art to describe these operations in detail, so that they may be fully understood from the description in the specification and the general knowledge in the art.
Furthermore, the features, operations, or characteristics described in the specification may be combined in any suitable manner to form various embodiments. Also, the various steps or actions in the method descriptions may be transposed or transposed in order, as will be apparent to one of ordinary skill in the art. Thus, the various sequences in the specification and drawings are for the purpose of describing certain embodiments only and are not intended to imply a required sequence unless otherwise indicated where such sequence must be followed.
The numbering of the components as such, e.g., "first", "second", etc., is used herein only to distinguish the objects as described, and does not have any sequential or technical meaning. The term "connected" and "coupled" when used in this application, unless otherwise indicated, includes both direct and indirect connections (couplings).
FIG. 1 is a diagram illustrating a layout of a writing environment according to an embodiment. As shown in fig. 1, a base 20 of the robot is placed on a horizontally disposed table, a robot arm 10 of the robot is mounted on the base 20, a writing tool 30 is held at a distal end of the robot arm 10, and a writing platform 40 is disposed below the writing tool 30. The writing instrument 30 is carried by the movement of the mechanical arm 10 to write on the writing platform 40. The writing tool 30 shown in the drawings is a writing brush, and may be a pencil, a pen, or the like. The robotic arm 10 employed in an alternative embodiment may include a large arm and a small arm, with four degrees of freedom, capable of controlling the movement of the writing instrument 30 along axis X, Y, Z as well as the rotation along the Z-axis. Wherein the large arm is 135mm long, and the rotation angle is 0-85 degrees; the small arm is 147mm long and the rotation angle is-10 to +90 degrees; the rotation angle of the base 20 is-90 to +90 degrees. The motion modes of the robot arm 10 may include jog mode, point position mode (PTP), and ARC motion mode (ARC). PTP and ARC may be collectively referred to as a point-of-presence reproduction motion pattern. The JUMP mode in PTP may be used to JUMP the end position of each stroke to the start position of the next stroke when writing. The robot arm 10 may also be communicatively connected to other devices through a communication interface, for example, a PC may be connected through a USB interface, a network server may be connected through a wireless communication module, and the like.
Fig. 2 is a flowchart of a calligraphy copying method for a robot according to an embodiment. As shown in fig. 2, the calligraphy copying method for a robot provided by this embodiment may include:
s101, style characteristic description parameters of the Chinese character to be copied are obtained from the reference image, and the style characteristic description parameters comprise part or all of the total stroke number, the stroke sequence, the starting point and the ending point of the strokes, the average width of the strokes, the coordinates of the skeleton points, the stroke width at the skeleton points, the inclination angle of the strokes and the skeleton length of the strokes.
In the embodiment, the Chinese character to be copied takes the image as a carrier, so that the characteristics of the Chinese character to be copied can be extracted by carrying out image processing on the reference image. Chinese characters are composed of strokes in a certain sequence, and the strokes are composed of points in an image, so that the characteristics of the Chinese characters can be quantified through the characteristics of the strokes and the characteristics of the points.
In an alternative embodiment, the obtaining style characteristic description parameters of the chinese character to be copied from the reference image may specifically include: denoising and binarizing the reference image; extracting skeleton lines of the Chinese characters to be copied; determining the stroke sequence of the Chinese character to be copied according to the extracted skeleton line; the coordinates of skeleton points included in each stroke and the stroke width at the skeleton points are determined.
For example, a gaussian smoothing filtering method may be used to perform denoising processing on the reference image, specifically, a 5 × 5 template may be used to perform weighted average on the reference image, and the weighted average gray value in the field is used to replace the pixel value in the center of the template to weaken gaussian noise. After denoising the reference image, binarization processing may be performed on the reference image by using an OSTU algorithm. Optionally, after the binarization processing is performed on the reference image, image normalization, including position normalization and size normalization, may also be performed on the reference image. The Chinese character skeleton line is a group of curve sets which pass through the stroke center and are consistent with the connectivity and topological structure distribution of the original Chinese character. The extraction of the skeleton line is also called image thinning, for example, a Zhang thinning algorithm can be adopted to extract the skeleton line of the Chinese character to be copied from the reference image after the binarization processing. After the skeleton line of the Chinese character to be copied is determined, the strokes and the stroke sequence of the Chinese character to be copied can be determined according to the requirements of the topological structure of the Chinese character. The stroke skeleton line can select skeleton points according to the rule of uniform interval of the points, for example, one skeleton point is selected every 3 pixel points, and then the coordinate of each skeleton point and the stroke width of each skeleton point are determined.
The style characteristic description parameters in this embodiment may include a total number of strokes, a stroke order, a start point and an end point of a stroke, an average width of a stroke, coordinates of skeleton points, a stroke width at a skeleton point, an inclination angle of a stroke, and a skeleton length of a stroke, and may be selected as needed. The style characterization parameters may be expressed, for example, as:
Figure BDA0002342091540000061
Figure BDA0002342091540000062
Figure BDA0002342091540000063
wherein M isnRepresenting the characteristic set of the nth stroke in the Chinese character to be copied, N representing the total number of strokes in the Chinese character to be copied, pnA feature set representing all skeleton points of the nth stroke,
Figure BDA0002342091540000064
coordinates of an mth skeleton point representing an nth stroke,
Figure BDA0002342091540000065
the width of the stroke at the mth skeleton point representing the nth strokeDegree, sn、enRespectively representing the starting point and the end point of the skeleton of the nth stroke, lnIndicates the skeleton length, θ, of the nth strokenIndicates the tilt angle of the nth stroke,
Figure BDA0002342091540000066
representing the average width of the nth stroke.
And S102, determining three-dimensional motion track control parameters during the motion of the mechanical arm according to the style characteristic description parameters.
Strokes, skeleton points and the like described by the style characteristic description parameters are all the characteristics of Chinese characters to be copied in a two-dimensional plane (XY plane) in a reference image, and the mechanical arm moves in a three-dimensional space, so after the style characteristic description parameters of the Chinese characters to be copied are obtained, the style characteristic description parameters are firstly required to be converted into three-dimensional motion track control parameters when the mechanical arm moves.
In an optional implementation manner, the determining the three-dimensional motion trajectory control parameter when the mechanical arm moves according to the style characteristic description parameter may specifically include: determining XY plane track coordinates when the mechanical arm moves according to the coordinates of the skeleton points; and determining the Z-axis coordinate of the mechanical arm during movement according to the stroke width at the skeleton point.
For a mechanical arm moving in a three-dimensional space, the track of an XY plane corresponds to the moving track of strokes of Chinese characters, and the track of a Z axis corresponds to the thickness of the strokes of the Chinese characters. Therefore, the coordinates of each framework point can be converted into the track coordinates of the mechanical arm on the XY plane, and specifically can be the track coordinates of the XY plane when a writing tool clamped by the mechanical arm writes on the writing platform; and converting the width information of each skeleton point into a Z-axis coordinate when the mechanical arm moves, and controlling the pen moving depth when the writing tool clamped by the mechanical arm writes on the writing platform.
And S103, determining the joint value of the mechanical arm according to the three-dimensional motion track control parameters by using the inverse kinematics of the robot.
The kinematics of the robot comprises forward kinematics and reverse kinematics, wherein the forward kinematics is that each joint variable of the robot is given, and the position posture of the tail end of the robot is calculated; and (3) calculating all joint variables of the corresponding position of the robot by using inverse kinematics, namely the position and the attitude of the known robot tail end.
In this embodiment, after the three-dimensional motion trajectory control parameter during the motion of the mechanical arm is determined, that is, after the position and posture of the tail end of the robot is determined, the joint value of the mechanical arm is determined according to the three-dimensional motion trajectory control parameter by using the inverse solution of the kinematics of the robot.
It should be noted that the kinematic equations established are different for different configurations of the robotic arm. In this embodiment, a kinematic equation may be established according to a structure of a specifically applied mechanical arm, and then an inverse solution of the kinematic equation is solved according to the three-dimensional motion trajectory control parameter, so as to obtain a joint value of the mechanical arm.
And S104, controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform.
After the joint value of the mechanical arm is determined, the mechanical arm can be controlled to move according to the determined joint value, the writing tool clamped by the mechanical arm is driven to write on the writing platform, and copying of characters to be copied in the reference image is completed.
The method provided by the embodiment comprises the steps of obtaining style characteristic description parameters of a Chinese character to be copied from a reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and ending points of strokes, average width of the strokes, coordinates of skeleton points, stroke width of the skeleton points, inclination angles of the strokes and skeleton lengths of the strokes; determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters; determining the joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using the inverse kinematics solution of the robot; and controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform. The method quantifies the characteristics of the Chinese characters to be copied through the style characteristic description parameters, and improves the accuracy and similarity of the robot copying calligraphy.
The calligraphy copying pursues the restoration of the style of the original calligraphy font, at present, the copying effect is mainly evaluated manually, and the influence of subjective factors cannot be avoided.
In order to objectively evaluate the similarity between the copy font and the original font, on the basis of the above embodiment, the embodiment of the present invention performs a quantitative analysis on the copy effect through a quantization index, and the method provided in this embodiment may further include: and measuring the similarity between the actual written image and the reference image according to three quantitative indexes of the gradient similarity, the balance similarity and the writing strength similarity. Wherein, the gradient similarity is used for measuring the similarity degree of the inclination angles of the strokes in the actual writing image and the reference image; the similarity of the balance degree is used for measuring the similarity degree of the relative size between the strokes in the fonts in the actual written image and the reference image; the writing force similarity is used for measuring the similarity degree of the stroke width in the actual written image and the reference image.
In an alternative embodiment, the similarity between the actual written image and the reference image may be determined according to the following formula:
S=k1I+k2B+k3E;k1+k2+k3=1;
wherein I represents the gradient similarity, k1A weight representing the similarity of the gradients; b represents similarity of degree of balance, k2A weight representing similarity of the degrees of balance; e denotes writing force similarity, k3A weight representing the similarity of writing strengths; s represents the similarity of the actual written image and the reference image. The similarity is in a value range of 0-1, and the larger the value is, the closer the actual written image is to the reference image is.
The inclination similarity, the balance similarity and the writing strength similarity respectively carry out quantitative analysis on the copying effect in the aspects of the inclination angle of the strokes, the relative size of the strokes and the width of the strokes. In specific implementation, specific implementation manners may be defined as needed:
the similarity of slopes may be determined, for example, according to the following formula:
Figure BDA0002342091540000081
wherein I represents the gradient similarity, N represents the total stroke number, InRepresents the gradient similarity, theta ', of the nth stroke'nRepresenting the tilt angle, θ, of the nth stroke in the reference imagenRepresenting the tilt angle of the nth stroke in the actual written image.
The value range of the gradient similarity is 0-1, and when the gradients of the actually written Chinese character strokes and the reference strokes are closer, the gradient similarity index is closer to 1.
The similarity of the degrees of balance may be determined, for example, according to the following formula:
Figure BDA0002342091540000082
where B represents the similarity of the degree of balance, N represents the total number of strokes, BnRepresenting balance similarity, l 'of the nth stroke'nRepresenting the skeleton length, l, of the nth stroke in the reference imagenRepresenting the skeleton length of the nth stroke in the actual writing image.
The value range of the similarity of the balance degree is 0-1, and when the balance degree of the actually written Chinese character strokes and the reference strokes is closer, the similarity index of the balance degree is closer to 1.
Since the pressure on the writing instrument is constantly changing while the writer is writing, and this change in pressure expresses the writer's authoring style to some extent, the writing strength can be expressed by the variance of the stroke width at the skeleton point from the average stroke width:
Figure BDA0002342091540000091
wherein D isnThe writing strength of the nth stroke is represented;
Figure BDA0002342091540000092
representing the width of the stroke at the mth skeleton point of the nth stroke; lnRepresenting the skeleton length of the nth stroke;
Figure BDA0002342091540000093
representing the average width of the nth stroke.
The writing power similarity can be determined, for example, according to the following formula:
Figure BDA0002342091540000094
wherein E represents writing force similarity, N represents total stroke number, EnRepresenting writing force similarity, D 'of the nth stroke'nRepresenting the writing power of the nth stroke in the reference image, DnRepresenting the writing strength of the nth stroke in the actual writing image.
How to determine the similarity between the actual written image and the reference image is explained in detail by a specific example. Because the permanent character comprises eight basic strokes (point, horizontal, vertical, hook, lifting, left falling, short left falling and right falling) in Chinese calligraphy Chinese characters and is a very representative character, the permanent character is copied by the copying method described in the embodiment of the method, and the copying effect is evaluated by the quantitative indexes.
TABLE 1
Figure BDA0002342091540000095
Fig. 3A-3C are schematic diagrams of a reference image and an actual writing image according to an embodiment. Wherein, FIG. 3A shows the stroke sequence of the "permanent" word in Chinese calligraphy; FIG. 3B is a reference image; fig. 3C is an actual writing image obtained by copying the image of fig. 3B by using the above copying method. Table 1 shows the quantitative indicators of the copy effect of fig. 3B and 3C. The unit of the inclination angle is radian, and the length of the stroke skeleton is the number of skeleton points included by the stroke.
From table 1, it can be determined that the similarity between the "permanent" word to be copied in the reference image shown in fig. 3B and the "permanent" word in the actual written image shown in fig. 3C is:
Figure BDA0002342091540000101
as shown in table 1, fig. 3B, and fig. 3C, in the calligraphy copying method for a robot according to the embodiment of the present invention, three quantitative indicators, namely, gradient similarity, balance similarity, and writing strength similarity, for copying are substantially all 0.9 or so, and the similarity between an actual written image and a reference image is also 0.9 or more, so that an ideal effect is obtained on the reduction degree and accuracy of the calligraphy font style.
Based on the above embodiment, the method provided by this embodiment further performs quantitative analysis on the copying effect from three aspects of the inclination angle of the stroke, the relative size of the stroke, and the width of the stroke respectively through the gradient similarity, the balance similarity, and the writing strength similarity, thereby achieving the objective evaluation of the similarity between the actual writing image and the reference image.
After the similarity between the actual written image and the reference image is determined, the three-dimensional motion trajectory control parameter during the motion of the mechanical arm can be adjusted according to the similarity, so that the reduction degree of the calligraphy font is further improved.
Fig. 4 is a flowchart of a calligraphy copying method for a robot according to yet another embodiment. As shown in fig. 4, the method may include:
s101, style characteristic description parameters of the Chinese character to be copied are obtained from the reference image, and the style characteristic description parameters comprise part or all of the total stroke number, the stroke sequence, the starting point and the ending point of the strokes, the average width of the strokes, the coordinates of the skeleton points, the stroke width at the skeleton points, the inclination angle of the strokes and the skeleton length of the strokes.
For a specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
And S102, determining three-dimensional motion track control parameters during the motion of the mechanical arm according to the style characteristic description parameters.
For a specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
And S103, determining the joint value of the mechanical arm according to the three-dimensional motion track control parameters by using the inverse kinematics of the robot.
For a specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
And S104, controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform.
For a specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
And S105, determining the similarity between the actual written image and the reference image according to the gradient similarity, the balance similarity and the writing strength similarity.
For a specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
And S106, judging whether the similarity meets the preset requirement or not. If the similarity does not meet the preset requirement, executing step S107; and if the similarity meets the preset requirement, ending the process.
In this embodiment, a similarity threshold that needs to be satisfied may be preset according to a requirement for a copy effect. For example, the similarity threshold may be set to 0.9, and the process is ended when the similarity between the actual written image and the reference image is greater than or equal to 0.9; when the similarity between the actual written image and the reference image is less than 0.9, the step S107 is continuously executed to adjust the control parameters.
And S107, adjusting style characteristic description parameters according to the similarity.
When the similarity does not meet the preset requirement, the style feature description parameter is adjusted according to the similarity, which may include: adjusting the inclination angle of the strokes according to the inclination similarity; adjusting the skeleton length of the strokes according to the similarity of the balance degrees; and adjusting the stroke width according to the similarity of the writing strength. Taking the adjustment of the stroke width according to the writing strength similarity as an example, the stroke width with the largest writing strength similarity can be iteratively solved by adopting a Gradient Descent (Gradient) algorithm, for example. And then determining three-dimensional motion trajectory control parameters during the motion of the mechanical arm according to the adjusted style characteristic description parameters, determining a joint value of the mechanical arm by using inverse kinematics of the robot, and then controlling the motion of the mechanical arm according to the determined joint value of the mechanical arm to drive a writing tool clamped by the mechanical arm to write on the writing platform. The process is repeatedly executed until the similarity meets the preset requirement.
According to the method provided by the embodiment, the style characteristic description parameters are adjusted according to the similarity until the similarity meets the preset requirement, so that the accuracy and the similarity of the robot copying calligraphy are further improved.
Fig. 5 is a schematic structural diagram of a calligraphy copying apparatus according to an embodiment. As shown in fig. 5, the calligraphy copying apparatus 50 provided in this embodiment may include:
the style feature extraction module 501 is configured to obtain style feature description parameters of the to-be-copied Chinese character from the reference image, where the style feature description parameters include part or all of the total number of strokes, the sequence of the strokes, the starting and ending points of the strokes, the average width of the strokes, the coordinates of the skeleton points, the stroke width at the skeleton points, the inclination angle of the strokes, and the skeleton length of the strokes;
a determining module 502, configured to determine a three-dimensional motion trajectory control parameter when the mechanical arm moves according to the style characteristic description parameter;
the processing module 503 is configured to determine a joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using a robot kinematics inverse solution;
and a motion control module 504, configured to control the mechanical arm to move according to the determined joint value of the mechanical arm, so as to drive the writing tool held by the mechanical arm to write on the writing platform.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 2, and the implementation principle and the technical effect are similar, which are not described herein again.
Optionally, the style feature extraction module 501 is configured to obtain style feature description parameters of the chinese character to be copied from the reference image, and specifically may include:
denoising and binarizing the reference image;
extracting skeleton lines of the Chinese characters to be copied;
determining the stroke sequence of the Chinese character to be copied according to the extracted skeleton line;
the coordinates of skeleton points included in each stroke and the stroke width at the skeleton points are determined.
Optionally, the determining module 502 is configured to determine the three-dimensional motion trajectory control parameter when the mechanical arm moves according to the style characteristic description parameter, and specifically may include:
determining XY plane track coordinates when the mechanical arm moves according to the coordinates of the skeleton points;
and determining the Z-axis coordinate of the mechanical arm during movement according to the stroke width at the skeleton point.
Optionally, the calligraphy copying apparatus 50 may further include a measurement module (not shown in the figure) for determining the similarity between the actual writing image and the reference image according to the following formula:
S=k1I+k2B+k3E;k1+k2+k3=1;
wherein I represents gradient similarity for measuring the similarity degree of the inclination angles of the strokes in the actual written image and the reference image, and k1A weight representing the similarity of the gradients; b represents the similarity of the balance degree, which is used for measuring the similarity degree of the relative size between the strokes in the fonts in the actual written image and the reference image, and k2A weight representing similarity of the degrees of balance; e represents the similarity of writing force and is used for measuring the similarity of stroke widths in an actual written image and a reference image, k3A weight representing the similarity of writing strengths; s represents the similarity of the actual written image and the reference image.
Optionally, the metric module may be specifically configured to determine the inclination similarity according to the following formula:
Figure BDA0002342091540000121
wherein I represents the gradient similarity, N represents the total stroke number, InRepresents the gradient similarity, theta ', of the nth stroke'nIn the representation reference imageAngle of inclination, theta, of the nth strokenRepresenting the tilt angle of the nth stroke in the actual written image.
Optionally, the measurement module may be specifically configured to determine the similarity of the degrees of balance according to the following formula:
Figure BDA0002342091540000131
where B represents the similarity of the degree of balance, N represents the total number of strokes, BnRepresenting balance similarity, l 'of the nth stroke'nRepresenting the skeleton length, l, of the nth stroke in the reference imagenRepresenting the skeleton length of the nth stroke in the actual writing image.
Optionally, the measurement module may be specifically configured to determine the similarity of writing strengths according to the following formula:
Figure BDA0002342091540000132
wherein E represents writing force similarity, N represents total stroke number, EnRepresenting writing force similarity, D 'of the nth stroke'nRepresenting the variance of the width of the nth stroke in the reference image and the average width of the nth stroke in the reference image, DnRepresenting the variance of the width of the nth stroke in the actual written image and the average width of the nth stroke in the actual written image.
Optionally, the measurement module may be further configured to adjust the style feature description parameter according to the similarity if the similarity does not meet the preset requirement until the similarity meets the preset requirement.
Fig. 6 shows a robot, which is only illustrated in fig. 6, and the embodiment of the present invention is not limited thereto. Fig. 6 is a schematic structural diagram of a robot according to an embodiment. As shown in fig. 6, the robot 60 provided in the present embodiment may include: memory 601, at least one processor 602, a bus 603, a robot arm 604, and a base 605. The robot 604 is mounted on a base 605, and the bus 603 is used for communication between the components.
The memory 601 is used for storing computer execution instructions; the at least one processor 602 is configured to execute computer-executable instructions stored in the memory 601, so that the at least one processor 602 can execute the method for copying calligraphy for a robot according to any of the above method embodiments.
It should be understood that the processor 602 may be a Central Processing Unit (CPU), other general-purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
The memory 601 may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one magnetic disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, and the like.
The bus 603 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The present embodiment is not limited to the specific shape and structure of the robot arm 604 and the base 605.
The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, can implement the calligraphy copying method for a robot provided in any of the above method embodiments. The computer-readable storage medium in this embodiment may be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that is integrated with one or more available media, and the available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., SSDs), etc.
Reference is made herein to various exemplary embodiments. However, those skilled in the art will recognize that changes and modifications may be made to the exemplary embodiments without departing from the scope hereof. For example, the various operational steps, as well as the components used to perform the operational steps, may be implemented in differing ways depending upon the particular application or consideration of any number of cost functions associated with operation of the system (e.g., one or more steps may be deleted, modified or incorporated into other steps).
Additionally, as will be appreciated by one skilled in the art, the principles herein may be reflected in a computer program product on a computer readable storage medium, which is pre-loaded with computer readable program code. Any tangible, non-transitory computer-readable storage medium may be used, including magnetic storage devices (hard disks, floppy disks, etc.), optical storage devices (CD-ROMs, DVDs, Blu Ray disks, etc.), flash memory, and/or the like. These computer program instructions may be loaded onto a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions which execute on the computer or other programmable data processing apparatus create means for implementing the functions specified. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including means for implementing the function specified. The computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified.
While the principles herein have been illustrated in various embodiments, many modifications of structure, arrangement, proportions, elements, materials, and components particularly adapted to specific environments and operative requirements may be employed without departing from the principles and scope of the present disclosure. The above modifications and other changes or modifications are intended to be included within the scope of this document.
The foregoing detailed description has been described with reference to various embodiments. However, one skilled in the art will recognize that various modifications and changes may be made without departing from the scope of the present disclosure. Accordingly, the disclosure is to be considered in an illustrative and not a restrictive sense, and all such modifications are intended to be included within the scope thereof. Also, advantages, other advantages, and solutions to problems have been described above with regard to various embodiments. However, the benefits, advantages, solutions to problems, and any element(s) that may cause any element(s) to occur or become more pronounced are not to be construed as a critical, required, or essential feature or element of any or all the claims. As used herein, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, system, article, or apparatus. Furthermore, the term "coupled," and any other variation thereof, as used herein, refers to a physical connection, an electrical connection, a magnetic connection, an optical connection, a communicative connection, a functional connection, and/or any other connection.
The present invention has been described in terms of specific examples, which are provided to aid understanding of the invention and are not intended to be limiting. For a person skilled in the art to which the invention pertains, several simple deductions, modifications or substitutions may be made according to the idea of the invention.

Claims (11)

1. A calligraphy copying method for a robot, comprising:
obtaining style characteristic description parameters of the Chinese character to be copied from a reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and ending points of strokes, average width of the strokes, coordinates of skeleton points and stroke width of the skeleton points, inclination angles of the strokes and skeleton lengths of the strokes;
determining three-dimensional motion trajectory control parameters when the mechanical arm moves according to the style characteristic description parameters;
determining the joint value of the mechanical arm according to the three-dimensional motion trajectory control parameter by using the inverse kinematics solution of the robot;
and controlling the mechanical arm to move according to the determined joint value of the mechanical arm, and driving the writing tool clamped by the mechanical arm to write on the writing platform.
2. The method of claim 1, wherein the obtaining style characterization parameters of the chinese character to be copied from the reference image comprises:
denoising and binarizing the reference image;
extracting skeleton lines of the Chinese characters to be copied;
determining the stroke sequence of the Chinese character to be copied according to the extracted skeleton line;
the coordinates of skeleton points included in each stroke and the stroke width at the skeleton points are determined.
3. The method of claim 1, wherein the determining three-dimensional motion trajectory control parameters of the mechanical arm in motion according to the style characterization parameters comprises:
determining XY plane track coordinates when the mechanical arm moves according to the coordinates of the skeleton points;
and determining the Z-axis coordinate of the mechanical arm during movement according to the stroke width at the skeleton point.
4. The method of any one of claims 1-3, further comprising:
determining the similarity between the actual written image and the reference image according to the following formula:
S=k1I+k2B+k3E;k1+k2+k3=1;
wherein I represents gradient similarity for measuring the similarity degree of the inclination angles of the strokes in the actual written image and the reference image, and k1A weight representing the similarity of the gradients; b represents the similarity of the balance degree, which is used for measuring the similarity degree of the relative size between the strokes in the fonts in the actual written image and the reference image, and k2A weight representing similarity of the degrees of balance; e represents the similarity of writing force and is used for measuring the similarity of stroke widths in an actual written image and a reference image, k3A weight representing the similarity of writing strengths; s represents the similarity of the actual written image and the reference image.
5. The method of claim 4, wherein the slope similarity is determined according to the following formula:
Figure FDA0002342091530000021
wherein I represents the gradient similarity, N represents the total stroke number, InRepresents the gradient similarity, theta ', of the nth stroke'nRepresenting the tilt angle, θ, of the nth stroke in the reference imagenRepresenting the tilt angle of the nth stroke in the actual written image.
6. The method of claim 4, wherein the similarity of equilibrium is determined according to the following formula:
Figure FDA0002342091530000022
where B represents the similarity of the degree of balance, N represents the total number of strokes, BnRepresenting balance similarity, l 'of the nth stroke'nRepresenting the skeleton length, l, of the nth stroke in the reference imagenRepresenting the skeleton length of the nth stroke in the actual writing image.
7. The method of claim 4, wherein the writing force similarity is determined according to the following formula:
Figure FDA0002342091530000023
wherein E represents writing force similarity, N represents total stroke number, EnRepresenting writing force similarity, D 'of the nth stroke'nRepresenting the variance of the width of the nth stroke in the reference image and the average width of the nth stroke in the reference image, DnRepresenting the variance of the width of the nth stroke in the actual written image and the average width of the nth stroke in the actual written image.
8. The method of claim 4, wherein the method further comprises:
and if the similarity does not meet the preset requirement, adjusting the style characteristic description parameters according to the similarity until the similarity meets the preset requirement.
9. A handwriting copying apparatus comprising:
the style characteristic extraction module is used for acquiring style characteristic description parameters of the Chinese character to be copied from the reference image, wherein the style characteristic description parameters comprise part or all of the total stroke number, stroke sequence, starting points and end points of strokes, average width of the strokes, coordinates of skeleton points, stroke width at the skeleton points, inclination angles of the strokes and skeleton length of the strokes;
the determining module is used for determining three-dimensional motion track control parameters when the mechanical arm moves according to the style characteristic description parameters;
the processing module is used for determining a joint value of the mechanical arm according to the three-dimensional motion track control parameter by utilizing the inverse kinematics solution of the robot;
and the motion control module is used for controlling the mechanical arm to move according to the determined joint value of the mechanical arm and driving the writing tool clamped by the mechanical arm to write on the writing platform.
10. A robot, comprising: a base, a robotic arm, at least one processor, and a memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the method for calligraphy copying for robots of any of claims 1-8.
11. A computer-readable storage medium having stored thereon computer-executable instructions for implementing the method for robot handwriting copying according to any of claims 1-8, when executed by a processor.
CN201911380411.7A 2019-12-27 2019-12-27 Calligraphy copying method and device for robot and robot Pending CN111152234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911380411.7A CN111152234A (en) 2019-12-27 2019-12-27 Calligraphy copying method and device for robot and robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911380411.7A CN111152234A (en) 2019-12-27 2019-12-27 Calligraphy copying method and device for robot and robot

Publications (1)

Publication Number Publication Date
CN111152234A true CN111152234A (en) 2020-05-15

Family

ID=70558694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911380411.7A Pending CN111152234A (en) 2019-12-27 2019-12-27 Calligraphy copying method and device for robot and robot

Country Status (1)

Country Link
CN (1) CN111152234A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111833669A (en) * 2020-07-13 2020-10-27 孙学峰 Chinese calligraphy pen teaching system and teaching method
CN112248006A (en) * 2020-10-29 2021-01-22 哈工大机器人湖州国际创新研究院 Writing control method for mechanical arm writing brush
CN113927582A (en) * 2021-06-30 2022-01-14 深圳市越疆科技有限公司 Robot system, method, robot arm, and storage medium for configuring copy function

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006231461A (en) * 2005-02-24 2006-09-07 Bandai Co Ltd Drawing robot and its controlling method, and control program
CN106409063A (en) * 2016-12-16 2017-02-15 北京奇虎科技有限公司 Robot painting teaching method and device and robot
CN109664300A (en) * 2019-01-09 2019-04-23 湘潭大学 A kind of windy lattice calligraphic copying method of robot for feeling study based on power
WO2019192149A1 (en) * 2018-04-04 2019-10-10 南京阿凡达机器人科技有限公司 Machine-vision-based drawing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006231461A (en) * 2005-02-24 2006-09-07 Bandai Co Ltd Drawing robot and its controlling method, and control program
CN106409063A (en) * 2016-12-16 2017-02-15 北京奇虎科技有限公司 Robot painting teaching method and device and robot
WO2019192149A1 (en) * 2018-04-04 2019-10-10 南京阿凡达机器人科技有限公司 Machine-vision-based drawing method and system
CN109664300A (en) * 2019-01-09 2019-04-23 湘潭大学 A kind of windy lattice calligraphic copying method of robot for feeling study based on power

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张晓光, 西安电子科技大学出版社 *
田小林: "光学相干层析图像处理及应用", 西安电子科技大学出版社, pages: 48 - 50 *
邢淑敏: "基于风格迁移的机器人书法临摹技术研究", 《对比文件1("基于风格迁移的机器人书法临摹技术研究",邢淑敏,中国优秀硕士学位论文全文数据库哲学与人文科学辑,2019年第06期,第F088-56页)公开了》, 30 June 2019 (2019-06-30), pages 2 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111833669A (en) * 2020-07-13 2020-10-27 孙学峰 Chinese calligraphy pen teaching system and teaching method
CN112248006A (en) * 2020-10-29 2021-01-22 哈工大机器人湖州国际创新研究院 Writing control method for mechanical arm writing brush
CN113927582A (en) * 2021-06-30 2022-01-14 深圳市越疆科技有限公司 Robot system, method, robot arm, and storage medium for configuring copy function

Similar Documents

Publication Publication Date Title
JP6941198B2 (en) Gesture recognition methods, gesture recognition devices, electronic devices, and storage media
CN111152234A (en) Calligraphy copying method and device for robot and robot
CN107428004B (en) Automatic collection and tagging of object data
JP7071054B2 (en) Information processing equipment, information processing methods and programs
CN104345948B (en) A kind of implementation method of original handwriting, realize device and electronic equipment
CN105205462A (en) Shooting promoting method and device
KR20180096590A (en) System and method for guiding handwriting diagram input
EP2608108A1 (en) Face feature vector construction
EP3555736B1 (en) System and method for management of handwritten diagram connectors
CN109658481B (en) Image labeling method and device, and feature map generation method and device
US11087517B2 (en) Sketch-based abstraction for character posing and synthesis
CN110069129B (en) Determination system and determination method
US20170109579A1 (en) System and method for recognition of handwritten diagram connectors
CN109746916A (en) A kind of method and system of machine person writing calligraphy
JP2010506320A (en) Projection apparatus and projection method for projecting a two-dimensional motif onto a complex surface of a three-dimensional object
US10573033B2 (en) Selective editing of brushstrokes in a digital graphical image based on direction
CN104951811B (en) Row style line recognition methods and device applied to brush writing
US11383386B2 (en) Robotic drawing
KR20200059465A (en) Method and apparatus for controlling a drawing robot based on image
CN109934896B (en) Drawing method and device, terminal equipment and computer readable storage medium
CN109676583B (en) Deep learning visual acquisition method based on target posture, learning system and storage medium
CN115035566B (en) Expression recognition method, apparatus, computer device and computer readable storage medium
CN111178019A (en) Robot character writing method, device and system based on voice control
TW201248456A (en) Identifying contacts and contact attributes in touch sensor data using spatial and temporal features
CN107025211B (en) Copy ruler suspension control method and device for font analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200515