New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OS X Yosemite with OpenCL: --enable-opencl now compiles but OCR fails #71
Comments
My stab in the dark at any answer is that, for some reason, the OpenCL API or ABI different from Tesseract is expecting as declared in header files. The malloc error occurs because (openclwrapper.cpp:674) in
The call to
I'd be happy to investigate further if someone can point me in the right direction. |
Can you check 0c3c3ea ? |
I currently get |
@zdenop I got the same error as @ryanfb. The consensus is that AC_CHECK_LIB doesn't play nicely with |
@zdenop I disabled the AC_CHECK_LIB(OpenCL) and replaced it with
To repair that I added the required conditional:
After ...and make failed with several errors of this form:
|
@jbarlow83: configure issues should be fixed. Which version of compiler you use? |
The line
That error occurs even though I am running Here is clang.
|
@jbarlow83: Thanks. Unfortunatelly I do not have Mac, so I can just guess what could work :-(. regading leptonica: Try to change line if it helps: |
#87 is also required. So I got to compile and apparently run successful OpenCL tests in which it selected my graphics card... but the OCR output was garbage. For example, if I had it generate a PDF, it still produced a valid PDF containing the input image, but the OCR text and its positioning was meaningless. If I rebuild the same source with OpenCL my test file was processed correctly.
|
@zdenop Our patches to date have fixed the build, but tesseract with OpenCL on Mac outputs gibberish as the OCR results (on an image that passes normal OCR). Both the perceived position of text and output text are corrupted. However, a blank image is correctly interpreted as a being blank - for example, tesseract can properly render a blank PDF file. I take this to mean somewhere OpenCL is distorting or corrupting the input during processing. How I can test it to narrow down where the error actually occurs? |
AFAIK they should work on this. Did you get wrong result if you use binarized (2 colors) (tif?) image? |
Image I used was: Although it appears to be grayscale it looks like it's formatted as true color. Output is:
I converted that to a 1-bit TIFF using ImageMagick. That produced no OCR output and some errors:
In both cases, I did output to PDF, and the PDF is formatted correct. The OCR is nonsense. When output to plain text, the OCR is also nonsense. If Tesseract is built without OpenCL the same image works fine for OCR. |
I tried both master and 3.04.00 with When running with OpenCL on FX8120 there are no warnings or errors during execution, but there are some warnings as |
With OpenCL-enabled HEAD on OS X, I also get garbage for @jbarlow83's test image. However if I convert PDFs to TIFF in the way I usually do for OCR with Tesseract, I can get text with OpenCL-enabled HEAD (the BW PDF for this book in this example):
Then OCR with e.g. Another thing I notice though is that I also get a score of |
I tried @zdenop: If a read and write pointer were strobing the data by different amounts you'd get this sort of thing. This really looks it a single increment somewhere is the wrong size and should be an easy fix for someone who knew where to look in the code base (i.e. not me). |
Yep, I have the same problem. Try resizing your image to powers of 2. Actually, just resize the canvas, leave the text part unchanged.You could do it with ImageMagick convert, or any image editor like Photoshop. Probably you only need to size the width to power of 2, I didn't test that, but it looks like the pitch is being miscalculated with non-power of two sized images. |
Oh...didn't mention it, but I get exactly the same output as you. Bring the distorted image up in PhotoShop, Select Filter->Distort->Shear and shear top left to bottom right with Wraparound selected. Do that 2-4 times and the text will magically appear. |
Look at Issue #124 |
Hi folks, i have a similar problems with the garbage output, when i enable opencl. I have checked out the current master revision (bd45b3a). also i get the mangled image with My Settings are:
the console output is:
My Question is: do i have a malconfigurated system or is it a bug? |
It seems that any OpenCL operation on my OS X Yosemite machine triggers attempts to allocate extremely large memory blocks and allocation failures.
The size of the attempted allocation is 1125865547108352 bytes or in hex, 0x3fff800001000, which looks special.
OpenCL otherwise works on my machine. I use the Python OpenCV library and a commercial application that uses OpenCL.
Aside from whatever is happening here, it also looks like a bug that the profile data gets written even if OpenCL fails. I highly doubt my graphics card and processor give identical performance so it looks some invalid calculation takes place and the results are then saved.
Testing --list-langs
Checking for languages in an OpenCL binary:
Results
Subsequent executions try to use the OpenCL profile results but still get errors:
Testing OCR of JPEG to PDF
Result:
Versions
The text was updated successfully, but these errors were encountered: