devaljain / Text-Line-Extraction-Using-Seam-Carving

Python implementtion of an Algorithm that computes robust separating seam lines that do not cut through words and line components using energy matrices of the image, which helps to compute individual lines of manuscripts.
4 stars 3 forks source link

Error when running on large image #2

Closed ghost closed 4 years ago

ghost commented 6 years ago

@devaljain your script runs without any problems on medium sized images and extracts the lines. But if I run it on larger images with dimensions 2500x3000 it fails with error:

 C:\Users\Home\Desktop\Text-line-extraction-using-seam-carving-master>seamcarving
.py text1.jpeg
(3300, 2550)
2
0
(37, 2733, 3)
Traceback (most recent call last):
  File "C:\Users\Home\Desktop\Text-line-extraction-using-seam-carving-master\sea
mcarving.py", line 319, in <module>
    imgcrop(q,ys,im)
  File "C:\Users\Home\Desktop\Text-line-extraction-using-seam-carving-master\sea
mcarving.py", line 172, in imgcrop
    x1=np.min(points[1, :])
  File "C:\Users\Home\AppData\Local\Programs\Python\Python37\lib\site-packages\n
umpy\core\fromnumeric.py", line 2442, in amin
    initial=initial)
  File "C:\Users\Home\AppData\Local\Programs\Python\Python37\lib\site-packages\n
umpy\core\fromnumeric.py", line 83, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation minimum which has no identity

the image is attached below text1

crigaud commented 6 years ago

That's maybe due to the static value 2733 (l.162). I replaced by sys.maxsize but I don't have big images to try if it solves your issue or not.