ruby-tesseract-ocr icon indicating copy to clipboard operation
ruby-tesseract-ocr copied to clipboard

Segfault on blank image

Open whoward opened this issue 11 years ago • 6 comments

Unfortunately it seems we get a segfault when you try to detect lines on a blank image. In our use case its entirely possible for this to happen as we apply a pre-filter to try to filter out only text in a given image.

Here is the commands used:

2.0.0-p451 :001 > require 'tesseract-ocr'
 => true 
2.0.0-p451 :002 > eng = Tesseract::Engine.new {|e| e.language = :eng }
 => #<Tesseract::Engine:0x0000000153f150 @api=#<Tesseract::API:0x0000000153ef98 @internal=#<FFI::AutoPointer address=0x00000001b69e10>>, @initializing=false, @init=#<Proc:0x0000000153f100@(irb):2>, @path=".", @language=:eng, @mode=:DEFAULT, @variables={}, @config=[], @rectangle=[]> 
2.0.0-p451 :003 > eng.image = "test.png"
 => "test.png" 
2.0.0-p451 :004 > eng.lines

And the trace can be found here: https://gist.github.com/whoward/4ad61571d6481a00e725

And finally the image used is here: https://www.dropbox.com/s/3lx60kshyj8qkvi/test.png

I don't have a workaround yet

whoward avatar Apr 25 '14 21:04 whoward

Hi, have you solved your problem in the meantime? If not, could you re upload the test image? Thank you!

moritzh avatar Oct 17 '14 17:10 moritzh

Hello, we didn't solve the problem and just ended up going with a shell solution but for reference this is the test image:

https://dl.dropboxusercontent.com/u/76484219/test.png

whoward avatar Oct 17 '14 17:10 whoward

It seems to me (and I've just validated that using your and the other issues' test file) that this is in fact the same problem as described in https://github.com/meh/ruby-tesseract-ocr/issues/16 .

moritzh avatar Oct 17 '14 17:10 moritzh

true, could very well be an upstream issue

whoward avatar Oct 17 '14 18:10 whoward

I "fixed" (well, not really, just commented some stuff out) it in a fork here, maybe it helps somebody else — our problem is resolved.

Am 17.10.2014 um 20:55 schrieb William Howard [email protected]:

true, could very well be an upstream issue

— Reply to this email directly or view it on GitHub.

moritzh avatar Oct 17 '14 19:10 moritzh

@moritzh I am having a similar issue. Is your fork still working properly for this? Mine is not off a blank image but the segfault trace is eerily similar. I figured I would post here before opening a separate issue.

ybur-yug avatar Mar 13 '15 17:03 ybur-yug