DDMAL / DDMAL/document-preprocessing-toolkit

branch: iss1 RuntimeError: Image view dimensions out of range for data

Offen
#1 4 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @mondaugen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
4
Forks
5
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

here is my program:

```
import sys
import string

from gamera.core import *
from gamera.toolkits import staffline_removal
from gamera.toolkits import lyric_extraction

init_gamera()

def print_image_data(self):
print "stride", self.data.stride
print "ncols", self.data.ncols
print "nrows", self.data.nrows
# print "dim", self.data.dim
print "page_offset_x", self.data.page_offset_x
print "page_offset_y", self.data.page_offset_y
# print "offset", self.data.offset
print "size", self.data.size

# Load image from command line
image = load_image(sys.argv[1])

print "image data after load"
print type(image)
print_image_data(image)

# Binarize image
onebit = image.djvu_threshold()

print "image data after binarization"
print type(onebit)
print_image_data(onebit)

# get an estimation of staff height
sh = onebit.staffheight_estimation()
# staffspace
ss = onebit.staffspace_estimation()
# do lyric line detection
llmask = onebit.baseline_detection(ss) #<--- the problem happens here
print 'Staff-height estimation', sh,'Staff-space estimation', ss

# outputfile path
if '.' in sys.argv[1]:
fpath = string.join(sys.argv[1].split('.')[0:-1],'.')+"_llmask.png"
else:
fpath = sys.argv[1]+"_llmask.png"

llmask.save_PNG(fpath)
```
#### end program

here is the output of the program

```
image data after load

stride 2712
ncols 2712
nrows 3368
page_offset_x 0
page_offset_y 0
size 9134016
image data after binarization

stride 2712
ncols 2712
nrows 3368
page_offset_x 0
page_offset_y 0
size 9134016
staffspace:36, staffheight:4
staffspace:36, staffheight:4
Traceback (most recent call last):
File "./lyric-baseline-study.py", line 40, in
llmask = onebit.baseline_detection(ss)
File "/Users/nickesterer/Documents/development/gamera_env/lib/python2.7/site-packages/gamera/toolkits/lyric_extraction/plugins/lyricline.py", line 93, in __call__
valid_angle_degree, scalar_valid_height, valid_min_group)
RuntimeError: Image view dimensions out of range for data
nrows 27
offset_y 3342
data nrows 3368
data offset_y 0
ncols 37
offset_x 66
data ncols 2712
data offset_x 0
```

This was happening before installing the most recent commit to DDMAL/document-preprocessing-toolkit, but only on some images and not on others. Now using the same images as before, it happens on all images.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.