Skip to content

Shreyasi3521/Generating_character_types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 

Repository files navigation

Generating character types

We have character πœ“ = { k, S, R} where k is number of strokes in set S = {S_1,S_2,...,S_k}, thus k relations in set R = {R_1,R_2,...,R_k}.
Within a stroke, say S_i, we have sub-strokes separated by pauses taken by the writer, i.e., S_i={s_i_1,s_i_2,...s_i_ni}.
Each s_i_j is {x_i_j, y_i_j, z_i_j}. Here x_i_j is sub-stroke control point, y_i_j is sub_stroke scale, z_i_j is the identity of sub-stroke.
Relations are of 4 types:

  • Along: R_i={πœ€_i = Along, u_i, v_i, t_i}
    u_i is the stroke number selected at random from {1,2,...,i-1}
    v_i is the sub-stroke number selected at random from {1,2,...,u_i}
    t_i is the coordinate in the sub-stroke selected randomly
  • Independent: R_i={πœ€_i = Independent, J_i, L_i}
    J_i <- P(J_i) where P(J_i) is a multinomial over 2D to select x coordinate of begining of new stroke
    L_i <- P(L_i|J_i) to select y coordinate of begining of new stroke
  • End: R_i={πœ€_i = End, u_i}
    u_i is the stroke number selected at random from {1,2,...,i-1}
  • Start: R_i={πœ€_i = Start, u_i}
    u_i is the stroke number selected at random from {1,2,...,i-1} First to generate stroke:
    We have i, ni.
def generate_stroke(i, n_i):
  z_i_1 <- P(z_i_1)
  for j in {2,...,n_i}:
    z_i_j <- P(z_i_j|z_i_(j-i))
  for j in {1,...,n_i}:
    x_i_j <- P(x_i_j|z_i_j)
    y_i_j <- P(y_i_j|z_i_j)
    s_i_j = {x_i_j, y_i_j, z_i_j}
  S_i = {s_i_1,...,s_i_ni}
  return S_i

Now to generate new character types :

def generate_type:
 k <- P(k)
 for i in range(k):
   n_i <- P(n_i|k)
   Si= generate_stroke(i, n_i)
   πœ€_i <- P(πœ€_i)
   R_i <- P(R_i | πœ€_i, S_1, S_2,...,S_(i-1))
 πœ“ = { k, S, R}
 return generate_token(πœ“)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published