Class: Ocarina::LetterpressCharacterGenerator

Inherits:
CharacterGenerator show all
Defined in:
lib/ocarina/letterpress_character_generator.rb

Overview

creates bitmap images for characters using letterpress board game images

We create the reference character images by cropping game board tiles for three boards for which the letters are known ahead of time. Together, the three boards provide images for all the letters of the alphabet.

Instance Attribute Summary

Attributes inherited from CharacterGenerator

#noise_image_hash, #reference_image_hash

Instance Method Summary collapse

Methods inherited from CharacterGenerator

#draw_image_for_char, #generate_noise_gif_for_char, #generate_reference_gif_for_char, #persist_tiles

Methods included from Util

#char_to_binary_string, #filename_for_noise_image, #filename_for_quantized_image, #filename_for_training_image, #int_to_binary_string, #is_lower?, #is_upper?, #noise_image_for_char, #pixel_number_to_col, #pixel_number_to_row, #pixel_to_bit, #quantize_image, #reference_image_for_char, #sigma

Constructor Details

#initialize(config) ⇒ LetterpressCharacterGenerator

Returns a new instance of LetterpressCharacterGenerator.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ocarina/letterpress_character_generator.rb', line 13

def initialize(config)
  @config = config

  # generate reference images
  #
  @reference_image_hash = process_letterpress_example_boards

  # generate noise images
  #
  @noise_image_hash = { }

  @config.char_set.each_char do |char|
    @noise_image_hash[char] = generate_noise_gif_for_char char
  end
end