DDMAL / DDMAL/document-preprocessing-toolkit

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

Abierto
#1 4 comentarios 0 reacciones 1 asignado Reclamado por @mondaugen Ver en GitHub
Lenguaje dominante
C++
Estrellas
4
Forks
5
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.