Tesseract Image Issue - tesseract

After I installed the tesseract on centos, I am getting the following error,
Tesseract Open Source OCR Engine v3.05.00dev with Leptonica
Error in pixReadMemJpeg: function not present
Error in pixReadMem: jpeg: no pix returned
Error during processing.

I solved this problem. The reason is that you do not install the libjpeg, libtiff, libpng before compile the leptonica.
Step 1: Install libjpeg, libtiff, libpng.
Step 2: Recompile and install the leptonica.
more links

Default image format for firstly tesseract version was .tif or .tiff. in new version you should install following format package (libgif libjpeg libpng libtiff zlib). Leptonica use this pakages for read images and tesseract use leptonica for analyse images.
libgif libjpeg libpng libtiff zlib
finally recompile and install leptonica as #BigBen answer.

Leptonica complains if its optional dependencies are not present. You can silence these errors by recompiling leptonica with the macro NO_CONSOLE_IO. For more information, see leptonica source code, file environ.h.

Related

Error When installing Tesseract 3.05 in Centos7 "error: Leptonica 1.74 or higher is required. Try to install libleptonica-dev package"

We had initially installed tesseract 3.04 in centos 7, and know switching to tesseract 3.05. We have un-installed the older versions and have already installed leptonica-1.75.3 downloaded from leptonica home site.
But, when we go for installing tesseract 3.05, we get following error
checking for LEPTONICA... no
configure: error: Leptonica 1.74 or higher is required. Try to install libleptonica-dev package.
when running ./configure in console in tesseract-3.05.01 folder.
Need to know, where the issue is.
The configure script uses pkg-config to see if the leptonica libs are installed (and have the required version).
After you have compiled and installed leptonica from source code you have to manually tell pkg-config where to find the lept.pc config file which is installed with leptonica. Set the PKG_CONFIG_PATH environment variable so it points to the location of lept.pc. If you installed leptonica to its default location you should do:
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
before running configure for tesseract.
Mine would not work until I did the following copy commands. My Leptonica was installed in the leptonica-1.83.0 directory, yours may be different.
cp /usr/local/leptonica-1.83.0/lib/pkgconfig/lept.pc /usr/lib64/pkgconfig/
cp -a /usr/local/leptonica-1.83.0/lib/liblept /usr/lib64
Also set:
export PKG_CONFIG_PATH=/usr/local/leptonica-1.83.0/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/leptonica-1.83.0/lib
export LIBLEPT_HEADERSDIR=/usr/local/leptonica-1.83.0/include/leptonica
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/leptonica-1.83.0/lib/pkgconfig
export PKG_CONFIG_PATH=/usr/local/leptonica-1.83.0/lib/pkgconfig/
Then it worked.

Tesseract 4.00.00alpha compilation

I installed tesseract 4.00.00alpha and leptonica in ubuntu 16.04 x86. When i am using the following command,
tesseract -v
The output is
tesseract 4.00.00alpha
leptonica-1.74
libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8
Found AVX
Found SSE
Which is desired.
But while i am trying to compile my following code,
#include<baseapi.h>
#include<allheaders.h>
int main(){
tesseract::TessBaseAPI *first=new tesseract::TessBaseAPI();
printf("Tesseract version %s\n",first->Version());
printf("leptonica version %s\n",getLeptonicaVersion());
return 0;
}
with the command,
g++ sample.cpp -o sample.out -I/usr/local/include/leptonica -I/usr/local/include/tesseract -llept -ltesseract
The output is,
Tesseract version 3.04.01
leptonica version leptonica-1.74
Why the previous tesseract version is being shown? Is there any problem with the library files of tesseract and leptonica? Thank you!
The problem was while installing leptonica 1.74, i used a command,
sudo apt-get install libleptonica-dev
and while building tesseract 4.00.00 from source, i used a command,
sudo apt-get install libtesseract-dev
These above two commands are creating the problem. Actually we dont need install libleptionica-dev and libtesseract-dev since you are building tesseract from source.
I uninstalled both packages and reran my code.
sudo apt-get remove libleptonica-dev libletesseract-dev
It then worked successfully.

