class MusicStaves_rl_simple

Last modified: October 27, 2015

Contents

MusicStaves_rl_simple

In module gamera.toolkits.musicstaves.musicstaves_rl_simple

This staff removal algorithm is a simplified implementation of some ideas in Ichiro Fujinaga's dissertation (see below).

The Method:

The basic idea is that black horizontal run lengths within a staff line are typically greater than staffspace_height, while the musical symbols have shorter runlenghts. Thus only sufficiently short runlengths are kept. Stafflines are detected with StaffFinder_projections.
In contrast to Fujinaga's approach, we do not try a deskewing by shearing. Moreover we only care for crossing symbols in a very crude way.

Assumptions and Limitations:

References:

Author:Christoph Dalitz and Thomas Karsten

remove_staves

Detects and removes staff lines from a music/tablature image.

Signature:

remove_staves(crossing_symbols='all', num_lines=0)

with

crossing_symbols:
Determines which symbols crossing staff lines should be kept intact. Supported values are 'all', 'bars' or 'none'.
num_lines:
Number of lines within one staff. A value of zero for automatic detection is supported, but if you give the actual number, staff line detection will improve.

get_staffpos

Returns the y-positions of all staff lines at a given x-position. Can only be called after remove_staves.

Signature:

get_staffpos(x=0)

with

x:
This parameter has no effect, because the staffline is assumed to be horizontal.

The return value is a list of StaffObj.