26
Intelligent Chinese Calligraphy Beautification from Handwritten Characters for Robotic Writing Xinyue ZHANG a , Yuanhao LI a , Zhiyi ZHANG a , Kouichi KONNO b , Shaojun Hu a a Northwest A&F University, China b Iwate University, Japan June, 2019 Calgary, Canada

Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Intelligent Chinese Calligraphy Beautification

from Handwritten Characters for Robotic Writing

Xinyue ZHANGa , Yuanhao LIa , Zhiyi ZHANGa , Kouichi KONNOb , Shaojun Hua

a Northwest A&F University, China b Iwate University, Japan

June, 2019

Calgary, Canada

Page 2: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Chinese calligraphy artworks

How to do for common people ?

Page 3: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

(a)

(b)

(c)

➢ Studies based on conversion from user’s handwritten characters

to digital calligraphy [Zhang et al. 2010], [Yi et al. 2014], [Li et al. 2012]

Related work

Digital ink

Page 4: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Overview

(d) Extract

parameters

lij

wij

θij

(e) Calligraphy

database

(f) Corresponding

stroke

(h) Write by robotic arm(g) Optimized character

(a) Chinese

handwriting (b) Extract strokes

13

7

co

nv

po

olin

g

co

nv

po

olin

g

...

Fu

ll-co

nnet

(c) Recognize with CNN

Part 1:Handwritten character

Part 2:Calligraphy strokes

Part 3:Beautification Part 4: Robotic writing

Page 5: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

1. Handwriting input and recognition

(d) Extract

parameters

lij

wij

θij

(e) Calligraphy

database

(f) Corresponding

stroke

(h) Write by robotic arm(g) Optimized character

(a) Chinese

handwriting (b) Extract strokes

13

7

co

nv

po

olin

g

co

nv

po

olin

g

...

Fu

ll-co

nnet

(c) Recognize with CNN

Part 1:Handwritten character

Page 6: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Obtain handwritten character & strokes

→ extract stroke coordinates directly from a user interface. It’s

easy to record the stroke coordinates and sequences.

➢ Input: mouse or touch pad

➢ Extraction:

(a) Input from a touch pad. (b) writing interface

(a) (b)

Page 7: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Stroke recognition with CNN

➢ Convolutional neural networks

(CNN)for handwritten characters

[Gupta et al. 2011], [Syamlan et al. 2015],

[Xiao et al. 2017]

Input

48×48

C1

(6×46×46)

S2

(6×23×23)

C3

(12×22×22)

S4

(12×11×11)

Convolution Subsampling

C5

(12×10×10)

Convolution Subsampling Fully-connect

3×3

Convolution Subsampling

S6

(12×5×5)

20 strokes

Output

F7

2×2 2×2 2×2 2×2 2×2

Heng

Shu

Pie

Na

➢ Our average recognition

rate reaches 93%.

Page 8: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

2. Calligraphy stroke database establishment

(d) Extract

parameters

lij

wij

θij

(e) Calligraphy

database

(f) Corresponding

stroke

(h) Write by robotic arm(g) Optimized character

(a) Chinese

handwriting (b) Extract strokes

13

7

co

nv

po

olin

g

co

nv

po

olin

g

...

Fu

ll-co

nnet

(c) Recognize with CNN

Part 2:Calligraphy strokes

Page 9: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Stroke parameterization

➢ Extract the skeleton of standard calligraphy stroke

➢ Build the parameter model for each stroke

Tian’s book — The Elaboration of Ancient and Modern Famous Kai Calligraphy

l — length

θ — angle

w — width

Rigid segment (red area) - contains the important features of regular-style calligraphy

Flexible segment (green area) - the transition segment between the rigid segments

(lij , θi

j , wij )

Page 10: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Problem & Approach

➢ Relationship between w (stroke width) & h (desent

of brush)

w = ah + b

h = horig- hrest

least-squares fitting

Page 11: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Standard stroke database

(a) Tian’s 20 Original standard strokes; (b) robot-written strokes

(a) (b)

Page 12: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

3. Calligraphy beautification and writing

(d) Extract

parameters

lij

wij

θij

(e) Calligraphy

database

(f) Corresponding

stroke

(h) Write by robotic arm(g) Optimized character

(a) Chinese

handwriting (b) Extract strokes

13

7

co

nv

po

olin

g

co

nv

po

olin

g

...

Fu

ll-co

nnet

(c) Recognize with CNN

Part 3:Beautification

Page 13: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Global optimization of the target strokes

➢ goal 1: make the target stroke be close to the user's handwriting.

→ Minimize a weighted Euclidean distance

between the handwriting and generated

points.

(a) original handwriting (b) skeleton of