Open Babel can't convert from mol2 to png because Cairo library is not loaded

I first installed Open Babel through brew. When I tried to run the command: "obabel -:"CC(=O)Cl" -opng -O mymol.png", I got this error message: " Open Babel Error in PNG Format
PNG2Format not found. Probably the Cairo library is not loaded." I then proceeded to use brew to uninstall Open Babel. Then, I installed Cairo with brew and then installed Open Babel with brew again. Still though, I try to create a PNG output and it gives me the same error message. I just do not know what's going on??
I’ve found that when using brew to install open-babel, I do not need to install Cairo in a separate step. The open-babel formula includes a '--with-cairo’ option that installs all the required dependencies, including Cairo.
Here is how I installed open-babel with Cairo support:
$ brew install --with-cairo open-babel

Graphviz Dot failing to remove overlaps due to missing library

I am trying to run the following dot command from the command line:
dot -v ~/Documents/FlowGraph/dot_sample_1_full.dot -Tpng 'Documents/FlowGraph/sampleOutput.png' -Ksfdp -Goverlap=false
but it is failing with this output:
dot - graphviz version 2.36.0 (20140111.2315)
Using render: cairo:cairo
Using device: png:cairo:cairo
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_neato_layout.6.dylib
Using layout: sfdp:neato_layout
The plugin configuration file:
/usr/local/lib/graphviz/config6
was successfully loaded.
render : cairo dot fig map pic pov ps quartz svg tk vml xdot
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
textlayout : textlayout
device : bmp canon cgimage cmap cmapx cmapx_np dot eps exr fig gif gv icns ico imap imap_np ismap jp2 jpe jpeg jpg pct pdf pic pict plain plain-ext png pov ps ps2 psd sgi svg svgz tga tif tiff tk vml vmlz x11 xdot xdot1.2 xdot1.4 xlib
loadimage : (lib) bmp eps gif jpe jpeg jpg pdf png ps svg
fontname: "Times-Roman" resolved to: (ps:pango Times, REGULAR) (PangoCairoCoreTextFont) "Times"
margin 8
pack info:
mode node
size 0
flags 0
ctrl->overlap=-1
Error: remove_overlap: Graphviz not built with triangulation library
I've Googled and found this thread, which suggested:
gts has to be installed before graphivz so enter 'sudo brew remove
graphviz' to remove graphivz and 'sudo brew install gts' and 'sudo
install graphivz' to install graphivz with gts.
but that didn't seem to work. I'm still getting the error so either I didn't do it right, or that wasn't the solution for me.
How do I add the triangulation library to graphviz?
I had a similar problem on macOS with sfdp and the following is what solved it.
$ brew uninstall graphviz
$ brew install gts
$ brew install --with-gts graphviz
Homebrew doesn't support command line install options anymore, so the previous answers will not work anymore.
However, by accident i discovered that removing graphviz, installing gts, then installing graphviz works. It seems that graphviz will use gts if it isnt installed, but for some reason, it isnt a dependency.
brew remove graphviz
brew install gts
brew install graphviz

Cairo "Could not find libpng in the pkg-config search path"

I'm trying to install GTK-DFB and cairo is a requirement. When I try to build it from source, it throws:
checking for cairo's PNG functions feature...
configure: WARNING: Could not find libpng in the pkg-config search path
checking whether cairo's PNG functions feature could be enabled... no
configure: error: recommended PNG functions feature could not be enabled
Ideas?
Thanks
For me it helped to export the following variable in the shell:
export png_REQUIRES="libpng"
Credit to this post
You need to have the libpng development packages installed; Installation is distribution dependent, but for debian derivatives following should be enough:
apt-get install libpng12-dev
If you're on Ubuntu, another much faster solution is to do:
apt-get build-dep gtk+2.0