Segmentation fault with OpenALPR

2.7k views Asked by At

I'm trying to install OpenALPR on Laravel Homestead (Ubuntu 18.04). First I tried The Easiest Way. I'm trying to run:

Error opening data file /usr/share/openalpr/runtime_data/ocr/lus.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'lus'
Tesseract couldn't load any languages!
Segmentation fault (core dumped)

I cd into /usr/share/openalpr/runtime_data/ocr directory, and I did not find the lus.traineddata file. But there was an ocr folder and there was a lus.traineddata. I copied it from there to the directory up, tried again to recognize but this time:

--(!) Runtime directory '/usr/share/openalpr/runtime_data' is invalid. Missing OCR data for the country: 'us'! Error loading OpenALPR

Then I tried The Easy Way. Everything was compiled normally. But:

Segmentation fault (core dumped)

2

There are 2 answers

0
danielillu On

This happens because openALPR's Tesseract OCR expects its trained data in a specific path and the files are not there. According to the error message it can be set using the TESSDATA_PREFIXenvironment variable but in my own experience didn't work.

I came accross with nother solution; it's not the best way but it may work.

I created a symbolic link from /usr/share/openalpr/runtime_data/ocr/tessdata/lus.traineddata to /usr/share/openalpr/runtime_data/ocr/lus.traineddata in order to make the trainedData files available to tesseract/openalpr right where they expect them.

sudo ln -s /usr/share/openalpr/runtime_data/ocr/tessdata/lus.traineddata /usr/share/openalpr/runtime_data/ocr/lus.traineddata

repeat the command changing lus with the desired language/region file (leu, lfr, ...)

Hope it helps

0
dolgom On

This is because the language trained data is in [runtime_data path]/ocr/tessdata/ in tesseract 4.0 unlike tesseract 3.0 which stores them in [runtime_data path]/ocr/.

This problem is fixed in this commit.

But it seems that the version of openalpr in the apt-get repository is behind this commit.

So the temporary solution is moving language data to [runtime_data path]/ocr like danielillu’s solution.

Since ‘us’ country config only require lus.traineddata file, you only need to move lus.traineddata file.