standard calligraphy (c) skeleton of target stroke

)()(),( ii

T

i

ii

i

ii vwvwvwvwF −−=−=

Generated

2D points

Handwriting

2D points

position similarity function F(w,v):→

Page 14: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

➢ goal 2: make the target stroke preserve calligraphy style.

pi = ui+1 + ui+2 - 2ui

qi = wi+1 + wi+2 - 2wi

SCV

Global optimization of the target strokes

(a) original handwriting (b) skeleton of

standard calligraphy (c) skeleton of target stroke

−=−=i

iisqrt

i

ii qpfqpwuG )(),(2

→ The objective function G(u,w):

→ Define an SCV(Shape Character Vector)

to represent the shape of a stroke

Page 15: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

➢ goal 3: make the target stroke be smooth as much as possible.

−=−

−= +

+

+

i

iisqrt

ii

ii nnfnn

nnwH )()( 1

1

1

ii

ii

iww

wwn

−=

+

+

1

1

normalized direction vector

Global optimization of the target strokes

(a) skeleton of target stroke

→ The constraint function H(w):

n1

n2

n3

n4

(a)

Page 16: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Optimization model

−+−+−−= + ])([])([)]()([minargˆ

1

i

iisqrt

i

iisqrtii

T

i

iix

nnfqpfvwvwX

min[F(w,v) +G(u,w) +H(w)]

goal 1

Handwriting

goal 2

Calligraphy

goal 3

Smoothness

−+−+−−= + ])([])([)]()([minargˆ

1

i

iisqrt

i

iisqrtii

T

i

iix

nnfqpfvwvwX

−+−+−−= + ])([])([)]()([minargˆ

1

i

iisqrt

i

iisqrtii

T

i

iix

nnfqpfvwvwX

α, β, γ : weight coefficients

Page 17: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Adjust & select parameters

➢ Set the range of each weight coefficient (α, β, γ) to [0.1,1]

(a)

(a) Original handwritten characters;

(b) handwritten characters in a 90 × 90 grid;

(c) optimized character;

(d)-(g) results of different combinations of parameters

α, β, γ for the stroke “Pie”.

handwritten skeletons

skeletons in standard calligraphy

the optimized result

Page 18: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

4. Control of robotic arm writing

(d) Extract

parameters

lij

wij

θij

(e) Calligraphy

database

(f) Corresponding

stroke

(h) Write by robotic arm(g) Optimized character

(a) Chinese

handwriting (b) Extract strokes

13

7

co

nv

po

olin

g

co

nv

po

olin

g

...

Fu

ll-co

nnet

(c) Recognize with CNN

Part 4: Robotic writing

Page 19: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Height values (z) of robot control points

➢ Problem: it is inappropriate to directly

use the z value of the standard stroke.

→ Approach: find new corresponding

points from standard calligraphy stroke, and

calculate a reasonable height value.

• Step 1 :expand the points (blue) on an optimized stroke

• Step 2 :Look for evenly spaced points w’i ( |w’i –w1|=|ui - u1| )

• Step 3 :the z value of wi linearly interpolated between w’i and w’i +1 -

-

u1

u2

u3

u4

u5

u6

u7

w1w2

w3

w4

w5

w6

w7

w’3

w’4

w’5

(a) Standard calligraphy stroke (b) Optimized stroke

(a) (b)

Page 20: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Control of robotic arm writing

(a) DOBOT robotic arm (b) DOBOT Studio interface

(a) (b)

Joint 1

Joint 2

Joint 3

Joint 4

Page 21: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Experiments & results

(a)

(b)

(c)

(a) no optimization results as the height of the brush is lowered (b) results of calligraphy writing after

optimization without rigid segment replacement (c) results of calligraphy writing after optimization with

rigid segment replacement

Page 22: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Results

Non-expert

users

Expert

users

Page 23: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

User study

Questions Choices

Q(1) The beautificationmethod is usefull

VerySomew

hatNeutr

alRarel

yNot at all

Q(2) Calligraphy written by robotic arm has the style of handwriting

VerySomew

hatNeutr

alRarel

yNot at all

Q(3) Calligraphy written by robotic arm has the characteristics of regular script

VerySomew

hatNeutr

alRarel

yNot at all

Q(4) Calligraphy written byrobotic arm is aesthetic

VerySomew

hatNeutr

alRarel

yNot at all

Q(5) The overall process is relatively time-consuming

VerySomew

hatNeutr

alRarel

yNot at all

Q(6) The system will berecommended to calligraphy amateurs

VerySomew

hatNeutr

alRarel

yNot at all

100.00%

80.00%

60.00%

40.00%

20.00%

0.00%

Q(1) Q(2) Q(3) Q(4) Q(5) Q(6)

Very

Somewhat

Neutral

Rarely

Not at all

Question

74%

Page 24: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Limitations

➢ Speed of overall process

➢ Incomplete stroke database

➢ The influence of the physical form of a brush.

100.00%

80.00%

60.00%

40.00%

20.00%

0.00%

Q(1) Q(2) Q(3) Q(4) Q(5) Q(6)

Very

Somewhat

Neutral

Rarely

Not at all

Question

Page 25: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Conclusion & future work

➢ A global optimization approach to generate

Chinese calligraphy for robotic calligraphy

writing.

➢ Improve the stroke database for complex

Chinese characters.

➢ Design a control system to automatically

detect and adjust the physical state of the

brush.

Page 26: Intelligent Chinese Calligraphy Beautification from ... · robotic arm is aesthetic Very Somew hat Neutr al Rarel y Not at all Q(5) The overall process is relatively time-consuming

Thank you!

Q&A

[email protected]

[email protected]