user220201
user220201

Reputation: 4532

tesseract not seeing makebox and batch.nochop files

First time using tesseract. I installed tesseract and am trying to generate some training images. Using the instructions I run the first command on the tif file.

# tesseract img.tif img makebox batch.nochop

When I run the above I get the following errors-

read_params_file: Can't open batch.nochop
read_params_file: Can't open makebox

Then I tried giving the complete paths of these files like this --

# tesseract img.tif img /usr/local/share/tessdata/tessconfigs/batch.nochop  /usr/local/share/tessdata/configs/makebox

Then I get this error --

Error in findTiffCompression: function not present
Error in pixReadStreamTiff: function not present
Error in pixReadStream: tiff: no pix returned
Error in pixRead: pix not read
Error in pixGetInputFormat: pix not defined
Reading start.tif as a list of filenames...
Error in fopenReadStream: file not found
Error in pixRead: image file not found: II*
Image file II* cannot be read!
Error during processing.

I am pretty sure I am missing some environment variables or something like that. Can someone point me in the right direction?

btw

# tesseract -v
tesseract 3.03
 leptonica-1.72
   libpng 1.2.51 : zlib 1.2.8

Upvotes: 1

Views: 4240

Answers (4)

Dr.l
Dr.l

Reputation: 11

I had the same issue and found the solution for me. here is the issue

[root@bogon aa]# tesseract num.font.exp0.tif num.font.exp0 batch.nochop makebox
read_params_file: Can't open batch.nochop
read_params_file: Can't open makebox
Tesseract Open Source OCR Engine v3.04.02dev with Leptonica

I found 'batch.nochop' and 'makebox' in config and tessconfigs under /usr/local/share/tessdata separately. so the solution is check your TESSDATA_PREFIX, and make sure the path include tessconfigs and config.

maybe it says not clearly, you can email me "[email protected]". hope it helps

Upvotes: 1

jolly
jolly

Reputation: 3598

I had same issue. If someone is looking for solution, it may help.

Based on old documentation, TESSDATA_PRIFIX was to be set manually. For Macos Yosemite, I did the same and caused issue in hocr & makebox.

I change the TESSDATA_PREFIX

export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/3.04.01_2/share/tessdata

The version number may vary for you; 3.04.01_2

Upvotes: 1

Chuande Wang
Chuande Wang

Reputation: 11

I found the solution:

    which tesseract

    /usr/local/bin/tesseract

    cd /usr/local/bin

    ll tesseract

    lrwxr-xr-x  1 wangchuande  admin  43  6 12 16:46 tesseract -> ../Cellar/tesseract/3.04.01_1/bin/tesseract

    cd ../Cellar/tesseract/3.04.01_1/share/tessdata/

    pwd

    /usr/local/Cellar/tesseract/3.04.01_1/share/tessdata

    export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/3.04.01_1/share/tessdata

    tesseract new.test.exp0.tif new.test.exp0 batch.nochop makebox

that's work!

Upvotes: 0

user220201
user220201

Reputation: 4532

Found the problem. Turns out I needed devel libs of jpeg and tiff and then re-install leptonica.

Upvotes: 0

Related Questions