1. Introduction
Computer creativity is a growing topic of research, which involves several interdisciplinary investigations, including studies in computer science, philosophy, music, and fine arts [
1]. The success of artificial intelligence (AI) in visual arts became exceptionally prominent due to commercially available examples of AI-powered programs capable of creating realistic images [
2]. In fields of visual art such as Chinese calligraphy, AI successfully passes an artistic version of the Turing test [
3]. In addition to solving the challenges of generating artistic-looking images, some efforts are aimed at adapting the performance of traditional physical artistic techniques to robotic systems, which is supported by the rapid development of the related fields in robotics, such as sensor design for collision detection [
4], positioning using data fusion [
5], target location, and active maneuvering in an unknown environment [
6]. These advances resulted in new industrial standards such as collaborative robots and new software libraries for solving different problems faced by robots in the real world. General advances in machine vision, distance and contact sensors, etc. provide a solid basis for specific branches of robotics such as artistically skilled robots. Various tasks are faced by developers of the latter systems from modifying paints and tools for better usability by robots to creating new mathematical models and control algorithms. During the last decade, a significant amount of studies have been dedicated to solving these problems, including creating machines for acrylic painting by brush and palette knife [
7,
8,
9,
10,
11,
12], watercolor brush painting [
13], spray painting [
14,
15], etc.
The majority of artistic robots use a round brush as a painting tool. The artistic brush consists of bristles clamped to a handle with a metal ferrule. Bristles comprise a flexible tuft which allows collecting a certain amount of paint and softly applying it to a canvas. The round brush is the most versatile variant of a brush and is the simplest to use in artistic robotic painting because of its symmetry in any direction. The width of the brushstroke painted by a round brush depends on the pressure applied to a brush, which in turn depends on the distance of the robot brush-holding mechanism to the canvas. The compliance of brush bristles causes some problems in the robot path planning, since the brush contact patch lags from the robot tool center position (TCP) during its motion. This produces a disparity between the TCP trajectory and the actual shape of the brushstroke. The precise robot control system should include a finely tuned brush model reproducing these features of the brush with a high level of fidelity.
Some works on artistic robots propose using special short-bristle brush designs with no need for elaborate modeling and calibration [
7,
16], but their expression capabilities are much lower than those obtained by a common brush. The other works propose different approaches to taking brush compliance into account. Early attempts to create artistic brush models refer to the 1990s, among which an example of a physically-based model can be found in a work [
17] considering compliance of the brush bristles and its influence on the brushstroke shape. Later, a model of a conic Chinese brush with a straight center line was described in a work [
18]. A more complicated 3D model of a brush exploiting the energy minimization principle in its shape adjustment was described in another work [
19].
The previously mentioned works were not aimed at modeling a particular real brush. The situation changed when interest in robotic painting and calligraphy led to the need for more accurate brush simulation [
20].
One of the early examples of brush calibration for a calligraphy robot was given in [
21]. The more complicated approach to brush modeling was proposed in [
22], which utilizes a regressing model of a brush lag depending on the brushstroke width and the trajectory curvature estimated in a set of experiments. Another empirically correct model was proposed in [
23], where difference equations of the brush dynamics were introduced, the coefficients of which were found on a calibration phase. Nevertheless, only a few words were said about the method of brush calibration and its theoretical justification. A notable question for creating a data-driven brush footprint model was considered in a work [
24], and a feedback-based approach based on an internal model control for a calligraphy robot was described in [
25]. One of the most detailed models of a brush was described in [
26]. The brush footprint trajectory in this work was modeled by a simple difference equation, but no closed-form solutions for the brush footprint coordinates were given.
Even though the majority of artistically skilled robots use a brush as a painting tool, and many works are dedicated to this topic, the question of creating a physically correct brush model and developing a simple and robust method for adjusting its parameters is still open. Forces acting at a brush contact patch were still not considered, nor was there any theoretical description of a brushstroke curvature induced only by bristles compliance. Moreover, there is still a question regarding how to calibrate a brush, since each research proposes different experiments requiring various equipment and different measurements.
So, the current work fills this gap. We propose a new physically motivated model of a brush contact patch movement relative to a brush handle trajectory. Then, we prove several theorems on a brush contact patch trajectory. After that, we propose an experimental setup and a detailed description of a calibration method allowing us to obtain an empirically correct model for use in robotic painting and calligraphy systems. The obtained model is verified in three tests, including measuring the coordinates of an angular brushstroke center line, simulating an angular brushstroke, and writing a signature using a robot.
The significance of the correct brush model in robotic visual art is undoubted, since it allows solving the robot’s path-planning problem and implementing brushstrokes properly as they were designed by simulation, thus avoiding the number of failures in art processes which does not assume correction such as calligraphy or watercolor, and decreasing the number of iterations in a feedback-guided painting process with acrylic or oil paints.
The paper is organized as follows. In
Section 2, an introduction to the physics of a painting brush is given. Equations of motion of a brush contact patch and a brush tip are given in the form of differential equations and their closed-from solutions. All results are presented in theorems, and their corollaries are supplied with proofs. In
Section 3, the results are presented. Three calibration methods were investigated, resulting in two models with different reliability.
Section 4 summarizes the recommended brush model calibration method. In
Section 5, brief conclusions are given.
2. Materials and Methods
Let us describe the painting brush by introducing the following formalism. Suppose that a brush is mounted on a robot and always moves orthogonal to a canvas plane. Suppose also that the brush stiffness is high relative to the friction force between the brush and the canvas, which is often true for synthetic and bristle brushes used in acrylic and oil painting. Therefore, each bristle can be modeled as an elastic beam with clearly defined boundary conditions. The following lemma ensures that under these assumptions, the solution of the bristle equation solution is unique.
Lemma 1. Let the bristle be modeled as the static Euler–Bernoulli beamwhere is the bristle deflection in the direction of the brush longitudinal direction x, is the bristle flexural rigidity, and is a distributed load. The bristle Equation (
1)
has the unique solution . Proof. Let us determine four boundary conditions for Equation (
1). Considering the normalized variable
with no loss of generality, the boundary conditions at the bristle root (the beam clamped end) are
, and
. The bristle tip is a sliding beam end with the corresponding initial conditions
,
.
Figure 1 illustrates our proposals. The existence and uniqueness of the generalized solution of the Euler–Bernoulli beam once four boundary conditions are known was proven in a work [
27], and special cases of unique solutions are given in several papers, e.g., [
28,
29]. □
Let us consider an example. The paper [
30] proposes exponential decay in the elastic modulus of the brush, leading to a complicated linear–exponential solution for
. Simplifying equations for the flexural rigidity, we adopt
and
. The Equation (
1) would read as shown below:
which has the following solution:
where
are constants determined by boundary conditions.
Let the robot move within relatively slow speeds, such as 25 mm/s, so the bristle inertia does not affect the brush contact patch shape, and bristles are always bent properly, as shown in
Figure 2a. First, we determined the shape of the brush contact patch as the shape of the envelope of all fragments of bristles contacting with a canvas. This envelope is defined exactly by the longitudinal and transverse positions of bristles. From Lemma 1, we know that the longitudinal position of a single bristle is uniquely defined by
z. By the energy minimization principle allowing only one optimal relative position of the bristles in a bunch [
19], the longitudinal and transverse positions of the bristles would also be uniquely defined. During brush turns, different bristles acquire and lose contact with the canvas, but if the round brush is not worn, the envelope will preserve its shape for the given value of
z due to the rotational symmetry of the brush. A short video demonstrating the effect of the brush contact patch shape immutability during rotation can be found at the link [
31]. For a particular value of
z, the dynamic of a contact patch is defined by a lag
r between a center of forces applied to a contact patch and a projection of a brush handle on a canvas plane. To locate the contact patch position relative to the center of forces, a gap
b from the brush tip to the center of the forces should be also known; see
Figure 2a.
2.1. Equation of Brush Movement with Normal Geometry
Denote
an angle of the brush foot median line relative to the direction of the robot movement and the lag
r between a center of forces applied to a brush contact patch and a brush handle axis. In
Figure 2b, schematic drawings are given explaining the geometry of a brush foot movement. Let us consider a general case: when
z changes during movement,
r also changes and should be considered as a function of
s.
Theorem 1. The equations of motion for the brush center of forces are shown below:where α is an angle between vector pointing to the center of forces and the direction of the brush root movement , is the brush root displacement, and r is the lag of the brush contact patch depending on s. Equation (4) has the following closed-form solution: Proof of Theorem 1. Let us consider a local coordinate system, in which a projection of a brush handle onto the canvas plane moves along the
x-axis. A brush contact patch is pulled by a leverage of length
r from the handle axis to the center of a friction force
. The center of the force follows a trajectory
T. The friction force is split into projections on coordinate axes
and
. When the robot TCP moves along the
x-axis and travels a distance
s, an angle between the brush footprint centerline and the
x-axis changes from
to
. The forces make the following work:
where
and
are displacements between the center of forces
and the robot TCP projection onto the canvas
, which are calculated from trigonometrical considerations as
and
The work of the force
is negative, since the direction of movement is opposite to its direction. Suppose that the sum is zero considering that no energy is obtained or lost, i.e.,
. From
Figure 2b, one may see that
where
s in (
9) is the robot TCP displacement along the
x-axis. Therefore, the force in Equation (
8) can be rewritten as follows:
After division by
, it can be simplified to
Considering an infinitesimally small translation
, writing this equation in terms of differentials, and taking into account that
, the equation reads as shown below:
where, eventually, we obtain a differential equation describing the behavior of the angle
as follows:
Consider the solution of (
10). Let us move the terms of the equation between its sides so that there are terms with
on the left and terms with
s on the right and integrate the following:
The left side of the equation has the exact solution
while the right side of the equation depends on the function
. Let us introduce a new variable
in the right side of the equation and change
to simply
to exclude subscripts:
which immediately leads to (
7). □
The equations of motion for the brush represent a system of differential–algebraic equations, and once an initial angle
and initial and final positions of the robot
and
are known, it is easy to calculate the robot position in a global coordinate system. Let the translation vector
have coordinates
. Then, the angle of rotation for translation between the local and global coordinate systems is determined by the pair
from where the coordinates of a new position for the center of forces
are found as
where
is a result of a cross-product
. This term is needed to verify the actual brush direction of the turn. If the brush moves from bottom to top as shown in
Figure 2b, then
, and if the brush moves from top to bottom in a mirrored manner with respect to
Figure 2b,
.
The next theorem is dedicated to the equation for the angle
, shown in
Figure 2b, in a special case
.
Theorem 2. The angle β between the direction of the robot TCP movement and a line of the brush tip displacement depends on and the value of displacement as follows: Proof of Theorem 2. The brush tip located at a distance
b from the center of force along the brush foot centerline changes its coordinates as follows:
For simpler notation, denote
. In terms of differentials, (
12) reads as
Applying again the Taylor expansion for the trigonometric functions, the latter equation simplifies to
The actual coordinates of the brush tip may be found via integration:
where
are the coordinates of the initial brush tip position. Substituting the value of
from (
10), we finally obtain
The angle
between the
x-axis and a line connecting an initial brush tip position with the actual brush tip position is determined by the following equation:
Substituting (
13) and (14) into the latter equation, we obtain the following:
which immediately leads to (
11). □
Figure 3 illustrates the solution of the brush dynamic Equation (
7) for
, (5) and (6) for the brush center of forces, and
for the brush tip. The parameter values are
and the initial values
, and
. The red line in
Figure 3a is the trajectory of the brushstroke center line, the blue line is the trajectory of a brush tip, and a thick black line shows the trajectory of the robot TCP.
In
Figure 3b, the line for
starts from the value denoted by a vertical dashed line located at
, where
is the discretization step.
2.2. Brush Movement with Loose Tension
If the brush changes its direction of movement by the angle greater than
, or when it touches the canvas with a too steep angle, a situation depicted in
Figure 4a occurs: the actual distance between the center of forces of the brush contact patch to the brush axis
is less than the radius
r inherent to the brush under the normal conditions for a particular value of
z. Practically, this means that the bristle bunch loses tension and bends due to compressive forces. Nevertheless, due to the uniqueness of the Euler–Bernoulli equation solution and energy minimization principle, the brush would still possess a uniquely defined geometry, and the brush tip would still be pointing in the direction opposite to the brush root exactly as shown in
Figure 4a.
This allows for simple treatment of this case. After calculating the distance between the new robot TCP and the brush contact patch center of reassure
, one should compare it with
inherent to the brush under normal conditions, as shown in
Figure 4b. If
, then the model (
4) is valid, and new
,
x and
y, as well as
and
, are calculated as described earlier. Otherwise,
x and
y remain the same, and a new
is chosen so that it is the angle of a straight line connecting the TCP and the center of forces of the brush contact patch. The brush contact patch is then rotated according to this angle, and new
and
values are calculated.
2.3. Executable Model of a Painting Brush
A realistic brush model calibrated as described before can be used in a variety of scenarios. One of the simplest is simulating the brushstroke behavior for a given brush root trajectory. Let the trajectory consist of straight segments. The current segment connects two points
and
, where
. The previous segment is denoted as
, and the current segment is denoted as
. The angle between these two segments can be determined from a formula for the scalar product:
For the first segment,
. The actual angle of rotation of a brush footprint with respect to the canvas coordinate system
is calculated by
where
atan2 is a function that returns an angle of a planar vector in a full range
. From a brush footprint library, two images of footprints
and
closest to the
z values in
and
are chosen.
The segment
is parameterized by a variable
. In each point
of the segment,
is calculated as a linear interpolation, from which
and
are estimated. A distance
between the current point
and
is compared to
, and if
, where
is a small regularization value, typically,
, then the new angle
is calculated as the angle of a straight line between
and
. The values
and
are found by simply rotating by the angle
around the point on a plane with coordinates
and
. Otherwise, the angle
is calculated by the formula (
7), and
and
are found in a local coordinate system by the formulas (
15) and (16). Then, the coordinates of a brush are translated into a global coordinate system.
A special procedure
Ic = MergeAndRotate(I1, I2, c, theta) was used for merging images of brushstrokes in a proportion
c and rotating it by the angle
, where
z is an actual
z-position of the robot TCP. For the normal brush geometry,
, and
I1 and
I2 are brush footprints corresponding to TCP heights
and
, but if
, then
, and
I1 is the brush footprint obtained when the brush touches the canvas vertically for the particular value of
z. A synthetic image of the current shape of a brush footprint
is depicted on a canvas. As a result, a whole segment of a brushstroke appears.
Figure 5 illustrates the flowchart of the described process.
In a feedback-guided painting process with a robot, intermediate steps of path planning and trajectory optimization can be added [
10,
16].
2.4. Finding Brush Parameters from Calibration Brushstrokes
One of the most versatile methods for brush parameter estimation is painting a set of calibration brushstrokes of different shapes. Some examples of methods for designing calibration brushstroke sets can be found in the literature [
10,
22,
32].
For different values of the brush root height above the canvas
z, we propose painting brushstrokes of two types. The first type is a straight brushstroke, and the second type is an angular brushstroke employing a situation when the robot TCP changes its direction of movement by 90 degrees. Examples of such strokes are depicted in
Figure 6.
Let us start from
Figure 6b, which shows an angular stroke
. By design, we know a distance
L, at which the robot TCP turns by 90 degrees, and therefore, we can visually detect a point where the stroke starts turning and measure a distance between this point and a line of subsequent movement, which equals
r. Having measured
r at various TCP
z values, we can find an approximate function
. An auxiliary horizontal stroke
shown in the bottom of the panel is needed to accurately measure
L in a real experimental environment, since the point when the brushstroke starts in an unreliable reference: its position is highly affected by a canvas relief, robot calibration, amount of paint remaining at the brush tip, etc.
Figure 6a shows a straight brushstroke
needed to find the parameter
b. To the left of the brushstroke, a trajectory of the robot TCP is shown. The point
is the point where the robot stops lowering the brush and goes further at one height. Due to the lag between the robot TCP and the brush contact patch, the distance
D between the brushstroke starting point and the point where it stops expansion is less than
. The exact position of this point depends on a distance
w between the brush footprint tip and the widest point of the footprint; see
Figure 6c. One can measure the distance
D and estimate the parameter
b using Equation (
17):
Of course, the parameter w is also a function of z, and this function should be preliminarily estimated. As for the brush footprints, a way to capture them is by taking a photo on the reverse side of a matte glass, as we will describe further.
2.5. Direct Way to Measure
A distance d from the brush root to the brush tip can be observed directly. This distance equals the sum of the required brush parameters and is useful for estimating b more accurately than using the other ways described before.
A brush slowly lowering while sweeping the canvas can be captured by a video camera, as shown in
Figure 7. Providing a scale and correcting possible lens aberration to achieve high linearity of the image, one can obtain a dataset on directly observed values of
for different
z.
In video frames, one should measure the positions of a certain ferrule point
and positions of the brush tip
. Then, from these data, one determines the constants
,
, and calibrates the distances
and vertical positions
as follows:
Once the function
is known, brush radii are easily found, and a dataset for
b is obtained via a simple relation
2.6. Finding Brush Parameters from Angles
Previous subsections propose reliable yet still indirect ways to measure r and b separately. Alas, these parameters cannot be measured directly because the position of the center of forces is unknown, and only moving the brush along a trajectory can reveal the brush dynamics. Nevertheless, angles and can be measured, and a series of these measurements may be used for another type of indirect estimation of r and b.
Theorem 3. Suppose we have a set of measurements , and , . To find r, introduce a function Having computed this function in all pairs , we can find r via least squares:where + stands for the pseudo-inverse of a matrix and ⊤ stands for the vector transpose. Proof. Integrating this equation with a constant value of
r, we obtain the following:
This equation has the following analytic solution:
Substituting the function
from (
19), we obtain a simple relation
so
r is easily found via least squares using Equation (
20). □
Having estimated r, we can now find b.
Theorem 4. Suppose we have a set of measurements , and , , and r is also already estimated. Denote So, we can find an auxiliary variable μ via the LSM:and eventually estimate b as follows Proof. Once a series of angles
and thus a series
are available, rewrite Equation (
11) in the following manner, taking into account the notation (
21):
where
. Therefore,
Denoting
, the latter is used for estimating
via the LSM using Formula (
22) and then finding
b using formula (
23). □
Thus, both unknown parameters r and b can found from experimental data containing angles , and displacements .
4. Discussion: Recommended Calibration Algorithm
First, brush footprints should be obtained for different values of
z using the setup shown in
Figure 8a. The matte glass can be purchased in a glass shop or manufactured manually, for example, by sanding an acrylic glass. The brush tip should be wet, and the length of the wet region of the bristles should correspond to the amount of paint that is intended to be used in a real painting process. For example, in our experiment, the brush was tipped into the paint by 7 mm, so the footprint’s maximal height was 7 mm.
Second, a set of angular calibration brushstrokes as shown in
Figure 6b should be painted with different values of
z to obtain a reliable estimation of the brush parameter
r and its dependency on
z, which is described as a polynomial like (
25).
Third, the parameter
b should be estimated. The best result can be obtained using video footage as shown in
Figure 7. The value of
b is obtained using the Formula (
18). A simpler but less accurate result is achieved from straight calibration strokes as shown in
Figure 6a. Using the polynomial approximation, a function (
24) should be estimated describing how the distance between the brush tip and the thickest part of a brush footprint depends on
z. Then, the Formula (
17) is used to obtain values of
b. For further use, a smooth dependency of values of
b on
z should be obtained in the form of a linear law (
23).
Using angles and for calibration is more error-prone, but in some cases, it is also useful for estimating parameters r and b.
The described brush calibration process contains several manual operations in the experimental result processing, which can be automated. For example, determining the parameter
r from the angular brushstroke can be performed with an algorithm consisting of the following stages. First, the stroke skeleton can be found by a simple deterministic algorithm such as that described in the work [
34]; then, the point of maximum skeleton deflection can be found using the Hough transform. From the
y coordinate of this point,
r is found as follows:
, where
is the maximal robot TCP
y coordinate while drawing the angular brushstroke.