class GermanGlyph

Last modified: May 13, 2016

Contents

GermanGlyph

In module gamera.toolkits.otr.german_glyph

Performs the semantic grouping of a classified list of German tablature glyphs and generates abc output for abctab2ps. All methods for semantic grouping are called in the constructor. The resulting abc code is stored in the property song.

__init__

The constructor already does all the semantic analysis. Consequently there is usually no need to call any other methods of GermanGlyph.

Signature:

__init__(image,ccs,lines_mb,bars,line_height,distance_between_two_lines,character_height,dots,title,debug)

with

image:
Onebit or greyscale image that is processed.
ccs:
List of classified glyphs to be semantically grouped.
line_height, distance_between_two_lines, charcter_height:
The corresponding properties of GermanLutePage.
line_mbs:
The least quare fit parameters (m,b) of all lines. This is the property straight_lines of GermanLutePage.
dots:
If dots shall be goruped to flags. This should be usually set to True, unless dotted flags have been trained as groups.
title:
Song title in abc output.
debug:
Debug level (verbosity). Can be =,1, or 2.

to_abcmusic

Gives an output of the sorted list self.glyphs as an abc music-formatted string.

Signature:

to_abcmusic(tuning="gdAFCG,", key="auto", factor=0)

with

tuning:
The tuning of each course, from top to bottom. Each note is specified as abc code (sharp = prefix '^', flat = prefix '_', octave up = postfix single quote, octave down = postfix comma)
key:
Key signature, e.g. the value Eb stands for E flat Major or Cm for C Minor. When set to auto the key is guessed automatically.
factor:
Logarithmic length factor for slowing down. For example, when set to 2 the sixteenth notes are printed as quarter notes. A negative integer leads to a speedup.

The returned string can be given as input to the external program abctab2ps.

mark_note_groups

Returns an RGB image with different note groups highlighted in different colors. This is useful for debugging.

mark_flag_groups

Returns an RGB image with all symbols belonging to the same flag highlighted in the same color. This is useful for debugging.