Exemple #1
0
def get_scaled_page(page):
  staffsize = single_staffdist(page)
  shape = tf.shape(page.image)
  a = tf.cast(SCALED_STAFFSIZE, tf.float32) / tf.cast(staffsize, tf.float32)
  b = 2048.0 / tf.cast(tf.reduce_max(tf.shape(page.image)), tf.float32)
  scale = tf.cond((a < 0) | (b < a), lambda: b, lambda: a)
  new_shape = tf.cast(tf.cast(shape, tf.float32) * scale, tf.int32)
  resized = util.scale(page.image, new_shape)
  return Page(pad_square(resized, 2048))
Exemple #2
0
def can_process(page):
    return abs(single_staffdist(page) - SCALED_STAFFSIZE) <= 1
Exemple #3
0
def can_process(page):
    return abs(single_staffdist(page) - SCALED_STAFFSIZE) <= 1