class PsaltikiNeumes

Last modified: February 17, 2010

Contents

PsaltikiNeumes

In module gamera.toolkits.psaltiki.psaltiki_neumes

Groups neumes and can create output code. The grouping is done automatically in the constructor and the result is stored in the following properties:

self.baselist
nested list glyph[line][neume] containing all neumes per line
self.grouping_list
nested list glyph[line][group][neume] containing all neumes per group and line as created by create_grouping_list

__init__

Constructs and returns a PsaltikiNeumes object. Signature:

__init__(image, ccs,oligon_height, oligon_height,baselines,debug,outfile,group_file)

Parameter:

ccs
The connected components must already be classified.
oligon_width, oligon_height, baselines
Shall be taken from the values computed by PsaltikiPage.
debug
for creation of debugging information: 0 = no info, 1 = progress info
group_file
text file controling the grouping of two original neumes. See the user's manual for the file format specification.

create_grouping_list

Organizes the neumes in a nested list. It is called automatically in the constructor.

The lowest level list represents the neumes of one neume group, these are organized in a list representing a line of neumes and the highest level list represents all lines.

The primary, the martyria and the chronos neumes will be the first element of each group in the grouping list. Each of those neumes opens its own group on its baseline. If the primary glyph does not lie on the baseline, then it is a secondary element. The consequence for this is, that the classified name will be renamed and the connected component will be specified again.

correct_outliers

Examines all glyphs that have an y- or x-distance greater than a given threshold from the closest other glyph in the same group. When the outlier is closer to the next or previous group, it is moved to that group; otherwise it is removed. The function only affects self.grouping_list, but not self.baselist.

Signature:

correct_outliers(distx=4, disty=4)

with

distx, disty

distance measured in units of oligon_height

Note

This function does not care about the general grouping scheme for secondary nuemes (like, e.g., secondaryright). It only tries to fix some grossly oulying neumes.

coloring_groups

Returns an RGB image in which all neumes belonging to the same group are highlighted in the same color. Additionally the detected baselines are drawn. Thus you can see easily which neumes are grouped together.

get_chant_code

Returns the recognized psaltiki chant in the code specified in the user's manual.

get_txt_output

Returns a string representing the recognized symbols.

Each symbol is printed in a separate line of the form

groupnumber (ul_xpos,ul_ypos,lr_xpos,lr_ypos) neumename

Groups are sorted by baseline and offset_x (ul_xpos).